ReactPhysics3D
v0.10.2
C++ Physics engine library
|
This class is used to display physics debug information directly into the user application view. More...
#include <include/reactphysics3d/utils/DebugRenderer.h>
Classes | |
struct | DebugLine |
Struture that represents a line of the DebugRenderer. More... | |
struct | DebugTriangle |
Struture that represents a triangle of the DebugRenderer. More... | |
Public Types | |
enum class | DebugColor { RED = 0xff0000 , GREEN = 0x00ff00 , BLUE = 0x0000ff , BLACK = 0x000000 , WHITE = 0xffffff , YELLOW = 0xffff00 , MAGENTA = 0xff00ff , CYAN = 0x00ffff } |
Enumeration with basic colors. | |
enum class | DebugItem { COLLIDER_AABB = 1 << 0 , COLLIDER_BROADPHASE_AABB = 1 << 1 , COLLISION_SHAPE = 1 << 2 , CONTACT_POINT = 1 << 3 , CONTACT_NORMAL = 1 << 4 , COLLISION_SHAPE_NORMAL = 1 << 5 } |
Enumeration with debug item to renderer. More... | |
Public Member Functions | |
DebugRenderer (MemoryAllocator &allocator) | |
Constructor. | |
~DebugRenderer () | |
Destructor. | |
uint32 | getNbLines () const |
Return the number of lines. | |
const Array< DebugLine > & | getLines () const |
Return a reference to the array of lines. | |
const DebugLine * | getLinesArray () const |
Return a pointer to the array of lines. | |
uint32 | getNbTriangles () const |
Return the number of triangles. | |
const Array< DebugTriangle > & | getTriangles () const |
Return a reference to the array of triangles. | |
const DebugTriangle * | getTrianglesArray () const |
Return a pointer to the array of triangles. | |
bool | getIsDebugItemDisplayed (DebugItem item) const |
Return whether a debug item is displayed or not. | |
void | setIsDebugItemDisplayed (DebugItem item, bool isDisplayed) |
Set whether a debug info is displayed or not. | |
decimal | getContactPointSphereRadius () const |
Get the contact point sphere radius. | |
void | setContactPointSphereRadius (decimal radius) |
Set the contact point sphere radius. | |
decimal | getContactNormalLength () const |
Return the length of contact normal. | |
void | setContactNormalLength (decimal contactNormalLength) |
Return the length of contact normal. | |
void | computeDebugRenderingPrimitives (const PhysicsWorld &world) |
Generate the rendering primitives (triangles, lines, ...) of a physics world. | |
void | reset () |
Clear all the debugging primitives (points, lines, triangles, ...) | |
virtual void | onContact (const CollisionCallback::CallbackData &callbackData) override |
Called when some contacts occur. | |
Public Member Functions inherited from reactphysics3d::EventListener | |
EventListener ()=default | |
Constructor. | |
virtual | ~EventListener () override=default |
Destructor. | |
virtual void | onTrigger (const OverlapCallback::CallbackData &) |
Called when some trigger events occur. | |
Public Member Functions inherited from reactphysics3d::CollisionCallback | |
virtual | ~CollisionCallback ()=default |
Destructor. | |
This class is used to display physics debug information directly into the user application view.
For instance, it is possible to display AABBs of colliders, colliders or contact points. This class can be used to get the debug information as arrays of basic primitives (points, linges, triangles, ...). You can use this to render physics debug information in your simulation on top of your object. Note that you should use this only for debugging purpose and you should disable it when you compile the final release version of your application because computing/rendering phyiscs debug information can be expensive.
|
strong |
Enumeration with debug item to renderer.
Enumerator | |
---|---|
COLLIDER_AABB | Display the AABB for each collider. |
COLLIDER_BROADPHASE_AABB | Display the fat AABB of the broad phase collision detection for each collider. |
COLLISION_SHAPE | Display the collision shape of each collider. |
CONTACT_POINT | Display the contact points. |
CONTACT_NORMAL | Display the contact normals. |
COLLISION_SHAPE_NORMAL | Display the face normals of the collision shapes. |
RP3D_FORCE_INLINE decimal reactphysics3d::DebugRenderer::getContactNormalLength | ( | ) | const |
Return the length of contact normal.
RP3D_FORCE_INLINE decimal reactphysics3d::DebugRenderer::getContactPointSphereRadius | ( | ) | const |
Get the contact point sphere radius.
RP3D_FORCE_INLINE bool reactphysics3d::DebugRenderer::getIsDebugItemDisplayed | ( | DebugItem | item | ) | const |
Return whether a debug item is displayed or not.
item | A debug item |
RP3D_FORCE_INLINE const Array< DebugRenderer::DebugLine > & reactphysics3d::DebugRenderer::getLines | ( | ) | const |
Return a reference to the array of lines.
RP3D_FORCE_INLINE const DebugRenderer::DebugLine * reactphysics3d::DebugRenderer::getLinesArray | ( | ) | const |
Return a pointer to the array of lines.
RP3D_FORCE_INLINE uint32 reactphysics3d::DebugRenderer::getNbLines | ( | ) | const |
Return the number of lines.
RP3D_FORCE_INLINE uint32 reactphysics3d::DebugRenderer::getNbTriangles | ( | ) | const |
Return the number of triangles.
RP3D_FORCE_INLINE const Array< DebugRenderer::DebugTriangle > & reactphysics3d::DebugRenderer::getTriangles | ( | ) | const |
Return a reference to the array of triangles.
RP3D_FORCE_INLINE const DebugRenderer::DebugTriangle * reactphysics3d::DebugRenderer::getTrianglesArray | ( | ) | const |
Return a pointer to the array of triangles.
|
overridevirtual |
Called when some contacts occur.
Reimplemented from reactphysics3d::EventListener.
RP3D_FORCE_INLINE void reactphysics3d::DebugRenderer::setContactNormalLength | ( | decimal | contactNormalLength | ) |
Return the length of contact normal.
contactNormalLength | The length of the contact normal to display |
RP3D_FORCE_INLINE void reactphysics3d::DebugRenderer::setContactPointSphereRadius | ( | decimal | radius | ) |
Set the contact point sphere radius.
radius | The radius of the sphere used to display a contact point |
RP3D_FORCE_INLINE void reactphysics3d::DebugRenderer::setIsDebugItemDisplayed | ( | DebugItem | item, |
bool | isDisplayed | ||
) |
Set whether a debug info is displayed or not.
item | A debug item to draw |
isDisplayed | True if the given debug item has to be displayed and false otherwise |