Skip to content

Commit

Permalink
Added DebugRendering for ContactPoint.
Browse files Browse the repository at this point in the history
  • Loading branch information
MStachowicz committed Dec 17, 2023
1 parent 8ad11b7 commit c21d1db
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
8 changes: 8 additions & 0 deletions source/OpenGL/DebugRenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,14 @@ namespace OpenGL
m_tri_mb.set_colour(p_colour);
m_tri_mb.add_triangle(p_triangle);
}
void DebugRenderer::add(const Geometry::ContactPoint& p_contact_point, const glm::vec4& p_colour)
{// Draw an arrow in the normal direction from the contact point + draw a line over the penertation depth from the contact point.
m_tri_mb.set_colour(p_colour);
m_tri_mb.add_arrow(p_contact_point.position, p_contact_point.position + (p_contact_point.normal * 2.f));

m_line_mb.set_colour(p_colour);
m_line_mb.add_line(Geometry::LineSegment(p_contact_point.position, p_contact_point.position + (-p_contact_point.normal * p_contact_point.penetration_depth)));
}
void DebugRenderer::add(const Geometry::Cone& p_cone, const glm::vec4& p_colour)
{
m_tri_mb.set_colour(p_colour);
Expand Down
3 changes: 3 additions & 0 deletions source/OpenGL/DebugRenderer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
namespace Geometry
{
class Cone;
struct ContactPoint;
class Cylinder;
class Cuboid;
class Frustrum;
Expand Down Expand Up @@ -85,5 +86,7 @@ namespace OpenGL
static void add(const Geometry::Ray& p_ray, const glm::vec4& p_colour = glm::vec4(1.f));
static void add(const Geometry::Sphere& p_sphere, const glm::vec4& p_colour = glm::vec4(1.f));
static void add(const Geometry::Triangle& p_triangle, const glm::vec4& p_colour = glm::vec4(1.f));

static void add(const Geometry::ContactPoint& p_contact_point, const glm::vec4& p_colour = glm::vec4(1.f));
};
}

0 comments on commit c21d1db

Please sign in to comment.