+ // name
+ char name[16];
+ // size
+ unsigned int width, height;
+ // SURF_ flags
+ unsigned int flags;
+
+ // position in the model's textures array
+ int number;
+
+ // type of rendering (SURFRENDER_ value)
+ int rendertype;
+
+ // loaded the same as model skins
+ skinframe_t skin;
+
+ // total frames in sequence and alternate sequence
+ int anim_total[2];
+ // direct pointers to each of the frames in the sequences
+ // (indexed as [alternate][frame])
+ struct texture_s *anim_frames[2][10];
+ // set if animated or there is an alternate frame set
+ // (this is an optimization in the renderer)
+ int animated;
+ // the current texture frame in animation
+ struct texture_s *currentframe;
+ // current alpha of the texture
+ float currentalpha;
+}
+texture_t;
+
+typedef struct
+{
+ unsigned short v[2];
+}
+medge_t;
+
+typedef struct
+{
+ float vecs[2][4];
+ texture_t *texture;
+ int flags;
+}
+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
+ 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;
+
+ // avoid multiple collision traces with a surface polygon
+ int colframe;
+
+ // 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;
+
+ // index into model->brush.shadowmesh
+ int num_firstshadowmeshtriangle;
+
+ // neighboring surfaces (one per poly_numverts)
+ //struct msurface_s **neighborsurfaces;
+ // currently used only for generating static shadow volumes
+ int lighttemp_castshadow;
+
+ // avoid redundent surface shadows
+ int shadowmark;
+}
+msurface_t;