+ // software processing buffers
+ int array_size;
+ unsigned char *array_base;
+ r_vertexmesh_t *array_modelvertexmesh;
+ r_vertexmesh_t *array_batchvertexmesh;
+ r_vertexposition_t *array_modelvertexposition;
+ r_vertexposition_t *array_batchvertexposition;
+ float *array_modelvertex3f;
+ float *array_modelsvector3f;
+ float *array_modeltvector3f;
+ float *array_modelnormal3f;
+ float *array_batchvertex3f;
+ float *array_batchsvector3f;
+ float *array_batchtvector3f;
+ float *array_batchnormal3f;
+ float *array_batchlightmapcolor4f;
+ float *array_batchtexcoordtexture2f;
+ float *array_batchtexcoordlightmap2f;
+ float *array_passcolor4f;
+ int *array_batchelement3i;
+ unsigned short *array_batchelement3s;
+
+ // current model array pointers
+ // these may point to processing buffers if model is animated,
+ // otherwise they point to static data.
+ // these are not directly used for rendering, they are just another level
+ // of processing
+ //
+ // these either point at array_model* buffers (if the model is animated)
+ // or the model->surfmesh.data_* buffers (if the model is not animated)
+ //
+ // these are only set when an entity render begins, they do not change on
+ // a per surface basis.
+ //
+ // this indicates the model* arrays are pointed at array_model* buffers
+ // (in other words, the model has been animated in software)
+ qboolean modelgeneratedvertex;
+ const float *modelvertex3f;
+ const r_meshbuffer_t *modelvertex3f_vertexbuffer;
+ size_t modelvertex3f_bufferoffset;
+ const float *modelsvector3f;
+ const r_meshbuffer_t *modelsvector3f_vertexbuffer;
+ size_t modelsvector3f_bufferoffset;
+ const float *modeltvector3f;
+ const r_meshbuffer_t *modeltvector3f_vertexbuffer;
+ size_t modeltvector3f_bufferoffset;
+ const float *modelnormal3f;
+ const r_meshbuffer_t *modelnormal3f_vertexbuffer;
+ size_t modelnormal3f_bufferoffset;
+ const float *modellightmapcolor4f;
+ const r_meshbuffer_t *modellightmapcolor4f_vertexbuffer;
+ size_t modellightmapcolor4f_bufferoffset;
+ const float *modeltexcoordtexture2f;
+ const r_meshbuffer_t *modeltexcoordtexture2f_vertexbuffer;
+ size_t modeltexcoordtexture2f_bufferoffset;
+ const float *modeltexcoordlightmap2f;
+ const r_meshbuffer_t *modeltexcoordlightmap2f_vertexbuffer;
+ size_t modeltexcoordlightmap2f_bufferoffset;
+ const r_vertexmesh_t *modelvertexmesh;
+ const r_meshbuffer_t *modelvertexmeshbuffer;
+ const r_vertexposition_t *modelvertexposition;
+ const r_meshbuffer_t *modelvertexpositionbuffer;
+ const int *modelelement3i;
+ const r_meshbuffer_t *modelelement3i_indexbuffer;
+ size_t modelelement3i_bufferoffset;
+ const unsigned short *modelelement3s;
+ const r_meshbuffer_t *modelelement3s_indexbuffer;
+ size_t modelelement3s_bufferoffset;
+ const int *modellightmapoffsets;
+ int modelnumvertices;
+ int modelnumtriangles;
+ const msurface_t *modelsurfaces;
+ // current rendering array pointers
+ // these may point to any of several different buffers depending on how
+ // much processing was needed to prepare this model for rendering
+ // these usually equal the model* pointers, they only differ if
+ // deformvertexes is used in a q3 shader, and consequently these can
+ // change on a per-surface basis (according to rsurface.texture)
+ qboolean batchgeneratedvertex;
+ int batchfirstvertex;
+ int batchnumvertices;
+ int batchfirsttriangle;
+ int batchnumtriangles;
+ const r_vertexmesh_t *batchvertexmesh;
+ const r_meshbuffer_t *batchvertexmeshbuffer;
+ const r_vertexposition_t *batchvertexposition;
+ const r_meshbuffer_t *batchvertexpositionbuffer;
+ const float *batchvertex3f;
+ const r_meshbuffer_t *batchvertex3f_vertexbuffer;
+ size_t batchvertex3f_bufferoffset;
+ const float *batchsvector3f;
+ const r_meshbuffer_t *batchsvector3f_vertexbuffer;
+ size_t batchsvector3f_bufferoffset;
+ const float *batchtvector3f;
+ const r_meshbuffer_t *batchtvector3f_vertexbuffer;
+ size_t batchtvector3f_bufferoffset;
+ const float *batchnormal3f;
+ const r_meshbuffer_t *batchnormal3f_vertexbuffer;
+ size_t batchnormal3f_bufferoffset;
+ const float *batchlightmapcolor4f;
+ const r_meshbuffer_t *batchlightmapcolor4f_vertexbuffer;
+ size_t batchlightmapcolor4f_bufferoffset;
+ const float *batchtexcoordtexture2f;
+ const r_meshbuffer_t *batchtexcoordtexture2f_vertexbuffer;
+ size_t batchtexcoordtexture2f_bufferoffset;
+ const float *batchtexcoordlightmap2f;
+ const r_meshbuffer_t *batchtexcoordlightmap2f_vertexbuffer;
+ size_t batchtexcoordlightmap2f_bufferoffset;
+ const int *batchelement3i;
+ const r_meshbuffer_t *batchelement3i_indexbuffer;
+ size_t batchelement3i_bufferoffset;
+ const unsigned short *batchelement3s;
+ const r_meshbuffer_t *batchelement3s_indexbuffer;
+ size_t batchelement3s_bufferoffset;
+ // rendering pass processing arrays in GL11 and GL13 paths
+ const float *passcolor4f;
+ const r_meshbuffer_t *passcolor4f_vertexbuffer;
+ size_t passcolor4f_bufferoffset;
+
+ // some important fields from the entity
+ int ent_skinnum;
+ int ent_qwskin;
+ int ent_flags;
+ float ent_shadertime;
+ int ent_alttextures; // used by q1bsp animated textures (pressed buttons)
+ // transform matrices to render this entity and effects on this entity
+ matrix4x4_t matrix;
+ matrix4x4_t inversematrix;
+ // scale factors for transforming lengths into/out of entity space
+ float matrixscale;
+ float inversematrixscale;
+ // animation blending state from entity
+ frameblend_t frameblend[MAX_FRAMEBLENDS];
+ skeleton_t *skeleton;
+ // directional model shading state from entity
+ vec3_t modellight_ambient;
+ vec3_t modellight_diffuse;
+ vec3_t modellight_lightdir;
+ // colormapping state from entity (these are black if colormapping is off)
+ vec3_t colormap_pantscolor;
+ vec3_t colormap_shirtcolor;
+ // special coloring of ambient/diffuse textures (gloss not affected)
+ // colormod[3] is the alpha of the entity
+ float colormod[4];
+ // special coloring of glow textures
+ float glowmod[3];
+ // view location in model space
+ vec3_t localvieworigin;
+ // polygon offset data for submodels
+ float basepolygonfactor;
+ float basepolygonoffset;
+ // current textures in batching code
+ texture_t *texture;
+ rtexture_t *lightmaptexture;
+ rtexture_t *deluxemaptexture;
+ // whether lightmapping is active on this batch
+ // (otherwise vertex colored)
+ qboolean uselightmaptexture;
+ // fog plane in model space for direct application to vertices
+ float fograngerecip;
+ float fogmasktabledistmultiplier;
+ float fogplane[4];
+ float fogheightfade;
+ float fogplaneviewdist;
+
+ // rtlight rendering
+ // light currently being rendered
+ const rtlight_t *rtlight;
+
+ // this is the location of the light in entity space
+ vec3_t entitylightorigin;
+ // this transforms entity coordinates to light filter cubemap coordinates
+ // (also often used for other purposes)
+ matrix4x4_t entitytolight;
+ // based on entitytolight this transforms -1 to +1 to 0 to 1 for purposes
+ // of attenuation texturing in full 3D (Z result often ignored)
+ matrix4x4_t entitytoattenuationxyz;
+ // this transforms only the Z to S, and T is always 0.5
+ matrix4x4_t entitytoattenuationz;
+
+ // user wavefunc parameters (from csqc)
+ float userwavefunc_param[Q3WAVEFUNC_USER_COUNT];
+
+ // pointer to an entity_render_t used only by R_GetCurrentTexture and
+ // RSurf_ActiveWorldEntity/RSurf_ActiveModelEntity as a unique id within
+ // each frame (see r_frame also)
+ entity_render_t *entity;