blob: 6103e092dd9a25c2d57dc5c2178311d0a4e1ce0e (
plain)
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
45
46
47
48
|
#pragma once
#include "../Common/Sizes.hpp"
#include "Mesh.hpp"
namespace MC::GFX {
class BindableMesh {
public:
void bind() const;
void unbind() const;
Bool has_indices() const;
USize size() const;
private:
BindableMesh(
U32 vao,
USize vertex_count,
USize attribute_count
) : m_vao(vao),
m_vertex_count(vertex_count),
m_has_indices(vertex_count > 0),
m_attribute_count(attribute_count) {}
U32 m_vao;
USize m_vertex_count;
Bool m_has_indices;
USize m_attribute_count;
friend class Binder;
};
class Binder {
public:
Binder() = default;
static BindableMesh load(const Mesh& mesh);
private:
static U32 create_vao();
static void unbind_vao();
static void store_in_attribute_list(U32 attribute, Int attribute_size, Int type_size, const void* data, long data_size);
static void store_indices(const U32* indices, USize indices_size);
};
}
|