Grindstone Game Engine v0.2.0
An open source game engine and toolkit.
Loading...
Searching...
No Matches
NavMeshDebugRenderer.hpp
1#pragma once
2
3#include <vector>
4
5#include <DebugDraw.h>
6#include <RecastDebugDraw.h>
7#include <EngineCore/Assets/AssetReference.hpp>
8#include <EngineCore/Assets/PipelineSet/GraphicsPipelineAsset.hpp>
9
10namespace Grindstone::Ai {
11 struct NavMeshDebugRenderer : public duDebugDraw {
12 struct DebugVertex {
13 float x, y, z;
14 float u, v;
15 uint32_t color;
16 };
17
18 struct DrawCall {
19 duDebugDrawPrimitives primitiveType;
20 float pointOrLineSize;
21 bool depthTest;
22 bool textured;
23 uint32_t vertexOffset;
24 uint32_t vertexCount;
25 };
26
27 void Initialize();
28 static NavMeshDebugRenderer* GetInstance();
29
30 void Clear();
31 void BuildVertexBuffers();
32
33 bool ShouldRenderThisFrame() const;
34 void DrawDebug(Grindstone::GraphicsAPI::CommandBuffer* commandBuffer, Grindstone::GraphicsPipelineAsset* pipelineAsset);
35
36 virtual void depthMask(bool state) override;
37
38 virtual void texture(bool state) override;
39
43 virtual void begin(duDebugDrawPrimitives prim, float size = 1.0f) override;
44
48 virtual void vertex(const float* pos, unsigned int color) override;
49
53 virtual void vertex(const float x, const float y, const float z, unsigned int color) override;
54
59 virtual void vertex(const float* pos, unsigned int color, const float* uv) override;
60
65 virtual void vertex(const float x, const float y, const float z, unsigned int color, const float u, const float v) override;
66
68 virtual void end() override;
69
71 virtual unsigned int areaToCol(unsigned int area) override;
72
73 protected:
74 std::vector<DebugVertex> vertices;
75 std::vector<DrawCall> drawCalls;
76 DrawCall* currentCall = nullptr;
77 bool isDepthTestEnabled = true;
78 bool isTextured = false;
79 Grindstone::GraphicsAPI::Buffer* vertexBuffer = nullptr;
81 };
82}
Definition Buffer.hpp:49
Definition CommandBuffer.hpp:109
Definition NavAgentComponent.hpp:12
Definition NavMeshDebugRenderer.hpp:12
Definition NavMeshDebugRenderer.hpp:18
Definition NavMeshDebugRenderer.hpp:11
virtual void begin(duDebugDrawPrimitives prim, float size=1.0f) override
Definition NavMeshDebugRenderer.cpp:111
virtual void end() override
End drawing primitives.
Definition NavMeshDebugRenderer.cpp:149
virtual void vertex(const float *pos, unsigned int color) override
Definition NavMeshDebugRenderer.cpp:125
virtual unsigned int areaToCol(unsigned int area) override
Compute a color for given area.
Definition NavMeshDebugRenderer.cpp:154
Definition GraphicsPipelineAsset.hpp:22