Grindstone Game Engine v0.2.0
An open source game engine and toolkit.
Loading...
Searching...
No Matches
GizmoRenderer.hpp
1#pragma once
2
3#include <glm/glm.hpp>
4#include <glm/gtc/quaternion.hpp>
5#include <vector>
6
7namespace Grindstone::GraphicsAPI {
8 class CommandBuffer;
9 class UniformBuffer;
10 class DescriptorSet;
11 class DescriptorSetLayout;
12 class GraphicsPipeline;
13 class VertexBuffer;
14 class IndexBuffer;
15 class VertexArrayObject;
16 class RenderPass;
17}
18
19namespace Grindstone::Editor {
21 public:
22 void Initialize(class Grindstone::GraphicsAPI::RenderPass* renderPass);
23 void SubmitCubeGizmo(const glm::mat4& transform, glm::vec3 size, glm::vec4 color = glm::vec4(1.0f));
24 void SubmitCapsuleGizmo(const glm::mat4& transform, float height, float radius, glm::vec4 color = glm::vec4(1.0f));
25 void SubmitPlaneGizmo(const glm::mat4& transform, glm::vec3 normal, float positionAlongNormal, glm::vec4 color = glm::vec4(1.0f));
26 void SubmitSphereGizmo(const glm::mat4& transform, float radius, glm::vec4 color = glm::vec4(1.0f));
27 void Render(Grindstone::GraphicsAPI::CommandBuffer* commandBuffer, glm::mat4 projView);
28 protected:
29 Grindstone::GraphicsAPI::UniformBuffer* gizmoUniformBuffer = nullptr;
30 Grindstone::GraphicsAPI::DescriptorSet* gizmoDescriptorSet = nullptr;
31 Grindstone::GraphicsAPI::DescriptorSetLayout* gizmoDescriptorSetLayout = nullptr;
32 Grindstone::GraphicsAPI::GraphicsPipeline* gizmoPipeline = nullptr;
33
34 Grindstone::GraphicsAPI::VertexBuffer* gizmoShapesVertexBuffer = nullptr;
35 Grindstone::GraphicsAPI::IndexBuffer* gizmoShapesIndexBuffer = nullptr;
36 Grindstone::GraphicsAPI::VertexArrayObject* gizmoShapesVao = nullptr;
37
38 enum class ShapeType {
39 Undefined,
40 Cube,
41 Sphere,
42 Cone,
43 Plane,
44 Capsule,
45 Cyclinder,
46 };
47
49 uint32_t firstIndex;
50 uint32_t indexCount;
51 uint32_t vertexOffset;
52 };
53
54 std::array<ShapeMetaData, 7> shapeMetaData;
55
57 glm::mat4 transform;
58 glm::vec4 color;
59 };
60
61 std::vector<GizmoUniformBuffer> dataBuffer;
62 std::vector<ShapeType> drawShapes;
63 size_t drawCount = 0;
64
65 inline void AppendData(ShapeType shapeType, uint32_t& currentVertexOffset, uint32_t& currentIndexOffset, uint32_t vertexCount, uint32_t indexCount);
66 };
67}
Definition GizmoRenderer.hpp:20
Definition CommandBuffer.hpp:21
Definition DescriptorSetLayout.hpp:11
Definition DescriptorSet.hpp:11
Definition GraphicsPipeline.hpp:18
Definition IndexBuffer.hpp:11
Definition RenderPass.hpp:27
Definition UniformBuffer.hpp:10
Definition VertexArrayObject.hpp:10
Definition VertexBuffer.hpp:130