}
mtexinfo_t;
-// LordHavoc: replaces glpoly, triangle mesh
-typedef struct surfmesh_s
-{
- int num_vertices; // number of vertices in the mesh
- int num_triangles; // number of triangles in the mesh
- float *data_vertex3f; // float[verts*3] vertex locations
- float *data_svector3f; // float[verts*3] direction of 'S' (right) texture axis for each vertex
- float *data_tvector3f; // float[verts*3] direction of 'T' (down) texture axis for each vertex
- float *data_normal3f; // float[verts*3] direction of 'R' (out) texture axis for each vertex
- int *data_lightmapoffsets; // index into surface's lightmap samples for vertex lighting
- float *data_texcoordtexture2f; // float[verts*2] texcoords for surface texture
- float *data_texcoordlightmap2f; // float[verts*2] texcoords for lightmap texture
- float *data_texcoorddetail2f; // float[verts*2] texcoords for detail texture
- int *data_element3i; // int[tris*3] triangles of the mesh, 3 indices into vertex arrays for each
- int *data_neighbor3i; // int[tris*3] neighboring triangle on each edge (-1 if none)
-}
-surfmesh_t;
-
typedef struct msurface_s
{
// bounding box for onscreen checks
// if lightmap settings changed, this forces update
int cached_dlight;
- // should be drawn if visframe == r_framecount (set by PrepareSurfaces)
- int visframe;
- // should be drawn if onscreen and not a backface (used for setting visframe)
- //int pvsframe;
- // chain of surfaces marked visible by pvs
- //struct msurface_s *pvschain;
-
// surface number, to avoid having to do a divide to find the number of a surface from it's address
int number;
typedef struct mnode_s
{
-// common with leaf
- // always 0 in nodes
- int contents;
-
+ //this part shared between node and leaf
+ mplane_t *plane; // != NULL
struct mnode_s *parent;
struct mportal_s *portals;
-
// for bounding box culling
vec3_t mins;
vec3_t maxs;
- mplane_t *plane; // != NULL
-// node specific
+ // this part unique to node
struct mnode_s *children[2];
-
unsigned short firstsurface;
unsigned short numsurfaces;
}
typedef struct mleaf_s
{
-// common with node
- // always negative in leafs
- int contents;
-
+ //this part shared between node and leaf
+ mplane_t *plane; // == NULL
struct mnode_s *parent;
struct mportal_s *portals;
-
// for bounding box culling
vec3_t mins;
vec3_t maxs;
- mplane_t *plane; // == NULL
-// leaf specific
- // next leaf in pvschain
- struct mleaf_s *pvschain;
- // potentially visible if current (model->pvsframecount)
- int pvsframe;
- // visible if marked current (r_framecount)
- int visframe;
- // used by certain worldnode variants to avoid processing the same leaf twice in a frame
- int worldnodeframe;
- // used by polygon-through-portals visibility checker
- int portalmarkid;
-
- // -1 is not in pvs, >= 0 is pvs bit number
- int clusterindex;
-
+ // this part unique to leaf
+ int clusterindex; // -1 is not in pvs, >= 0 is pvs bit number
+ int contents; // TODO: remove (only used temporarily during loading when making collision hull 0)
int *firstmarksurface;
int nummarksurfaces;
qbyte ambient_sound_level[NUM_AMBIENTS];
+ int portalmarkid; // used by see-polygon-through-portals visibility checker
}
mleaf_t;
struct mportal_s *next; // the next portal on this leaf
mleaf_t *here; // the leaf this portal is on
mleaf_t *past; // the leaf through this portal (infront)
- mvertex_t *points;
int numpoints;
+ mvertex_t *points;
+ vec3_t mins, maxs; // culling
mplane_t plane;
- int visframe; // is this portal visible this frame?
}
mportal_t;