| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
#pragma once |
| 6 |
|
| 7 |
#ifndef JPH_DEBUG_RENDERER |
| 8 |
#error This file should only be included when JPH_DEBUG_RENDERER is defined |
| 9 |
#endif |
| 10 |
|
| 11 |
#include <Jolt/Renderer/DebugRenderer.h> |
| 12 |
|
| 13 |
JPH_NAMESPACE_BEGIN |
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
class JPH_DEBUG_RENDERER_EXPORT DebugRendererSimple : public DebugRenderer |
| 38 |
{ |
| 39 |
public: |
| 40 |
JPH_OVERRIDE_NEW_DELETE |
| 41 |
|
| 42 |
|
| 43 |
DebugRendererSimple(); |
| 44 |
|
| 45 |
|
| 46 |
|
| 47 |
void SetCameraPos(RVec3Arg inCameraPos) |
| 48 |
{ |
| 49 |
mCameraPos = inCameraPos; |
| 50 |
mCameraPosSet = true; |
| 51 |
} |
| 52 |
|
| 53 |
|
| 54 |
virtual void DrawTriangle(RVec3Arg inV1, RVec3Arg inV2, RVec3Arg inV3, ColorArg inColor, ECastShadow inCastShadow) override |
| 55 |
{ |
| 56 |
DrawLine(inV1, inV2, inColor); |
| 57 |
DrawLine(inV2, inV3, inColor); |
| 58 |
DrawLine(inV3, inV1, inColor); |
| 59 |
} |
| 60 |
|
| 61 |
protected: |
| 62 |
|
| 63 |
virtual Batch CreateTriangleBatch(const Triangle *inTriangles, int inTriangleCount) override; |
| 64 |
virtual Batch CreateTriangleBatch(const Vertex *inVertices, int inVertexCount, const uint32 *inIndices, int inIndexCount) override; |
| 65 |
virtual void DrawGeometry(RMat44Arg inModelMatrix, const AABox &inWorldSpaceBounds, float inLODScaleSq, ColorArg inModelColor, const GeometryRef &inGeometry, ECullMode inCullMode, ECastShadow inCastShadow, EDrawMode inDrawMode) override; |
| 66 |
|
| 67 |
private: |
| 68 |
|
| 69 |
class BatchImpl : public RefTargetVirtual |
| 70 |
{ |
| 71 |
public: |
| 72 |
JPH_OVERRIDE_NEW_DELETE |
| 73 |
|
| 74 |
virtual void AddRef() override { ++mRefCount; } |
| 75 |
virtual void Release() override { if (--mRefCount == 0) delete this; } |
| 76 |
|
| 77 |
Array<Triangle> mTriangles; |
| 78 |
|
| 79 |
private: |
| 80 |
atomic<uint32> mRefCount = 0; |
| 81 |
}; |
| 82 |
|
| 83 |
|
| 84 |
RVec3 mCameraPos; |
| 85 |
bool mCameraPosSet = false; |
| 86 |
}; |
| 87 |
|
| 88 |
JPH_NAMESPACE_END |