summary refs log tree commit diff
path: root/src/GFX/Mesh.hpp
blob: 9d640b6744d07b57b9a484905d7e259a9fd156f4 (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
#pragma once

#include <utility>
#include <vector>
#include <cstdint>
#include "../Math/Math.hpp"

namespace MC::GFX {

class Mesh {
public:
    struct Attribute {
        template<size_t S = 3, typename T = float>
        Attribute(
            std::vector<Vector<S, T>> data
        ) : data((T*) data.data()),
            data_size(data.size()),
            attribute_size(S),
            type_size(sizeof(T)) {};

        void* data;
        long data_size;
        int attribute_size;
        int type_size;
    };

    Mesh(
        std::vector<Attribute> attributes,
        std::vector<uint32_t> indices
    ) : m_attributes(std::move(attributes)),
        m_indices(std::move(indices)) {};

    Mesh(
        std::vector<Attribute> attributes
    ) : m_attributes(std::move(attributes)),
        m_indices() {};

    std::vector<uint32_t> indices();
    std::vector<Attribute> attributes();

private:
    std::vector<Attribute> m_attributes;
    std::vector<uint32_t> m_indices;
};

}