]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - model_brush.h
fixed GL_Scissor call in rtlight code (apparently I need to feed it a top to bottom...
[xonotic/darkplaces.git] / model_brush.h
index 83f11d2d030880123e902c54d3a1b5ebdf76653a..f812fdb8c61cf7e89b7976b8d511fcafefe533d6 100644 (file)
@@ -145,20 +145,18 @@ mtexinfo_t;
 // LordHavoc: replaces glpoly, triangle mesh
 typedef struct surfmesh_s
 {
-       // can be multiple meshs per surface
-       struct surfmesh_s *chain;
-       int numverts; // number of vertices in the mesh
-       int numtriangles; // number of triangles in the mesh
-       float *vertex3f; // float[verts*3] vertex locations
-       float *svector3f; // float[verts*3] direction of 'S' (right) texture axis for each vertex
-       float *tvector3f; // float[verts*3] direction of 'T' (down) texture axis for each vertex
-       float *normal3f; // float[verts*3] direction of 'R' (out) texture axis for each vertex
-       int *lightmapoffsets; // index into surface's lightmap samples for vertex lighting
-       float *texcoordtexture2f; // float[verts*2] texcoords for surface texture
-       float *texcoordlightmap2f; // float[verts*2] texcoords for lightmap texture
-       float *texcoorddetail2f; // float[verts*2] texcoords for detail texture
-       int *element3i; // int[tris*3] triangles of the mesh, 3 indices into vertex arrays for each
-       int *neighbor3i; // int[tris*3] neighboring triangle on each edge (-1 if none)
+       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;
 
@@ -178,7 +176,7 @@ typedef struct msurface_s
        // the lightmap texture fragment to use on the rendering mesh
        rtexture_t *lightmaptexture;
        // mesh for rendering
-       surfmesh_t *mesh;
+       surfmesh_t mesh;
        // if lightmap settings changed, this forces update
        int cached_dlight;
 
@@ -225,7 +223,7 @@ typedef struct msurface_s
        // neighboring surfaces (one per poly_numverts)
        //struct msurface_s **neighborsurfaces;
        // currently used only for generating static shadow volumes
-       int castshadow;
+       int lighttemp_castshadow;
 }
 msurface_t;
 
@@ -242,8 +240,8 @@ typedef struct mnode_s
        vec3_t mins;
        vec3_t maxs;
 
+       mplane_t *plane; // != NULL
 // node specific
-       mplane_t *plane;
        struct mnode_s *children[2];
 
        unsigned short firstsurface;
@@ -264,6 +262,7 @@ typedef struct mleaf_s
        vec3_t mins;
        vec3_t maxs;
 
+       mplane_t *plane; // == NULL
 // leaf specific
        // next leaf in pvschain
        struct mleaf_s *pvschain;
@@ -276,7 +275,8 @@ typedef struct mleaf_s
        // used by polygon-through-portals visibility checker
        int portalmarkid;
 
-       qbyte *compressed_vis;
+       // -1 is not in pvs, >= 0 is pvs bit number
+       int clusterindex;
 
        int *firstmarksurface;
        int nummarksurfaces;
@@ -668,7 +668,7 @@ q3deffect_t;
 #define Q3FACETYPE_POLYGON 1 // common
 #define Q3FACETYPE_PATCH 2 // common
 #define Q3FACETYPE_MESH 3 // common
-#define Q3FACETYPE_BILLBOARD 4 // rare (is this ever used?)
+#define Q3FACETYPE_FLARE 4 // rare (is this ever used?)
 
 typedef struct
 {
@@ -679,19 +679,71 @@ typedef struct
        int numvertices;
        int firstelement;
        int numelements;
-       int lightmapindex;
-       int lightmap_base[2]; // only needed by lighting util
-       int lightmap_size[2]; // only needed by lighting util
-       float lightmap_origin[3]; // only needed by lighting util
-       float lightmap_vectors[2][3]; // only needed by lighting util
-       float normal[3]; // only needed by lighting util
-       int patchsize[2]; // size for Q3FACETYPE_PATCH
+       int lightmapindex; // -1 if none
+       int lightmap_base[2];
+       int lightmap_size[2];
+       union
+       {
+               struct
+               {
+                       // corrupt or don't care
+                       int blah[14];
+               }
+               unknown;
+               struct
+               {
+                       // Q3FACETYPE_POLYGON
+                       // polygon is simply a convex polygon, renderable as a mesh
+                       float lightmap_origin[3];
+                       float lightmap_vectors[2][3];
+                       float normal[3];
+                       int unused1[2];
+               }
+               polygon;
+               struct
+               {
+                       // Q3FACETYPE_PATCH
+                       // patch renders as a bezier mesh, with adjustable tesselation
+                       // level (optionally based on LOD using the bbox and polygon
+                       // count to choose a tesselation level)
+                       // note: multiple patches may have the same bbox to cause them to
+                       // be LOD adjusted together as a group
+                       int unused1[3];
+                       float mins[3]; // LOD bbox
+                       float maxs[3]; // LOD bbox
+                       int unused2[3];
+                       int patchsize[2]; // dimensions of vertex grid
+               }
+               patch;
+               struct
+               {
+                       // Q3FACETYPE_MESH
+                       // mesh renders as simply a triangle mesh
+                       int unused1[3];
+                       float mins[3];
+                       float maxs[3];
+                       int unused2[5];
+               }
+               mesh;
+               struct
+               {
+                       // Q3FACETYPE_FLARE
+                       // flare renders as a simple sprite at origin, no geometry
+                       // exists, nor does it have a radius, a cvar controls the radius
+                       // and another cvar controls distance fade
+                       // (they were not used in Q3 I'm told)
+                       float origin[3];
+                       int unused1[11];
+               }
+               flare;
+       }
+       specific;
 }
 q3dface_t;
 
 typedef struct
 {
-       unsigned char rgb[128][128][3];
+       unsigned char rgb[128*128*3];
 }
 q3dlightmap_t;
 
@@ -714,5 +766,8 @@ typedef struct
 }
 q3dpvs_t;
 
+#define CHECKPVSBIT(pvs,b) ((b) >= 0 ? ((pvs)[(b) >> 3] & (1 << ((b) & 7))) : false)
+#define SETPVSBIT(pvs,b) ((b) >= 0 ? ((pvs)[(b) >> 3] |= (1 << ((b) & 7))) : false)
+
 #endif