-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvertex_array.hpp
More file actions
44 lines (33 loc) · 1.19 KB
/
vertex_array.hpp
File metadata and controls
44 lines (33 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#ifndef VERTEX_ARRAY_H
#define VERTEX_ARRAY_H
// Stolen from Hazel [https://github.com/TheCherno/Hazel]
#include <Nostalgia/rendering/buffers.hpp>
class VertexArray
{
public:
virtual ~VertexArray() = default;
virtual void Bind() const = 0;
virtual void Unbind() const = 0;
virtual uint GetID() const = 0;
virtual void AddVertexBuffer(Shared<VertexBuffer> inVertexBuffer) = 0;
virtual void SetIndexBuffer(Shared<IndexBuffer> inIndexBuffer) = 0;
virtual Shared<IndexBuffer> GetIndexBuffer() const = 0;
static Shared<VertexArray> CreateDummy();
static Shared<VertexArray> Create();
protected:
std::vector<Shared<VertexBuffer>> mVertexBuffers{};
Shared<IndexBuffer> mIndexBuffer{nullptr};
};
class DummyVertexArray final : public VertexArray
{
public:
DummyVertexArray() = default;
virtual ~DummyVertexArray() = default;
void Bind() const final {}
void Unbind() const final {}
uint GetID() const final { return 0; }
void AddVertexBuffer(Shared<VertexBuffer>) final {}
void SetIndexBuffer(Shared<IndexBuffer>) final {}
Shared<IndexBuffer> GetIndexBuffer() const final { return IndexBuffer::CreateDummy(); }
};
#endif // VERTEX_ARRAY_H