- GL_LockArrays(0, surface->mesh.num_vertices);
- R_Mesh_Draw(surface->mesh.num_vertices, surface->mesh.num_triangles, surface->mesh.data_element3i);
- GL_LockArrays(0, 0);
- }
- }
- }
- else
- {
- if (r == 1 && g == 1 && b == 1)
- {
-#if 0
- // experimental direct state calls for measuring
- // R_Mesh_ call overhead, do not use!
- R_Mesh_VertexPointer(varray_vertex3f);
- R_Mesh_TexCoordPointer(0, 2, varray_texcoord2f[0]);
- R_Mesh_TexCoordPointer(1, 2, varray_texcoord2f[1]);
- R_Mesh_TexBind(0, R_GetTexture(r_texture_white));
- R_Mesh_ColorPointer(varray_color4f);
- for (texturesurfaceindex = 0;texturesurfaceindex < texturenumsurfaces;texturesurfaceindex++)
- {
- surface = texturesurfacelist[texturesurfaceindex];
- qglVertexPointer(3, GL_FLOAT, sizeof(float[3]), surface->mesh.data_vertex3f);
- qglClientActiveTexture(GL_TEXTURE0_ARB);
- qglTexCoordPointer(2, GL_FLOAT, sizeof(float[2]), surface->mesh.data_texcoordlightmap2f);
- qglClientActiveTexture(GL_TEXTURE1_ARB);
- qglTexCoordPointer(2, GL_FLOAT, sizeof(float[2]), surface->mesh.data_texcoordtexture2f);
- if (surface->lightmaptexture)
- {
- R_Mesh_TexBind(0, R_GetTexture(surface->lightmaptexture));
- qglDisableClientState(GL_COLOR_ARRAY);
- qglColor4f(r, g, b, 1);
- }
- else //if (r == 1 && g == 1 && b == 1)
- {
- R_Mesh_TexBind(0, R_GetTexture(r_texture_white));
- qglEnableClientState(GL_COLOR_ARRAY);
- qglColorPointer(4, GL_FLOAT, sizeof(float[4]), surface->mesh.data_lightmapcolor4f);
- }
- qglLockArraysEXT(0, surface->mesh.num_vertices);
- qglDrawRangeElements(GL_TRIANGLES, 0, surface->mesh.num_vertices, surface->mesh.num_triangles * 3, GL_UNSIGNED_INT, surface->mesh.data_element3i);
- qglUnlockArraysEXT();
- }
-#else
- for (texturesurfaceindex = 0;texturesurfaceindex < texturenumsurfaces;texturesurfaceindex++)
- {
- surface = texturesurfacelist[texturesurfaceindex];
- R_Mesh_VertexPointer(surface->mesh.data_vertex3f);
- R_Mesh_TexCoordPointer(0, 2, surface->mesh.data_texcoordlightmap2f);
- R_Mesh_TexCoordPointer(1, 2, surface->mesh.data_texcoordtexture2f);
- if (surface->lightmaptexture)
- {
- R_Mesh_TexBind(0, R_GetTexture(surface->lightmaptexture));
- R_Mesh_ColorPointer(NULL);
- }
- else //if (r == 1 && g == 1 && b == 1)
- {
- R_Mesh_TexBind(0, R_GetTexture(r_texture_white));
- R_Mesh_ColorPointer(surface->mesh.data_lightmapcolor4f);
- }
- GL_LockArrays(0, surface->mesh.num_vertices);
- R_Mesh_Draw(surface->mesh.num_vertices, surface->mesh.num_triangles, surface->mesh.data_element3i);
- GL_LockArrays(0, 0);
- }
-#endif
- }
- else
- {
- for (texturesurfaceindex = 0;texturesurfaceindex < texturenumsurfaces;texturesurfaceindex++)
- {
- surface = texturesurfacelist[texturesurfaceindex];
- R_Mesh_VertexPointer(surface->mesh.data_vertex3f);
- R_Mesh_TexCoordPointer(0, 2, surface->mesh.data_texcoordlightmap2f);
- R_Mesh_TexCoordPointer(1, 2, surface->mesh.data_texcoordtexture2f);
- if (surface->lightmaptexture)
- {
- R_Mesh_TexBind(0, R_GetTexture(surface->lightmaptexture));
- R_Mesh_ColorPointer(NULL);
- }
- else
- {
- R_Mesh_TexBind(0, R_GetTexture(r_texture_white));
- R_Mesh_ColorPointer(varray_color4f);
- for (i = 0;i < surface->mesh.num_vertices;i++)
- {
- varray_color4f[i*4+0] = surface->mesh.data_lightmapcolor4f[i*4+0] * r;
- varray_color4f[i*4+1] = surface->mesh.data_lightmapcolor4f[i*4+1] * g;
- varray_color4f[i*4+2] = surface->mesh.data_lightmapcolor4f[i*4+2] * b;
- varray_color4f[i*4+3] = surface->mesh.data_lightmapcolor4f[i*4+3];
- }
- }
- GL_LockArrays(0, surface->mesh.num_vertices);
- R_Mesh_Draw(surface->mesh.num_vertices, surface->mesh.num_triangles, surface->mesh.data_element3i);
- GL_LockArrays(0, 0);