]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
do not crash if no matching water plane could be found (BUT WHY DOES THIS HAPPEN...
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 14 Dec 2010 14:17:41 +0000 (14:17 +0000)
committerRudolf Polzer <divVerent@xonotic.org>
Tue, 14 Dec 2010 14:22:55 +0000 (15:22 +0100)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@10659 d7cf8633-e32d-0410-b094-e92efae38249
::stable-branch::merge=7a40a91a24fa53b6ef38e0d1fb14dcfe270b8b61

gl_rmain.c

index ac4edaab92c1d55fe007ad56bbb3cdff7749f8df..0808d5b17a53a9dcd171b63180f5f54022ad3bbf 100644 (file)
@@ -12618,16 +12618,22 @@ static void R_DrawTextureSurfaceList_GL20(int texturenumsurfaces, const msurface
        // bind lightmap texture
 
        // water/refraction/reflection/camera surfaces have to be handled specially
-       if ((rsurface.texture->currentmaterialflags & (MATERIALFLAG_WATERSHADER | MATERIALFLAG_REFRACTION | MATERIALFLAG_CAMERA | MATERIALFLAG_REFLECTION)) && !r_waterstate.renderingscene)
+       if ((rsurface.texture->currentmaterialflags & (MATERIALFLAG_WATERSHADER | MATERIALFLAG_REFRACTION | MATERIALFLAG_CAMERA | MATERIALFLAG_REFLECTION)))
        {
                int start, end, startplaneindex;
                for (start = 0;start < texturenumsurfaces;start = end)
                {
                        startplaneindex = RSurf_FindWaterPlaneForSurface(texturesurfacelist[start]);
+                       if(startplaneindex < 0)
+                       {
+                               Con_Printf("No matching water plane for surface with material flags 0x%08x - PLEASE DEBUG THIS\n", rsurface.texture->currentmaterialflags);
+                               end = start + 1;
+                               continue;
+                       }
                        for (end = start + 1;end < texturenumsurfaces && startplaneindex == RSurf_FindWaterPlaneForSurface(texturesurfacelist[end]);end++)
                                ;
                        // now that we have a batch using the same planeindex, render it
-                       if ((rsurface.texture->currentmaterialflags & (MATERIALFLAG_WATERSHADER | MATERIALFLAG_REFRACTION | MATERIALFLAG_CAMERA)) && !r_waterstate.renderingscene)
+                       if ((rsurface.texture->currentmaterialflags & (MATERIALFLAG_WATERSHADER | MATERIALFLAG_REFRACTION | MATERIALFLAG_CAMERA)))
                        {
                                // render water or distortion background
                                GL_DepthMask(true);