-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathBspModelDefs.h
More file actions
88 lines (71 loc) · 1.86 KB
/
BspModelDefs.h
File metadata and controls
88 lines (71 loc) · 1.86 KB
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#include "3dmaths/f3dmath.h"
namespace P3D
{
class Vertex3d
{
public:
V3<fp> pos;
unsigned int vertex_id = no_vx_id;
V2<fp> uv;
static const unsigned int no_vx_id = -1;
};
class Triangle3d
{
public:
Vertex3d verts[3];
};
class Texture
{
public:
const pixel* pixels;
unsigned short width;
unsigned short height;
bool alpha;
};
typedef struct BspModelHeader
{
unsigned int texture_count;
unsigned int texture_offset; //Offset in bytes from BspModel*
unsigned int triangle_count;
unsigned int triangle_offset; //Bytes from BspModel*
unsigned int node_count;
unsigned int node_offset;
unsigned int texture_pixels_offset; //Bytes from BspModel*
unsigned int texture_palette_offset; //Bytes from BspModel*
unsigned int fog_lightmap_offset; //Bytes from BspModel*
} BspModelHeader;
typedef struct BspModelTriangle
{
Triangle3d tri;
AABB<fp> tri_bb;
Plane<fp> normal_plane;
Plane<fp> edge_plane_0_1;
Plane<fp> edge_plane_1_2;
Plane<fp> edge_plane_2_0;
int texture;
pixel color;
} BspModelTriangle;
typedef struct TriIndexList
{
unsigned short offset;
unsigned short count;
} TriIndexList;
typedef struct BspNodeTexture
{
unsigned int texture_pixels_offset; //Pixels
unsigned short width;
unsigned short height;
bool alpha;
} BspNodeTexture;
typedef struct BspModelNode
{
Plane<fp> plane;
AABB<fp> node_bb;
AABB<fp> child_bb;
unsigned int parent_node;
unsigned int front_node;
unsigned int back_node;
TriIndexList front_tris;
TriIndexList back_tris;
} BspModelNode;
}