Jolt Physics
A multi core friendly Game Physics Engine
|
#include <DebugRendererSimple.h>
Protected Member Functions | |
virtual Batch | CreateTriangleBatch (const Triangle *inTriangles, int inTriangleCount) override |
Implementation of DebugRenderer interface. | |
virtual Batch | CreateTriangleBatch (const Vertex *inVertices, int inVertexCount, const uint32 *inIndices, int inIndexCount) override |
virtual void | DrawGeometry (RMat44Arg inModelMatrix, const AABox &inWorldSpaceBounds, float inLODScaleSq, ColorArg inModelColor, const GeometryRef &inGeometry, ECullMode inCullMode, ECastShadow inCastShadow, EDrawMode inDrawMode) override |
Protected Member Functions inherited from DebugRenderer | |
void | Initialize () |
Initialize the system, must be called from the constructor of the DebugRenderer implementation. | |
Additional Inherited Members | |
Public Types inherited from DebugRenderer | |
enum class | ECastShadow { On , Off } |
Enum that determines if a shadow should be cast or not. More... | |
enum class | EDrawMode { Solid , Wireframe } |
Determines how triangles are drawn. More... | |
enum class | ECullMode { CullBackFace , CullFrontFace , Off } |
Determines which polygons are culled. More... | |
using | Batch = Ref<RefTargetVirtual> |
Handle for a batch of triangles. | |
using | GeometryRef = Ref<Geometry> |
Handle for a lodded triangle batch. | |
using | SupportFunction = function<Vec3 (Vec3Arg inDirection)> |
Create a primitive for a convex shape using its support function. | |
Static Public Member Functions inherited from DebugRenderer | |
static AABox | sCalculateBounds (const Vertex *inVertices, int inVertexCount) |
Calculate bounding box for a batch of triangles. | |
Static Public Attributes inherited from DebugRenderer | |
static DebugRenderer * | sInstance = nullptr |
Singleton instance. | |
Inherit from this class to simplify implementing a debug renderer, start with this implementation:
class MyDebugRenderer : public JPH::DebugRendererSimple { public: virtual void DrawLine(JPH::RVec3Arg inFrom, JPH::RVec3Arg inTo, JPH::ColorArg inColor) override { // Implement } virtual void DrawTriangle(JPH::RVec3Arg inV1, JPH::RVec3Arg inV2, JPH::RVec3Arg inV3, JPH::ColorArg inColor, ECastShadow inCastShadow) override { // Implement } virtual void DrawText3D(JPH::RVec3Arg inPosition, const string_view &inString, JPH::ColorArg inColor, float inHeight) override { // Implement } };
Note that this class is meant to be a quick start for implementing a debug renderer, it is not the most efficient way to implement a debug renderer.
JPH_NAMESPACE_BEGIN DebugRendererSimple::DebugRendererSimple | ( | ) |
Constructor.
|
overrideprotectedvirtual |
Implementation of DebugRenderer interface.
Implements DebugRenderer.
|
overrideprotectedvirtual |
Implements DebugRenderer.
|
overrideprotectedvirtual |
Draw some geometry
inModelMatrix | is the matrix that transforms the geometry to world space. |
inWorldSpaceBounds | is the bounding box of the geometry after transforming it into world space. |
inLODScaleSq | is the squared scale of the model matrix, it is multiplied with the LOD distances in inGeometry to calculate the real LOD distance (so a number > 1 will force a higher LOD). |
inModelColor | is the color with which to multiply the vertex colors in inGeometry. |
inGeometry | The geometry to draw. |
inCullMode | determines which polygons are culled. |
inCastShadow | determines if this geometry should cast a shadow or not. |
inDrawMode | determines if we draw the geometry solid or in wireframe. |
Implements DebugRenderer.
|
inlineoverridevirtual |
Fallback implementation that uses DrawLine to draw a triangle (override this if you have a version that renders solid triangles)
Implements DebugRenderer.
Should be called every frame by the application to provide the camera position. This is used to determine the correct LOD for rendering.