Jolt Physics
A multi core friendly Game Physics Engine
Loading...
Searching...
No Matches
DebugRendererRecorder Class Referencefinal

Implementation of DebugRenderer that records the API invocations to be played back later. More...

#include <DebugRendererRecorder.h>

Inheritance diagram for DebugRendererRecorder:
DebugRenderer NonCopyable

Classes

struct  Frame
 All information for a single frame. More...
 
struct  GeometryBlob
 Holds a single geometry draw call. More...
 
struct  LineBlob
 Holds a single line segment. More...
 
struct  TextBlob
 Holds a single text entry. More...
 
struct  TriangleBlob
 Holds a single triangle. More...
 

Public Types

enum class  ECommand : uint8 { CreateBatch , CreateBatchIndexed , CreateGeometry , EndFrame }
 Control commands written into the stream. More...
 
- 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.
 

Public Member Functions

JPH_OVERRIDE_NEW_DELETE DebugRendererRecorder (StreamOut &inStream)
 Constructor.
 
virtual void DrawLine (RVec3Arg inFrom, RVec3Arg inTo, ColorArg inColor) override
 Implementation of DebugRenderer interface.
 
virtual void DrawTriangle (RVec3Arg inV1, RVec3Arg inV2, RVec3Arg inV3, ColorArg inColor, ECastShadow inCastShadow) override
 Draw a single back face culled triangle.
 
virtual Batch CreateTriangleBatch (const Triangle *inTriangles, int inTriangleCount) override
 Create a batch of triangles that can be drawn efficiently.
 
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
 
virtual void DrawText3D (RVec3Arg inPosition, const string_view &inString, ColorArg inColor, float inHeight) override
 Draw text.
 
void EndFrame ()
 Mark the end of a frame.
 
- Public Member Functions inherited from DebugRenderer
JPH_OVERRIDE_NEW_DELETE DebugRenderer ()
 Constructor.
 
virtual ~DebugRenderer ()
 
void NextFrame ()
 Call once after frame is complete. Releases unused dynamically generated geometry assets.
 
void DrawWireBox (const AABox &inBox, ColorArg inColor)
 Draw wireframe box.
 
void DrawWireBox (const OrientedBox &inBox, ColorArg inColor)
 
void DrawWireBox (RMat44Arg inMatrix, const AABox &inBox, ColorArg inColor)
 
void DrawMarker (RVec3Arg inPosition, ColorArg inColor, float inSize)
 Draw a marker on a position.
 
void DrawArrow (RVec3Arg inFrom, RVec3Arg inTo, ColorArg inColor, float inSize)
 Draw an arrow.
 
void DrawCoordinateSystem (RMat44Arg inTransform, float inSize=1.0f)
 Draw coordinate system (3 arrows, x = red, y = green, z = blue)
 
void DrawPlane (RVec3Arg inPoint, Vec3Arg inNormal, ColorArg inColor, float inSize)
 Draw a plane through inPoint with normal inNormal.
 
void DrawWireTriangle (RVec3Arg inV1, RVec3Arg inV2, RVec3Arg inV3, ColorArg inColor)
 Draw wireframe triangle.
 
template<class VERTEX_ARRAY >
void DrawWirePolygon (RMat44Arg inTransform, const VERTEX_ARRAY &inVertices, ColorArg inColor, float inArrowSize=0.0f)
 Draw a wireframe polygon.
 
void DrawWireSphere (RVec3Arg inCenter, float inRadius, ColorArg inColor, int inLevel=3)
 Draw wireframe sphere.
 
void DrawWireUnitSphere (RMat44Arg inMatrix, ColorArg inColor, int inLevel=3)
 
void DrawBox (const AABox &inBox, ColorArg inColor, ECastShadow inCastShadow=ECastShadow::On, EDrawMode inDrawMode=EDrawMode::Solid)
 Draw a box.
 
void DrawBox (RMat44Arg inMatrix, const AABox &inBox, ColorArg inColor, ECastShadow inCastShadow=ECastShadow::On, EDrawMode inDrawMode=EDrawMode::Solid)
 
void DrawSphere (RVec3Arg inCenter, float inRadius, ColorArg inColor, ECastShadow inCastShadow=ECastShadow::On, EDrawMode inDrawMode=EDrawMode::Solid)
 Draw a sphere.
 
void DrawUnitSphere (RMat44Arg inMatrix, ColorArg inColor, ECastShadow inCastShadow=ECastShadow::On, EDrawMode inDrawMode=EDrawMode::Solid)
 
void DrawCapsule (RMat44Arg inMatrix, float inHalfHeightOfCylinder, float inRadius, ColorArg inColor, ECastShadow inCastShadow=ECastShadow::On, EDrawMode inDrawMode=EDrawMode::Solid)
 
void DrawCylinder (RMat44Arg inMatrix, float inHalfHeight, float inRadius, ColorArg inColor, ECastShadow inCastShadow=ECastShadow::On, EDrawMode inDrawMode=EDrawMode::Solid)
 
void DrawOpenCone (RVec3Arg inTop, Vec3Arg inAxis, Vec3Arg inPerpendicular, float inHalfAngle, float inLength, ColorArg inColor, ECastShadow inCastShadow=ECastShadow::On, EDrawMode inDrawMode=EDrawMode::Solid)
 
void DrawSwingConeLimits (RMat44Arg inMatrix, float inSwingYHalfAngle, float inSwingZHalfAngle, float inEdgeLength, ColorArg inColor, ECastShadow inCastShadow=ECastShadow::On, EDrawMode inDrawMode=EDrawMode::Solid)
 
void DrawSwingPyramidLimits (RMat44Arg inMatrix, float inMinSwingYAngle, float inMaxSwingYAngle, float inMinSwingZAngle, float inMaxSwingZAngle, float inEdgeLength, ColorArg inColor, ECastShadow inCastShadow=ECastShadow::On, EDrawMode inDrawMode=EDrawMode::Solid)
 
void DrawPie (RVec3Arg inCenter, float inRadius, Vec3Arg inNormal, Vec3Arg inAxis, float inMinAngle, float inMaxAngle, ColorArg inColor, ECastShadow inCastShadow=ECastShadow::On, EDrawMode inDrawMode=EDrawMode::Solid)
 
void DrawTaperedCylinder (RMat44Arg inMatrix, float inTop, float inBottom, float inTopRadius, float inBottomRadius, ColorArg inColor, ECastShadow inCastShadow=ECastShadow::On, EDrawMode inDrawMode=EDrawMode::Solid)
 
Batch CreateTriangleBatch (const Array< Triangle > &inTriangles)
 
Batch CreateTriangleBatch (const Array< Vertex > &inVertices, const Array< uint32 > &inIndices)
 
Batch CreateTriangleBatch (const VertexList &inVertices, const IndexedTriangleNoMaterialList &inTriangles)
 
Batch CreateTriangleBatchForConvex (SupportFunction inGetSupport, int inLevel, AABox *outBounds=nullptr)
 
GeometryRef CreateTriangleGeometryForConvex (SupportFunction inGetSupport)
 
void DrawGeometry (RMat44Arg inModelMatrix, ColorArg inModelColor, const GeometryRef &inGeometry, ECullMode inCullMode=ECullMode::CullBackFace, ECastShadow inCastShadow=ECastShadow::On, EDrawMode inDrawMode=EDrawMode::Solid)
 
- Public Member Functions inherited from NonCopyable
 NonCopyable ()=default
 
 NonCopyable (const NonCopyable &)=delete
 
void operator= (const NonCopyable &)=delete
 

Additional Inherited Members

- 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 DebugRenderersInstance = nullptr
 Singleton instance.
 
- Protected Member Functions inherited from DebugRenderer
void Initialize ()
 Initialize the system, must be called from the constructor of the DebugRenderer implementation.
 

Detailed Description

Implementation of DebugRenderer that records the API invocations to be played back later.

Member Enumeration Documentation

◆ ECommand

Control commands written into the stream.

Enumerator
CreateBatch 
CreateBatchIndexed 
CreateGeometry 
EndFrame 

Constructor & Destructor Documentation

◆ DebugRendererRecorder()

JPH_OVERRIDE_NEW_DELETE DebugRendererRecorder::DebugRendererRecorder ( StreamOut inStream)
inline

Constructor.

Member Function Documentation

◆ CreateTriangleBatch() [1/2]

DebugRenderer::Batch DebugRendererRecorder::CreateTriangleBatch ( const Triangle inTriangles,
int  inTriangleCount 
)
overridevirtual

Create a batch of triangles that can be drawn efficiently.

Implements DebugRenderer.

◆ CreateTriangleBatch() [2/2]

DebugRenderer::Batch DebugRendererRecorder::CreateTriangleBatch ( const Vertex inVertices,
int  inVertexCount,
const uint32 inIndices,
int  inIndexCount 
)
overridevirtual

Implements DebugRenderer.

◆ DrawGeometry()

void DebugRendererRecorder::DrawGeometry ( RMat44Arg  inModelMatrix,
const AABox inWorldSpaceBounds,
float  inLODScaleSq,
ColorArg  inModelColor,
const GeometryRef inGeometry,
ECullMode  inCullMode,
ECastShadow  inCastShadow,
EDrawMode  inDrawMode 
)
overridevirtual

Draw some geometry

Parameters
inModelMatrixis the matrix that transforms the geometry to world space.
inWorldSpaceBoundsis the bounding box of the geometry after transforming it into world space.
inLODScaleSqis 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).
inModelColoris the color with which to multiply the vertex colors in inGeometry.
inGeometryThe geometry to draw.
inCullModedetermines which polygons are culled.
inCastShadowdetermines if this geometry should cast a shadow or not.
inDrawModedetermines if we draw the geometry solid or in wireframe.

Implements DebugRenderer.

◆ DrawLine()

JPH_NAMESPACE_BEGIN void DebugRendererRecorder::DrawLine ( RVec3Arg  inFrom,
RVec3Arg  inTo,
ColorArg  inColor 
)
overridevirtual

Implementation of DebugRenderer interface.

Implements DebugRenderer.

◆ DrawText3D()

void DebugRendererRecorder::DrawText3D ( RVec3Arg  inPosition,
const string_view &  inString,
ColorArg  inColor,
float  inHeight 
)
overridevirtual

Draw text.

Implements DebugRenderer.

◆ DrawTriangle()

void DebugRendererRecorder::DrawTriangle ( RVec3Arg  inV1,
RVec3Arg  inV2,
RVec3Arg  inV3,
ColorArg  inColor,
ECastShadow  inCastShadow 
)
overridevirtual

Draw a single back face culled triangle.

Implements DebugRenderer.

◆ EndFrame()

void DebugRendererRecorder::EndFrame ( )

Mark the end of a frame.


The documentation for this class was generated from the following files: