// r_stain
void R_Stain(const vec3_t origin, float radius, int cr1, int cg1, int cb1, int ca1, int cr2, int cg2, int cb2, int ca2);
-void R_CalcBeam_Vertex3f(float *vert, const vec3_t org1, const vec3_t org2, float width);
-void R_CalcSprite_Vertex3f(float *vertex3f, const vec3_t origin, const vec3_t left, const vec3_t up, float scalex1, float scalex2, float scaley1, float scaley2);
+void R_CalcBeam_Vertex3f(float *vert, const float *org1, const float *org2, float width);
+void R_CalcSprite_Vertex3f(float *vertex3f, const float *origin, const float *left, const float *up, float scalex1, float scalex2, float scaley1, float scaley2);
extern mempool_t *r_main_mempool;
// (in other words, the model has been animated in software)
qboolean forcecurrenttextureupdate; // set for RSurf_ActiveCustomEntity to force R_GetCurrentTexture to recalculate the texture parameters (such as entity alpha)
qboolean modelgeneratedvertex;
+ // skeletal animation can be done by entity (animcache) or per batch,
+ // batch may be non-skeletal even if entity is skeletal, indicating that
+ // the dynamicvertex code path had to apply skeletal manually for a case
+ // where gpu-skinning is not possible, for this reason batch has its own
+ // variables
+ int entityskeletalnumtransforms; // how many transforms are used for this mesh
+ float *entityskeletaltransform3x4; // use gpu-skinning shader on this mesh
float *modelvertex3f;
const r_meshbuffer_t *modelvertex3f_vertexbuffer;
size_t modelvertex3f_bufferoffset;
float *modeltexcoordlightmap2f;
const r_meshbuffer_t *modeltexcoordlightmap2f_vertexbuffer;
size_t modeltexcoordlightmap2f_bufferoffset;
+ unsigned char *modelskeletalindex4ub;
+ const r_meshbuffer_t *modelskeletalindex4ub_vertexbuffer;
+ size_t modelskeletalindex4ub_bufferoffset;
+ unsigned char *modelskeletalweight4ub;
+ const r_meshbuffer_t *modelskeletalweight4ub_vertexbuffer;
+ size_t modelskeletalweight4ub_bufferoffset;
r_vertexmesh_t *modelvertexmesh;
const r_meshbuffer_t *modelvertexmeshbuffer;
const r_meshbuffer_t *modelvertex3fbuffer;
// deformvertexes is used in a q3 shader, and consequently these can
// change on a per-surface basis (according to rsurface.texture)
qboolean batchgeneratedvertex;
+ qboolean batchmultidraw;
+ int batchmultidrawnumsurfaces;
+ const msurface_t **batchmultidrawsurfacelist;
int batchfirstvertex;
int batchnumvertices;
int batchfirsttriangle;
float *batchtexcoordlightmap2f;
const r_meshbuffer_t *batchtexcoordlightmap2f_vertexbuffer;
size_t batchtexcoordlightmap2f_bufferoffset;
+ unsigned char *batchskeletalindex4ub;
+ const r_meshbuffer_t *batchskeletalindex4ub_vertexbuffer;
+ size_t batchskeletalindex4ub_bufferoffset;
+ unsigned char *batchskeletalweight4ub;
+ const r_meshbuffer_t *batchskeletalweight4ub_vertexbuffer;
+ size_t batchskeletalweight4ub_bufferoffset;
int *batchelement3i;
const r_meshbuffer_t *batchelement3i_indexbuffer;
size_t batchelement3i_bufferoffset;
unsigned short *batchelement3s;
const r_meshbuffer_t *batchelement3s_indexbuffer;
size_t batchelement3s_bufferoffset;
+ int batchskeletalnumtransforms;
+ float *batchskeletaltransform3x4;
// rendering pass processing arrays in GL11 and GL13 paths
float *passcolor4f;
const r_meshbuffer_t *passcolor4f_vertexbuffer;
#define BATCHNEED_VERTEXMESH_VERTEXCOLOR (1<< 4) // set up vertex colors in rsurface.batchvertexmesh if BATCHNEED_MESH, set up rsurface.batchlightmapcolor4f if BATCHNEED_ARRAYS
#define BATCHNEED_VERTEXMESH_TEXCOORD (1<< 5) // set up vertex colors in rsurface.batchvertexmesh if BATCHNEED_MESH, set up rsurface.batchlightmapcolor4f if BATCHNEED_ARRAYS
#define BATCHNEED_VERTEXMESH_LIGHTMAP (1<< 6) // set up vertex colors in rsurface.batchvertexmesh if BATCHNEED_MESH, set up rsurface.batchlightmapcolor4f if BATCHNEED_ARRAYS
-#define BATCHNEED_ARRAY_VERTEX (1<< 7) // set up rsurface.batchvertex3f and optionally others
-#define BATCHNEED_ARRAY_NORMAL (1<< 8) // set up normals in rsurface.batchvertexmesh if BATCHNEED_MESH, set up rsurface.batchnormal3f if BATCHNEED_ARRAYS
-#define BATCHNEED_ARRAY_VECTOR (1<< 9) // set up vectors in rsurface.batchvertexmesh if BATCHNEED_MESH, set up rsurface.batchsvector3f and rsurface.batchtvector3f if BATCHNEED_ARRAYS
-#define BATCHNEED_ARRAY_VERTEXCOLOR (1<<10) // set up vertex colors in rsurface.batchvertexmesh if BATCHNEED_MESH, set up rsurface.batchlightmapcolor4f if BATCHNEED_ARRAYS
-#define BATCHNEED_ARRAY_TEXCOORD (1<<11) // set up vertex colors in rsurface.batchvertexmesh if BATCHNEED_MESH, set up rsurface.batchlightmapcolor4f if BATCHNEED_ARRAYS
-#define BATCHNEED_ARRAY_LIGHTMAP (1<<12) // set up vertex colors in rsurface.batchvertexmesh if BATCHNEED_MESH, set up rsurface.batchlightmapcolor4f if BATCHNEED_ARRAYS
-#define BATCHNEED_NOGAPS (1<<13) // force vertex copying (no gaps)
+#define BATCHNEED_VERTEXMESH_SKELETAL (1<< 7) // set up skeletal index and weight data for vertex shader
+#define BATCHNEED_ARRAY_VERTEX (1<< 8) // set up rsurface.batchvertex3f and optionally others
+#define BATCHNEED_ARRAY_NORMAL (1<< 9) // set up normals in rsurface.batchvertexmesh if BATCHNEED_MESH, set up rsurface.batchnormal3f if BATCHNEED_ARRAYS
+#define BATCHNEED_ARRAY_VECTOR (1<<10) // set up vectors in rsurface.batchvertexmesh if BATCHNEED_MESH, set up rsurface.batchsvector3f and rsurface.batchtvector3f if BATCHNEED_ARRAYS
+#define BATCHNEED_ARRAY_VERTEXCOLOR (1<<11) // set up vertex colors in rsurface.batchvertexmesh if BATCHNEED_MESH, set up rsurface.batchlightmapcolor4f if BATCHNEED_ARRAYS
+#define BATCHNEED_ARRAY_TEXCOORD (1<<12) // set up vertex colors in rsurface.batchvertexmesh if BATCHNEED_MESH, set up rsurface.batchlightmapcolor4f if BATCHNEED_ARRAYS
+#define BATCHNEED_ARRAY_LIGHTMAP (1<<13) // set up vertex colors in rsurface.batchvertexmesh if BATCHNEED_MESH, set up rsurface.batchlightmapcolor4f if BATCHNEED_ARRAYS
+#define BATCHNEED_ARRAY_SKELETAL (1<<14) // set up skeletal index and weight data for vertex shader
+#define BATCHNEED_NOGAPS (1<<15) // force vertex copying if firstvertex is not zero or there are gaps
+#define BATCHNEED_ALLOWMULTIDRAW (1<<16) // allow multiple draws
void RSurf_PrepareVerticesForBatch(int batchneed, int texturenumsurfaces, const msurface_t **texturesurfacelist);
void RSurf_DrawBatch(void);
void R_SetupShader_Generic(rtexture_t *first, rtexture_t *second, int texturemode, int rgbscale, qboolean usegamma, qboolean notrippy, qboolean suppresstexalpha);
void R_SetupShader_Generic_NoTexture(qboolean usegamma, qboolean notrippy);
-void R_SetupShader_DepthOrShadow(qboolean notrippy, qboolean depthrgb);
+void R_SetupShader_DepthOrShadow(qboolean notrippy, qboolean depthrgb, qboolean skeletal);
void R_SetupShader_ShowDepth(qboolean notrippy);
void R_SetupShader_Surface(const vec3_t lightcolorbase, qboolean modellighting, float ambientscale, float diffusescale, float specularscale, rsurfacepass_t rsurfacepass, int texturenumsurfaces, const msurface_t **texturesurfacelist, void *waterplane, qboolean notrippy);
void R_SetupShader_DeferredLight(const rtlight_t *rtlight);
extern cvar_t r_shadows_throwdirection;
extern cvar_t r_shadows_focus;
extern cvar_t r_shadows_shadowmapscale;
-
+extern cvar_t r_shadows_shadowmapbias;
extern cvar_t r_transparent_alphatocoverage;
extern cvar_t r_transparent_sortsurfacesbynearest;
extern cvar_t r_transparent_useplanardistance;