qglUnlockArraysEXT();
CHECKGLERROR
}
- if (count && gl_supportslockarrays && gl_lockarrays.integer)
+ if (count && gl_supportslockarrays && gl_lockarrays.integer && r_render.integer)
{
gl_state.lockrange_first = first;
gl_state.lockrange_count = count;
Con_Printf("R_Mesh_Draw(%d, %d, %08p);\n", numverts, numtriangles, elements);
return;
}
+ CHECKGLERROR
if (r_showtrispass)
{
R_Mesh_Draw_ShowTris(numverts, numtriangles, elements);
}
c_meshs++;
c_meshelements += numelements;
- CHECKGLERROR
- if (r_render.integer)
+ if (gl_paranoid.integer)
{
- if (gl_paranoid.integer)
+ int i, j, size;
+ const int *p;
+ if (!qglIsEnabled(GL_VERTEX_ARRAY))
+ Con_Print("R_Mesh_Draw: vertex array not enabled\n");
+ for (j = 0, size = numverts * (int)sizeof(float[3]), p = gl_state.pointer_vertex;j < size;j += sizeof(int), p++)
+ paranoidblah += *p;
+ if (gl_state.pointer_color)
{
- int i, j, size;
- const int *p;
- if (!qglIsEnabled(GL_VERTEX_ARRAY))
- Con_Print("R_Mesh_Draw: vertex array not enabled\n");
- for (j = 0, size = numverts * (int)sizeof(float[3]), p = gl_state.pointer_vertex;j < size;j += sizeof(int), p++)
+ if (!qglIsEnabled(GL_COLOR_ARRAY))
+ Con_Print("R_Mesh_Draw: color array set but not enabled\n");
+ for (j = 0, size = numverts * (int)sizeof(float[4]), p = gl_state.pointer_color;j < size;j += sizeof(int), p++)
paranoidblah += *p;
- if (gl_state.pointer_color)
+ }
+ for (i = 0;i < backendunits;i++)
+ {
+ if (gl_state.units[i].t1d || gl_state.units[i].t2d || gl_state.units[i].t3d || gl_state.units[i].tcubemap || gl_state.units[i].arrayenabled)
{
- if (!qglIsEnabled(GL_COLOR_ARRAY))
- Con_Print("R_Mesh_Draw: color array set but not enabled\n");
- for (j = 0, size = numverts * (int)sizeof(float[4]), p = gl_state.pointer_color;j < size;j += sizeof(int), p++)
+ if (gl_state.units[i].arrayenabled && !(gl_state.units[i].t1d || gl_state.units[i].t2d || gl_state.units[i].t3d || gl_state.units[i].tcubemap))
+ Con_Print("R_Mesh_Draw: array enabled but no texture bound\n");
+ GL_ActiveTexture(i);
+ if (!qglIsEnabled(GL_TEXTURE_COORD_ARRAY))
+ Con_Print("R_Mesh_Draw: texcoord array set but not enabled\n");
+ for (j = 0, size = numverts * ((gl_state.units[i].t3d || gl_state.units[i].tcubemap) ? (int)sizeof(float[3]) : (int)sizeof(float[2])), p = gl_state.units[i].pointer_texcoord;j < size;j += sizeof(int), p++)
paranoidblah += *p;
}
- for (i = 0;i < backendunits;i++)
- {
- if (gl_state.units[i].t1d || gl_state.units[i].t2d || gl_state.units[i].t3d || gl_state.units[i].tcubemap || gl_state.units[i].arrayenabled)
- {
- if (gl_state.units[i].arrayenabled && !(gl_state.units[i].t1d || gl_state.units[i].t2d || gl_state.units[i].t3d || gl_state.units[i].tcubemap))
- Con_Print("R_Mesh_Draw: array enabled but no texture bound\n");
- GL_ActiveTexture(i);
- if (!qglIsEnabled(GL_TEXTURE_COORD_ARRAY))
- Con_Print("R_Mesh_Draw: texcoord array set but not enabled\n");
- for (j = 0, size = numverts * ((gl_state.units[i].t3d || gl_state.units[i].tcubemap) ? (int)sizeof(float[3]) : (int)sizeof(float[2])), p = gl_state.units[i].pointer_texcoord;j < size;j += sizeof(int), p++)
- paranoidblah += *p;
- }
- }
- for (i = 0;i < numtriangles * 3;i++)
+ }
+ for (i = 0;i < numtriangles * 3;i++)
+ {
+ if (elements[i] < 0 || elements[i] >= numverts)
{
- if (elements[i] < 0 || elements[i] >= numverts)
- {
- Con_Printf("R_Mesh_Draw: invalid vertex index %i (outside range 0 - %i) in elements list\n", elements[i], numverts);
- return;
- }
+ Con_Printf("R_Mesh_Draw: invalid vertex index %i (outside range 0 - %i) in elements list\n", elements[i], numverts);
+ return;
}
}
CHECKGLERROR
- GL_LockArrays(0, numverts);
+ }
+ if (r_render.integer)
+ {
CHECKGLERROR
if (gl_mesh_testmanualfeeding.integer)
{
qglDrawElements(GL_TRIANGLES, numelements, GL_UNSIGNED_INT, elements);CHECKGLERROR
}
CHECKGLERROR
- GL_LockArrays(0, 0);
- CHECKGLERROR
}
}
batchcount++;
if (batchcount >= 128)
{
+ GL_LockArrays(0, batchcount * 4);
R_Mesh_Draw(batchcount * 4, batchcount * 2, quadelements);
+ GL_LockArrays(0, 0);
batchcount = 0;
at = varray_texcoord2f[0];
av = varray_vertex3f;
x += w;
}
if (batchcount > 0)
+ {
+ GL_LockArrays(0, batchcount * 4);
R_Mesh_Draw(batchcount * 4, batchcount * 2, quadelements);
+ GL_LockArrays(0, 0);
+ }
break;
case DRAWQUEUE_MESH:
mesh = (void *)(dq + 1);
m.tex[0] = R_GetTexture(mesh->texture);
m.pointer_texcoord[0] = mesh->data_texcoord2f;
R_Mesh_State(&m);
+ GL_LockArrays(0, mesh->num_vertices);
R_Mesh_Draw(mesh->num_vertices, mesh->num_triangles, mesh->data_element3i);
+ GL_LockArrays(0, 0);
m.pointer_color = NULL;
currentpic = "\0";
break;
}
}
R_Mesh_State(&m);
+ GL_LockArrays(0, mesh->num_vertices);
R_Mesh_Draw(mesh->num_vertices, mesh->num_triangles, mesh->data_element3i);
+ GL_LockArrays(0, 0);
}
}
else
GL_Color(ambientcolor4f[0], ambientcolor4f[1], ambientcolor4f[2], ambientcolor4f[3]);
R_Mesh_State(&mstate);
+ GL_LockArrays(0, numverts);
R_Mesh_Draw(numverts, numtriangles, elements);
+ GL_LockArrays(0, 0);
c_alias_polys += numtriangles;
if (fog)
GL_Color(fogcolor[0], fogcolor[1], fogcolor[2], ent->alpha * fog);
ZymoticTransformVerts(numverts, varray_vertex3f, ent->model->alias.zymdata_vertbonecounts, ent->model->alias.zymdata_verts);
R_Mesh_State(&mstate);
+ GL_LockArrays(0, numverts);
R_Mesh_Draw(numverts, numtriangles, elements);
+ GL_LockArrays(0, 0);
c_alias_polys += numtriangles;
}
}
{
m.pointer_vertex = surf->mesh.data_vertex3f;
R_Mesh_State(&m);
+ GL_LockArrays(0, surf->mesh.num_vertices);
R_Mesh_Draw(surf->mesh.num_vertices, surf->mesh.num_triangles, surf->mesh.data_element3i);
+ GL_LockArrays(0, 0);
}
}
GL_ColorMask(1,1,1,1);
m.pointer_texcoord[1] = surf->mesh.data_texcoordtexture2f;
m.texcombinergb[1] = GL_REPLACE;
R_Mesh_State(&m);
+ GL_LockArrays(0, surf->mesh.num_vertices);
R_Mesh_Draw(surf->mesh.num_vertices, surf->mesh.num_triangles, surf->mesh.data_element3i);
+ GL_LockArrays(0, 0);
if (gl_textureshader && r_watershader.value && !fogenabled)
{
m.pointer_color = varray_color4f;
R_Mesh_State(&m);
RSurf_FogPassColors_Vertex3f_Color4f(surf->mesh.data_vertex3f, varray_color4f, fogcolor[0], fogcolor[1], fogcolor[2], alpha, 1, surf->mesh.num_vertices, modelorg);
+ GL_LockArrays(0, surf->mesh.num_vertices);
R_Mesh_Draw(surf->mesh.num_vertices, surf->mesh.num_triangles, surf->mesh.data_element3i);
+ GL_LockArrays(0, 0);
}
if ((gl_textureshader && r_watershader.value && !fogenabled) || r_waterscroll.value)
RSurf_AddLightmapToVertexColors_Color4f(surf->mesh.data_lightmapoffsets, varray_color4f,surf->mesh.num_vertices, surf->samples, ((surf->extents[0]>>4)+1)*((surf->extents[1]>>4)+1)*3, surf->styles);
}
RSurf_FogColors_Vertex3f_Color4f(surf->mesh.data_vertex3f, varray_color4f, colorscale, surf->mesh.num_vertices, modelorg);
+ GL_LockArrays(0, surf->mesh.num_vertices);
R_Mesh_Draw(surf->mesh.num_vertices, surf->mesh.num_triangles, surf->mesh.data_element3i);
+ GL_LockArrays(0, 0);
}
static void RSurfShader_Wall_Pass_Glow(const entity_render_t *ent, const msurface_t *surf, const texture_t *texture, int rendertype, float currentalpha)
m.pointer_texcoord[0] = surf->mesh.data_texcoordtexture2f;
R_Mesh_State(&m);
RSurf_FoggedColors_Vertex3f_Color4f(surf->mesh.data_vertex3f, varray_color4f, 1, 1, 1, currentalpha, 1, surf->mesh.num_vertices, modelorg);
+ GL_LockArrays(0, surf->mesh.num_vertices);
R_Mesh_Draw(surf->mesh.num_vertices, surf->mesh.num_triangles, surf->mesh.data_element3i);
+ GL_LockArrays(0, 0);
}
static void RSurfShader_Wall_Pass_Fog(const entity_render_t *ent, const msurface_t *surf, const texture_t *texture, int rendertype, float currentalpha)
m.pointer_texcoord[0] = surf->mesh.data_texcoordtexture2f;
R_Mesh_State(&m);
RSurf_FogPassColors_Vertex3f_Color4f(surf->mesh.data_vertex3f, varray_color4f, fogcolor[0], fogcolor[1], fogcolor[2], currentalpha, 1, surf->mesh.num_vertices, modelorg);
+ GL_LockArrays(0, surf->mesh.num_vertices);
R_Mesh_Draw(surf->mesh.num_vertices, surf->mesh.num_triangles, surf->mesh.data_element3i);
+ GL_LockArrays(0, 0);
}
static void RSurfShader_OpaqueWall_Pass_BaseCombine_TextureLightmapDetailGlow(const entity_render_t *ent, const texture_t *texture, msurface_t **surfchain)
m.pointer_texcoord[2] = surf->mesh.data_texcoorddetail2f;
m.pointer_texcoord[3] = surf->mesh.data_texcoordtexture2f;
R_Mesh_State(&m);
+ GL_LockArrays(0, surf->mesh.num_vertices);
R_Mesh_Draw(surf->mesh.num_vertices, surf->mesh.num_triangles, surf->mesh.data_element3i);
+ GL_LockArrays(0, 0);
}
}
}
m.pointer_texcoord[1] = surf->mesh.data_texcoordlightmap2f;
m.pointer_texcoord[2] = surf->mesh.data_texcoorddetail2f;
R_Mesh_State(&m);
+ GL_LockArrays(0, surf->mesh.num_vertices);
R_Mesh_Draw(surf->mesh.num_vertices, surf->mesh.num_triangles, surf->mesh.data_element3i);
+ GL_LockArrays(0, 0);
}
}
}
m.pointer_texcoord[0] = surf->mesh.data_texcoordtexture2f;
m.pointer_texcoord[1] = surf->mesh.data_texcoordlightmap2f;
R_Mesh_State(&m);
+ GL_LockArrays(0, surf->mesh.num_vertices);
R_Mesh_Draw(surf->mesh.num_vertices, surf->mesh.num_triangles, surf->mesh.data_element3i);
+ GL_LockArrays(0, 0);
}
}
}
m.pointer_vertex = surf->mesh.data_vertex3f;
m.pointer_texcoord[0] = surf->mesh.data_texcoordtexture2f;
R_Mesh_State(&m);
+ GL_LockArrays(0, surf->mesh.num_vertices);
R_Mesh_Draw(surf->mesh.num_vertices, surf->mesh.num_triangles, surf->mesh.data_element3i);
+ GL_LockArrays(0, 0);
}
}
}
m.pointer_vertex = surf->mesh.data_vertex3f;
m.pointer_texcoord[0] = surf->mesh.data_texcoordlightmap2f;
R_Mesh_State(&m);
+ GL_LockArrays(0, surf->mesh.num_vertices);
R_Mesh_Draw(surf->mesh.num_vertices, surf->mesh.num_triangles, surf->mesh.data_element3i);
+ GL_LockArrays(0, 0);
}
}
}
m.pointer_texcoord[0] = surf->mesh.data_texcoordtexture2f;
R_Mesh_State(&m);
RSurf_FogPassColors_Vertex3f_Color4f(surf->mesh.data_vertex3f, varray_color4f, fogcolor[0], fogcolor[1], fogcolor[2], 1, 1, surf->mesh.num_vertices, modelorg);
+ GL_LockArrays(0, surf->mesh.num_vertices);
R_Mesh_Draw(surf->mesh.num_vertices, surf->mesh.num_triangles, surf->mesh.data_element3i);
+ GL_LockArrays(0, 0);
}
}
}
m.pointer_vertex = surf->mesh.data_vertex3f;
m.pointer_texcoord[0] = surf->mesh.data_texcoorddetail2f;
R_Mesh_State(&m);
+ GL_LockArrays(0, surf->mesh.num_vertices);
R_Mesh_Draw(surf->mesh.num_vertices, surf->mesh.num_triangles, surf->mesh.data_element3i);
+ GL_LockArrays(0, 0);
}
}
}
m.pointer_vertex = surf->mesh.data_vertex3f;
m.pointer_texcoord[0] = surf->mesh.data_texcoordtexture2f;
R_Mesh_State(&m);
+ GL_LockArrays(0, surf->mesh.num_vertices);
R_Mesh_Draw(surf->mesh.num_vertices, surf->mesh.num_triangles, surf->mesh.data_element3i);
+ GL_LockArrays(0, 0);
}
}
}
m.pointer_vertex = surf->mesh.data_vertex3f;
m.pointer_texcoord[0] = surf->mesh.data_texcoordtexture2f;
R_Mesh_State(&m);
+ GL_LockArrays(0, surf->mesh.num_vertices);
R_Mesh_Draw(surf->mesh.num_vertices, surf->mesh.num_triangles, surf->mesh.data_element3i);
+ GL_LockArrays(0, 0);
}
}
}
m.pointer_vertex = surf->mesh.data_vertex3f;
m.pointer_texcoord[0] = surf->mesh.data_texcoordlightmap2f;
R_Mesh_State(&m);
+ GL_LockArrays(0, surf->mesh.num_vertices);
R_Mesh_Draw(surf->mesh.num_vertices, surf->mesh.num_triangles, surf->mesh.data_element3i);
+ GL_LockArrays(0, 0);
}
}
}
else
for (i = 0, v = varray_vertex3f;i < portal->numpoints;i++, v += 3)
VectorCopy(portal->points[i].position, v);
+ GL_LockArrays(0, portal->numpoints);
R_Mesh_Draw(portal->numpoints, portal->numpoints - 2, polygonelements);
+ GL_LockArrays(0, 0);
}
// LordHavoc: this is just a nice debugging tool, very slow
R_Mesh_State(&m);
i = ((int)brush) / sizeof(colbrushf_t);
GL_Color((i & 31) * (1.0f / 32.0f), ((i >> 5) & 31) * (1.0f / 32.0f), ((i >> 10) & 31) * (1.0f / 32.0f), 0.2f);
+ GL_LockArrays(0, brush->numpoints);
R_Mesh_Draw(brush->numpoints, brush->numtriangles, brush->elements);
+ GL_LockArrays(0, 0);
}
void R_Q3BSP_DrawCollisionFace(entity_render_t *ent, q3mface_t *face)
R_Mesh_State(&m);
i = ((int)face) / sizeof(q3mface_t);
GL_Color((i & 31) * (1.0f / 32.0f), ((i >> 5) & 31) * (1.0f / 32.0f), ((i >> 10) & 31) * (1.0f / 32.0f), 0.2f);
+ GL_LockArrays(0, face->num_collisionvertices);
R_Mesh_Draw(face->num_collisionvertices, face->num_collisiontriangles, face->data_collisionelement3i);
+ GL_LockArrays(0, 0);
}
void R_Q3BSP_DrawSkyFace(entity_render_t *ent, q3mface_t *face)
m.pointer_vertex = face->data_vertex3f;
R_Mesh_State(&m);
+ GL_LockArrays(0, face->num_vertices);
R_Mesh_Draw(face->num_vertices, face->num_triangles, face->data_element3i);
+ GL_LockArrays(0, 0);
GL_ColorMask(1,1,1,1);
}
GL_Color(0, 0, 0, 1);
m.pointer_vertex = face->data_vertex3f;
R_Mesh_State(&m);
+ GL_LockArrays(0, face->num_vertices);
R_Mesh_Draw(face->num_vertices, face->num_triangles, face->data_element3i);
+ GL_LockArrays(0, 0);
}
void R_Q3BSP_DrawFace_OpaqueWall_Pass_TextureLightmapCombine(entity_render_t *ent, q3mface_t *face)
GL_Color(1, 1, 1, 1);
m.pointer_vertex = face->data_vertex3f;
R_Mesh_State(&m);
+ GL_LockArrays(0, face->num_vertices);
R_Mesh_Draw(face->num_vertices, face->num_triangles, face->data_element3i);
+ GL_LockArrays(0, 0);
}
void R_Q3BSP_DrawFace_OpaqueWall_Pass_Texture(entity_render_t *ent, q3mface_t *face)
GL_Color(1, 1, 1, 1);
m.pointer_vertex = face->data_vertex3f;
R_Mesh_State(&m);
+ GL_LockArrays(0, face->num_vertices);
R_Mesh_Draw(face->num_vertices, face->num_triangles, face->data_element3i);
+ GL_LockArrays(0, 0);
}
void R_Q3BSP_DrawFace_OpaqueWall_Pass_Lightmap(entity_render_t *ent, q3mface_t *face)
GL_Color(1, 1, 1, 1);
m.pointer_vertex = face->data_vertex3f;
R_Mesh_State(&m);
+ GL_LockArrays(0, face->num_vertices);
R_Mesh_Draw(face->num_vertices, face->num_triangles, face->data_element3i);
+ GL_LockArrays(0, 0);
}
void R_Q3BSP_DrawFace_OpaqueWall_Pass_LightmapOnly(entity_render_t *ent, q3mface_t *face)
GL_Color(1, 1, 1, 1);
m.pointer_vertex = face->data_vertex3f;
R_Mesh_State(&m);
+ GL_LockArrays(0, face->num_vertices);
R_Mesh_Draw(face->num_vertices, face->num_triangles, face->data_element3i);
+ GL_LockArrays(0, 0);
}
void R_Q3BSP_DrawFace_OpaqueWall_Pass_Glow(entity_render_t *ent, q3mface_t *face)
GL_Color(0, 0, 0, 1);
m.pointer_vertex = face->data_vertex3f;
R_Mesh_State(&m);
+ GL_LockArrays(0, face->num_vertices);
R_Mesh_Draw(face->num_vertices, face->num_triangles, face->data_element3i);
+ GL_LockArrays(0, 0);
}
void R_Q3BSP_DrawFace_OpaqueWall_Pass_TextureVertex(entity_render_t *ent, q3mface_t *face)
}
m.pointer_vertex = face->data_vertex3f;
R_Mesh_State(&m);
+ GL_LockArrays(0, face->num_vertices);
R_Mesh_Draw(face->num_vertices, face->num_triangles, face->data_element3i);
+ GL_LockArrays(0, 0);
}
void R_Q3BSP_DrawFace_OpaqueWall_Pass_VertexOnly(entity_render_t *ent, q3mface_t *face)
}
m.pointer_vertex = face->data_vertex3f;
R_Mesh_State(&m);
+ GL_LockArrays(0, face->num_vertices);
R_Mesh_Draw(face->num_vertices, face->num_triangles, face->data_element3i);
+ GL_LockArrays(0, 0);
}
void R_Q3BSP_DrawFace_OpaqueWall_Pass_AddTextureAmbient(entity_render_t *ent, q3mface_t *face)
GL_Color(r_ambient.value * (1.0f / 128.0f), r_ambient.value * (1.0f / 128.0f), r_ambient.value * (1.0f / 128.0f), 1);
m.pointer_vertex = face->data_vertex3f;
R_Mesh_State(&m);
+ GL_LockArrays(0, face->num_vertices);
R_Mesh_Draw(face->num_vertices, face->num_triangles, face->data_element3i);
+ GL_LockArrays(0, 0);
}
void R_Q3BSP_DrawFace_TransparentCallback(const void *voident, int facenumber)
m.pointer_vertex = face->data_vertex3f;
R_Mesh_State(&m);
qglDisable(GL_CULL_FACE);
+ GL_LockArrays(0, face->num_vertices);
R_Mesh_Draw(face->num_vertices, face->num_triangles, face->data_element3i);
+ GL_LockArrays(0, 0);
qglEnable(GL_CULL_FACE);
}
GL_Color(alpha, alpha, alpha, 1);
+ GL_LockArrays(0, numverts);
R_Mesh_Draw(numverts, numtriangles, explosiontris[0]);
+ GL_LockArrays(0, 0);
}
void R_MoveExplosion(explosion_t *e)
R_Mesh_State(&m);
// draw the 3 polygons as one batch of 6 triangles using the 12 vertices
+ GL_LockArrays(0, 12);
R_Mesh_Draw(12, 6, r_lightningbeamelements);
+ GL_LockArrays(0, 0);
}
void R_DrawLightningBeams(void)
memset(&m, 0, sizeof(m));
m.pointer_vertex = vertex3f;
R_Mesh_State(&m);
+ GL_LockArrays(0, numvertices);
if (r_shadowstage == SHADOWSTAGE_STENCIL)
{
// decrement stencil if frontface is behind depthbuffer
R_Mesh_Draw(numvertices, numtriangles, element3i);
c_rt_shadowmeshes++;
c_rt_shadowtris += numtriangles;
+ GL_LockArrays(0, 0);
}
void R_Shadow_RenderShadowMeshVolume(shadowmesh_t *firstmesh)
{
m.pointer_vertex = mesh->vertex3f;
R_Mesh_State(&m);
+ GL_LockArrays(0, mesh->numverts);
if (r_shadowstage == SHADOWSTAGE_STENCIL)
{
// decrement stencil if frontface is behind depthbuffer
R_Mesh_Draw(mesh->numverts, mesh->numtriangles, mesh->element3i);
c_rtcached_shadowmeshes++;
c_rtcached_shadowtris += mesh->numtriangles;
+ GL_LockArrays(0, 0);
}
}
GL_BlendFunc(GL_ONE, GL_ZERO);
R_Shadow_GenTexCoords_Diffuse_NormalCubeMap(varray_texcoord3f[1], numverts, vertex3f, svector3f, tvector3f, normal3f, relativelightorigin);
R_Shadow_Transform_Vertex3f_TexCoord3f(varray_texcoord3f[2], numverts, vertex3f, matrix_modeltoattenuationxyz);
+ GL_LockArrays(0, numverts);
R_Mesh_Draw(numverts, numtriangles, elements);
+ GL_LockArrays(0, 0);
c_rt_lightmeshes++;
c_rt_lighttris += numtriangles;
R_Shadow_Transform_Vertex3f_TexCoord3f(varray_texcoord3f[1], numverts, vertex3f, matrix_modeltolight);
}
R_Mesh_State(&m);
+ GL_LockArrays(0, numverts);
GL_ColorMask(1,1,1,0);
GL_BlendFunc(GL_DST_ALPHA, GL_ONE);
VectorScale(lightcolor, r_shadow_lightintensityscale.value, color2);
c_rt_lightmeshes++;
c_rt_lighttris += numtriangles;
}
+ GL_LockArrays(0, 0);
}
else if (r_shadow_texture3d.integer && r_textureunits.integer >= 2 && lightcubemap)
{
GL_ColorMask(0,0,0,1);
GL_BlendFunc(GL_ONE, GL_ZERO);
R_Shadow_Transform_Vertex3f_TexCoord3f(varray_texcoord3f[0], numverts, vertex3f, matrix_modeltoattenuationxyz);
+ GL_LockArrays(0, numverts);
R_Mesh_Draw(numverts, numtriangles, elements);
+ GL_LockArrays(0, 0);
c_rt_lightmeshes++;
c_rt_lighttris += numtriangles;
R_Mesh_State(&m);
GL_BlendFunc(GL_DST_ALPHA, GL_ZERO);
R_Shadow_GenTexCoords_Diffuse_NormalCubeMap(varray_texcoord3f[1], numverts, vertex3f, svector3f, tvector3f, normal3f, relativelightorigin);
+ GL_LockArrays(0, numverts);
R_Mesh_Draw(numverts, numtriangles, elements);
+ GL_LockArrays(0, 0);
c_rt_lightmeshes++;
c_rt_lighttris += numtriangles;
R_Shadow_Transform_Vertex3f_TexCoord3f(varray_texcoord3f[1], numverts, vertex3f, matrix_modeltolight);
}
R_Mesh_State(&m);
+ GL_LockArrays(0, numverts);
GL_ColorMask(1,1,1,0);
GL_BlendFunc(GL_DST_ALPHA, GL_ONE);
VectorScale(lightcolor, r_shadow_lightintensityscale.value, color2);
c_rt_lightmeshes++;
c_rt_lighttris += numtriangles;
}
+ GL_LockArrays(0, 0);
}
else if (r_shadow_texture3d.integer && r_textureunits.integer >= 2 && !lightcubemap)
{
GL_ColorMask(0,0,0,1);
GL_BlendFunc(GL_ONE, GL_ZERO);
R_Shadow_GenTexCoords_Diffuse_NormalCubeMap(varray_texcoord3f[1], numverts, vertex3f, svector3f, tvector3f, normal3f, relativelightorigin);
+ GL_LockArrays(0, numverts);
R_Mesh_Draw(numverts, numtriangles, elements);
+ GL_LockArrays(0, 0);
c_rt_lightmeshes++;
c_rt_lighttris += numtriangles;
m.pointer_texcoord[0] = texcoord2f;
m.pointer_texcoord[1] = varray_texcoord3f[1];
R_Mesh_State(&m);
+ GL_LockArrays(0, numverts);
GL_ColorMask(1,1,1,0);
GL_BlendFunc(GL_DST_ALPHA, GL_ONE);
R_Shadow_Transform_Vertex3f_TexCoord3f(varray_texcoord3f[1], numverts, vertex3f, matrix_modeltoattenuationxyz);
c_rt_lightmeshes++;
c_rt_lighttris += numtriangles;
}
+ GL_LockArrays(0, 0);
}
else if (r_textureunits.integer >= 4)
{
R_Shadow_GenTexCoords_Diffuse_NormalCubeMap(varray_texcoord3f[1], numverts, vertex3f, svector3f, tvector3f, normal3f, relativelightorigin);
R_Shadow_Transform_Vertex3f_TexCoord2f(varray_texcoord2f[2], numverts, vertex3f, matrix_modeltoattenuationxyz);
R_Shadow_Transform_Vertex3f_TexCoord2f(varray_texcoord2f[3], numverts, vertex3f, matrix_modeltoattenuationz);
+ GL_LockArrays(0, numverts);
R_Mesh_Draw(numverts, numtriangles, elements);
+ GL_LockArrays(0, 0);
c_rt_lightmeshes++;
c_rt_lighttris += numtriangles;
R_Shadow_Transform_Vertex3f_TexCoord3f(varray_texcoord3f[1], numverts, vertex3f, matrix_modeltolight);
}
R_Mesh_State(&m);
+ GL_LockArrays(0, numverts);
GL_ColorMask(1,1,1,0);
GL_BlendFunc(GL_DST_ALPHA, GL_ONE);
VectorScale(lightcolor, r_shadow_lightintensityscale.value, color2);
c_rt_lightmeshes++;
c_rt_lighttris += numtriangles;
}
+ GL_LockArrays(0, 0);
}
else
{
GL_BlendFunc(GL_ONE, GL_ZERO);
R_Shadow_Transform_Vertex3f_TexCoord2f(varray_texcoord2f[0], numverts, vertex3f, matrix_modeltoattenuationxyz);
R_Shadow_Transform_Vertex3f_TexCoord2f(varray_texcoord2f[1], numverts, vertex3f, matrix_modeltoattenuationz);
+ GL_LockArrays(0, numverts);
R_Mesh_Draw(numverts, numtriangles, elements);
+ GL_LockArrays(0, 0);
c_rt_lightmeshes++;
c_rt_lighttris += numtriangles;
R_Mesh_State(&m);
GL_BlendFunc(GL_DST_ALPHA, GL_ZERO);
R_Shadow_GenTexCoords_Diffuse_NormalCubeMap(varray_texcoord3f[1], numverts, vertex3f, svector3f, tvector3f, normal3f, relativelightorigin);
+ GL_LockArrays(0, numverts);
R_Mesh_Draw(numverts, numtriangles, elements);
+ GL_LockArrays(0, 0);
c_rt_lightmeshes++;
c_rt_lighttris += numtriangles;
R_Shadow_Transform_Vertex3f_TexCoord3f(varray_texcoord3f[1], numverts, vertex3f, matrix_modeltolight);
}
R_Mesh_State(&m);
+ GL_LockArrays(0, numverts);
GL_ColorMask(1,1,1,0);
GL_BlendFunc(GL_DST_ALPHA, GL_ONE);
VectorScale(lightcolor, r_shadow_lightintensityscale.value, color2);
c_rt_lightmeshes++;
c_rt_lighttris += numtriangles;
}
+ GL_LockArrays(0, 0);
}
}
else
R_Shadow_Transform_Vertex3f_TexCoord2f(varray_texcoord2f[1], numverts, vertex3f, matrix_modeltoattenuationxyz);
}
R_Mesh_State(&m);
+ GL_LockArrays(0, numverts);
for (renders = 0;renders < 64 && (color2[0] > 0 || color2[1] > 0 || color2[2] > 0);renders++, color2[0]--, color2[1]--, color2[2]--)
{
color[0] = bound(0, color2[0], 1);
c_rt_lightmeshes++;
c_rt_lighttris += numtriangles;
}
+ GL_LockArrays(0, 0);
}
}
// this squares the result
GL_BlendFunc(GL_SRC_ALPHA, GL_ZERO);
R_Shadow_GenTexCoords_Specular_NormalCubeMap(varray_texcoord3f[1], numverts, vertex3f, svector3f, tvector3f, normal3f, relativelightorigin, relativeeyeorigin);
+ GL_LockArrays(0, numverts);
R_Mesh_Draw(numverts, numtriangles, elements);
+ GL_LockArrays(0, 0);
c_rt_lightmeshes++;
c_rt_lighttris += numtriangles;
memset(&m, 0, sizeof(m));
m.pointer_vertex = vertex3f;
R_Mesh_State(&m);
+ GL_LockArrays(0, numverts);
// square alpha in framebuffer a few times to make it shiny
GL_BlendFunc(GL_ZERO, GL_DST_ALPHA);
// these comments are a test run through this math for intensity 0.5
R_Mesh_Draw(numverts, numtriangles, elements);
c_rt_lightmeshes++;
c_rt_lighttris += numtriangles;
+ GL_LockArrays(0, 0);
memset(&m, 0, sizeof(m));
m.pointer_vertex = vertex3f;
R_Mesh_State(&m);
GL_BlendFunc(GL_DST_ALPHA, GL_ZERO);
R_Shadow_Transform_Vertex3f_TexCoord3f(varray_texcoord3f[0], numverts, vertex3f, matrix_modeltoattenuationxyz);
+ GL_LockArrays(0, numverts);
R_Mesh_Draw(numverts, numtriangles, elements);
+ GL_LockArrays(0, 0);
c_rt_lightmeshes++;
c_rt_lighttris += numtriangles;
}
m.pointer_texcoord[0] = texcoord2f;
R_Mesh_State(&m);
+ GL_LockArrays(0, numverts);
GL_ColorMask(1,1,1,0);
GL_BlendFunc(GL_DST_ALPHA, GL_ONE);
VectorScale(lightcolor, colorscale, color2);
c_rt_lightmeshes++;
c_rt_lighttris += numtriangles;
}
+ GL_LockArrays(0, 0);
}
else if (r_shadow_texture3d.integer && r_textureunits.integer >= 2 && !lightcubemap /*&& gl_support_blendsquare*/) // FIXME: detect blendsquare!
{
// this squares the result
GL_BlendFunc(GL_SRC_ALPHA, GL_ZERO);
R_Shadow_GenTexCoords_Specular_NormalCubeMap(varray_texcoord3f[1], numverts, vertex3f, svector3f, tvector3f, normal3f, relativelightorigin, relativeeyeorigin);
+ GL_LockArrays(0, numverts);
R_Mesh_Draw(numverts, numtriangles, elements);
+ GL_LockArrays(0, 0);
c_rt_lightmeshes++;
c_rt_lighttris += numtriangles;
memset(&m, 0, sizeof(m));
m.pointer_vertex = vertex3f;
R_Mesh_State(&m);
+ GL_LockArrays(0, numverts);
// square alpha in framebuffer a few times to make it shiny
GL_BlendFunc(GL_ZERO, GL_DST_ALPHA);
// these comments are a test run through this math for intensity 0.5
R_Mesh_Draw(numverts, numtriangles, elements);
c_rt_lightmeshes++;
c_rt_lighttris += numtriangles;
+ GL_LockArrays(0, 0);
memset(&m, 0, sizeof(m));
m.pointer_vertex = vertex3f;
m.pointer_texcoord[0] = texcoord2f;
m.pointer_texcoord[1] = varray_texcoord3f[1];
R_Mesh_State(&m);
+ GL_LockArrays(0, numverts);
GL_ColorMask(1,1,1,0);
GL_BlendFunc(GL_DST_ALPHA, GL_ONE);
R_Shadow_Transform_Vertex3f_TexCoord3f(varray_texcoord3f[1], numverts, vertex3f, matrix_modeltoattenuationxyz);
c_rt_lightmeshes++;
c_rt_lighttris += numtriangles;
}
+ GL_LockArrays(0, 0);
}
else if (r_textureunits.integer >= 2 /*&& gl_support_blendsquare*/) // FIXME: detect blendsquare!
{
// this squares the result
GL_BlendFunc(GL_SRC_ALPHA, GL_ZERO);
R_Shadow_GenTexCoords_Specular_NormalCubeMap(varray_texcoord3f[1], numverts, vertex3f, svector3f, tvector3f, normal3f, relativelightorigin, relativeeyeorigin);
+ GL_LockArrays(0, numverts);
R_Mesh_Draw(numverts, numtriangles, elements);
+ GL_LockArrays(0, 0);
c_rt_lightmeshes++;
c_rt_lighttris += numtriangles;
memset(&m, 0, sizeof(m));
m.pointer_vertex = vertex3f;
R_Mesh_State(&m);
+ GL_LockArrays(0, numverts);
// square alpha in framebuffer a few times to make it shiny
GL_BlendFunc(GL_ZERO, GL_DST_ALPHA);
// these comments are a test run through this math for intensity 0.5
R_Mesh_Draw(numverts, numtriangles, elements);
c_rt_lightmeshes++;
c_rt_lighttris += numtriangles;
+ GL_LockArrays(0, 0);
memset(&m, 0, sizeof(m));
m.pointer_vertex = vertex3f;
GL_BlendFunc(GL_DST_ALPHA, GL_ZERO);
R_Shadow_Transform_Vertex3f_TexCoord2f(varray_texcoord2f[0], numverts, vertex3f, matrix_modeltoattenuationxyz);
R_Shadow_Transform_Vertex3f_TexCoord2f(varray_texcoord2f[1], numverts, vertex3f, matrix_modeltoattenuationz);
+ GL_LockArrays(0, numverts);
R_Mesh_Draw(numverts, numtriangles, elements);
+ GL_LockArrays(0, 0);
c_rt_lightmeshes++;
c_rt_lighttris += numtriangles;
}
m.pointer_texcoord[0] = texcoord2f;
R_Mesh_State(&m);
+ GL_LockArrays(0, numverts);
GL_ColorMask(1,1,1,0);
GL_BlendFunc(GL_DST_ALPHA, GL_ONE);
VectorScale(lightcolor, colorscale, color2);
c_rt_lightmeshes++;
c_rt_lighttris += numtriangles;
}
+ GL_LockArrays(0, 0);
}
}
}
GL_DepthTest(false); // don't modify or read zbuffer
m.pointer_vertex = skyboxvertex3f;
m.pointer_texcoord[0] = skyboxtexcoord2f;
+ GL_LockArrays(0, 6*4);
for (i = 0;i < 6;i++)
{
m.tex[0] = R_GetTexture(skyboxside[i]);
R_Mesh_State(&m);
R_Mesh_Draw(6*4, 2, skyboxelements + i * 6);
}
+ GL_LockArrays(0, 0);
}
#define skygridx 32
m.pointer_texcoord[1] = skysphere_texcoord2f;
R_Mesh_State(&m);
R_Mesh_TextureMatrix(1, &scroll2matrix);
+ GL_LockArrays(0, skysphere_numverts);
R_Mesh_Draw(skysphere_numverts, skysphere_numtriangles, skysphere_element3i);
+ GL_LockArrays(0, 0);
R_Mesh_TextureMatrix(1, &identitymatrix);
}
else
{
// two pass
R_Mesh_State(&m);
+ GL_LockArrays(0, skysphere_numverts);
R_Mesh_Draw(skysphere_numverts, skysphere_numtriangles, skysphere_element3i);
+ GL_LockArrays(0, 0);
GL_BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
m.tex[0] = R_GetTexture(alphaskytexture);
R_Mesh_State(&m);
R_Mesh_TextureMatrix(0, &scroll2matrix);
+ GL_LockArrays(0, skysphere_numverts);
R_Mesh_Draw(skysphere_numverts, skysphere_numtriangles, skysphere_element3i);
+ GL_LockArrays(0, 0);
}
R_Mesh_TextureMatrix(0, &identitymatrix);
}
-n darkplaces: write a readme (Antti)
-n dpmod: make grapple off-hand (joe hill)
-n darkplaces: add DP_SV_ROTATINGBMODEL extension to explain that MOVETYPE_PUSH/SOLID_BSP support rotation in darkplaces and a demonstration of how to use it without qc modifications (Uffe, Supajoe)
+2 darkplaces: shadow volume rendering should not unlock the arrays between renders (Mercury)
3 darkplaces: add Draw2D function to model struct to make it easy to draw models without an entity (Tomaz)
0 darkplaces: add GL_EXT_stencil_two_side support to shadow rendering (fuh)
0 darkplaces: add Mem_AllocNoClear function, and use it where possible, if developer is on it should clear with random garbage