|
@@ -49,75 +49,75 @@ public:
|
|
JPH_OVERRIDE_NEW_DELETE
|
|
JPH_OVERRIDE_NEW_DELETE
|
|
|
|
|
|
/// Constructor
|
|
/// Constructor
|
|
- DebugRenderer();
|
|
|
|
- virtual ~DebugRenderer();
|
|
|
|
|
|
+ DebugRenderer();
|
|
|
|
+ virtual ~DebugRenderer();
|
|
|
|
|
|
/// Call once after frame is complete. Releases unused dynamically generated geometry assets.
|
|
/// Call once after frame is complete. Releases unused dynamically generated geometry assets.
|
|
- void NextFrame();
|
|
|
|
|
|
+ void NextFrame();
|
|
|
|
|
|
/// Draw line
|
|
/// Draw line
|
|
- virtual void DrawLine(RVec3Arg inFrom, RVec3Arg inTo, ColorArg inColor) = 0;
|
|
|
|
|
|
+ virtual void DrawLine(RVec3Arg inFrom, RVec3Arg inTo, ColorArg inColor) = 0;
|
|
|
|
|
|
/// Draw wireframe box
|
|
/// Draw wireframe box
|
|
- void DrawWireBox(const AABox &inBox, ColorArg inColor);
|
|
|
|
- void DrawWireBox(const OrientedBox &inBox, ColorArg inColor);
|
|
|
|
- void DrawWireBox(RMat44Arg inMatrix, const AABox &inBox, ColorArg inColor);
|
|
|
|
|
|
+ void DrawWireBox(const AABox &inBox, ColorArg inColor);
|
|
|
|
+ void DrawWireBox(const OrientedBox &inBox, ColorArg inColor);
|
|
|
|
+ void DrawWireBox(RMat44Arg inMatrix, const AABox &inBox, ColorArg inColor);
|
|
|
|
|
|
/// Draw a marker on a position
|
|
/// Draw a marker on a position
|
|
- void DrawMarker(RVec3Arg inPosition, ColorArg inColor, float inSize);
|
|
|
|
|
|
+ void DrawMarker(RVec3Arg inPosition, ColorArg inColor, float inSize);
|
|
|
|
|
|
/// Draw an arrow
|
|
/// Draw an arrow
|
|
- void DrawArrow(RVec3Arg inFrom, RVec3Arg inTo, ColorArg inColor, float inSize);
|
|
|
|
|
|
+ void DrawArrow(RVec3Arg inFrom, RVec3Arg inTo, ColorArg inColor, float inSize);
|
|
|
|
|
|
/// Draw coordinate system (3 arrows, x = red, y = green, z = blue)
|
|
/// Draw coordinate system (3 arrows, x = red, y = green, z = blue)
|
|
- void DrawCoordinateSystem(RMat44Arg inTransform, float inSize = 1.0f);
|
|
|
|
|
|
+ void DrawCoordinateSystem(RMat44Arg inTransform, float inSize = 1.0f);
|
|
|
|
|
|
/// Draw a plane through inPoint with normal inNormal
|
|
/// Draw a plane through inPoint with normal inNormal
|
|
- void DrawPlane(RVec3Arg inPoint, Vec3Arg inNormal, ColorArg inColor, float inSize);
|
|
|
|
|
|
+ void DrawPlane(RVec3Arg inPoint, Vec3Arg inNormal, ColorArg inColor, float inSize);
|
|
|
|
|
|
/// Draw wireframe triangle
|
|
/// Draw wireframe triangle
|
|
- void DrawWireTriangle(RVec3Arg inV1, RVec3Arg inV2, RVec3Arg inV3, ColorArg inColor);
|
|
|
|
|
|
+ void DrawWireTriangle(RVec3Arg inV1, RVec3Arg inV2, RVec3Arg inV3, ColorArg inColor);
|
|
|
|
|
|
/// Draw a wireframe polygon
|
|
/// Draw a wireframe polygon
|
|
template <class VERTEX_ARRAY>
|
|
template <class VERTEX_ARRAY>
|
|
- void DrawWirePolygon(RMat44Arg inTransform, const VERTEX_ARRAY &inVertices, ColorArg inColor, float inArrowSize = 0.0f) { for (typename VERTEX_ARRAY::size_type i = 0; i < inVertices.size(); ++i) DrawArrow(inTransform * inVertices[i], inTransform * inVertices[(i + 1) % inVertices.size()], inColor, inArrowSize); }
|
|
|
|
|
|
+ void DrawWirePolygon(RMat44Arg inTransform, const VERTEX_ARRAY &inVertices, ColorArg inColor, float inArrowSize = 0.0f) { for (typename VERTEX_ARRAY::size_type i = 0; i < inVertices.size(); ++i) DrawArrow(inTransform * inVertices[i], inTransform * inVertices[(i + 1) % inVertices.size()], inColor, inArrowSize); }
|
|
|
|
|
|
/// Draw wireframe sphere
|
|
/// Draw wireframe sphere
|
|
- void DrawWireSphere(RVec3Arg inCenter, float inRadius, ColorArg inColor, int inLevel = 3);
|
|
|
|
- void DrawWireUnitSphere(RMat44Arg inMatrix, ColorArg inColor, int inLevel = 3);
|
|
|
|
|
|
+ void DrawWireSphere(RVec3Arg inCenter, float inRadius, ColorArg inColor, int inLevel = 3);
|
|
|
|
+ void DrawWireUnitSphere(RMat44Arg inMatrix, ColorArg inColor, int inLevel = 3);
|
|
|
|
|
|
/// Enum that determines if a shadow should be cast or not
|
|
/// Enum that determines if a shadow should be cast or not
|
|
enum class ECastShadow
|
|
enum class ECastShadow
|
|
{
|
|
{
|
|
- On, // This shape should cast a shadow
|
|
|
|
- Off // This shape should not cast a shadow
|
|
|
|
|
|
+ On, ///< This shape should cast a shadow
|
|
|
|
+ Off ///< This shape should not cast a shadow
|
|
};
|
|
};
|
|
|
|
|
|
/// Determines how triangles are drawn
|
|
/// Determines how triangles are drawn
|
|
enum class EDrawMode
|
|
enum class EDrawMode
|
|
{
|
|
{
|
|
- Solid, ///< Draw as a solid shape
|
|
|
|
- Wireframe, ///< Draw as wireframe
|
|
|
|
|
|
+ Solid, ///< Draw as a solid shape
|
|
|
|
+ Wireframe, ///< Draw as wireframe
|
|
};
|
|
};
|
|
|
|
|
|
/// Draw a single back face culled triangle
|
|
/// Draw a single back face culled triangle
|
|
- virtual void DrawTriangle(RVec3Arg inV1, RVec3Arg inV2, RVec3Arg inV3, ColorArg inColor, ECastShadow inCastShadow = ECastShadow::Off) = 0;
|
|
|
|
|
|
+ virtual void DrawTriangle(RVec3Arg inV1, RVec3Arg inV2, RVec3Arg inV3, ColorArg inColor, ECastShadow inCastShadow = ECastShadow::Off) = 0;
|
|
|
|
|
|
/// Draw a box
|
|
/// Draw a box
|
|
- void DrawBox(const AABox &inBox, ColorArg inColor, ECastShadow inCastShadow = ECastShadow::On, EDrawMode inDrawMode = EDrawMode::Solid);
|
|
|
|
- void DrawBox(RMat44Arg inMatrix, const AABox &inBox, ColorArg inColor, ECastShadow inCastShadow = ECastShadow::On, EDrawMode inDrawMode = EDrawMode::Solid);
|
|
|
|
|
|
+ void DrawBox(const AABox &inBox, ColorArg inColor, ECastShadow inCastShadow = ECastShadow::On, EDrawMode inDrawMode = EDrawMode::Solid);
|
|
|
|
+ void DrawBox(RMat44Arg inMatrix, const AABox &inBox, ColorArg inColor, ECastShadow inCastShadow = ECastShadow::On, EDrawMode inDrawMode = EDrawMode::Solid);
|
|
|
|
|
|
/// Draw a sphere
|
|
/// Draw a sphere
|
|
- void DrawSphere(RVec3Arg inCenter, float inRadius, ColorArg inColor, ECastShadow inCastShadow = ECastShadow::On, EDrawMode inDrawMode = EDrawMode::Solid);
|
|
|
|
- void DrawUnitSphere(RMat44Arg inMatrix, 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);
|
|
|
|
+ void DrawUnitSphere(RMat44Arg inMatrix, ColorArg inColor, ECastShadow inCastShadow = ECastShadow::On, EDrawMode inDrawMode = EDrawMode::Solid);
|
|
|
|
|
|
/// Draw a capsule with one half sphere at (0, -inHalfHeightOfCylinder, 0) and the other half sphere at (0, inHalfHeightOfCylinder, 0) and radius inRadius.
|
|
/// Draw a capsule with one half sphere at (0, -inHalfHeightOfCylinder, 0) and the other half sphere at (0, inHalfHeightOfCylinder, 0) and radius inRadius.
|
|
/// The capsule will be transformed by inMatrix.
|
|
/// The capsule will be transformed by inMatrix.
|
|
- void DrawCapsule(RMat44Arg inMatrix, float inHalfHeightOfCylinder, float inRadius, 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);
|
|
|
|
|
|
/// Draw a cylinder with top (0, inHalfHeight, 0) and bottom (0, -inHalfHeight, 0) and radius inRadius.
|
|
/// Draw a cylinder with top (0, inHalfHeight, 0) and bottom (0, -inHalfHeight, 0) and radius inRadius.
|
|
/// The cylinder will be transformed by inMatrix
|
|
/// The cylinder will be transformed by inMatrix
|
|
- void DrawCylinder(RMat44Arg inMatrix, float inHalfHeight, 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);
|
|
|
|
|
|
/// Draw a bottomless cone.
|
|
/// Draw a bottomless cone.
|
|
/// @param inTop Top of cone, center of base is at inTop + inAxis.
|
|
/// @param inTop Top of cone, center of base is at inTop + inAxis.
|
|
@@ -128,7 +128,7 @@ public:
|
|
/// @param inColor Color to use for drawing the cone.
|
|
/// @param inColor Color to use for drawing the cone.
|
|
/// @param inCastShadow determines if this geometry should cast a shadow or not.
|
|
/// @param inCastShadow determines if this geometry should cast a shadow or not.
|
|
/// @param inDrawMode determines if we draw the geometry solid or in wireframe.
|
|
/// @param inDrawMode determines if we draw the geometry solid or in wireframe.
|
|
- void DrawOpenCone(RVec3Arg inTop, Vec3Arg inAxis, Vec3Arg inPerpendicular, float inHalfAngle, float inLength, 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);
|
|
|
|
|
|
/// Draws cone rotation limits as used by the SwingTwistConstraintPart.
|
|
/// Draws cone rotation limits as used by the SwingTwistConstraintPart.
|
|
/// @param inMatrix Matrix that transforms from constraint space to world space
|
|
/// @param inMatrix Matrix that transforms from constraint space to world space
|
|
@@ -138,7 +138,7 @@ public:
|
|
/// @param inColor Color to use for drawing the cone.
|
|
/// @param inColor Color to use for drawing the cone.
|
|
/// @param inCastShadow determines if this geometry should cast a shadow or not.
|
|
/// @param inCastShadow determines if this geometry should cast a shadow or not.
|
|
/// @param inDrawMode determines if we draw the geometry solid or in wireframe.
|
|
/// @param inDrawMode determines if we draw the geometry solid or in wireframe.
|
|
- void DrawSwingConeLimits(RMat44Arg inMatrix, float inSwingYHalfAngle, float inSwingZHalfAngle, float inEdgeLength, 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);
|
|
|
|
|
|
/// Draws rotation limits as used by the SwingTwistConstraintPart.
|
|
/// Draws rotation limits as used by the SwingTwistConstraintPart.
|
|
/// @param inMatrix Matrix that transforms from constraint space to world space
|
|
/// @param inMatrix Matrix that transforms from constraint space to world space
|
|
@@ -150,7 +150,7 @@ public:
|
|
/// @param inColor Color to use for drawing the cone.
|
|
/// @param inColor Color to use for drawing the cone.
|
|
/// @param inCastShadow determines if this geometry should cast a shadow or not.
|
|
/// @param inCastShadow determines if this geometry should cast a shadow or not.
|
|
/// @param inDrawMode determines if we draw the geometry solid or in wireframe.
|
|
/// @param inDrawMode determines if we draw the geometry solid or in wireframe.
|
|
- 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 DrawSwingPyramidLimits(RMat44Arg inMatrix, float inMinSwingYAngle, float inMaxSwingYAngle, float inMinSwingZAngle, float inMaxSwingZAngle, float inEdgeLength, ColorArg inColor, ECastShadow inCastShadow = ECastShadow::On, EDrawMode inDrawMode = EDrawMode::Solid);
|
|
|
|
|
|
/// Draw a pie (part of a circle).
|
|
/// Draw a pie (part of a circle).
|
|
/// @param inCenter The center of the circle.
|
|
/// @param inCenter The center of the circle.
|
|
@@ -162,30 +162,30 @@ public:
|
|
/// @param inColor Color to use for drawing the pie.
|
|
/// @param inColor Color to use for drawing the pie.
|
|
/// @param inCastShadow determines if this geometry should cast a shadow or not.
|
|
/// @param inCastShadow determines if this geometry should cast a shadow or not.
|
|
/// @param inDrawMode determines if we draw the geometry solid or in wireframe.
|
|
/// @param inDrawMode determines if we draw the geometry solid or in wireframe.
|
|
- 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 DrawPie(RVec3Arg inCenter, float inRadius, Vec3Arg inNormal, Vec3Arg inAxis, float inMinAngle, float inMaxAngle, ColorArg inColor, ECastShadow inCastShadow = ECastShadow::On, EDrawMode inDrawMode = EDrawMode::Solid);
|
|
|
|
|
|
/// Singleton instance
|
|
/// Singleton instance
|
|
- static DebugRenderer * sInstance;
|
|
|
|
|
|
+ static DebugRenderer * sInstance;
|
|
|
|
|
|
/// Vertex format used by the triangle renderer
|
|
/// Vertex format used by the triangle renderer
|
|
class Vertex
|
|
class Vertex
|
|
{
|
|
{
|
|
public:
|
|
public:
|
|
- Float3 mPosition;
|
|
|
|
- Float3 mNormal;
|
|
|
|
- Float2 mUV;
|
|
|
|
- Color mColor;
|
|
|
|
|
|
+ Float3 mPosition;
|
|
|
|
+ Float3 mNormal;
|
|
|
|
+ Float2 mUV;
|
|
|
|
+ Color mColor;
|
|
};
|
|
};
|
|
|
|
|
|
/// A single triangle
|
|
/// A single triangle
|
|
class JPH_DEBUG_RENDERER_EXPORT Triangle
|
|
class JPH_DEBUG_RENDERER_EXPORT Triangle
|
|
{
|
|
{
|
|
public:
|
|
public:
|
|
- Triangle() = default;
|
|
|
|
- Triangle(Vec3Arg inV1, Vec3Arg inV2, Vec3Arg inV3, ColorArg inColor);
|
|
|
|
- Triangle(Vec3Arg inV1, Vec3Arg inV2, Vec3Arg inV3, ColorArg inColor, Vec3Arg inUVOrigin, Vec3Arg inUVDirection);
|
|
|
|
|
|
+ Triangle() = default;
|
|
|
|
+ Triangle(Vec3Arg inV1, Vec3Arg inV2, Vec3Arg inV3, ColorArg inColor);
|
|
|
|
+ Triangle(Vec3Arg inV1, Vec3Arg inV2, Vec3Arg inV3, ColorArg inColor, Vec3Arg inUVOrigin, Vec3Arg inUVDirection);
|
|
|
|
|
|
- Vertex mV[3];
|
|
|
|
|
|
+ Vertex mV[3];
|
|
};
|
|
};
|
|
|
|
|
|
/// Handle for a batch of triangles
|
|
/// Handle for a batch of triangles
|
|
@@ -195,8 +195,8 @@ public:
|
|
class LOD
|
|
class LOD
|
|
{
|
|
{
|
|
public:
|
|
public:
|
|
- Batch mTriangleBatch;
|
|
|
|
- float mDistance;
|
|
|
|
|
|
+ Batch mTriangleBatch;
|
|
|
|
+ float mDistance;
|
|
};
|
|
};
|
|
|
|
|
|
/// A geometry primitive containing triangle batches for various lods
|
|
/// A geometry primitive containing triangle batches for various lods
|
|
@@ -206,15 +206,15 @@ public:
|
|
JPH_OVERRIDE_NEW_DELETE
|
|
JPH_OVERRIDE_NEW_DELETE
|
|
|
|
|
|
/// Constructor
|
|
/// Constructor
|
|
- Geometry(const AABox &inBounds) : mBounds(inBounds) { }
|
|
|
|
- Geometry(const Batch &inBatch, const AABox &inBounds) : mBounds(inBounds) { mLODs.push_back({ inBatch, FLT_MAX }); }
|
|
|
|
|
|
+ Geometry(const AABox &inBounds) : mBounds(inBounds) { }
|
|
|
|
+ Geometry(const Batch &inBatch, const AABox &inBounds) : mBounds(inBounds) { mLODs.push_back({ inBatch, FLT_MAX }); }
|
|
|
|
|
|
/// Determine which LOD to render
|
|
/// Determine which LOD to render
|
|
/// @param inCameraPosition Current position of the camera
|
|
/// @param inCameraPosition Current position of the camera
|
|
/// @param inWorldSpaceBounds World space bounds for this geometry (transform mBounds by model space matrix)
|
|
/// @param inWorldSpaceBounds World space bounds for this geometry (transform mBounds by model space matrix)
|
|
/// @param 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).
|
|
/// @param 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).
|
|
/// @return The selected LOD.
|
|
/// @return The selected LOD.
|
|
- const LOD & GetLOD(Vec3Arg inCameraPosition, const AABox &inWorldSpaceBounds, float inLODScaleSq) const
|
|
|
|
|
|
+ const LOD & GetLOD(Vec3Arg inCameraPosition, const AABox &inWorldSpaceBounds, float inLODScaleSq) const
|
|
{
|
|
{
|
|
float dist_sq = inWorldSpaceBounds.GetSqDistanceTo(inCameraPosition);
|
|
float dist_sq = inWorldSpaceBounds.GetSqDistanceTo(inCameraPosition);
|
|
for (const LOD &lod : mLODs)
|
|
for (const LOD &lod : mLODs)
|
|
@@ -225,36 +225,36 @@ public:
|
|
}
|
|
}
|
|
|
|
|
|
/// All level of details for this mesh
|
|
/// All level of details for this mesh
|
|
- Array<LOD> mLODs;
|
|
|
|
|
|
+ Array<LOD> mLODs;
|
|
|
|
|
|
/// Bounding box that encapsulates all LODs
|
|
/// Bounding box that encapsulates all LODs
|
|
- AABox mBounds;
|
|
|
|
|
|
+ AABox mBounds;
|
|
};
|
|
};
|
|
|
|
|
|
/// Handle for a lodded triangle batch
|
|
/// Handle for a lodded triangle batch
|
|
using GeometryRef = Ref<Geometry>;
|
|
using GeometryRef = Ref<Geometry>;
|
|
|
|
|
|
/// Calculate bounding box for a batch of triangles
|
|
/// Calculate bounding box for a batch of triangles
|
|
- static AABox sCalculateBounds(const Vertex *inVertices, int inVertexCount);
|
|
|
|
|
|
+ static AABox sCalculateBounds(const Vertex *inVertices, int inVertexCount);
|
|
|
|
|
|
/// Create a batch of triangles that can be drawn efficiently
|
|
/// Create a batch of triangles that can be drawn efficiently
|
|
- virtual Batch CreateTriangleBatch(const Triangle *inTriangles, int inTriangleCount) = 0;
|
|
|
|
- virtual Batch CreateTriangleBatch(const Vertex *inVertices, int inVertexCount, const uint32 *inIndices, int inIndexCount) = 0;
|
|
|
|
- Batch CreateTriangleBatch(const Array<Triangle> &inTriangles) { return CreateTriangleBatch(inTriangles.empty()? nullptr : &inTriangles[0], int(inTriangles.size())); }
|
|
|
|
- Batch CreateTriangleBatch(const Array<Vertex> &inVertices, const Array<uint32> &inIndices) { return CreateTriangleBatch(inVertices.empty()? nullptr : &inVertices[0], int(inVertices.size()), inIndices.empty()? nullptr : &inIndices[0], int(inIndices.size())); }
|
|
|
|
- Batch CreateTriangleBatch(const VertexList &inVertices, const IndexedTriangleNoMaterialList &inTriangles);
|
|
|
|
|
|
+ virtual Batch CreateTriangleBatch(const Triangle *inTriangles, int inTriangleCount) = 0;
|
|
|
|
+ virtual Batch CreateTriangleBatch(const Vertex *inVertices, int inVertexCount, const uint32 *inIndices, int inIndexCount) = 0;
|
|
|
|
+ Batch CreateTriangleBatch(const Array<Triangle> &inTriangles) { return CreateTriangleBatch(inTriangles.empty()? nullptr : &inTriangles[0], int(inTriangles.size())); }
|
|
|
|
+ Batch CreateTriangleBatch(const Array<Vertex> &inVertices, const Array<uint32> &inIndices) { return CreateTriangleBatch(inVertices.empty()? nullptr : &inVertices[0], int(inVertices.size()), inIndices.empty()? nullptr : &inIndices[0], int(inIndices.size())); }
|
|
|
|
+ Batch CreateTriangleBatch(const VertexList &inVertices, const IndexedTriangleNoMaterialList &inTriangles);
|
|
|
|
|
|
/// Create a primitive for a convex shape using its support function
|
|
/// Create a primitive for a convex shape using its support function
|
|
using SupportFunction = function<Vec3 (Vec3Arg inDirection)>;
|
|
using SupportFunction = function<Vec3 (Vec3Arg inDirection)>;
|
|
- Batch CreateTriangleBatchForConvex(SupportFunction inGetSupport, int inLevel, AABox *outBounds = nullptr);
|
|
|
|
- GeometryRef CreateTriangleGeometryForConvex(SupportFunction inGetSupport);
|
|
|
|
|
|
+ Batch CreateTriangleBatchForConvex(SupportFunction inGetSupport, int inLevel, AABox *outBounds = nullptr);
|
|
|
|
+ GeometryRef CreateTriangleGeometryForConvex(SupportFunction inGetSupport);
|
|
|
|
|
|
/// Determines which polygons are culled
|
|
/// Determines which polygons are culled
|
|
enum class ECullMode
|
|
enum class ECullMode
|
|
{
|
|
{
|
|
- CullBackFace, ///< Don't draw backfacing polygons
|
|
|
|
- CullFrontFace, ///< Don't draw front facing polygons
|
|
|
|
- Off ///< Don't do culling and draw both sides
|
|
|
|
|
|
+ CullBackFace, ///< Don't draw backfacing polygons
|
|
|
|
+ CullFrontFace, ///< Don't draw front facing polygons
|
|
|
|
+ Off ///< Don't do culling and draw both sides
|
|
};
|
|
};
|
|
|
|
|
|
/// Draw some geometry
|
|
/// Draw some geometry
|
|
@@ -266,60 +266,60 @@ public:
|
|
/// @param inCullMode determines which polygons are culled.
|
|
/// @param inCullMode determines which polygons are culled.
|
|
/// @param inCastShadow determines if this geometry should cast a shadow or not.
|
|
/// @param inCastShadow determines if this geometry should cast a shadow or not.
|
|
/// @param inDrawMode determines if we draw the geometry solid or in wireframe.
|
|
/// @param inDrawMode determines if we draw the geometry solid or in wireframe.
|
|
- virtual void DrawGeometry(RMat44Arg inModelMatrix, const AABox &inWorldSpaceBounds, float inLODScaleSq, ColorArg inModelColor, const GeometryRef &inGeometry, ECullMode inCullMode = ECullMode::CullBackFace, ECastShadow inCastShadow = ECastShadow::On, EDrawMode inDrawMode = EDrawMode::Solid) = 0;
|
|
|
|
- void DrawGeometry(RMat44Arg inModelMatrix, ColorArg inModelColor, const GeometryRef &inGeometry, ECullMode inCullMode = ECullMode::CullBackFace, ECastShadow inCastShadow = ECastShadow::On, EDrawMode inDrawMode = EDrawMode::Solid) { DrawGeometry(inModelMatrix, inGeometry->mBounds.Transformed(inModelMatrix), max(max(inModelMatrix.GetAxisX().LengthSq(), inModelMatrix.GetAxisY().LengthSq()), inModelMatrix.GetAxisZ().LengthSq()), inModelColor, inGeometry, inCullMode, inCastShadow, inDrawMode); }
|
|
|
|
|
|
+ virtual void DrawGeometry(RMat44Arg inModelMatrix, const AABox &inWorldSpaceBounds, float inLODScaleSq, ColorArg inModelColor, const GeometryRef &inGeometry, ECullMode inCullMode = ECullMode::CullBackFace, ECastShadow inCastShadow = ECastShadow::On, EDrawMode inDrawMode = EDrawMode::Solid) = 0;
|
|
|
|
+ void DrawGeometry(RMat44Arg inModelMatrix, ColorArg inModelColor, const GeometryRef &inGeometry, ECullMode inCullMode = ECullMode::CullBackFace, ECastShadow inCastShadow = ECastShadow::On, EDrawMode inDrawMode = EDrawMode::Solid) { DrawGeometry(inModelMatrix, inGeometry->mBounds.Transformed(inModelMatrix), max(max(inModelMatrix.GetAxisX().LengthSq(), inModelMatrix.GetAxisY().LengthSq()), inModelMatrix.GetAxisZ().LengthSq()), inModelColor, inGeometry, inCullMode, inCastShadow, inDrawMode); }
|
|
|
|
|
|
/// Draw text
|
|
/// Draw text
|
|
- virtual void DrawText3D(RVec3Arg inPosition, const string_view &inString, ColorArg inColor = Color::sWhite, float inHeight = 0.5f) = 0;
|
|
|
|
|
|
+ virtual void DrawText3D(RVec3Arg inPosition, const string_view &inString, ColorArg inColor = Color::sWhite, float inHeight = 0.5f) = 0;
|
|
|
|
|
|
protected:
|
|
protected:
|
|
/// Initialize the system, must be called from the constructor of the DebugRenderer implementation
|
|
/// Initialize the system, must be called from the constructor of the DebugRenderer implementation
|
|
- void Initialize();
|
|
|
|
|
|
+ void Initialize();
|
|
|
|
|
|
private:
|
|
private:
|
|
/// Recursive helper function for DrawWireUnitSphere
|
|
/// Recursive helper function for DrawWireUnitSphere
|
|
- void DrawWireUnitSphereRecursive(RMat44Arg inMatrix, ColorArg inColor, Vec3Arg inDir1, Vec3Arg inDir2, Vec3Arg inDir3, int inLevel);
|
|
|
|
|
|
+ void DrawWireUnitSphereRecursive(RMat44Arg inMatrix, ColorArg inColor, Vec3Arg inDir1, Vec3Arg inDir2, Vec3Arg inDir3, int inLevel);
|
|
|
|
|
|
/// Helper functions to create a box
|
|
/// Helper functions to create a box
|
|
- void CreateQuad(Array<uint32> &ioIndices, Array<Vertex> &ioVertices, Vec3Arg inV1, Vec3Arg inV2, Vec3Arg inV3, Vec3Arg inV4);
|
|
|
|
|
|
+ void CreateQuad(Array<uint32> &ioIndices, Array<Vertex> &ioVertices, Vec3Arg inV1, Vec3Arg inV2, Vec3Arg inV3, Vec3Arg inV4);
|
|
|
|
|
|
/// Helper functions to create a vertex and index buffer for a sphere
|
|
/// Helper functions to create a vertex and index buffer for a sphere
|
|
- void Create8thSphereRecursive(Array<uint32> &ioIndices, Array<Vertex> &ioVertices, Vec3Arg inDir1, uint32 &ioIdx1, Vec3Arg inDir2, uint32 &ioIdx2, Vec3Arg inDir3, uint32 &ioIdx3, const Float2 &inUV, SupportFunction inGetSupport, int inLevel);
|
|
|
|
- void Create8thSphere(Array<uint32> &ioIndices, Array<Vertex> &ioVertices, Vec3Arg inDir1, Vec3Arg inDir2, Vec3Arg inDir3, const Float2 &inUV, SupportFunction inGetSupport, int inLevel);
|
|
|
|
|
|
+ void Create8thSphereRecursive(Array<uint32> &ioIndices, Array<Vertex> &ioVertices, Vec3Arg inDir1, uint32 &ioIdx1, Vec3Arg inDir2, uint32 &ioIdx2, Vec3Arg inDir3, uint32 &ioIdx3, const Float2 &inUV, SupportFunction inGetSupport, int inLevel);
|
|
|
|
+ void Create8thSphere(Array<uint32> &ioIndices, Array<Vertex> &ioVertices, Vec3Arg inDir1, Vec3Arg inDir2, Vec3Arg inDir3, const Float2 &inUV, SupportFunction inGetSupport, int inLevel);
|
|
|
|
|
|
/// Helper function for DrawSwingConeLimits and DrawSwingPyramidLimits
|
|
/// Helper function for DrawSwingConeLimits and DrawSwingPyramidLimits
|
|
- Geometry * CreateSwingLimitGeometry(int inNumSegments, const Vec3 *inVertices);
|
|
|
|
|
|
+ Geometry * CreateSwingLimitGeometry(int inNumSegments, const Vec3 *inVertices);
|
|
|
|
|
|
// Predefined shapes
|
|
// Predefined shapes
|
|
- GeometryRef mBox;
|
|
|
|
- GeometryRef mSphere;
|
|
|
|
- GeometryRef mCapsuleTop;
|
|
|
|
- GeometryRef mCapsuleMid;
|
|
|
|
- GeometryRef mCapsuleBottom;
|
|
|
|
- GeometryRef mOpenCone;
|
|
|
|
- GeometryRef mCylinder;
|
|
|
|
|
|
+ GeometryRef mBox;
|
|
|
|
+ GeometryRef mSphere;
|
|
|
|
+ GeometryRef mCapsuleTop;
|
|
|
|
+ GeometryRef mCapsuleMid;
|
|
|
|
+ GeometryRef mCapsuleBottom;
|
|
|
|
+ GeometryRef mOpenCone;
|
|
|
|
+ GeometryRef mCylinder;
|
|
|
|
|
|
struct SwingConeLimits
|
|
struct SwingConeLimits
|
|
{
|
|
{
|
|
- bool operator == (const SwingConeLimits &inRHS) const
|
|
|
|
|
|
+ bool operator == (const SwingConeLimits &inRHS) const
|
|
{
|
|
{
|
|
return mSwingYHalfAngle == inRHS.mSwingYHalfAngle
|
|
return mSwingYHalfAngle == inRHS.mSwingYHalfAngle
|
|
&& mSwingZHalfAngle == inRHS.mSwingZHalfAngle;
|
|
&& mSwingZHalfAngle == inRHS.mSwingZHalfAngle;
|
|
}
|
|
}
|
|
|
|
|
|
- float mSwingYHalfAngle;
|
|
|
|
- float mSwingZHalfAngle;
|
|
|
|
|
|
+ float mSwingYHalfAngle;
|
|
|
|
+ float mSwingZHalfAngle;
|
|
};
|
|
};
|
|
|
|
|
|
JPH_MAKE_HASH_STRUCT(SwingConeLimits, SwingConeLimitsHasher, t.mSwingYHalfAngle, t.mSwingZHalfAngle)
|
|
JPH_MAKE_HASH_STRUCT(SwingConeLimits, SwingConeLimitsHasher, t.mSwingYHalfAngle, t.mSwingZHalfAngle)
|
|
|
|
|
|
using SwingConeBatches = UnorderedMap<SwingConeLimits, GeometryRef, SwingConeLimitsHasher>;
|
|
using SwingConeBatches = UnorderedMap<SwingConeLimits, GeometryRef, SwingConeLimitsHasher>;
|
|
- SwingConeBatches mSwingConeLimits;
|
|
|
|
- SwingConeBatches mPrevSwingConeLimits;
|
|
|
|
|
|
+ SwingConeBatches mSwingConeLimits;
|
|
|
|
+ SwingConeBatches mPrevSwingConeLimits;
|
|
|
|
|
|
struct SwingPyramidLimits
|
|
struct SwingPyramidLimits
|
|
{
|
|
{
|
|
- bool operator == (const SwingPyramidLimits &inRHS) const
|
|
|
|
|
|
+ bool operator == (const SwingPyramidLimits &inRHS) const
|
|
{
|
|
{
|
|
return mMinSwingYAngle == inRHS.mMinSwingYAngle
|
|
return mMinSwingYAngle == inRHS.mMinSwingYAngle
|
|
&& mMaxSwingYAngle == inRHS.mMaxSwingYAngle
|
|
&& mMaxSwingYAngle == inRHS.mMaxSwingYAngle
|
|
@@ -327,21 +327,21 @@ private:
|
|
&& mMaxSwingZAngle == inRHS.mMaxSwingZAngle;
|
|
&& mMaxSwingZAngle == inRHS.mMaxSwingZAngle;
|
|
}
|
|
}
|
|
|
|
|
|
- float mMinSwingYAngle;
|
|
|
|
- float mMaxSwingYAngle;
|
|
|
|
- float mMinSwingZAngle;
|
|
|
|
- float mMaxSwingZAngle;
|
|
|
|
|
|
+ float mMinSwingYAngle;
|
|
|
|
+ float mMaxSwingYAngle;
|
|
|
|
+ float mMinSwingZAngle;
|
|
|
|
+ float mMaxSwingZAngle;
|
|
};
|
|
};
|
|
|
|
|
|
JPH_MAKE_HASH_STRUCT(SwingPyramidLimits, SwingPyramidLimitsHasher, t.mMinSwingYAngle, t.mMaxSwingYAngle, t.mMinSwingZAngle, t.mMaxSwingZAngle)
|
|
JPH_MAKE_HASH_STRUCT(SwingPyramidLimits, SwingPyramidLimitsHasher, t.mMinSwingYAngle, t.mMaxSwingYAngle, t.mMinSwingZAngle, t.mMaxSwingZAngle)
|
|
|
|
|
|
using SwingPyramidBatches = UnorderedMap<SwingPyramidLimits, GeometryRef, SwingPyramidLimitsHasher>;
|
|
using SwingPyramidBatches = UnorderedMap<SwingPyramidLimits, GeometryRef, SwingPyramidLimitsHasher>;
|
|
- SwingPyramidBatches mSwingPyramidLimits;
|
|
|
|
- SwingPyramidBatches mPrevSwingPyramidLimits;
|
|
|
|
|
|
+ SwingPyramidBatches mSwingPyramidLimits;
|
|
|
|
+ SwingPyramidBatches mPrevSwingPyramidLimits;
|
|
|
|
|
|
using PieBatces = UnorderedMap<float, GeometryRef>;
|
|
using PieBatces = UnorderedMap<float, GeometryRef>;
|
|
- PieBatces mPieLimits;
|
|
|
|
- PieBatces mPrevPieLimits;
|
|
|
|
|
|
+ PieBatces mPieLimits;
|
|
|
|
+ PieBatces mPrevPieLimits;
|
|
};
|
|
};
|
|
|
|
|
|
JPH_NAMESPACE_END
|
|
JPH_NAMESPACE_END
|