-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathobj3d.h
More file actions
221 lines (166 loc) · 3.58 KB
/
Copy pathobj3d.h
File metadata and controls
221 lines (166 loc) · 3.58 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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
#ifndef OBJ3D_H
#define OBJ3D_H
#include "QuakeViewer.h"
#include "3d.h"
#include "obj3d.h"
typedef struct
{
int r, g, b;
} cor_t;
typedef struct {
int onseam;
float s;
float t;
} skinvert_t;
typedef struct
{
int v[2];
} edge_t;
typedef struct
{
int v[3];
vetor3d_t normal;
char isFront;
cor_t cor;
int planenum;
int texinfo;
} triangulo_t;
typedef struct
{
char name[16];
unsigned width, height;
char *data;
} texture_t;
typedef struct
{
vetor3d_t vetorS;
float distS;
vetor3d_t vetorT;
float distT;
int miptex;
int flags;
} textureinfo_t;
typedef struct
{
int id;
short side;
int *firstledge;
short numedges;
textureinfo_t *texinfo;
texture_t *texture;
plano_t *plano;
byte *light;
short light_width, light_height;
short light_mins_s, light_mins_t;
int drawn;
} face_t;
typedef struct
{
char nome[16];
vetor3d_t bboxmin;
vetor3d_t bboxmax;
} frameinfo_t;
typedef struct
{
char nome[16];
int frameI;
int frameF;
} animationframes_t;
typedef struct mnode_s
{
// common with leaf
int contents; // 0, to differentiate from leafs
int visofs; // node needs to be traversed if current
vetor3d_t min; // for bounding box culling
vetor3d_t max;
struct mnode_s *parent;
// node specific
plano_t *plane;
struct mnode_s *children[2];
unsigned int firstsurface;
unsigned int numsurfaces;
} node_t;
typedef struct mleaf_s
{
// common with node
int contents; // wil be a negative contents number
int visofs; // node needs to be traversed if current
vetor3d_t min; // for bounding box culling
vetor3d_t max;
struct mnode_s *parent;
// leaf specific
byte *compressed_vis;
// efrag_t *efrags;
face_t **firstmarksurface;
int nummarksurfaces;
int key; // BSP sequence number for leaf's contents
// byte ambient_sound_level[NUM_AMBIENTS];
} leaf_t;
typedef struct obj3d_s
{
struct obj3d_s *next;
char nome[64];
int numverts;
int numtris;
int numframes;
int totAnims;
int offsetChao;
vetor3d_t posOlho;
int numAnimIdle;
int numAnimWalk;
int numAnimAttack[6];
int totAnimAttack;
int numAnimDeath[4];
int totAnimDeath;
texture_t texture;
skinvert_t *skinmap;
frameinfo_t *frameinfo;
vetor3d_t *frames;
triangulo_t *tris;
vetor3d_t *trisnormals;
animationframes_t *framesanims;
ponto_t *verts;
} obj3d_t;
typedef struct
{
char nome[64];
vetor3d_t player_start;
int player_start_angle;
int tipo;
int numverts;
int numedges;
int numledges;
int numplanes;
int numfaces;
int nummarksurfaces;
int numnodes;
int numtextures;
int numtexinfo;
int numleafs;
int numTextureTrigger;
vetor3d_t bbMin, bbMax;
vetor3d_t *base;
edge_t *edges;
int *ledges;
plano_t *planes;
face_t *faces;
face_t **marksurfaces;
texture_t *textures;
textureinfo_t *texinfo;
node_t *nodes;
leaf_t *leafs;
char *lighting;
int lightinglen;
char *entities;
int entitieslen;
char *visibility;
int visibilitylen;
ponto_t *verts;
} mapa_t;
void freeObj3D(obj3d_t *obj);
void freeMapa3D(mapa_t *mapa);
void obj_calculate_offsetChao(obj3d_t *obj);
void obj_calculate_face_normals(obj3d_t *obj);
void mapa_projecao3D(camera_t *cam, mapa_t *mapa);
obj3d_t *obj_plano(int sizeX, int sizeY);
#endif