-
Notifications
You must be signed in to change notification settings - Fork 0
/
bsp.h
49 lines (41 loc) · 834 Bytes
/
bsp.h
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
#ifndef BSP_H
#define BSP_H
#include <vector>
#include <cstring>
#define CHARS_TO_I32(raw, shift) (raw[(shift + 3)] << 24 | raw[(shift) + 2] << 16 | raw[(shift) + 1] << 8 | raw[(shift)])
#define CHARS_TO_I16(raw, shift) (raw[(shift) + 1] << 8 | raw[(shift)])
enum Lumps
{
ENTITIES = 0,
PLANES,
TEXTURES,
VERTICES,
VISIBILITY,
NODES,
TEXINFO,
FACES,
LIGHTING,
CLIPNODES,
LEAVES,
MARKSURFACES,
EDGES,
SURFEDGES,
MODELS,
HEADER_LUMPS,
LUMPS_LENGTH
};
struct Vector3D { float x, y, z; };
struct Plane
{
Vector3D vertex;
float dist;
uint32_t type;
};
struct BSP
{
std::vector<Vector3D> vertices;
std::vector<std::pair<short, short>> edges;
std::vector<Plane> planes;
};
BSP parseBSP(std::vector<unsigned char> buffer);
#endif /* BSP_H */