6 |
|
*/ |
7 |
|
#ifndef _RAD_MESH_H_ |
8 |
|
#define _RAD_MESH_H_ |
9 |
– |
#ifdef __cplusplus |
10 |
– |
extern "C" { |
11 |
– |
#endif |
9 |
|
|
13 |
– |
#include "copyright.h" |
14 |
– |
|
10 |
|
#include "lookup.h" |
11 |
|
|
12 |
< |
#ifndef uint4 |
13 |
< |
#define uint4 unsigned int4 |
12 |
> |
#ifdef __cplusplus |
13 |
> |
extern "C" { |
14 |
|
#endif |
15 |
+ |
|
16 |
|
#ifndef BYTE |
17 |
|
#define BYTE unsigned char |
18 |
|
#endif |
48 |
|
|
49 |
|
/* A triangle mesh patch */ |
50 |
|
typedef struct { |
51 |
< |
uint4 (*xyz)[3]; /* up to 256 patch vertices */ |
52 |
< |
int4 *norm; /* vertex normals */ |
53 |
< |
uint4 (*uv)[2]; /* vertex local coordinates */ |
51 |
> |
uint32 (*xyz)[3]; /* up to 256 patch vertices */ |
52 |
> |
int32 *norm; /* vertex normals */ |
53 |
> |
uint32 (*uv)[2]; /* vertex local coordinates */ |
54 |
|
struct PTri { |
55 |
|
BYTE v1, v2, v3; /* local vertices */ |
56 |
|
} *tri; /* local triangles */ |
57 |
|
short solemat; /* sole material */ |
58 |
< |
int2 *trimat; /* or local material indices */ |
58 |
> |
int16 *trimat; /* or local material indices */ |
59 |
|
struct PJoin1 { |
60 |
< |
int4 v1j; /* non-local vertex */ |
61 |
< |
int2 mat; /* material index */ |
60 |
> |
int32 v1j; /* non-local vertex */ |
61 |
> |
int16 mat; /* material index */ |
62 |
|
BYTE v2, v3; /* local vertices */ |
63 |
|
} *j1tri; /* joiner triangles */ |
64 |
|
struct PJoin2 { |
65 |
< |
int4 v1j, v2j; /* non-local vertices */ |
66 |
< |
int2 mat; /* material index */ |
65 |
> |
int32 v1j, v2j; /* non-local vertices */ |
66 |
> |
int16 mat; /* material index */ |
67 |
|
BYTE v3; /* local vertex */ |
68 |
|
} *j2tri; /* double joiner triangles */ |
69 |
|
short nverts; /* vertex count */ |
70 |
< |
short ntris; /* triangle count */ |
70 |
> |
short ntris; /* local triangle count */ |
71 |
|
short nj1tris; /* joiner triangle count */ |
72 |
|
short nj2tris; /* double joiner triangle count */ |
73 |
|
} MESHPATCH; |
78 |
|
int nref; /* reference count */ |
79 |
|
int ldflags; /* what we've loaded */ |
80 |
|
CUBE mcube; /* bounds and octree */ |
81 |
< |
FLOAT uvlim[2][2]; /* local coordinate extrema */ |
81 |
> |
RREAL uvlim[2][2]; /* local coordinate extrema */ |
82 |
|
OBJECT mat0; /* base material index */ |
83 |
|
OBJECT nmats; /* number of materials */ |
84 |
|
MESHPATCH *patch; /* mesh patch list */ |
105 |
|
int fl; /* setting flags */ |
106 |
|
FVECT v; /* vertex location */ |
107 |
|
FVECT n; /* vertex normal */ |
108 |
< |
FLOAT uv[2]; /* local coordinates */ |
108 |
> |
RREAL uv[2]; /* local coordinates */ |
109 |
|
} MESHVERT; |
110 |
|
|
111 |
|
/* mesh format identifier */ |
116 |
|
|
117 |
|
extern MESH *getmesh(char *mname, int flags); |
118 |
|
extern MESHINST *getmeshinst(OBJREC *o, int flags); |
119 |
< |
extern int getmeshtrivid(int4 tvid[3], OBJECT *mo, |
119 |
> |
extern int getmeshtrivid(int32 tvid[3], OBJECT *mo, |
120 |
|
MESH *mp, OBJECT ti); |
121 |
< |
extern int getmeshvert(MESHVERT *vp, MESH *mp, int4 vid, int what); |
121 |
> |
extern int getmeshvert(MESHVERT *vp, MESH *mp, int32 vid, int what); |
122 |
|
extern int getmeshtri(MESHVERT tv[3], OBJECT *mo, |
123 |
|
MESH *mp, OBJECT ti, int what); |
124 |
|
extern OBJREC *getmeshpseudo(MESH *mp, OBJECT mo); |
125 |
< |
extern int4 addmeshvert(MESH *mp, MESHVERT *vp); |
125 |
> |
extern int32 addmeshvert(MESH *mp, MESHVERT *vp); |
126 |
|
extern OBJECT addmeshtri(MESH *mp, MESHVERT tv[3], OBJECT mo); |
127 |
|
extern char *checkmesh(MESH *mp); |
128 |
|
extern void printmeshstats(MESH *ms, FILE *fp); |
136 |
|
} |
137 |
|
#endif |
138 |
|
#endif /* _RAD_MESH_H_ */ |
143 |
– |
|