]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
Move Alpha-To-Coverage stuff to gl_backend.c, fix bug with shadows rendering.
authorvortex <vortex@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 9 May 2011 11:28:12 +0000 (11:28 +0000)
committervortex <vortex@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 9 May 2011 11:28:12 +0000 (11:28 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11139 d7cf8633-e32d-0410-b094-e92efae38249

gl_backend.c
gl_rmain.c
r_shadow.c

index 6fc886ba0052b212304e5857536ddbcc4928ec79..e8d2e6408dd4dc597c2a52bfbb9dbb86e4ec4c10 100644 (file)
@@ -2155,6 +2155,14 @@ void GL_AlphaTest(int state)
                        break;
                case RENDERPATH_GL20:
                case RENDERPATH_GLES2:
+                       if (vid_multisampling.integer)
+                       {
+                               if (gl_state.alphatest && r_transparent_alphatocoverage.integer)
+                                       qglEnable(GL_SAMPLE_ALPHA_TO_COVERAGE_ARB);
+                               else
+                                       qglDisable(GL_SAMPLE_ALPHA_TO_COVERAGE_ARB);
+                               CHECKGLERROR
+                       }
                        break;
                }
        }
index 996fd2d9eb976ab828bca401870667ec0bd9aae8..eee8a48f8c05ddd6a4d5d3dcffaf8add82d37ac7 100644 (file)
@@ -2092,20 +2092,12 @@ void R_SetupShader_Surface(const vec3_t lightcolorbase, qboolean modellighting,
        matrix4x4_t tempmatrix;
        r_waterstate_waterplane_t *waterplane = (r_waterstate_waterplane_t *)surfacewaterplane;
        if (rsurface.texture->currentmaterialflags & MATERIALFLAG_ALPHATEST)
-               permutation |= SHADERPERMUTATION_ALPHAKILL;
-       // Alpha to Coverage
-       // fixme: move to gl_backend
-       if (vid_multisampling.integer && r_transparent_alphatocoverage.integer)
        {
-               if (rsurface.texture->currentmaterialflags & MATERIALFLAG_ALPHATEST)
-               {
-                       qglEnable(GL_SAMPLE_ALPHA_TO_COVERAGE_ARB);CHECKGLERROR
-               }
-               else
-               {
-                       qglDisable(GL_SAMPLE_ALPHA_TO_COVERAGE_ARB);CHECKGLERROR
-               }
+               permutation |= SHADERPERMUTATION_ALPHAKILL;
+               GL_AlphaTest(true);
        }
+       else
+               GL_AlphaTest(false);
        if (rsurface.texture->r_water_waterscroll[0] && rsurface.texture->r_water_waterscroll[1])
                permutation |= SHADERPERMUTATION_NORMALMAPSCROLLBLEND; // todo: make generic
        if (rsurfacepass == RSURFPASS_BACKGROUND)
index 5b2a8190b38327019a438c751ec629f850caaca0..47507cf91484eacd0a6c1cb1db160450384044af 100644 (file)
@@ -1952,13 +1952,14 @@ void R_Shadow_RenderMode_Begin(void)
        CHECKGLERROR
        R_Mesh_ResetTextureState();
        GL_BlendFunc(GL_ONE, GL_ZERO);
+       GL_AlphaTest(false);
        GL_DepthRange(0, 1);
        GL_PolygonOffset(r_refdef.polygonfactor, r_refdef.polygonoffset);
        GL_DepthTest(true);
        GL_DepthMask(false);
        GL_Color(0, 0, 0, 1);
        GL_Scissor(r_refdef.view.viewport.x, r_refdef.view.viewport.y, r_refdef.view.viewport.width, r_refdef.view.viewport.height);
-
+       
        r_shadow_rendermode = R_SHADOW_RENDERMODE_NONE;
 
        if (gl_ext_separatestencil.integer && vid.support.ati_separate_stencil)