]> de.git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
showsurfaces 3: refactor it a bit; disable r_water in this mode
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Sun, 7 Dec 2008 08:06:38 +0000 (08:06 +0000)
committerdivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Sun, 7 Dec 2008 08:06:38 +0000 (08:06 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@8573 d7cf8633-e32d-0410-b094-e92efae38249

gl_rmain.c

index 5475734c9b4add1db210555db3fc42c14dbc27cc..3da1981e67f3c3bdbb7ad814363d14affb99fa15 100644 (file)
@@ -3027,7 +3027,7 @@ static void R_Water_StartFrame(void)
 
        // calculate desired texture sizes
        // can't use water if the card does not support the texture size
-       if (!r_water.integer || !r_glsl.integer || !gl_support_fragment_shader || waterwidth > gl_max_texture_size || waterheight > gl_max_texture_size)
+       if (!r_water.integer || !r_glsl.integer || !gl_support_fragment_shader || waterwidth > gl_max_texture_size || waterheight > gl_max_texture_size || r_showsurfaces.integer)
                texturewidth = textureheight = waterwidth = waterheight = 0;
        else if (gl_support_arb_texture_non_power_of_two)
        {
@@ -6505,25 +6505,41 @@ static void R_ProcessTextureSurfaceList(int texturenumsurfaces, msurface_t **tex
                RSurf_PrepareVerticesForBatch(false, false, texturenumsurfaces, texturesurfacelist);
                RSurf_DrawBatch_Simple(texturenumsurfaces, texturesurfacelist);
        }
-       else if (r_showsurfaces.integer && !(r_showsurfaces.integer == 3 && (rsurface.texture->currentmaterialflags & MATERIALFLAG_SKY)))
+       else if (r_showsurfaces.integer == 3) // eeepc mode
        {
-               RSurf_SetupDepthAndCulling();
-               GL_AlphaTest(false);
-               R_Mesh_ColorPointer(NULL, 0, 0);
-               R_Mesh_ResetTextureState();
-               R_SetupGenericShader(false);
-               RSurf_PrepareVerticesForBatch(false, false, texturenumsurfaces, texturesurfacelist);
                if (!r_refdef.view.showdebug)
                {
+                       RSurf_SetupDepthAndCulling();
+                       GL_AlphaTest(false);
+                       R_Mesh_ColorPointer(NULL, 0, 0);
+                       R_Mesh_ResetTextureState();
+                       R_SetupGenericShader(false);
+                       RSurf_PrepareVerticesForBatch(false, false, texturenumsurfaces, texturesurfacelist);
                        GL_Color(0, 0, 0, 1);
                        GL_BlendFunc(GL_ONE, GL_ZERO);
                        GL_DepthTest(writedepth);
                        GL_DepthMask(true);
                        RSurf_DrawBatch_Simple(texturenumsurfaces, texturesurfacelist);
                }
-               else if (r_showsurfaces.integer == 3)
+               else 
                {
                        float c[4];
+
+                       if(rsurface.texture->currentmaterialflags & MATERIALFLAG_SKY)
+                       {
+                               R_DrawTextureSurfaceList_Sky(texturenumsurfaces, texturesurfacelist);
+                               return;
+                       }
+
+                       if(!rsurface.texture->currentnumlayers)
+                               return;
+
+                       RSurf_SetupDepthAndCulling();
+                       GL_AlphaTest(false);
+                       R_Mesh_ColorPointer(NULL, 0, 0);
+                       R_Mesh_ResetTextureState();
+                       R_SetupGenericShader(false);
+
                        if(rsurface.texture && rsurface.texture->currentskinframe)
                                memcpy(c, rsurface.texture->currentskinframe->avgcolor, sizeof(c));
                        else
@@ -6578,27 +6594,43 @@ static void R_ProcessTextureSurfaceList(int texturenumsurfaces, msurface_t **tex
                        rsurface.lightmapcolor4f = rsurface.modellightmapcolor4f;
                        rsurface.lightmapcolor4f_bufferobject = rsurface.modellightmapcolor4f_bufferobject;
                        rsurface.lightmapcolor4f_bufferoffset = rsurface.modellightmapcolor4f_bufferoffset;
-                       GL_Color(c[0], c[1], c[2], c[3]);
                        RSurf_DrawBatch_GL11_ApplyAmbient(texturenumsurfaces, texturesurfacelist);
                        RSurf_DrawBatch_GL11_ApplyColor(texturenumsurfaces, texturesurfacelist, c[0], c[1], c[2], c[3]);
 
                        if (rsurface.texture->currentmaterialflags & MATERIALFLAG_MODELLIGHT)
                        {
+                               RSurf_PrepareVerticesForBatch(true, false, texturenumsurfaces, texturesurfacelist);
                                r_refdef.lightmapintensity = 1;
                                RSurf_DrawBatch_GL11_VertexShade(texturenumsurfaces, texturesurfacelist, c[0], c[1], c[2], c[3], false, false);
                                r_refdef.lightmapintensity = 0; // we're in showsurfaces, after all
                        }
                        else
                        {
+                               RSurf_PrepareVerticesForBatch(false, false, texturenumsurfaces, texturesurfacelist);
                                R_Mesh_ColorPointer(rsurface.lightmapcolor4f, rsurface.lightmapcolor4f_bufferobject, rsurface.lightmapcolor4f_bufferoffset);
                                RSurf_DrawBatch_Simple(texturenumsurfaces, texturesurfacelist);
                        }
                }
+       }
+       else if (r_showsurfaces.integer)
+       {
+               RSurf_SetupDepthAndCulling();
+               GL_AlphaTest(false);
+               R_Mesh_ColorPointer(NULL, 0, 0);
+               R_Mesh_ResetTextureState();
+               R_SetupGenericShader(false);
+               RSurf_PrepareVerticesForBatch(false, false, texturenumsurfaces, texturesurfacelist);
+               GL_DepthMask(true);
+               GL_BlendFunc(GL_ONE, GL_ZERO);
+               if (!r_refdef.view.showdebug)
+               {
+                       GL_Color(0, 0, 0, 1);
+                       GL_DepthTest(writedepth);
+                       RSurf_DrawBatch_Simple(texturenumsurfaces, texturesurfacelist);
+               }
                else 
                {
                        GL_DepthTest(true);
-                       GL_DepthMask(true);
-                       GL_BlendFunc(GL_ONE, GL_ZERO);
                        RSurf_DrawBatch_ShowSurfaces(texturenumsurfaces, texturesurfacelist);
                }
        }