forked from excessive/exmview
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathiqm.hpp
52 lines (44 loc) · 889 Bytes
/
iqm.hpp
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
49
50
51
52
#pragma once
#include <vector>
#include <string>
enum MeshComponent {
MC_NONE = 0,
MC_POSITION = 1 << 0,
MC_NORMAL = 1 << 1,
MC_TEXCOORD = 1 << 2,
MC_TANGENT = 1 << 3,
MC_BONE = 1 << 4,
MC_WEIGHT = 1 << 5,
MC_COLOR = 1 << 6
};
union Rights {
unsigned u;
float f;
};
enum LayerType {
MT_INT,
MT_FLOAT
};
struct MeshLayer {
MeshComponent component;
std::vector<Rights> data;
size_t bytes;
LayerType type;
unsigned count;
bool should_normalize;
};
struct MeshChunk {
unsigned offset;
unsigned num_indices;
std::string name;
std::string material;
};
struct MeshData {
unsigned mask;
bool need_int_indices;
std::vector<MeshChunk> chunks;
std::vector<MeshLayer> layers;
std::vector<unsigned> indices;
size_t indices_bytes;
};
bool iqm_read_data(MeshData *md, const std::string &filename, bool fill_colors);