6 |
|
*/ |
7 |
|
#ifndef _RAD_MESH_H_ |
8 |
|
#define _RAD_MESH_H_ |
9 |
+ |
|
10 |
+ |
#include "lookup.h" |
11 |
+ |
|
12 |
|
#ifdef __cplusplus |
13 |
|
extern "C" { |
14 |
|
#endif |
15 |
|
|
13 |
– |
#include "lookup.h" |
14 |
– |
|
16 |
|
#ifndef BYTE |
17 |
|
#define BYTE unsigned char |
18 |
|
#endif |
30 |
|
* |
31 |
|
* Vertex ID's are encoded using the bottom 8 bits of a 4-byte integer |
32 |
|
* to index a vertex in a patch indicated by the 22 bits above (8-29). |
33 |
< |
* For triangle ID's, the top 22 bits (10-31) indicate the patch, and |
34 |
< |
* the bit 9 (0x200) indicates whether the triangle joins patches. |
33 |
> |
* For triangle ID's, the top 22 bits (10-31) indicate the parent patch, |
34 |
> |
* and the 10th bit (0x200) indicates whether the triangle joins patches. |
35 |
|
* If not, then the bottom 9 bits index into the local PTri array. |
36 |
< |
* If it's a joiner, then the 8th bit indicates whether the triangle joins |
36 |
> |
* If it's a joiner, then the 9th bit indicates whether the triangle joins |
37 |
|
* two patches, in which case the bottom 8 bits index the PJoin2 array. |
38 |
|
* Otherwise, the bottom 8 bits index the PJoin1 array. |
39 |
|
* |
43 |
|
* a lot of effort, but it can reduce mesh storage by a factor of 3 |
44 |
|
* or more. This is important, as the whole point is to model very |
45 |
|
* complicated geometry with this structure, and memory is the main |
46 |
< |
* limitation. |
46 |
> |
* limitation. (This representation is so efficient, that the octree |
47 |
> |
* structure ends up dominating memory for most compiled meshes.) |
48 |
|
*/ |
49 |
|
|
50 |
|
/* A triangle mesh patch */ |
68 |
|
BYTE v3; /* local vertex */ |
69 |
|
} *j2tri; /* double joiner triangles */ |
70 |
|
short nverts; /* vertex count */ |
71 |
< |
short ntris; /* triangle count */ |
71 |
> |
short ntris; /* local triangle count */ |
72 |
|
short nj1tris; /* joiner triangle count */ |
73 |
|
short nj2tris; /* double joiner triangle count */ |
74 |
|
} MESHPATCH; |
82 |
|
RREAL uvlim[2][2]; /* local coordinate extrema */ |
83 |
|
OBJECT mat0; /* base material index */ |
84 |
|
OBJECT nmats; /* number of materials */ |
85 |
< |
MESHPATCH *patch; /* mesh patch list */ |
85 |
> |
MESHPATCH *patch; /* allocated mesh patch array */ |
86 |
|
int npatches; /* number of mesh patches */ |
87 |
|
OBJREC *pseudo; /* mesh pseudo objects */ |
88 |
|
LUTAB lut; /* vertex lookup table */ |
137 |
|
} |
138 |
|
#endif |
139 |
|
#endif /* _RAD_MESH_H_ */ |
138 |
– |
|