}
if (numlines > 0)
{
- R_Mesh_PrepareVertices_Generic(numlines*2, vertex, NULL);
+ R_Mesh_PrepareVertices_Generic(numlines*2, vertex, NULL, 0);
DrawQ_Lines(0.0f, numlines, 0, false);
}
x = graphx;
// animation cache (pointers allocated using R_FrameData_Alloc)
// ONLY valid during R_RenderView! may be NULL (not cached)
- float *animcache_vertex3f;
- float *animcache_normal3f;
- float *animcache_svector3f;
- float *animcache_tvector3f;
+ float *animcache_vertex3f;
+ r_meshbuffer_t *animcache_vertex3f_vertexbuffer;
+ int animcache_vertex3f_bufferoffset;
+ float *animcache_normal3f;
+ r_meshbuffer_t *animcache_normal3f_vertexbuffer;
+ int animcache_normal3f_bufferoffset;
+ float *animcache_svector3f;
+ r_meshbuffer_t *animcache_svector3f_vertexbuffer;
+ int animcache_svector3f_bufferoffset;
+ float *animcache_tvector3f;
+ r_meshbuffer_t *animcache_tvector3f_vertexbuffer;
+ int animcache_tvector3f_bufferoffset;
// interleaved arrays for rendering and dynamic vertex buffers for them
- r_meshbuffer_t *animcache_vertex3fbuffer;
r_vertexmesh_t *animcache_vertexmesh;
- r_meshbuffer_t *animcache_vertexmeshbuffer;
+ r_meshbuffer_t *animcache_vertexmesh_vertexbuffer;
+ int animcache_vertexmesh_bufferoffset;
// gpu-skinning shader needs transforms in a certain format, we have to
// upload this to a uniform buffer for the shader to use, and also keep a
// backup copy in system memory for the dynamic batch fallback code
#endif
}
-void R_Mesh_PrepareVertices_Vertex3f(int numvertices, const float *vertex3f, const r_meshbuffer_t *vertexbuffer)
+void R_Mesh_PrepareVertices_Vertex3f(int numvertices, const float *vertex3f, const r_meshbuffer_t *vertexbuffer, int bufferoffset)
{
// upload temporary vertexbuffer for this rendering
if (!gl_state.usevbo_staticvertex)
case RENDERPATH_GLES2:
if (vertexbuffer)
{
- R_Mesh_VertexPointer(3, GL_FLOAT, sizeof(float[3]), vertex3f, vertexbuffer, 0);
+ R_Mesh_VertexPointer(3, GL_FLOAT, sizeof(float[3]), vertex3f, vertexbuffer, bufferoffset);
R_Mesh_ColorPointer(4, GL_FLOAT, sizeof(float[4]), NULL, NULL, 0);
R_Mesh_TexCoordPointer(0, 2, GL_FLOAT, sizeof(float[2]), NULL, NULL, 0);
R_Mesh_TexCoordPointer(1, 2, GL_FLOAT, sizeof(float[2]), NULL, NULL, 0);
case RENDERPATH_GLES1:
if (vertexbuffer)
{
- R_Mesh_VertexPointer(3, GL_FLOAT, sizeof(float[3]), vertex3f, vertexbuffer, 0);
+ R_Mesh_VertexPointer(3, GL_FLOAT, sizeof(float[3]), vertex3f, vertexbuffer, bufferoffset);
R_Mesh_ColorPointer(4, GL_FLOAT, sizeof(float[4]), NULL, NULL, 0);
R_Mesh_TexCoordPointer(0, 2, GL_FLOAT, sizeof(float[2]), NULL, NULL, 0);
R_Mesh_TexCoordPointer(1, 2, GL_FLOAT, sizeof(float[2]), NULL, NULL, 0);
case RENDERPATH_GL11:
if (vertexbuffer)
{
- R_Mesh_VertexPointer(3, GL_FLOAT, sizeof(float[3]), vertex3f, vertexbuffer, 0);
+ R_Mesh_VertexPointer(3, GL_FLOAT, sizeof(float[3]), vertex3f, vertexbuffer, bufferoffset);
R_Mesh_ColorPointer(4, GL_FLOAT, sizeof(float[4]), NULL, NULL, 0);
R_Mesh_TexCoordPointer(0, 2, GL_FLOAT, sizeof(float[2]), NULL, NULL, 0);
}
#ifdef SUPPORTD3D
IDirect3DDevice9_SetVertexDeclaration(vid_d3d9dev, r_vertex3f_d3d9decl);
if (vertexbuffer)
- IDirect3DDevice9_SetStreamSource(vid_d3d9dev, 0, (IDirect3DVertexBuffer9*)vertexbuffer->devicebuffer, 0, sizeof(float[3]));
+ IDirect3DDevice9_SetStreamSource(vid_d3d9dev, 0, (IDirect3DVertexBuffer9*)vertexbuffer->devicebuffer, bufferoffset, sizeof(float[3]));
else
IDirect3DDevice9_SetStreamSource(vid_d3d9dev, 0, NULL, 0, 0);
gl_state.d3dvertexbuffer = (void *)vertexbuffer;
qboolean R_Mesh_PrepareVertices_Generic_Unlock(void)
{
- R_Mesh_PrepareVertices_Generic(gl_state.preparevertices_numvertices, gl_state.preparevertices_vertexgeneric, NULL);
+ R_Mesh_PrepareVertices_Generic(gl_state.preparevertices_numvertices, gl_state.preparevertices_vertexgeneric, NULL, 0);
gl_state.preparevertices_vertexgeneric = NULL;
gl_state.preparevertices_numvertices = 0;
return true;
for (i = 0;i < numvertices;i++)
Vector2Copy(texcoord2f + 2*i, vertex[i].texcoord2f);
R_Mesh_PrepareVertices_Generic_Unlock();
- R_Mesh_PrepareVertices_Generic(numvertices, vertex, NULL);
+ R_Mesh_PrepareVertices_Generic(numvertices, vertex, NULL, 0);
}
-void R_Mesh_PrepareVertices_Generic(int numvertices, const r_vertexgeneric_t *vertex, const r_meshbuffer_t *vertexbuffer)
+void R_Mesh_PrepareVertices_Generic(int numvertices, const r_vertexgeneric_t *vertex, const r_meshbuffer_t *vertexbuffer, int bufferoffset)
{
// upload temporary vertexbuffer for this rendering
if (!gl_state.usevbo_staticvertex)
case RENDERPATH_GLES2:
if (vertexbuffer)
{
- R_Mesh_VertexPointer( 3, GL_FLOAT , sizeof(*vertex), vertex->vertex3f , vertexbuffer, (int)((unsigned char *)vertex->vertex3f - (unsigned char *)vertex));
- R_Mesh_ColorPointer( 4, GL_FLOAT , sizeof(*vertex), vertex->color4f , vertexbuffer, (int)((unsigned char *)vertex->color4f - (unsigned char *)vertex));
- R_Mesh_TexCoordPointer(0, 2, GL_FLOAT , sizeof(*vertex), vertex->texcoord2f , vertexbuffer, (int)((unsigned char *)vertex->texcoord2f - (unsigned char *)vertex));
+ R_Mesh_VertexPointer( 3, GL_FLOAT , sizeof(*vertex), vertex->vertex3f , vertexbuffer, bufferoffset + (int)((unsigned char *)vertex->vertex3f - (unsigned char *)vertex));
+ R_Mesh_ColorPointer( 4, GL_FLOAT , sizeof(*vertex), vertex->color4f , vertexbuffer, bufferoffset + (int)((unsigned char *)vertex->color4f - (unsigned char *)vertex));
+ R_Mesh_TexCoordPointer(0, 2, GL_FLOAT , sizeof(*vertex), vertex->texcoord2f , vertexbuffer, bufferoffset + (int)((unsigned char *)vertex->texcoord2f - (unsigned char *)vertex));
R_Mesh_TexCoordPointer(1, 2, GL_FLOAT, sizeof(float[2]), NULL, NULL, 0);
R_Mesh_TexCoordPointer(2, 2, GL_FLOAT, sizeof(float[2]), NULL, NULL, 0);
R_Mesh_TexCoordPointer(3, 2, GL_FLOAT, sizeof(float[2]), NULL, NULL, 0);
case RENDERPATH_GLES1:
if (vertexbuffer)
{
- R_Mesh_VertexPointer( 3, GL_FLOAT , sizeof(*vertex), vertex->vertex3f , vertexbuffer, (int)((unsigned char *)vertex->vertex3f - (unsigned char *)vertex));
- R_Mesh_ColorPointer( 4, GL_FLOAT , sizeof(*vertex), vertex->color4f , vertexbuffer, (int)((unsigned char *)vertex->color4f - (unsigned char *)vertex));
- R_Mesh_TexCoordPointer(0, 2, GL_FLOAT , sizeof(*vertex), vertex->texcoord2f , vertexbuffer, (int)((unsigned char *)vertex->texcoord2f - (unsigned char *)vertex));
+ R_Mesh_VertexPointer( 3, GL_FLOAT , sizeof(*vertex), vertex->vertex3f , vertexbuffer, bufferoffset + (int)((unsigned char *)vertex->vertex3f - (unsigned char *)vertex));
+ R_Mesh_ColorPointer( 4, GL_FLOAT , sizeof(*vertex), vertex->color4f , vertexbuffer, bufferoffset + (int)((unsigned char *)vertex->color4f - (unsigned char *)vertex));
+ R_Mesh_TexCoordPointer(0, 2, GL_FLOAT , sizeof(*vertex), vertex->texcoord2f , vertexbuffer, bufferoffset + (int)((unsigned char *)vertex->texcoord2f - (unsigned char *)vertex));
R_Mesh_TexCoordPointer(1, 2, GL_FLOAT, sizeof(float[2]), NULL, NULL, 0);
}
else
case RENDERPATH_GL11:
if (vertexbuffer)
{
- R_Mesh_VertexPointer( 3, GL_FLOAT , sizeof(*vertex), vertex->vertex3f , vertexbuffer, (int)((unsigned char *)vertex->vertex3f - (unsigned char *)vertex));
- R_Mesh_ColorPointer( 4, GL_FLOAT , sizeof(*vertex), vertex->color4f , vertexbuffer, (int)((unsigned char *)vertex->color4f - (unsigned char *)vertex));
- R_Mesh_TexCoordPointer(0, 2, GL_FLOAT , sizeof(*vertex), vertex->texcoord2f , vertexbuffer, (int)((unsigned char *)vertex->texcoord2f - (unsigned char *)vertex));
+ R_Mesh_VertexPointer( 3, GL_FLOAT , sizeof(*vertex), vertex->vertex3f , vertexbuffer, bufferoffset + (int)((unsigned char *)vertex->vertex3f - (unsigned char *)vertex));
+ R_Mesh_ColorPointer( 4, GL_FLOAT , sizeof(*vertex), vertex->color4f , vertexbuffer, bufferoffset + (int)((unsigned char *)vertex->color4f - (unsigned char *)vertex));
+ R_Mesh_TexCoordPointer(0, 2, GL_FLOAT , sizeof(*vertex), vertex->texcoord2f , vertexbuffer, bufferoffset + (int)((unsigned char *)vertex->texcoord2f - (unsigned char *)vertex));
}
else
{
#ifdef SUPPORTD3D
IDirect3DDevice9_SetVertexDeclaration(vid_d3d9dev, r_vertexgeneric_d3d9decl);
if (vertexbuffer)
- IDirect3DDevice9_SetStreamSource(vid_d3d9dev, 0, (IDirect3DVertexBuffer9*)vertexbuffer->devicebuffer, 0, sizeof(*vertex));
+ IDirect3DDevice9_SetStreamSource(vid_d3d9dev, 0, (IDirect3DVertexBuffer9*)vertexbuffer->devicebuffer, bufferoffset, sizeof(*vertex));
else
IDirect3DDevice9_SetStreamSource(vid_d3d9dev, 0, NULL, 0, 0);
gl_state.d3dvertexbuffer = (void *)vertexbuffer;
qboolean R_Mesh_PrepareVertices_Mesh_Unlock(void)
{
- R_Mesh_PrepareVertices_Mesh(gl_state.preparevertices_numvertices, gl_state.preparevertices_vertexmesh, NULL);
+ R_Mesh_PrepareVertices_Mesh(gl_state.preparevertices_numvertices, gl_state.preparevertices_vertexmesh, NULL, 0);
gl_state.preparevertices_vertexmesh = NULL;
gl_state.preparevertices_numvertices = 0;
return true;
for (i = 0;i < numvertices;i++)
Vector2Copy(texcoordlightmap2f + 2*i, vertex[i].texcoordlightmap2f);
R_Mesh_PrepareVertices_Mesh_Unlock();
- R_Mesh_PrepareVertices_Mesh(numvertices, vertex, NULL);
+ R_Mesh_PrepareVertices_Mesh(numvertices, vertex, NULL, 0);
}
-void R_Mesh_PrepareVertices_Mesh(int numvertices, const r_vertexmesh_t *vertex, const r_meshbuffer_t *vertexbuffer)
+void R_Mesh_PrepareVertices_Mesh(int numvertices, const r_vertexmesh_t *vertex, const r_meshbuffer_t *vertexbuffer, int bufferoffset)
{
// upload temporary vertexbuffer for this rendering
if (!gl_state.usevbo_staticvertex)
case RENDERPATH_GLES2:
if (vertexbuffer)
{
- R_Mesh_VertexPointer( 3, GL_FLOAT , sizeof(*vertex), vertex->vertex3f , vertexbuffer, (int)((unsigned char *)vertex->vertex3f - (unsigned char *)vertex));
- R_Mesh_ColorPointer( 4, GL_FLOAT , sizeof(*vertex), vertex->color4f , vertexbuffer, (int)((unsigned char *)vertex->color4f - (unsigned char *)vertex));
- R_Mesh_TexCoordPointer(0, 2, GL_FLOAT , sizeof(*vertex), vertex->texcoordtexture2f , vertexbuffer, (int)((unsigned char *)vertex->texcoordtexture2f - (unsigned char *)vertex));
- R_Mesh_TexCoordPointer(1, 3, GL_FLOAT , sizeof(*vertex), vertex->svector3f , vertexbuffer, (int)((unsigned char *)vertex->svector3f - (unsigned char *)vertex));
- R_Mesh_TexCoordPointer(2, 3, GL_FLOAT , sizeof(*vertex), vertex->tvector3f , vertexbuffer, (int)((unsigned char *)vertex->tvector3f - (unsigned char *)vertex));
- R_Mesh_TexCoordPointer(3, 3, GL_FLOAT , sizeof(*vertex), vertex->normal3f , vertexbuffer, (int)((unsigned char *)vertex->normal3f - (unsigned char *)vertex));
- R_Mesh_TexCoordPointer(4, 2, GL_FLOAT , sizeof(*vertex), vertex->texcoordlightmap2f, vertexbuffer, (int)((unsigned char *)vertex->texcoordlightmap2f - (unsigned char *)vertex));
+ R_Mesh_VertexPointer( 3, GL_FLOAT , sizeof(*vertex), vertex->vertex3f , vertexbuffer, bufferoffset + (int)((unsigned char *)vertex->vertex3f - (unsigned char *)vertex));
+ R_Mesh_ColorPointer( 4, GL_FLOAT , sizeof(*vertex), vertex->color4f , vertexbuffer, bufferoffset + (int)((unsigned char *)vertex->color4f - (unsigned char *)vertex));
+ R_Mesh_TexCoordPointer(0, 2, GL_FLOAT , sizeof(*vertex), vertex->texcoordtexture2f , vertexbuffer, bufferoffset + (int)((unsigned char *)vertex->texcoordtexture2f - (unsigned char *)vertex));
+ R_Mesh_TexCoordPointer(1, 3, GL_FLOAT , sizeof(*vertex), vertex->svector3f , vertexbuffer, bufferoffset + (int)((unsigned char *)vertex->svector3f - (unsigned char *)vertex));
+ R_Mesh_TexCoordPointer(2, 3, GL_FLOAT , sizeof(*vertex), vertex->tvector3f , vertexbuffer, bufferoffset + (int)((unsigned char *)vertex->tvector3f - (unsigned char *)vertex));
+ R_Mesh_TexCoordPointer(3, 3, GL_FLOAT , sizeof(*vertex), vertex->normal3f , vertexbuffer, bufferoffset + (int)((unsigned char *)vertex->normal3f - (unsigned char *)vertex));
+ R_Mesh_TexCoordPointer(4, 2, GL_FLOAT , sizeof(*vertex), vertex->texcoordlightmap2f, vertexbuffer, bufferoffset + (int)((unsigned char *)vertex->texcoordlightmap2f - (unsigned char *)vertex));
R_Mesh_TexCoordPointer(5, 2, GL_FLOAT , sizeof(*vertex), NULL, NULL, 0);
- R_Mesh_TexCoordPointer(6, 4, GL_UNSIGNED_BYTE | 0x80000000, sizeof(*vertex), vertex->skeletalindex4ub , vertexbuffer, (int)((unsigned char *)vertex->skeletalindex4ub - (unsigned char *)vertex));
- R_Mesh_TexCoordPointer(7, 4, GL_UNSIGNED_BYTE, sizeof(*vertex), vertex->skeletalweight4ub , vertexbuffer, (int)((unsigned char *)vertex->skeletalweight4ub - (unsigned char *)vertex));
+ R_Mesh_TexCoordPointer(6, 4, GL_UNSIGNED_BYTE | 0x80000000, sizeof(*vertex), vertex->skeletalindex4ub , vertexbuffer, bufferoffset + (int)((unsigned char *)vertex->skeletalindex4ub - (unsigned char *)vertex));
+ R_Mesh_TexCoordPointer(7, 4, GL_UNSIGNED_BYTE, sizeof(*vertex), vertex->skeletalweight4ub , vertexbuffer, bufferoffset + (int)((unsigned char *)vertex->skeletalweight4ub - (unsigned char *)vertex));
}
else
{
case RENDERPATH_GLES1:
if (vertexbuffer)
{
- R_Mesh_VertexPointer( 3, GL_FLOAT , sizeof(*vertex), vertex->vertex3f , vertexbuffer, (int)((unsigned char *)vertex->vertex3f - (unsigned char *)vertex));
- R_Mesh_ColorPointer( 4, GL_FLOAT , sizeof(*vertex), vertex->color4f , vertexbuffer, (int)((unsigned char *)vertex->color4f - (unsigned char *)vertex));
- R_Mesh_TexCoordPointer(0, 2, GL_FLOAT , sizeof(*vertex), vertex->texcoordtexture2f , vertexbuffer, (int)((unsigned char *)vertex->texcoordtexture2f - (unsigned char *)vertex));
- R_Mesh_TexCoordPointer(1, 2, GL_FLOAT , sizeof(*vertex), vertex->texcoordlightmap2f, vertexbuffer, (int)((unsigned char *)vertex->texcoordlightmap2f - (unsigned char *)vertex));
+ R_Mesh_VertexPointer( 3, GL_FLOAT , sizeof(*vertex), vertex->vertex3f , vertexbuffer, bufferoffset + (int)((unsigned char *)vertex->vertex3f - (unsigned char *)vertex));
+ R_Mesh_ColorPointer( 4, GL_FLOAT , sizeof(*vertex), vertex->color4f , vertexbuffer, bufferoffset + (int)((unsigned char *)vertex->color4f - (unsigned char *)vertex));
+ R_Mesh_TexCoordPointer(0, 2, GL_FLOAT , sizeof(*vertex), vertex->texcoordtexture2f , vertexbuffer, bufferoffset + (int)((unsigned char *)vertex->texcoordtexture2f - (unsigned char *)vertex));
+ R_Mesh_TexCoordPointer(1, 2, GL_FLOAT , sizeof(*vertex), vertex->texcoordlightmap2f, vertexbuffer, bufferoffset + (int)((unsigned char *)vertex->texcoordlightmap2f - (unsigned char *)vertex));
}
else
{
case RENDERPATH_GL11:
if (vertexbuffer)
{
- R_Mesh_VertexPointer( 3, GL_FLOAT , sizeof(*vertex), vertex->vertex3f , vertexbuffer, (int)((unsigned char *)vertex->vertex3f - (unsigned char *)vertex));
- R_Mesh_ColorPointer( 4, GL_FLOAT , sizeof(*vertex), vertex->color4f , vertexbuffer, (int)((unsigned char *)vertex->color4f - (unsigned char *)vertex));
- R_Mesh_TexCoordPointer(0, 2, GL_FLOAT , sizeof(*vertex), vertex->texcoordtexture2f , vertexbuffer, (int)((unsigned char *)vertex->texcoordtexture2f - (unsigned char *)vertex));
+ R_Mesh_VertexPointer( 3, GL_FLOAT , sizeof(*vertex), vertex->vertex3f , vertexbuffer, bufferoffset + (int)((unsigned char *)vertex->vertex3f - (unsigned char *)vertex));
+ R_Mesh_ColorPointer( 4, GL_FLOAT , sizeof(*vertex), vertex->color4f , vertexbuffer, bufferoffset + (int)((unsigned char *)vertex->color4f - (unsigned char *)vertex));
+ R_Mesh_TexCoordPointer(0, 2, GL_FLOAT , sizeof(*vertex), vertex->texcoordtexture2f , vertexbuffer, bufferoffset + (int)((unsigned char *)vertex->texcoordtexture2f - (unsigned char *)vertex));
}
else
{
#ifdef SUPPORTD3D
IDirect3DDevice9_SetVertexDeclaration(vid_d3d9dev, r_vertexmesh_d3d9decl);
if (vertexbuffer)
- IDirect3DDevice9_SetStreamSource(vid_d3d9dev, 0, (IDirect3DVertexBuffer9*)vertexbuffer->devicebuffer, 0, sizeof(*vertex));
+ IDirect3DDevice9_SetStreamSource(vid_d3d9dev, 0, (IDirect3DVertexBuffer9*)vertexbuffer->devicebuffer, bufferoffset, sizeof(*vertex));
else
IDirect3DDevice9_SetStreamSource(vid_d3d9dev, 0, NULL, 0, 0);
gl_state.d3dvertexbuffer = (void *)vertexbuffer;
void R_Mesh_DestroyMeshBuffer(r_meshbuffer_t *buffer);
void GL_Mesh_ListVBOs(qboolean printeach);
-void R_Mesh_PrepareVertices_Vertex3f(int numvertices, const float *vertex3f, const r_meshbuffer_t *buffer);
+void R_Mesh_PrepareVertices_Vertex3f(int numvertices, const float *vertex3f, const r_meshbuffer_t *buffer, int bufferoffset);
r_vertexgeneric_t *R_Mesh_PrepareVertices_Generic_Lock(int numvertices);
qboolean R_Mesh_PrepareVertices_Generic_Unlock(void);
void R_Mesh_PrepareVertices_Generic_Arrays(int numvertices, const float *vertex3f, const float *color4f, const float *texcoord2f);
-void R_Mesh_PrepareVertices_Generic(int numvertices, const r_vertexgeneric_t *vertex, const r_meshbuffer_t *vertexbuffer);
+void R_Mesh_PrepareVertices_Generic(int numvertices, const r_vertexgeneric_t *vertex, const r_meshbuffer_t *vertexbuffer, int bufferoffset);
r_vertexmesh_t *R_Mesh_PrepareVertices_Mesh_Lock(int numvertices);
qboolean R_Mesh_PrepareVertices_Mesh_Unlock(void); // if this returns false, you need to prepare the mesh again!
void R_Mesh_PrepareVertices_Mesh_Arrays(int numvertices, const float *vertex3f, const float *svector3f, const float *tvector3f, const float *normal3f, const float *color4f, const float *texcoordtexture2f, const float *texcoordlightmap2f);
-void R_Mesh_PrepareVertices_Mesh(int numvertices, const r_vertexmesh_t *vertex, const r_meshbuffer_t *buffer);
+void R_Mesh_PrepareVertices_Mesh(int numvertices, const r_vertexmesh_t *vertex, const r_meshbuffer_t *buffer, int bufferoffset);
// sets up the requested vertex transform matrix
void R_EntityMatrix(const matrix4x4_t *matrix);
cvar_t r_batch_multidraw = {CVAR_SAVE, "r_batch_multidraw", "1", "issue multiple glDrawElements calls when rendering a batch of surfaces with the same texture (otherwise the index data is copied to make it one draw)"};
cvar_t r_batch_multidraw_mintriangles = {CVAR_SAVE, "r_batch_multidraw_mintriangles", "0", "minimum number of triangles to activate multidraw path (copying small groups of triangles may be faster)"};
cvar_t r_batch_debugdynamicvertexpath = {CVAR_SAVE, "r_batch_debugdynamicvertexpath", "0", "force the dynamic batching code path for debugging purposes"};
+cvar_t r_batch_dynamicbuffer = {CVAR_SAVE, "r_batch_dynamicbuffer", "0", "use vertex/index buffers for drawing dynamic and copytriangles batches"};
cvar_t r_glsl_saturation = {CVAR_SAVE, "r_glsl_saturation", "1", "saturation multiplier (only working in glsl!)"};
cvar_t r_glsl_saturation_redcompensate = {CVAR_SAVE, "r_glsl_saturation_redcompensate", "0", "a 'vampire sight' addition to desaturation effect, does compensation for red color, r_glsl_restart is required"};
case RENDERPATH_D3D9:
#ifdef SUPPORTD3D
RSurf_PrepareVerticesForBatch(BATCHNEED_VERTEXMESH_VERTEX | BATCHNEED_VERTEXMESH_NORMAL | BATCHNEED_VERTEXMESH_VECTOR | (rsurface.modellightmapcolor4f ? BATCHNEED_VERTEXMESH_VERTEXCOLOR : 0) | BATCHNEED_VERTEXMESH_TEXCOORD | (rsurface.uselightmaptexture ? BATCHNEED_VERTEXMESH_LIGHTMAP : 0) | BATCHNEED_ALLOWMULTIDRAW, texturenumsurfaces, texturesurfacelist);
- R_Mesh_PrepareVertices_Mesh(rsurface.batchnumvertices, rsurface.batchvertexmesh, rsurface.batchvertexmeshbuffer);
+ R_Mesh_PrepareVertices_Mesh(rsurface.batchnumvertices, rsurface.batchvertexmesh, rsurface.batchvertexmesh_vertexbuffer, rsurface.batchvertexmesh_bufferoffset);
R_SetupShader_SetPermutationHLSL(mode, permutation);
Matrix4x4_ToArrayFloatGL(&rsurface.matrix, m16f);hlslPSSetParameter16f(D3DPSREGISTER_ModelToReflectCube, m16f);
if (mode == SHADERMODE_LIGHTSOURCE)
else
{
RSurf_PrepareVerticesForBatch(BATCHNEED_VERTEXMESH_VERTEX | BATCHNEED_VERTEXMESH_NORMAL | BATCHNEED_VERTEXMESH_VECTOR | (rsurface.modellightmapcolor4f ? BATCHNEED_VERTEXMESH_VERTEXCOLOR : 0) | BATCHNEED_VERTEXMESH_TEXCOORD | (rsurface.uselightmaptexture ? BATCHNEED_VERTEXMESH_LIGHTMAP : 0) | (rsurface.entityskeletaltransform3x4 ? BATCHNEED_VERTEXMESH_SKELETAL : 0) | BATCHNEED_ALLOWMULTIDRAW, texturenumsurfaces, texturesurfacelist);
- R_Mesh_PrepareVertices_Mesh(rsurface.batchnumvertices, rsurface.batchvertexmesh, rsurface.batchvertexmeshbuffer);
+ R_Mesh_PrepareVertices_Mesh(rsurface.batchnumvertices, rsurface.batchvertexmesh, rsurface.batchvertexmesh_vertexbuffer, rsurface.batchvertexmesh_bufferoffset);
}
// this has to be after RSurf_PrepareVerticesForBatch
if (rsurface.batchskeletaltransform3x4buffer)
Cvar_RegisterVariable(&r_framedatasize);
for (i = 0;i < R_BUFFERDATA_COUNT;i++)
Cvar_RegisterVariable(&r_bufferdatasize[i]);
+ Cvar_RegisterVariable(&r_batch_dynamicbuffer);
if (gamemode == GAME_NEHAHRA || gamemode == GAME_TENEBRAE)
Cvar_SetValue("r_fullbrights", 0);
R_RegisterModule("GL_Main", gl_main_start, gl_main_shutdown, gl_main_newmap, NULL, NULL);
for (i = 0;i < r_refdef.scene.numentities;i++)
{
ent = r_refdef.scene.entities[i];
- ent->animcache_vertex3f = NULL; // for shadow geometry
- ent->animcache_normal3f = NULL; // for lit geometry
- ent->animcache_svector3f = NULL; // for lit geometry
- ent->animcache_tvector3f = NULL; // for lit geometry
- ent->animcache_vertexmesh = NULL; // interleaved vertex arrays for D3D
- ent->animcache_vertex3fbuffer = NULL; // vertex buffer for D3D
- ent->animcache_vertexmeshbuffer = NULL; // vertex buffer for D3D
- ent->animcache_skeletaltransform3x4 = NULL; // for dynamic batch fallback with r_glsl_skeletal
- ent->animcache_skeletaltransform3x4buffer = NULL; // for r_glsl_skeletal
+ ent->animcache_vertex3f = NULL;
+ ent->animcache_vertex3f_vertexbuffer = NULL;
+ ent->animcache_vertex3f_bufferoffset = 0;
+ ent->animcache_normal3f = NULL;
+ ent->animcache_normal3f_vertexbuffer = NULL;
+ ent->animcache_normal3f_bufferoffset = 0;
+ ent->animcache_svector3f = NULL;
+ ent->animcache_svector3f_vertexbuffer = NULL;
+ ent->animcache_svector3f_bufferoffset = 0;
+ ent->animcache_tvector3f = NULL;
+ ent->animcache_tvector3f_vertexbuffer = NULL;
+ ent->animcache_tvector3f_bufferoffset = 0;
+ ent->animcache_vertexmesh = NULL;
+ ent->animcache_vertexmesh_vertexbuffer = NULL;
+ ent->animcache_vertexmesh_bufferoffset = 0;
+ ent->animcache_skeletaltransform3x4 = NULL;
+ ent->animcache_skeletaltransform3x4buffer = NULL;
ent->animcache_skeletaltransform3x4offset = 0;
ent->animcache_skeletaltransform3x4size = 0;
}
if (!ent->animcache_vertexmesh && ent->animcache_normal3f)
ent->animcache_vertexmesh = (r_vertexmesh_t *)R_FrameData_Alloc(sizeof(r_vertexmesh_t)*numvertices);
- // TODO: upload vertex3f buffer?
+ // TODO: upload vertexbuffer?
if (ent->animcache_vertexmesh)
{
r_refdef.stats[r_stat_animcache_vertexmesh_count] += 1;
r_refdef.stats[r_stat_animcache_vertexmesh_vertices] += numvertices;
r_refdef.stats[r_stat_animcache_vertexmesh_maxvertices] = max(r_refdef.stats[r_stat_animcache_vertexmesh_maxvertices], numvertices);
- memcpy(ent->animcache_vertexmesh, ent->model->surfmesh.vertexmesh, sizeof(r_vertexmesh_t)*numvertices);
+ memcpy(ent->animcache_vertexmesh, ent->model->surfmesh.data_vertexmesh, sizeof(r_vertexmesh_t)*numvertices);
for (i = 0;i < numvertices;i++)
memcpy(ent->animcache_vertexmesh[i].vertex3f, ent->animcache_vertex3f + 3*i, sizeof(float[3]));
if (ent->animcache_svector3f)
if (ent->animcache_normal3f)
for (i = 0;i < numvertices;i++)
memcpy(ent->animcache_vertexmesh[i].normal3f, ent->animcache_normal3f + 3*i, sizeof(float[3]));
- // TODO: upload vertexmeshbuffer?
}
}
rsurface.modelnumvertices = model->surfmesh.num_vertices;
rsurface.modelnumtriangles = model->surfmesh.num_triangles;
rsurface.modelsurfaces = model->data_surfaces;
- rsurface.modelvertexmesh = model->surfmesh.vertexmesh;
- rsurface.modelvertexmeshbuffer = model->surfmesh.vertexmeshbuffer;
- rsurface.modelvertex3fbuffer = model->surfmesh.vertex3fbuffer;
+ rsurface.modelvertexmesh = model->surfmesh.data_vertexmesh;
+ rsurface.modelvertexmesh_vertexbuffer = model->surfmesh.vbo_vertexbuffer;
+ rsurface.modelvertexmesh_bufferoffset = model->surfmesh.vbooffset_vertex3f;
rsurface.modelgeneratedvertex = false;
rsurface.batchgeneratedvertex = false;
rsurface.batchfirstvertex = 0;
rsurface.batchskeletalweight4ub_vertexbuffer = NULL;
rsurface.batchskeletalweight4ub_bufferoffset = 0;
rsurface.batchvertexmesh = NULL;
- rsurface.batchvertexmeshbuffer = NULL;
- rsurface.batchvertex3fbuffer = NULL;
+ rsurface.batchvertexmesh_vertexbuffer = NULL;
+ rsurface.batchvertexmesh_bufferoffset = 0;
rsurface.batchelement3i = NULL;
rsurface.batchelement3i_indexbuffer = NULL;
rsurface.batchelement3i_bufferoffset = 0;
r_refdef.stats[r_stat_batch_entitycache_vertices] += model->surfmesh.num_vertices;
r_refdef.stats[r_stat_batch_entitycache_triangles] += model->surfmesh.num_triangles;
rsurface.modelvertex3f = ent->animcache_vertex3f;
+ rsurface.modelvertex3f_vertexbuffer = ent->animcache_vertex3f_vertexbuffer;
+ rsurface.modelvertex3f_bufferoffset = ent->animcache_vertex3f_bufferoffset;
rsurface.modelsvector3f = wanttangents ? ent->animcache_svector3f : NULL;
+ rsurface.modelsvector3f_vertexbuffer = wanttangents ? ent->animcache_svector3f_vertexbuffer : NULL;
+ rsurface.modelsvector3f_bufferoffset = wanttangents ? ent->animcache_svector3f_bufferoffset : 0;
rsurface.modeltvector3f = wanttangents ? ent->animcache_tvector3f : NULL;
+ rsurface.modeltvector3f_vertexbuffer = wanttangents ? ent->animcache_tvector3f_vertexbuffer : NULL;
+ rsurface.modeltvector3f_bufferoffset = wanttangents ? ent->animcache_tvector3f_bufferoffset : 0;
rsurface.modelnormal3f = wantnormals ? ent->animcache_normal3f : NULL;
+ rsurface.modelnormal3f_vertexbuffer = wantnormals ? ent->animcache_normal3f_vertexbuffer : NULL;
+ rsurface.modelnormal3f_bufferoffset = wantnormals ? ent->animcache_normal3f_bufferoffset : 0;
rsurface.modelvertexmesh = ent->animcache_vertexmesh;
- rsurface.modelvertexmeshbuffer = ent->animcache_vertexmeshbuffer;
- rsurface.modelvertex3fbuffer = ent->animcache_vertex3fbuffer;
+ rsurface.modelvertexmesh_vertexbuffer = ent->animcache_vertexmesh_vertexbuffer;
+ rsurface.modelvertexmesh_bufferoffset = ent->animcache_vertexmesh_bufferoffset;
}
else if (wanttangents)
{
rsurface.modelnormal3f = (float *)R_FrameData_Alloc(model->surfmesh.num_vertices * sizeof(float[3]));
model->AnimateVertices(model, rsurface.frameblend, rsurface.skeleton, rsurface.modelvertex3f, rsurface.modelnormal3f, rsurface.modelsvector3f, rsurface.modeltvector3f);
rsurface.modelvertexmesh = NULL;
- rsurface.modelvertexmeshbuffer = NULL;
- rsurface.modelvertex3fbuffer = NULL;
+ rsurface.modelvertexmesh_vertexbuffer = NULL;
+ rsurface.modelvertexmesh_bufferoffset = 0;
+ rsurface.modelvertex3f_vertexbuffer = NULL;
+ rsurface.modelvertex3f_bufferoffset = 0;
+ rsurface.modelvertex3f_vertexbuffer = 0;
+ rsurface.modelvertex3f_bufferoffset = 0;
+ rsurface.modelsvector3f_vertexbuffer = 0;
+ rsurface.modelsvector3f_bufferoffset = 0;
+ rsurface.modeltvector3f_vertexbuffer = 0;
+ rsurface.modeltvector3f_bufferoffset = 0;
+ rsurface.modelnormal3f_vertexbuffer = 0;
+ rsurface.modelnormal3f_bufferoffset = 0;
}
else if (wantnormals)
{
rsurface.modelnormal3f = (float *)R_FrameData_Alloc(model->surfmesh.num_vertices * sizeof(float[3]));
model->AnimateVertices(model, rsurface.frameblend, rsurface.skeleton, rsurface.modelvertex3f, rsurface.modelnormal3f, NULL, NULL);
rsurface.modelvertexmesh = NULL;
- rsurface.modelvertexmeshbuffer = NULL;
- rsurface.modelvertex3fbuffer = NULL;
+ rsurface.modelvertexmesh_vertexbuffer = NULL;
+ rsurface.modelvertexmesh_bufferoffset = 0;
+ rsurface.modelvertex3f_vertexbuffer = NULL;
+ rsurface.modelvertex3f_bufferoffset = 0;
+ rsurface.modelvertex3f_vertexbuffer = 0;
+ rsurface.modelvertex3f_bufferoffset = 0;
+ rsurface.modelsvector3f_vertexbuffer = 0;
+ rsurface.modelsvector3f_bufferoffset = 0;
+ rsurface.modeltvector3f_vertexbuffer = 0;
+ rsurface.modeltvector3f_bufferoffset = 0;
+ rsurface.modelnormal3f_vertexbuffer = 0;
+ rsurface.modelnormal3f_bufferoffset = 0;
}
else
{
rsurface.modelnormal3f = NULL;
model->AnimateVertices(model, rsurface.frameblend, rsurface.skeleton, rsurface.modelvertex3f, NULL, NULL, NULL);
rsurface.modelvertexmesh = NULL;
- rsurface.modelvertexmeshbuffer = NULL;
- rsurface.modelvertex3fbuffer = NULL;
- }
- rsurface.modelvertex3f_vertexbuffer = 0;
- rsurface.modelvertex3f_bufferoffset = 0;
- rsurface.modelsvector3f_vertexbuffer = 0;
- rsurface.modelsvector3f_bufferoffset = 0;
- rsurface.modeltvector3f_vertexbuffer = 0;
- rsurface.modeltvector3f_bufferoffset = 0;
- rsurface.modelnormal3f_vertexbuffer = 0;
- rsurface.modelnormal3f_bufferoffset = 0;
+ rsurface.modelvertexmesh_vertexbuffer = NULL;
+ rsurface.modelvertexmesh_bufferoffset = 0;
+ rsurface.modelvertex3f_vertexbuffer = NULL;
+ rsurface.modelvertex3f_bufferoffset = 0;
+ rsurface.modelvertex3f_vertexbuffer = 0;
+ rsurface.modelvertex3f_bufferoffset = 0;
+ rsurface.modelsvector3f_vertexbuffer = 0;
+ rsurface.modelsvector3f_bufferoffset = 0;
+ rsurface.modeltvector3f_vertexbuffer = 0;
+ rsurface.modeltvector3f_bufferoffset = 0;
+ rsurface.modelnormal3f_vertexbuffer = 0;
+ rsurface.modelnormal3f_bufferoffset = 0;
+ }
rsurface.modelgeneratedvertex = true;
}
else
rsurface.modelnormal3f = model->surfmesh.data_normal3f;
rsurface.modelnormal3f_vertexbuffer = model->surfmesh.vbo_vertexbuffer;
rsurface.modelnormal3f_bufferoffset = model->surfmesh.vbooffset_normal3f;
- rsurface.modelvertexmesh = model->surfmesh.vertexmesh;
- rsurface.modelvertexmeshbuffer = model->surfmesh.vertexmeshbuffer;
- rsurface.modelvertex3fbuffer = model->surfmesh.vertex3fbuffer;
+ rsurface.modelvertexmesh = model->surfmesh.data_vertexmesh;
+ rsurface.modelvertexmesh_vertexbuffer = model->surfmesh.vbo_vertexbuffer;
+ rsurface.modelvertexmesh_bufferoffset = model->surfmesh.vbooffset_vertex3f;
rsurface.modelgeneratedvertex = false;
}
rsurface.modellightmapcolor4f = model->surfmesh.data_lightmapcolor4f;
rsurface.batchskeletalweight4ub_vertexbuffer = NULL;
rsurface.batchskeletalweight4ub_bufferoffset = 0;
rsurface.batchvertexmesh = NULL;
- rsurface.batchvertexmeshbuffer = NULL;
- rsurface.batchvertex3fbuffer = NULL;
+ rsurface.batchvertexmesh_vertexbuffer = NULL;
+ rsurface.batchvertexmesh_bufferoffset = 0;
rsurface.batchelement3i = NULL;
rsurface.batchelement3i_indexbuffer = NULL;
rsurface.batchelement3i_bufferoffset = 0;
rsurface.modelnormal3f = NULL;
}
rsurface.modelvertexmesh = NULL;
- rsurface.modelvertexmeshbuffer = NULL;
- rsurface.modelvertex3fbuffer = NULL;
+ rsurface.modelvertexmesh_vertexbuffer = NULL;
+ rsurface.modelvertexmesh_bufferoffset = 0;
rsurface.modelvertex3f_vertexbuffer = 0;
rsurface.modelvertex3f_bufferoffset = 0;
rsurface.modelsvector3f_vertexbuffer = 0;
rsurface.batchskeletalweight4ub_vertexbuffer = NULL;
rsurface.batchskeletalweight4ub_bufferoffset = 0;
rsurface.batchvertexmesh = NULL;
- rsurface.batchvertexmeshbuffer = NULL;
- rsurface.batchvertex3fbuffer = NULL;
+ rsurface.batchvertexmesh_vertexbuffer = NULL;
+ rsurface.batchvertexmesh_bufferoffset = 0;
rsurface.batchelement3i = NULL;
rsurface.batchelement3i_indexbuffer = NULL;
rsurface.batchelement3i_bufferoffset = 0;
// when the model data has no vertex buffer (dynamic mesh), we need to
// eliminate gaps
- if (vid.useinterleavedarrays && !rsurface.modelvertexmeshbuffer)
+ if (vid.useinterleavedarrays && !rsurface.modelvertexmesh_vertexbuffer)
batchneed |= BATCHNEED_NOGAPS;
// the caller can specify BATCHNEED_NOGAPS to force a batch with
rsurface.batchskeletalweight4ub = rsurface.modelskeletalweight4ub;
rsurface.batchskeletalweight4ub_vertexbuffer = rsurface.modelskeletalweight4ub_vertexbuffer;
rsurface.batchskeletalweight4ub_bufferoffset = rsurface.modelskeletalweight4ub_bufferoffset;
- rsurface.batchvertex3fbuffer = rsurface.modelvertex3fbuffer;
rsurface.batchvertexmesh = rsurface.modelvertexmesh;
- rsurface.batchvertexmeshbuffer = rsurface.modelvertexmeshbuffer;
+ rsurface.batchvertexmesh_vertexbuffer = rsurface.modelvertexmesh_vertexbuffer;
+ rsurface.batchvertexmesh_bufferoffset = rsurface.modelvertexmesh_bufferoffset;
rsurface.batchelement3i = rsurface.modelelement3i;
rsurface.batchelement3i_indexbuffer = rsurface.modelelement3i_indexbuffer;
rsurface.batchelement3i_bufferoffset = rsurface.modelelement3i_bufferoffset;
for (i = 0;i < numtriangles*3;i++)
rsurface.batchelement3s[i] = rsurface.batchelement3i[i];
}
+ // upload buffer data for the copytriangles batch
+ if (vid.forcevbo || (r_batch_dynamicbuffer.integer && vid.support.arb_vertex_buffer_object))
+ {
+ if (rsurface.batchelement3s)
+ rsurface.batchelement3s_indexbuffer = R_BufferData_Store(rsurface.batchnumtriangles * sizeof(short[3]), rsurface.batchelement3s, R_BUFFERDATA_INDEX16, &rsurface.batchelement3s_bufferoffset, !vid.forcevbo);
+ else if (rsurface.batchelement3i)
+ rsurface.batchelement3i_indexbuffer = R_BufferData_Store(rsurface.batchnumtriangles * sizeof(int[3]), rsurface.batchelement3i, R_BUFFERDATA_INDEX32, &rsurface.batchelement3i_bufferoffset, !vid.forcevbo);
+ }
}
else
{
// need actual vertex positions and normals
//if (dynamicvertex)
{
- rsurface.batchvertex3fbuffer = NULL;
rsurface.batchvertexmesh = NULL;
- rsurface.batchvertexmeshbuffer = NULL;
+ rsurface.batchvertexmesh_vertexbuffer = NULL;
+ rsurface.batchvertexmesh_bufferoffset = 0;
rsurface.batchvertex3f = NULL;
rsurface.batchvertex3f_vertexbuffer = NULL;
rsurface.batchvertex3f_bufferoffset = 0;
{
// convert the modified arrays to vertex structs
// rsurface.batchvertexmesh = R_FrameData_Alloc(batchnumvertices * sizeof(r_vertexmesh_t));
-// rsurface.batchvertexmeshbuffer = NULL;
+// rsurface.batchvertexmesh_vertexbuffer = NULL;
+// rsurface.batchvertexmesh_bufferoffset = 0;
if (batchneed & BATCHNEED_VERTEXMESH_VERTEX)
for (j = 0, vertexmesh = rsurface.batchvertexmesh;j < batchnumvertices;j++, vertexmesh++)
VectorCopy(rsurface.batchvertex3f + 3*j, vertexmesh->vertex3f);
}
}
}
+
+ // upload buffer data for the dynamic batch
+ if (vid.forcevbo || (r_batch_dynamicbuffer.integer && vid.support.arb_vertex_buffer_object))
+ {
+ if (rsurface.batchvertexmesh)
+ rsurface.batchvertexmesh_vertexbuffer = R_BufferData_Store(rsurface.batchnumvertices * sizeof(r_vertexmesh_t), rsurface.batchvertexmesh, R_BUFFERDATA_VERTEX, &rsurface.batchvertexmesh_bufferoffset, !vid.forcevbo);
+ else
+ {
+ if (rsurface.batchvertex3f)
+ rsurface.batchvertex3f_vertexbuffer = R_BufferData_Store(rsurface.batchnumvertices * sizeof(float[3]), rsurface.batchvertex3f, R_BUFFERDATA_VERTEX, &rsurface.batchvertex3f_bufferoffset, !vid.forcevbo);
+ if (rsurface.batchsvector3f)
+ rsurface.batchsvector3f_vertexbuffer = R_BufferData_Store(rsurface.batchnumvertices * sizeof(float[3]), rsurface.batchsvector3f, R_BUFFERDATA_VERTEX, &rsurface.batchsvector3f_bufferoffset, !vid.forcevbo);
+ if (rsurface.batchtvector3f)
+ rsurface.batchtvector3f_vertexbuffer = R_BufferData_Store(rsurface.batchnumvertices * sizeof(float[3]), rsurface.batchtvector3f, R_BUFFERDATA_VERTEX, &rsurface.batchtvector3f_bufferoffset, !vid.forcevbo);
+ if (rsurface.batchnormal3f)
+ rsurface.batchnormal3f_vertexbuffer = R_BufferData_Store(rsurface.batchnumvertices * sizeof(float[3]), rsurface.batchnormal3f, R_BUFFERDATA_VERTEX, &rsurface.batchnormal3f_bufferoffset, !vid.forcevbo);
+ if (rsurface.batchlightmapcolor4f && r_batch_dynamicbuffer.integer && vid.support.arb_vertex_buffer_object)
+ rsurface.batchlightmapcolor4f_vertexbuffer = R_BufferData_Store(rsurface.batchnumvertices * sizeof(float[4]), rsurface.batchlightmapcolor4f, R_BUFFERDATA_VERTEX, &rsurface.batchlightmapcolor4f_bufferoffset, !vid.forcevbo);
+ if (rsurface.batchtexcoordtexture2f && r_batch_dynamicbuffer.integer && vid.support.arb_vertex_buffer_object)
+ rsurface.batchtexcoordtexture2f_vertexbuffer = R_BufferData_Store(rsurface.batchnumvertices * sizeof(float[2]), rsurface.batchtexcoordtexture2f, R_BUFFERDATA_VERTEX, &rsurface.batchtexcoordtexture2f_bufferoffset, !vid.forcevbo);
+ if (rsurface.batchtexcoordlightmap2f && r_batch_dynamicbuffer.integer && vid.support.arb_vertex_buffer_object)
+ rsurface.batchtexcoordlightmap2f_vertexbuffer = R_BufferData_Store(rsurface.batchnumvertices * sizeof(float[2]), rsurface.batchtexcoordlightmap2f, R_BUFFERDATA_VERTEX, &rsurface.batchtexcoordlightmap2f_bufferoffset, !vid.forcevbo);
+ if (rsurface.batchskeletalindex4ub)
+ rsurface.batchskeletalindex4ub_vertexbuffer = R_BufferData_Store(rsurface.batchnumvertices * sizeof(unsigned char[4]), rsurface.batchskeletalindex4ub, R_BUFFERDATA_VERTEX, &rsurface.batchskeletalindex4ub_bufferoffset, !vid.forcevbo);
+ if (rsurface.batchskeletalweight4ub)
+ rsurface.batchskeletalweight4ub_vertexbuffer = R_BufferData_Store(rsurface.batchnumvertices * sizeof(unsigned char[4]), rsurface.batchskeletalweight4ub, R_BUFFERDATA_VERTEX, &rsurface.batchskeletalweight4ub_bufferoffset, !vid.forcevbo);
+ }
+ if (rsurface.batchelement3s)
+ rsurface.batchelement3s_indexbuffer = R_BufferData_Store(rsurface.batchnumtriangles * sizeof(short[3]), rsurface.batchelement3s, R_BUFFERDATA_INDEX16, &rsurface.batchelement3s_bufferoffset, !vid.forcevbo);
+ else if (rsurface.batchelement3i)
+ rsurface.batchelement3i_indexbuffer = R_BufferData_Store(rsurface.batchnumtriangles * sizeof(int[3]), rsurface.batchelement3i, R_BUFFERDATA_INDEX32, &rsurface.batchelement3i_bufferoffset, !vid.forcevbo);
+ }
}
void RSurf_DrawBatch(void)
// anything despite that colormask...
GL_BlendFunc(GL_ZERO, GL_ONE);
RSurf_PrepareVerticesForBatch(BATCHNEED_ARRAY_VERTEX | BATCHNEED_ALLOWMULTIDRAW, texturenumsurfaces, texturesurfacelist);
- if (rsurface.batchvertex3fbuffer)
- R_Mesh_PrepareVertices_Vertex3f(rsurface.batchnumvertices, rsurface.batchvertex3f, rsurface.batchvertex3fbuffer);
- else
- R_Mesh_PrepareVertices_Vertex3f(rsurface.batchnumvertices, rsurface.batchvertex3f, rsurface.batchvertex3f_vertexbuffer);
+ R_Mesh_PrepareVertices_Vertex3f(rsurface.batchnumvertices, rsurface.batchvertex3f, rsurface.batchvertex3f_vertexbuffer, rsurface.batchvertex3f_bufferoffset);
}
else
{
RSurf_SetupDepthAndCulling();
RSurf_PrepareVerticesForBatch(BATCHNEED_ARRAY_VERTEX | BATCHNEED_ALLOWMULTIDRAW, texturenumsurfaces, texturesurfacelist);
R_SetupShader_DepthOrShadow(false, false, !!rsurface.batchskeletaltransform3x4);
- if (rsurface.batchvertex3fbuffer)
- R_Mesh_PrepareVertices_Vertex3f(rsurface.batchnumvertices, rsurface.batchvertex3f, rsurface.batchvertex3fbuffer);
- else
- R_Mesh_PrepareVertices_Vertex3f(rsurface.batchnumvertices, rsurface.batchvertex3f, rsurface.batchvertex3f_vertexbuffer);
+ R_Mesh_PrepareVertices_Vertex3f(rsurface.batchnumvertices, rsurface.batchvertex3f, rsurface.batchvertex3f_vertexbuffer, rsurface.batchvertex3f_bufferoffset);
RSurf_DrawBatch();
}
if (setup)
return;
RSurf_SetupDepthAndCulling();
RSurf_PrepareVerticesForBatch(BATCHNEED_ARRAY_VERTEX | BATCHNEED_ALLOWMULTIDRAW, texturenumsurfaces, texturesurfacelist);
- if (rsurface.batchvertex3fbuffer)
- R_Mesh_PrepareVertices_Vertex3f(rsurface.batchnumvertices, rsurface.batchvertex3f, rsurface.batchvertex3fbuffer);
- else
- R_Mesh_PrepareVertices_Vertex3f(rsurface.batchnumvertices, rsurface.batchvertex3f, rsurface.batchvertex3f_vertexbuffer);
+ R_Mesh_PrepareVertices_Vertex3f(rsurface.batchnumvertices, rsurface.batchvertex3f, rsurface.batchvertex3f_vertexbuffer, rsurface.batchvertex3f_bufferoffset);
R_SetupShader_DepthOrShadow(false, false, !!rsurface.batchskeletaltransform3x4);
RSurf_DrawBatch();
}
--modelsurfacelistindex;
GL_CullFace(rsurface.texture->currentmaterialflags & MATERIALFLAG_NOCULLFACE ? GL_NONE : r_refdef.view.cullface_back);
RSurf_PrepareVerticesForBatch(BATCHNEED_ARRAY_VERTEX | BATCHNEED_ALLOWMULTIDRAW, batchnumsurfaces, batchsurfacelist);
- if (rsurface.batchvertex3fbuffer)
- R_Mesh_PrepareVertices_Vertex3f(rsurface.batchnumvertices, rsurface.batchvertex3f, rsurface.batchvertex3fbuffer);
- else
- R_Mesh_PrepareVertices_Vertex3f(rsurface.batchnumvertices, rsurface.batchvertex3f, rsurface.batchvertex3f_vertexbuffer);
+ R_Mesh_PrepareVertices_Vertex3f(rsurface.batchnumvertices, rsurface.batchvertex3f, rsurface.batchvertex3f_vertexbuffer, rsurface.batchvertex3f_bufferoffset);
RSurf_DrawBatch();
}
R_FrameData_ReturnToMark();
used = mod->used;
if (mod->mempool)
{
- if (mod->surfmesh.vertex3fbuffer)
- R_Mesh_DestroyMeshBuffer(mod->surfmesh.vertex3fbuffer);
- mod->surfmesh.vertex3fbuffer = NULL;
- if (mod->surfmesh.vertexmeshbuffer)
- R_Mesh_DestroyMeshBuffer(mod->surfmesh.vertexmeshbuffer);
- mod->surfmesh.vertexmeshbuffer = NULL;
if (mod->surfmesh.data_element3i_indexbuffer)
R_Mesh_DestroyMeshBuffer(mod->surfmesh.data_element3i_indexbuffer);
mod->surfmesh.data_element3i_indexbuffer = NULL;
}
}
- // upload r_vertexmesh_t array as a buffer
- if (mesh->vertexmesh && !mesh->vertexmeshbuffer)
- mesh->vertexmeshbuffer = R_Mesh_CreateMeshBuffer(mesh->vertexmesh, mesh->numverts * sizeof(*mesh->vertexmesh), loadmodel->name, false, false, false, false);
-
- // upload vertex3f array as a buffer
- if (mesh->vertex3f && !mesh->vertex3fbuffer)
- mesh->vertex3fbuffer = R_Mesh_CreateMeshBuffer(mesh->vertex3f, mesh->numverts * sizeof(float[3]), loadmodel->name, false, false, false, false);
-
// upload short indices as a buffer
if (mesh->element3s && !mesh->element3s_indexbuffer)
mesh->element3s_indexbuffer = R_Mesh_CreateMeshBuffer(mesh->element3s, mesh->numtriangles * sizeof(short[3]), loadmodel->name, true, false, false, true);
size_t size;
unsigned char *mem;
size = 0;
+ mesh->vbooffset_vertexmesh = size;if (mesh->vertexmesh ) size += mesh->numverts * sizeof(r_vertexmesh_t);
mesh->vbooffset_vertex3f = size;if (mesh->vertex3f ) size += mesh->numverts * sizeof(float[3]);
mesh->vbooffset_svector3f = size;if (mesh->svector3f ) size += mesh->numverts * sizeof(float[3]);
mesh->vbooffset_tvector3f = size;if (mesh->tvector3f ) size += mesh->numverts * sizeof(float[3]);
mesh->vbooffset_normal3f = size;if (mesh->normal3f ) size += mesh->numverts * sizeof(float[3]);
mesh->vbooffset_texcoord2f = size;if (mesh->texcoord2f ) size += mesh->numverts * sizeof(float[2]);
mem = (unsigned char *)Mem_Alloc(tempmempool, size);
+ if (mesh->vertexmesh ) memcpy(mem + mesh->vbooffset_vertexmesh , mesh->vertexmesh , mesh->numverts * sizeof(r_vertexmesh_t));
if (mesh->vertex3f ) memcpy(mem + mesh->vbooffset_vertex3f , mesh->vertex3f , mesh->numverts * sizeof(float[3]));
if (mesh->svector3f ) memcpy(mem + mesh->vbooffset_svector3f , mesh->svector3f , mesh->numverts * sizeof(float[3]));
if (mesh->tvector3f ) memcpy(mem + mesh->vbooffset_tvector3f , mesh->tvector3f , mesh->numverts * sizeof(float[3]));
shadowmesh_t *nextmesh;
for (;mesh;mesh = nextmesh)
{
- if (mesh->vertex3fbuffer)
- R_Mesh_DestroyMeshBuffer(mesh->vertex3fbuffer);
- if (mesh->vertexmeshbuffer)
- R_Mesh_DestroyMeshBuffer(mesh->vertexmeshbuffer);
if (mesh->element3i_indexbuffer)
R_Mesh_DestroyMeshBuffer(mesh->element3i_indexbuffer);
if (mesh->element3s_indexbuffer)
// build r_vertexmesh_t array
// (compressed interleaved array for D3D)
- if (!loadmodel->surfmesh.vertexmesh && vid.useinterleavedarrays)
+ if (!loadmodel->surfmesh.data_vertexmesh && vid.useinterleavedarrays)
{
int vertexindex;
int numvertices = loadmodel->surfmesh.num_vertices;
r_vertexmesh_t *vertexmesh;
- loadmodel->surfmesh.vertexmesh = vertexmesh = (r_vertexmesh_t*)Mem_Alloc(loadmodel->mempool, numvertices * sizeof(*loadmodel->surfmesh.vertexmesh));
+ loadmodel->surfmesh.data_vertexmesh = vertexmesh = (r_vertexmesh_t*)Mem_Alloc(loadmodel->mempool, numvertices * sizeof(r_vertexmesh_t));
for (vertexindex = 0;vertexindex < numvertices;vertexindex++, vertexmesh++)
{
VectorCopy(loadmodel->surfmesh.data_vertex3f + 3*vertexindex, vertexmesh->vertex3f);
}
}
- // upload r_vertexmesh_t array as a buffer
- if (loadmodel->surfmesh.vertexmesh && !loadmodel->surfmesh.vertexmeshbuffer)
- loadmodel->surfmesh.vertexmeshbuffer = R_Mesh_CreateMeshBuffer(loadmodel->surfmesh.vertexmesh, loadmodel->surfmesh.num_vertices * sizeof(*loadmodel->surfmesh.vertexmesh), loadmodel->name, false, false, false, false);
-
- // upload vertex3f array as a buffer
- if (loadmodel->surfmesh.data_vertex3f && !loadmodel->surfmesh.vertex3fbuffer)
- loadmodel->surfmesh.vertex3fbuffer = R_Mesh_CreateMeshBuffer(loadmodel->surfmesh.data_vertex3f, loadmodel->surfmesh.num_vertices * sizeof(float[3]), loadmodel->name, false, false, false, false);
-
// upload short indices as a buffer
if (loadmodel->surfmesh.data_element3s && !loadmodel->surfmesh.data_element3s_indexbuffer)
loadmodel->surfmesh.data_element3s_indexbuffer = R_Mesh_CreateMeshBuffer(loadmodel->surfmesh.data_element3s, loadmodel->surfmesh.num_triangles * sizeof(short[3]), loadmodel->name, true, false, false, true);
size_t size;
unsigned char *mem;
size = 0;
+ loadmodel->surfmesh.vbooffset_vertexmesh = size;if (loadmodel->surfmesh.data_vertexmesh ) size += loadmodel->surfmesh.num_vertices * sizeof(r_vertexmesh_t);
loadmodel->surfmesh.vbooffset_vertex3f = size;if (loadmodel->surfmesh.data_vertex3f ) size += loadmodel->surfmesh.num_vertices * sizeof(float[3]);
loadmodel->surfmesh.vbooffset_svector3f = size;if (loadmodel->surfmesh.data_svector3f ) size += loadmodel->surfmesh.num_vertices * sizeof(float[3]);
loadmodel->surfmesh.vbooffset_tvector3f = size;if (loadmodel->surfmesh.data_tvector3f ) size += loadmodel->surfmesh.num_vertices * sizeof(float[3]);
loadmodel->surfmesh.vbooffset_skeletalindex4ub = size;if (loadmodel->surfmesh.data_skeletalindex4ub ) size += loadmodel->surfmesh.num_vertices * sizeof(unsigned char[4]);
loadmodel->surfmesh.vbooffset_skeletalweight4ub = size;if (loadmodel->surfmesh.data_skeletalweight4ub ) size += loadmodel->surfmesh.num_vertices * sizeof(unsigned char[4]);
mem = (unsigned char *)Mem_Alloc(tempmempool, size);
+ if (loadmodel->surfmesh.data_vertexmesh ) memcpy(mem + loadmodel->surfmesh.vbooffset_vertexmesh , loadmodel->surfmesh.data_vertexmesh , loadmodel->surfmesh.num_vertices * sizeof(r_vertexmesh_t));
if (loadmodel->surfmesh.data_vertex3f ) memcpy(mem + loadmodel->surfmesh.vbooffset_vertex3f , loadmodel->surfmesh.data_vertex3f , loadmodel->surfmesh.num_vertices * sizeof(float[3]));
if (loadmodel->surfmesh.data_svector3f ) memcpy(mem + loadmodel->surfmesh.vbooffset_svector3f , loadmodel->surfmesh.data_svector3f , loadmodel->surfmesh.num_vertices * sizeof(float[3]));
if (loadmodel->surfmesh.data_tvector3f ) memcpy(mem + loadmodel->surfmesh.vbooffset_tvector3f , loadmodel->surfmesh.data_tvector3f , loadmodel->surfmesh.num_vertices * sizeof(float[3]));
if (model->surfmesh.num_vertices > 65536)
model->surfmesh.data_element3s = NULL;
- if (model->surfmesh.vertexmesh)
- Mem_Free(model->surfmesh.vertexmesh);
- model->surfmesh.vertexmesh = NULL;
- if (model->surfmesh.vertex3fbuffer)
- R_Mesh_DestroyMeshBuffer(model->surfmesh.vertex3fbuffer);
- model->surfmesh.vertex3fbuffer = NULL;
- if (model->surfmesh.vertexmeshbuffer)
- R_Mesh_DestroyMeshBuffer(model->surfmesh.vertexmeshbuffer);
- model->surfmesh.vertexmeshbuffer = NULL;
if (model->surfmesh.data_element3i_indexbuffer)
R_Mesh_DestroyMeshBuffer(model->surfmesh.data_element3i_indexbuffer);
model->surfmesh.data_element3i_indexbuffer = NULL;
unsigned char *data_skeletalindex4ub;
unsigned char *data_skeletalweight4ub;
int *data_lightmapoffsets; // index into surface's lightmap samples for vertex lighting
+ r_vertexmesh_t *data_vertexmesh; // interleaved arrays for D3D
// vertex buffer object (stores geometry in video memory)
r_meshbuffer_t *vbo_vertexbuffer;
- size_t vbooffset_vertex3f;
- size_t vbooffset_svector3f;
- size_t vbooffset_tvector3f;
- size_t vbooffset_normal3f;
- size_t vbooffset_texcoordtexture2f;
- size_t vbooffset_texcoordlightmap2f;
- size_t vbooffset_lightmapcolor4f;
- size_t vbooffset_skeletalindex4ub;
- size_t vbooffset_skeletalweight4ub;
+ int vbooffset_vertex3f;
+ int vbooffset_svector3f;
+ int vbooffset_tvector3f;
+ int vbooffset_normal3f;
+ int vbooffset_texcoordtexture2f;
+ int vbooffset_texcoordlightmap2f;
+ int vbooffset_lightmapcolor4f;
+ int vbooffset_skeletalindex4ub;
+ int vbooffset_skeletalweight4ub;
+ int vbooffset_vertexmesh;
// morph blending, these are zero if model is skeletal or static
int num_morphframes;
struct md3vertex_s *data_morphmd3vertex;
qboolean isanimated;
// vertex and index buffers for rendering
- r_vertexmesh_t *vertexmesh;
- r_meshbuffer_t *vertex3fbuffer;
- r_meshbuffer_t *vertexmeshbuffer;
+ r_meshbuffer_t *vertexmesh_vertexbuffer;
}
surfmesh_t;
// used always
int *element3i;
r_meshbuffer_t *element3i_indexbuffer;
- size_t element3i_bufferoffset;
+ int element3i_bufferoffset;
unsigned short *element3s;
r_meshbuffer_t *element3s_indexbuffer;
- size_t element3s_bufferoffset;
+ int element3s_bufferoffset;
+ // vertex/index buffers for rendering
+ // (created by Mod_ShadowMesh_Finish if possible)
+ r_vertexmesh_t *vertexmesh; // usually NULL
// used for shadow mapping cubemap side partitioning
int sideoffsets[6], sidetotals[6];
// used for shadow mesh (NULL on light mesh)
// while building meshes
shadowmeshvertexhash_t **vertexhashtable, *vertexhashentries;
r_meshbuffer_t *vbo_vertexbuffer;
- size_t vbooffset_vertex3f;
- size_t vbooffset_svector3f;
- size_t vbooffset_tvector3f;
- size_t vbooffset_normal3f;
- size_t vbooffset_texcoord2f;
- // vertex/index buffers for rendering
- // (created by Mod_ShadowMesh_Finish if possible)
- r_vertexmesh_t *vertexmesh; // usually NULL
- r_meshbuffer_t *vertex3fbuffer;
- r_meshbuffer_t *vertexmeshbuffer; // usually NULL
+ int vbooffset_vertex3f;
+ int vbooffset_svector3f;
+ int vbooffset_tvector3f;
+ int vbooffset_normal3f;
+ int vbooffset_texcoord2f;
+ int vbooffset_vertexmesh;
}
shadowmesh_t;
else if (r_shadow_rendermode == R_SHADOW_RENDERMODE_VISIBLEVOLUMES)
{
tris = R_Shadow_ConstructShadowVolume_ZFail(numverts, numtris, elements, neighbors, invertex3f, &outverts, shadowelements, shadowvertex3f, projectorigin, projectdirection, projectdistance, nummarktris, marktris);
- R_Mesh_PrepareVertices_Vertex3f(outverts, shadowvertex3f, NULL);
+ R_Mesh_PrepareVertices_Vertex3f(outverts, shadowvertex3f, NULL, 0);
R_Mesh_Draw(0, outverts, 0, tris, shadowelements, NULL, 0, NULL, NULL, 0);
}
else
GL_CullFace(r_refdef.view.cullface_back);
R_SetStencil(true, 255, GL_KEEP, GL_INCR, GL_KEEP, GL_ALWAYS, 128, 255);
}
- R_Mesh_PrepareVertices_Vertex3f(outverts, shadowvertex3f, NULL);
+ R_Mesh_PrepareVertices_Vertex3f(outverts, shadowvertex3f, NULL, 0);
R_Mesh_Draw(0, outverts, 0, tris, shadowelements, NULL, 0, NULL, NULL, 0);
}
}
GL_DepthTest(true);
GL_DepthFunc(GL_GREATER);
GL_CullFace(r_refdef.view.cullface_back);
- R_Mesh_PrepareVertices_Vertex3f(8, vertex3f, NULL);
+ R_Mesh_PrepareVertices_Vertex3f(8, vertex3f, NULL, 0);
R_Mesh_Draw(0, 8, 0, 12, NULL, NULL, 0, bboxelements, NULL, 0);
}
if (!mesh->sidetotals[r_shadow_shadowmapside])
continue;
r_refdef.stats[r_stat_lights_shadowtriangles] += mesh->sidetotals[r_shadow_shadowmapside];
- if (mesh->vertex3fbuffer)
- R_Mesh_PrepareVertices_Vertex3f(mesh->numverts, mesh->vertex3f, mesh->vertex3fbuffer);
- else
- R_Mesh_PrepareVertices_Vertex3f(mesh->numverts, mesh->vertex3f, mesh->vbo_vertexbuffer);
+ R_Mesh_PrepareVertices_Vertex3f(mesh->numverts, mesh->vertex3f, mesh->vbo_vertexbuffer, mesh->vbooffset_vertex3f);
R_Mesh_Draw(0, mesh->numverts, mesh->sideoffsets[r_shadow_shadowmapside], mesh->sidetotals[r_shadow_shadowmapside], mesh->element3i, mesh->element3i_indexbuffer, mesh->element3i_bufferoffset, mesh->element3s, mesh->element3s_indexbuffer, mesh->element3s_bufferoffset);
}
CHECKGLERROR
for (;mesh;mesh = mesh->next)
{
r_refdef.stats[r_stat_lights_shadowtriangles] += mesh->numtriangles;
- if (mesh->vertex3fbuffer)
- R_Mesh_PrepareVertices_Vertex3f(mesh->numverts, mesh->vertex3f, mesh->vertex3fbuffer);
- else
- R_Mesh_PrepareVertices_Vertex3f(mesh->numverts, mesh->vertex3f, mesh->vbo_vertexbuffer);
+ R_Mesh_PrepareVertices_Vertex3f(mesh->numverts, mesh->vertex3f, mesh->vbo_vertexbuffer, mesh->vbooffset_vertex3f);
if (r_shadow_rendermode == R_SHADOW_RENDERMODE_ZPASS_STENCIL)
{
// increment stencil if frontface is infront of depthbuffer
qglBeginQueryARB(GL_SAMPLES_PASSED_ARB, rtlight->corona_queryindex_allpixels);
GL_DepthFunc(GL_ALWAYS);
R_CalcSprite_Vertex3f(vertex3f, centerorigin, r_refdef.view.right, r_refdef.view.up, scale, -scale, -scale, scale);
- R_Mesh_PrepareVertices_Vertex3f(4, vertex3f, NULL);
+ R_Mesh_PrepareVertices_Vertex3f(4, vertex3f, NULL, 0);
R_Mesh_Draw(0, 4, 0, 2, polygonelement3i, NULL, 0, polygonelement3s, NULL, 0);
qglEndQueryARB(GL_SAMPLES_PASSED_ARB);
GL_DepthFunc(GL_LEQUAL);
qglBeginQueryARB(GL_SAMPLES_PASSED_ARB, rtlight->corona_queryindex_visiblepixels);
R_CalcSprite_Vertex3f(vertex3f, rtlight->shadoworigin, r_refdef.view.right, r_refdef.view.up, scale, -scale, -scale, scale);
- R_Mesh_PrepareVertices_Vertex3f(4, vertex3f, NULL);
+ R_Mesh_PrepareVertices_Vertex3f(4, vertex3f, NULL, 0);
R_Mesh_Draw(0, 4, 0, 2, polygonelement3i, NULL, 0, polygonelement3s, NULL, 0);
qglEndQueryARB(GL_SAMPLES_PASSED_ARB);
CHECKGLERROR
int entityskeletaltransform3x4size;
float *modelvertex3f;
const r_meshbuffer_t *modelvertex3f_vertexbuffer;
- size_t modelvertex3f_bufferoffset;
+ int modelvertex3f_bufferoffset;
float *modelsvector3f;
const r_meshbuffer_t *modelsvector3f_vertexbuffer;
- size_t modelsvector3f_bufferoffset;
+ int modelsvector3f_bufferoffset;
float *modeltvector3f;
const r_meshbuffer_t *modeltvector3f_vertexbuffer;
- size_t modeltvector3f_bufferoffset;
+ int modeltvector3f_bufferoffset;
float *modelnormal3f;
const r_meshbuffer_t *modelnormal3f_vertexbuffer;
- size_t modelnormal3f_bufferoffset;
+ int modelnormal3f_bufferoffset;
float *modellightmapcolor4f;
const r_meshbuffer_t *modellightmapcolor4f_vertexbuffer;
- size_t modellightmapcolor4f_bufferoffset;
+ int modellightmapcolor4f_bufferoffset;
float *modeltexcoordtexture2f;
const r_meshbuffer_t *modeltexcoordtexture2f_vertexbuffer;
- size_t modeltexcoordtexture2f_bufferoffset;
+ int modeltexcoordtexture2f_bufferoffset;
float *modeltexcoordlightmap2f;
const r_meshbuffer_t *modeltexcoordlightmap2f_vertexbuffer;
- size_t modeltexcoordlightmap2f_bufferoffset;
+ int modeltexcoordlightmap2f_bufferoffset;
unsigned char *modelskeletalindex4ub;
const r_meshbuffer_t *modelskeletalindex4ub_vertexbuffer;
- size_t modelskeletalindex4ub_bufferoffset;
+ int modelskeletalindex4ub_bufferoffset;
unsigned char *modelskeletalweight4ub;
const r_meshbuffer_t *modelskeletalweight4ub_vertexbuffer;
- size_t modelskeletalweight4ub_bufferoffset;
+ int modelskeletalweight4ub_bufferoffset;
r_vertexmesh_t *modelvertexmesh;
- const r_meshbuffer_t *modelvertexmeshbuffer;
- const r_meshbuffer_t *modelvertex3fbuffer;
+ const r_meshbuffer_t *modelvertexmesh_vertexbuffer;
+ int modelvertexmesh_bufferoffset;
int *modelelement3i;
const r_meshbuffer_t *modelelement3i_indexbuffer;
- size_t modelelement3i_bufferoffset;
+ int modelelement3i_bufferoffset;
unsigned short *modelelement3s;
const r_meshbuffer_t *modelelement3s_indexbuffer;
- size_t modelelement3s_bufferoffset;
+ int modelelement3s_bufferoffset;
int *modellightmapoffsets;
int modelnumvertices;
int modelnumtriangles;
int batchfirsttriangle;
int batchnumtriangles;
r_vertexmesh_t *batchvertexmesh;
- const r_meshbuffer_t *batchvertexmeshbuffer;
- const r_meshbuffer_t *batchvertex3fbuffer;
+ const r_meshbuffer_t *batchvertexmesh_vertexbuffer;
+ int batchvertexmesh_bufferoffset;
float *batchvertex3f;
const r_meshbuffer_t *batchvertex3f_vertexbuffer;
- size_t batchvertex3f_bufferoffset;
+ int batchvertex3f_bufferoffset;
float *batchsvector3f;
const r_meshbuffer_t *batchsvector3f_vertexbuffer;
- size_t batchsvector3f_bufferoffset;
+ int batchsvector3f_bufferoffset;
float *batchtvector3f;
const r_meshbuffer_t *batchtvector3f_vertexbuffer;
- size_t batchtvector3f_bufferoffset;
+ int batchtvector3f_bufferoffset;
float *batchnormal3f;
const r_meshbuffer_t *batchnormal3f_vertexbuffer;
- size_t batchnormal3f_bufferoffset;
+ int batchnormal3f_bufferoffset;
float *batchlightmapcolor4f;
const r_meshbuffer_t *batchlightmapcolor4f_vertexbuffer;
- size_t batchlightmapcolor4f_bufferoffset;
+ int batchlightmapcolor4f_bufferoffset;
float *batchtexcoordtexture2f;
const r_meshbuffer_t *batchtexcoordtexture2f_vertexbuffer;
- size_t batchtexcoordtexture2f_bufferoffset;
+ int batchtexcoordtexture2f_bufferoffset;
float *batchtexcoordlightmap2f;
const r_meshbuffer_t *batchtexcoordlightmap2f_vertexbuffer;
- size_t batchtexcoordlightmap2f_bufferoffset;
+ int batchtexcoordlightmap2f_bufferoffset;
unsigned char *batchskeletalindex4ub;
const r_meshbuffer_t *batchskeletalindex4ub_vertexbuffer;
- size_t batchskeletalindex4ub_bufferoffset;
+ int batchskeletalindex4ub_bufferoffset;
unsigned char *batchskeletalweight4ub;
const r_meshbuffer_t *batchskeletalweight4ub_vertexbuffer;
- size_t batchskeletalweight4ub_bufferoffset;
+ int batchskeletalweight4ub_bufferoffset;
int *batchelement3i;
const r_meshbuffer_t *batchelement3i_indexbuffer;
- size_t batchelement3i_bufferoffset;
+ int batchelement3i_bufferoffset;
unsigned short *batchelement3s;
const r_meshbuffer_t *batchelement3s_indexbuffer;
- size_t batchelement3s_bufferoffset;
+ int batchelement3s_bufferoffset;
int batchskeletalnumtransforms;
float *batchskeletaltransform3x4;
const r_meshbuffer_t *batchskeletaltransform3x4buffer; // uniform buffer
// rendering pass processing arrays in GL11 and GL13 paths
float *passcolor4f;
const r_meshbuffer_t *passcolor4f_vertexbuffer;
- size_t passcolor4f_bufferoffset;
+ int passcolor4f_bufferoffset;
// some important fields from the entity
int ent_skinnum;