- int visframe; // should be drawn when node is crossed
-
- mplane_t *plane;
- int flags;
-
- int firstedge; // look up in model->surfedges[], negative numbers
- int numedges; // are backwards edges
-
- short texturemins[2];
- short extents[2];
-
- short light_s, light_t; // gl lightmap coordinates
-
- glpoly_t *polys; // multiple if warped
-
- mtexinfo_t *texinfo;
-
-// lighting info
- int dlightframe;
- int dlightbits[8];
-
- int lightframe; // avoid redundent addition of dlights
- int worldnodeframe; // only render each surface once
-
- int lightmaptexturenum;
- byte styles[MAXLIGHTMAPS];
- unsigned short cached_light[MAXLIGHTMAPS]; // values currently used in lightmap
- short cached_dlight; // LordHavoc: if lightmap was lit by dynamic lights, update on frame after end of effect to erase it
- short cached_lightscalebit; // LordHavoc: to cause lightmap to be rerendered when lighthalf changes
- float cached_ambient; // LordHavoc: rerender lightmaps when r_ambient changes
- byte *samples; // [numstyles*surfsize]
-} msurface_t;
+ // bounding box for onscreen checks
+ vec3_t poly_mins;
+ vec3_t poly_maxs;
+
+ // the node plane this is on, backwards if SURF_PLANEBACK flag set
+ mplane_t *plane;
+ // SURF_ flags
+ int flags;
+ // texture mapping properties used by this surface
+ mtexinfo_t *texinfo;
+
+ // the lightmap texture fragment to use on the rendering mesh
+ rtexture_t *lightmaptexture;
+ // mesh for rendering
+ surfmesh_t *mesh;
+ // 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;
+
+ // center for sorting transparent meshes
+ vec3_t poly_center;
+
+ // index into d_lightstylevalue array, 255 means not used (black)
+ qbyte styles[MAXLIGHTMAPS];
+ // RGB lighting data [numstyles][height][width][3]
+ qbyte *samples;
+ // stain to apply on lightmap (soot/dirt/blood/whatever)
+ qbyte *stainsamples;
+ // the stride when building lightmaps to comply with fragment update
+ int lightmaptexturestride;
+ int texturemins[2];
+ int extents[2];
+
+ // if this == r_framecount there are dynamic lights on the surface
+ int dlightframe;
+ // which dynamic lights are touching this surface
+ // (only access this if dlightframe is current)
+ int dlightbits[8];
+ // avoid redundent addition of dlights
+ int lightframe;
+
+ // these are just 3D points defining the outline of the polygon,
+ // no texcoord info (that can be generated from these)
+ int poly_numverts;
+ float *poly_verts;
+
+ // neighboring surfaces (one per poly_numverts)
+ //struct msurface_s **neighborsurfaces;
+ // currently used only for generating static shadow volumes
+ int castshadow;
+}
+msurface_t;