29-debugdraw: Display intersection normal.

This commit is contained in:
Branimir Karadžić
2017-09-28 22:52:23 -07:00
parent c89a4106b3
commit 07f5e1184c
2 changed files with 29 additions and 3 deletions

View File

@@ -94,6 +94,32 @@ public:
return 0;
}
template<typename Ty>
bool intersect(const Ray& _ray, const Ty& _shape)
{
Hit hit;
if (::intersect(_ray, _shape, &hit) )
{
ddPush();
ddSetColor(0xff0000ff);
float tmp[3];
bx::vec3Mul(tmp, hit.m_normal, 0.7f);
float end[3];
bx::vec3Add(end, hit.m_pos, tmp);
ddDrawCone(hit.m_pos, end, 0.1f);
ddPop();
return true;
}
return false;
}
bool update() override
{
if (!entry::processEvents(m_width, m_height, m_debug, m_reset, &m_mouseState) )