summary refs log tree commit diff
path: root/src/Binder.hpp
blob: 721ec779e87d0b65fdd8b6e6e41d0cfeed57629f (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
#pragma once

#include <cstdint>
#include "Mesh.hpp"

namespace MC {

class BindableMesh {
public:
    void bind() const;
    void unbind();

    size_t size() const;

private:
    BindableMesh(uint32_t vao, size_t vertex_count) : m_vao(vao), m_vertex_count(vertex_count) {};

    uint32_t m_vao;
    size_t m_vertex_count;

    friend class Binder;
};

class Binder {
public:
    Binder() = default;;

    static BindableMesh load(Mesh& mesh);

private:
    static uint32_t create_vao();
    static uint32_t unbind_vao();

    static void store_in_attribute_list(uint32_t attribute, size_t size, float* data, size_t data_size);
};

}