Hymn to Beauty
C++ 3D Engine
Geometry2D.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <glm/glm.hpp>
4
5namespace Video {
6class LowLevelRenderer;
7class Buffer;
8class VertexDescription;
9class GeometryBinding;
10
11namespace Geometry {
14 public:
16 struct Vertex {
18 glm::vec2 position;
19
22 };
23
25
28 explicit Geometry2D(LowLevelRenderer* lowLevelRenderer);
29
31 virtual ~Geometry2D();
32
34
37 virtual const Vertex* GetVertices() const = 0;
38
40
43 virtual unsigned int GetVertexCount() const = 0;
44
46
49 virtual const unsigned int* GetIndices() const = 0;
50
52
55 virtual unsigned int GetIndexCount() const = 0;
56
58
62
63 protected:
65 void GenerateBuffers();
66
69
70 private:
71 LowLevelRenderer* lowLevelRenderer;
72 Buffer* vertexBuffer;
73 Buffer* indexBuffer;
74 VertexDescription* vertexDescription;
75 GeometryBinding* geometryBinding;
76};
77} // namespace Geometry
78} // namespace Video
A buffer containing GPU accessible data.
Definition: Buffer.hpp:8
Interface for renderable 2D geometry.
Definition: Geometry2D.hpp:13
virtual const unsigned int * GetIndices() const =0
Get all the vertex indices.
void GenerateBuffers()
Generate vertex and index buffers.
Definition: Geometry2D.cpp:27
void GenerateGeometryBinding()
Generate geometry binding.
Definition: Geometry2D.cpp:32
Geometry2D(LowLevelRenderer *lowLevelRenderer)
Create new 2D geometry.
Definition: Geometry2D.cpp:12
virtual unsigned int GetIndexCount() const =0
Get the number of indicies.
virtual unsigned int GetVertexCount() const =0
Get the number of vertices.
virtual const Vertex * GetVertices() const =0
Get all the vertices.
const GeometryBinding * GetGeometryBinding() const
Get the geometry binding.
Definition: Geometry2D.cpp:23
virtual ~Geometry2D()
Destructor.
Definition: Geometry2D.cpp:16
Binds together a vertex description with buffers.
Definition: GeometryBinding.hpp:8
Low level renderer abstracting the underlaying graphics API (OpenGL or Vulkan).
Definition: LowLevelRenderer.hpp:27
Describes how a vertex buffer is accessed by a shader.
Definition: VertexDescription.hpp:8
Definition: AssetEditor.hpp:5
Definition: Editor.hpp:18
A vertex point.
Definition: Geometry2D.hpp:16
glm::vec2 textureCoordinate
Texture coordinate.
Definition: Geometry2D.hpp:21
glm::vec2 position
Position.
Definition: Geometry2D.hpp:18