- if (surf->dlightframe == r_framecount)
- RSurf_LightSeparate_Vertex3f_Color4f(&ent->inversematrix, surf->dlightbits, surf->mesh.num_vertices, surf->mesh.data_vertex3f, varray_color4f, 1);
- if (surf->flags & SURF_LIGHTMAP)
- 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);
- R_Mesh_Draw(surf->mesh.num_vertices, surf->mesh.num_triangles, surf->mesh.data_element3i);
-}
-
-static void RSurfShader_Wall_Pass_Glow(const entity_render_t *ent, const msurface_t *surf, const texture_t *texture, int rendertype, float currentalpha)
-{
- rmeshstate_t m;
- float modelorg[3];
- Matrix4x4_Transform(&ent->inversematrix, r_origin, modelorg);
- memset(&m, 0, sizeof(m));
- GL_BlendFunc(GL_SRC_ALPHA, GL_ONE);
- GL_DepthMask(false);
- GL_DepthTest(true);
- m.tex[0] = R_GetTexture(texture->skin.glow);
- GL_ColorPointer(varray_color4f);
-
- GL_VertexPointer(surf->mesh.data_vertex3f);
- if (m.tex[0])
- m.pointer_texcoord[0] = surf->mesh.data_texcoordtexture2f;
- R_Mesh_State_Texture(&m);
- RSurf_FoggedColors_Vertex3f_Color4f(surf->mesh.data_vertex3f, varray_color4f, 1, 1, 1, currentalpha, 1, surf->mesh.num_vertices, modelorg);
- R_Mesh_Draw(surf->mesh.num_vertices, surf->mesh.num_triangles, surf->mesh.data_element3i);
-}
-
-static void RSurfShader_Wall_Pass_Fog(const entity_render_t *ent, const msurface_t *surf, const texture_t *texture, int rendertype, float currentalpha)
-{
- rmeshstate_t m;
- float modelorg[3];
- Matrix4x4_Transform(&ent->inversematrix, r_origin, modelorg);
- memset(&m, 0, sizeof(m));
- GL_BlendFunc(GL_SRC_ALPHA, GL_ONE);
- GL_DepthMask(false);
- GL_DepthTest(true);
- m.tex[0] = R_GetTexture(texture->skin.fog);
- GL_ColorPointer(varray_color4f);
-
- GL_VertexPointer(surf->mesh.data_vertex3f);
- if (m.tex[0])
- m.pointer_texcoord[0] = surf->mesh.data_texcoordtexture2f;
- R_Mesh_State_Texture(&m);
- RSurf_FogPassColors_Vertex3f_Color4f(surf->mesh.data_vertex3f, varray_color4f, fogcolor[0], fogcolor[1], fogcolor[2], currentalpha, 1, surf->mesh.num_vertices, modelorg);
- R_Mesh_Draw(surf->mesh.num_vertices, surf->mesh.num_triangles, surf->mesh.data_element3i);
-}
-
-static void RSurfShader_OpaqueWall_Pass_BaseTripleTexCombine(const entity_render_t *ent, const texture_t *texture, msurface_t **surfchain)
-{
- const msurface_t *surf;
- rmeshstate_t m;
- int lightmaptexturenum;
- memset(&m, 0, sizeof(m));
- GL_BlendFunc(GL_ONE, GL_ZERO);
- GL_DepthMask(true);
- GL_DepthTest(true);
- m.tex[0] = R_GetTexture(texture->skin.base);
- m.tex[1] = R_GetTexture((**surfchain).lightmaptexture);
- m.texrgbscale[1] = 2;
- m.tex[2] = R_GetTexture(texture->skin.detail);
- m.texrgbscale[2] = 2;
- GL_Color(1, 1, 1, 1);
-
- while((surf = *surfchain++) != NULL)
- {
- if (surf->visframe == r_framecount)
- {
- lightmaptexturenum = R_GetTexture(surf->lightmaptexture);
- //if (m.tex[1] != lightmaptexturenum)
- //{
- m.tex[1] = lightmaptexturenum;
- // R_Mesh_State_Texture(&m);
- //}
- GL_VertexPointer(surf->mesh.data_vertex3f);
- m.pointer_texcoord[0] = surf->mesh.data_texcoordtexture2f;
- m.pointer_texcoord[1] = surf->mesh.data_texcoordlightmap2f;
- m.pointer_texcoord[2] = surf->mesh.data_texcoorddetail2f;
- R_Mesh_State_Texture(&m);
- R_Mesh_Draw(surf->mesh.num_vertices, surf->mesh.num_triangles, surf->mesh.data_element3i);
- }
- }
-}
-
-static void RSurfShader_OpaqueWall_Pass_BaseDoubleTexCombine(const entity_render_t *ent, const texture_t *texture, msurface_t **surfchain)
-{
- const msurface_t *surf;
- rmeshstate_t m;
- int lightmaptexturenum;
- memset(&m, 0, sizeof(m));
- GL_BlendFunc(GL_ONE, GL_ZERO);
- GL_DepthMask(true);
- GL_DepthTest(true);
- m.tex[0] = R_GetTexture(texture->skin.base);
- m.tex[1] = R_GetTexture((**surfchain).lightmaptexture);
- m.texrgbscale[1] = 2;
- GL_Color(1, 1, 1, 1);
- while((surf = *surfchain++) != NULL)
- {
- if (surf->visframe == r_framecount)
- {
- lightmaptexturenum = R_GetTexture(surf->lightmaptexture);
- //if (m.tex[1] != lightmaptexturenum)
- //{
- m.tex[1] = lightmaptexturenum;
- // R_Mesh_State_Texture(&m);
- //}
- GL_VertexPointer(surf->mesh.data_vertex3f);
- m.pointer_texcoord[0] = surf->mesh.data_texcoordtexture2f;
- m.pointer_texcoord[1] = surf->mesh.data_texcoordlightmap2f;
- R_Mesh_State_Texture(&m);
- R_Mesh_Draw(surf->mesh.num_vertices, surf->mesh.num_triangles, surf->mesh.data_element3i);
- }
- }
-}
-
-static void RSurfShader_OpaqueWall_Pass_BaseTexture(const entity_render_t *ent, const texture_t *texture, msurface_t **surfchain)
-{
- const msurface_t *surf;
- rmeshstate_t m;
- memset(&m, 0, sizeof(m));
- GL_DepthMask(true);
- GL_DepthTest(true);
- GL_BlendFunc(GL_ONE, GL_ZERO);
- m.tex[0] = R_GetTexture(texture->skin.base);
- GL_Color(1, 1, 1, 1);
- while((surf = *surfchain++) != NULL)
- {
- if (surf->visframe == r_framecount)
- {
- GL_VertexPointer(surf->mesh.data_vertex3f);
- m.pointer_texcoord[0] = surf->mesh.data_texcoordtexture2f;
- R_Mesh_State_Texture(&m);
- R_Mesh_Draw(surf->mesh.num_vertices, surf->mesh.num_triangles, surf->mesh.data_element3i);
- }
- }
-}
-
-static void RSurfShader_OpaqueWall_Pass_BaseLightmap(const entity_render_t *ent, const texture_t *texture, msurface_t **surfchain)
-{
- const msurface_t *surf;
- rmeshstate_t m;
- int lightmaptexturenum;
- memset(&m, 0, sizeof(m));
- GL_BlendFunc(GL_DST_COLOR, GL_SRC_COLOR);
- GL_DepthMask(false);
- GL_DepthTest(true);
- m.tex[0] = R_GetTexture((**surfchain).lightmaptexture);
- GL_Color(1, 1, 1, 1);
- while((surf = *surfchain++) != NULL)
- {
- if (surf->visframe == r_framecount)
- {
- lightmaptexturenum = R_GetTexture(surf->lightmaptexture);
- //if (m.tex[0] != lightmaptexturenum)
- //{
- m.tex[0] = lightmaptexturenum;
- // R_Mesh_State_Texture(&m);
- //}
- GL_VertexPointer(surf->mesh.data_vertex3f);
- m.pointer_texcoord[0] = surf->mesh.data_texcoordlightmap2f;
- R_Mesh_State_Texture(&m);
- R_Mesh_Draw(surf->mesh.num_vertices, surf->mesh.num_triangles, surf->mesh.data_element3i);
- }
- }
-}
-
-static void RSurfShader_OpaqueWall_Pass_Fog(const entity_render_t *ent, const texture_t *texture, msurface_t **surfchain)
-{
- const msurface_t *surf;
- rmeshstate_t m;
- float modelorg[3];
- Matrix4x4_Transform(&ent->inversematrix, r_origin, modelorg);
- memset(&m, 0, sizeof(m));
- GL_BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
- GL_DepthMask(false);
- GL_DepthTest(true);
- GL_ColorPointer(varray_color4f);
- while((surf = *surfchain++) != NULL)
- {
- if (surf->visframe == r_framecount)
- {
- GL_VertexPointer(surf->mesh.data_vertex3f);
- if (m.tex[0])
- m.pointer_texcoord[0] = surf->mesh.data_texcoordtexture2f;
- R_Mesh_State_Texture(&m);
- RSurf_FogPassColors_Vertex3f_Color4f(surf->mesh.data_vertex3f, varray_color4f, fogcolor[0], fogcolor[1], fogcolor[2], 1, 1, surf->mesh.num_vertices, modelorg);
- R_Mesh_Draw(surf->mesh.num_vertices, surf->mesh.num_triangles, surf->mesh.data_element3i);
- }
- }
-}
-
-static void RSurfShader_OpaqueWall_Pass_BaseDetail(const entity_render_t *ent, const texture_t *texture, msurface_t **surfchain)
-{
- const msurface_t *surf;
- rmeshstate_t m;
- memset(&m, 0, sizeof(m));
- GL_BlendFunc(GL_DST_COLOR, GL_SRC_COLOR);
- GL_DepthMask(false);
- GL_DepthTest(true);
- m.tex[0] = R_GetTexture(texture->skin.detail);
- GL_Color(1, 1, 1, 1);
- while((surf = *surfchain++) != NULL)
- {
- if (surf->visframe == r_framecount)
- {
- GL_VertexPointer(surf->mesh.data_vertex3f);
- m.pointer_texcoord[0] = surf->mesh.data_texcoorddetail2f;
- R_Mesh_State_Texture(&m);
- R_Mesh_Draw(surf->mesh.num_vertices, surf->mesh.num_triangles, surf->mesh.data_element3i);
- }
- }
-}
-
-static void RSurfShader_OpaqueWall_Pass_Glow(const entity_render_t *ent, const texture_t *texture, msurface_t **surfchain)
-{
- const msurface_t *surf;
- rmeshstate_t m;
- memset(&m, 0, sizeof(m));
- GL_BlendFunc(GL_SRC_ALPHA, GL_ONE);
- GL_DepthMask(false);
- GL_DepthTest(true);
- m.tex[0] = R_GetTexture(texture->skin.glow);
- GL_Color(1, 1, 1, 1);
- while((surf = *surfchain++) != NULL)
- {
- if (surf->visframe == r_framecount)