]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
UNMERGE
authorhavoc havoc@d7cf8633-e32d-0410-b094-e92efae38249 <>
Thu, 15 Jul 2010 12:38:52 +0000 (12:38 +0000)
committerRudolf Polzer <divverent@alientrap.org>
Fri, 24 Sep 2010 20:00:39 +0000 (22:00 +0200)
improved r_shadows 2 shadowmapping setup code a bit, especially the
debugging code snippets

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@10330 d7cf8633-e32d-0410-b094-e92efae38249
::stable-branch::unmerge=3b9340be64eef705edfc005476b9913a314b8c84

r_shadow.c

index 4392b2ed94df92d384d1d51fc2e90a7908dc15cc..b4b04085543c20ae3b615b9929f168194ff1b768 100644 (file)
@@ -4452,33 +4452,26 @@ void R_DrawModelShadowMaps(void)
        R_Viewport_InitOrtho(&viewport, &cameramatrix, 0, 0, size, size, 0, 0, 1, 1, 0, -1, NULL); 
 
        VectorMA(shadoworigin, (1.0f - fabs(dot1)) * radius, shadowforward, shadoworigin);
-
+#if 0
+       R_Mesh_ResetRenderTargets();
+       R_SetupShader_ShowDepth();
+#else
        R_Mesh_SetRenderTargets(fbo, r_shadow_shadowmap2dtexture, NULL, NULL, NULL, NULL);
        R_SetupShader_DepthOrShadow();
+#endif
        GL_PolygonOffset(r_shadow_shadowmapping_polygonfactor.value, r_shadow_shadowmapping_polygonoffset.value);
        GL_DepthMask(true);
        GL_DepthTest(true);
        R_SetViewport(&viewport);
        GL_Scissor(viewport.x, viewport.y, min(viewport.width + r_shadow_shadowmapborder, 2*r_shadow_shadowmapmaxsize), viewport.height + r_shadow_shadowmapborder);
        Vector4Set(clearcolor, 1,1,1,1);
-       // in D3D9 we have to render to a color texture shadowmap
-       // in GL we render directly to a depth texture only
-       if (r_shadow_shadowmap2dtexture)
-               GL_Clear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT, clearcolor, 1.0f, 0);
-       else
-               GL_Clear(GL_DEPTH_BUFFER_BIT, clearcolor, 1.0f, 0);
-       // render into a slightly restricted region so that the borders of the
-       // shadowmap area fade away, rather than streaking across everything
-       // outside the usable area
-       GL_Scissor(viewport.x + r_shadow_shadowmapborder, viewport.y + r_shadow_shadowmapborder, viewport.width - 2*r_shadow_shadowmapborder, viewport.height - 2*r_shadow_shadowmapborder);
-
 #if 0
-       // debugging
-       R_Mesh_ResetRenderTargets();
-       R_SetupShader_ShowDepth();
-       GL_ColorMask(1,1,1,1);
        GL_Clear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT, clearcolor, 1.0f, 0);
+#else
+       GL_Clear(GL_DEPTH_BUFFER_BIT, clearcolor, 1.0f, 0);
 #endif
+       GL_Scissor(viewport.x + r_shadow_shadowmapborder, viewport.y + r_shadow_shadowmapborder, viewport.width - 2*r_shadow_shadowmapborder, viewport.height - 2*r_shadow_shadowmapborder);
 
        for (i = 0;i < r_refdef.scene.numentities;i++)
        {
@@ -4504,19 +4497,6 @@ void R_DrawModelShadowMaps(void)
                }
        }
 
-#if 0
-       if (r_test.integer)
-       {
-               unsigned char *rawpixels = Z_Malloc(viewport.width*viewport.height*4);
-               CHECKGLERROR
-               qglReadPixels(viewport.x, viewport.y, viewport.width, viewport.height, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, rawpixels);
-               CHECKGLERROR
-               Image_WriteTGABGRA("r_shadows_2.tga", viewport.width, viewport.height, rawpixels);
-               Cvar_SetValueQuick(&r_test, 0);
-               Z_Free(rawpixels);
-       }
-#endif
-
        R_Shadow_RenderMode_End();
 
        Matrix4x4_Concat(&mvpmatrix, &r_refdef.view.viewport.projectmatrix, &r_refdef.view.viewport.viewmatrix);