ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/common/mesh.h
(Generate patch)

Comparing ray/src/common/mesh.h (file contents):
Revision 2.2 by greg, Wed Mar 12 04:59:04 2003 UTC vs.
Revision 2.6 by greg, Fri Jun 20 00:25:49 2003 UTC

# Line 4 | Line 4
4   *
5   *  Include after standard.h, object.h and octree.h
6   */
7 + #ifndef _RAD_MESH_H_
8 + #define _RAD_MESH_H_
9 + #ifdef __cplusplus
10 + extern "C" {
11 + #endif
12  
13   #include "copyright.h"
14  
15 < #ifndef uint4
16 < #define uint4   unsigned int4
12 < #endif
15 > #include "lookup.h"
16 >
17   #ifndef BYTE
18   #define BYTE    unsigned char
19   #endif
# Line 40 | Line 44
44   * a lot of effort, but it can reduce mesh storage by a factor of 3
45   * or more.  This is important, as the whole point is to model very
46   * complicated geometry with this structure, and memory is the main
47 < * limitation.  (We also optimize intersection tests for triangles.)
47 > * limitation.
48   */
49  
50   /* A triangle mesh patch */
51   typedef struct {
52 <        uint4           (*xyz)[3];      /* up to 256 patch vertices */
53 <        int4            *norm;          /* vertex normals */
54 <        uint4           (*uv)[2];       /* vertex local coordinates */
52 >        uint32          (*xyz)[3];      /* up to 256 patch vertices */
53 >        int32           *norm;          /* vertex normals */
54 >        uint32          (*uv)[2];       /* vertex local coordinates */
55          struct PTri {
56                  BYTE            v1, v2, v3;     /* local vertices */
57          }               *tri;           /* local triangles */
58 +        short           solemat;        /* sole material */
59 +        int16           *trimat;        /* or local material indices */
60          struct PJoin1 {
61 <                int4            v1j;            /* non-local vertex */
61 >                int32           v1j;            /* non-local vertex */
62 >                int16           mat;            /* material index */
63                  BYTE            v2, v3;         /* local vertices */
64          }               *j1tri;         /* joiner triangles */
65          struct PJoin2 {
66 <                int4            v1j, v2j;       /* non-local vertices */
66 >                int32           v1j, v2j;       /* non-local vertices */
67 >                int16           mat;            /* material index */
68                  BYTE            v3;             /* local vertex */
69          }               *j2tri;         /* double joiner triangles */
70          short           nverts;         /* vertex count */
# Line 72 | Line 80 | typedef struct mesh {
80          int             ldflags;        /* what we've loaded */
81          CUBE            mcube;          /* bounds and octree */
82          FLOAT           uvlim[2][2];    /* local coordinate extrema */
83 +        OBJECT          mat0;           /* base material index */
84 +        OBJECT          nmats;          /* number of materials */
85          MESHPATCH       *patch;         /* mesh patch list */
86          int             npatches;       /* number of mesh patches */
87 <        char            *cdata;         /* opaque client data pointer */
87 >        OBJREC          *pseudo;        /* mesh pseudo objects */
88 >        LUTAB           lut;            /* vertex lookup table */
89          struct mesh     *next;          /* next mesh in list */
90   } MESH;
91  
# Line 101 | Line 112 | typedef struct {
112                                  /* mesh format identifier */
113   #define MESHFMT         "Radiance_tmesh"
114                                  /* magic number for mesh files */
115 < #define MESHMAGIC       ( 0 *MAXOBJSIZ+311)     /* increment first value */
115 > #define MESHMAGIC       ( 1 *MAXOBJSIZ+311)     /* increment first value */
116  
106 #ifdef NOPROTO
117  
108 extern MESH     *getmesh();
109 extern INSTANCE *getmeshinst();
110 extern int      getmeshtrivid();
111 extern int      getmeshvert();
112 extern int      getmeshtri();
113 extern int4     addmeshvert();
114 extern OBJECT   addmeshtri();
115 extern void     printmeshstats();
116 extern void     freemesh();
117 extern void     freemeshinst();
118 extern void     readmesh();
119 extern void     writemesh();
120
121 #else
122
118   extern MESH     *getmesh(char *mname, int flags);
119   extern MESHINST *getmeshinst(OBJREC *o, int flags);
120 < extern int      getmeshtrivid(int4 tvid[3], MESH *mp, OBJECT ti);
121 < extern int      getmeshvert(MESHVERT *vp, MESH *mp, int4 vid, int what);
122 < extern int      getmeshtri(MESHVERT tv[3], MESH *mp, OBJECT ti, int what);
123 < extern int4     addmeshvert(MESH *mp, MESHVERT *vp);
124 < extern OBJECT   addmeshtri(MESH *mp, MESHVERT tv[3]);
120 > extern int      getmeshtrivid(int32 tvid[3], OBJECT *mo,
121 >                                MESH *mp, OBJECT ti);
122 > extern int      getmeshvert(MESHVERT *vp, MESH *mp, int32 vid, int what);
123 > extern int      getmeshtri(MESHVERT tv[3], OBJECT *mo,
124 >                                MESH *mp, OBJECT ti, int what);
125 > extern OBJREC   *getmeshpseudo(MESH *mp, OBJECT mo);
126 > extern int32    addmeshvert(MESH *mp, MESHVERT *vp);
127 > extern OBJECT   addmeshtri(MESH *mp, MESHVERT tv[3], OBJECT mo);
128 > extern char     *checkmesh(MESH *mp);
129   extern void     printmeshstats(MESH *ms, FILE *fp);
130   extern void     freemesh(MESH *ms);
131   extern void     freemeshinst(OBJREC *o);
132   extern void     readmesh(MESH *mp, char *path, int flags);
133   extern void     writemesh(MESH *mp, FILE *fp);
134  
135 < #endif /* NOPROTO */
135 >
136 > #ifdef __cplusplus
137 > }
138 > #endif
139 > #endif /* _RAD_MESH_H_ */
140 >

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines