]> git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
Fix a bug with r_batch_debugdynamicvertexpath in R_DrawTextureSurfaceList_Sky where...
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 1 Jun 2020 03:02:26 +0000 (03:02 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 1 Jun 2020 03:02:26 +0000 (03:02 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@12620 d7cf8633-e32d-0410-b094-e92efae38249

gl_rmain.c

index d14d2493fb90ee977172e75880f41d5a2709e46d..be5fea34ba898929c006dd391f7a1847a71f54cf 100644 (file)
@@ -8663,7 +8663,7 @@ void RSurf_SetupDepthAndCulling(void)
 
 static void R_DrawTextureSurfaceList_Sky(int texturenumsurfaces, const msurface_t **texturesurfacelist)
 {
 
 static void R_DrawTextureSurfaceList_Sky(int texturenumsurfaces, const msurface_t **texturesurfacelist)
 {
-       int i, j;
+       int j;
        // transparent sky would be ridiculous
        if (rsurface.texture->currentmaterialflags & MATERIALFLAGMASK_DEPTHSORTED)
                return;
        // transparent sky would be ridiculous
        if (rsurface.texture->currentmaterialflags & MATERIALFLAGMASK_DEPTHSORTED)
                return;
@@ -8675,54 +8675,50 @@ static void R_DrawTextureSurfaceList_Sky(int texturenumsurfaces, const msurface_
        // add the vertices of the surfaces to a world bounding box so we can scissor the sky render later
        if (r_sky_scissor.integer)
        {
        // add the vertices of the surfaces to a world bounding box so we can scissor the sky render later
        if (r_sky_scissor.integer)
        {
-               RSurf_PrepareVerticesForBatch(BATCHNEED_ARRAY_VERTEX | BATCHNEED_ALLOWMULTIDRAW, texturenumsurfaces, texturesurfacelist);
-               for (i = 0; i < texturenumsurfaces; i++)
+               RSurf_PrepareVerticesForBatch(BATCHNEED_ARRAY_VERTEX | BATCHNEED_NOGAPS, texturenumsurfaces, texturesurfacelist);
+               const float *v;
+               float p[3];
+               float mins[3], maxs[3];
+               int scissor[4];
+               for (j = 0, v = rsurface.batchvertex3f + 3 * rsurface.batchfirstvertex; j < rsurface.batchnumvertices; j++, v += 3)
                {
                {
-                       const msurface_t *surf = texturesurfacelist[i];
-                       const float *v;
-                       float p[3];
-                       float mins[3], maxs[3];
-                       int scissor[4];
-                       for (j = 0, v = rsurface.batchvertex3f + 3 * surf->num_firstvertex; j < surf->num_vertices; j++, v += 3)
+                       Matrix4x4_Transform(&rsurface.matrix, v, p);
+                       if (j > 0)
                        {
                        {
-                               Matrix4x4_Transform(&rsurface.matrix, v, p);
-                               if (j > 0)
-                               {
-                                       if (mins[0] > p[0]) mins[0] = p[0];
-                                       if (mins[1] > p[1]) mins[1] = p[1];
-                                       if (mins[2] > p[2]) mins[2] = p[2];
-                                       if (maxs[0] < p[0]) maxs[0] = p[0];
-                                       if (maxs[1] < p[1]) maxs[1] = p[1];
-                                       if (maxs[2] < p[2]) maxs[2] = p[2];
-                               }
-                               else
-                               {
-                                       VectorCopy(p, mins);
-                                       VectorCopy(p, maxs);
-                               }
+                               if (mins[0] > p[0]) mins[0] = p[0];
+                               if (mins[1] > p[1]) mins[1] = p[1];
+                               if (mins[2] > p[2]) mins[2] = p[2];
+                               if (maxs[0] < p[0]) maxs[0] = p[0];
+                               if (maxs[1] < p[1]) maxs[1] = p[1];
+                               if (maxs[2] < p[2]) maxs[2] = p[2];
+                       }
+                       else
+                       {
+                               VectorCopy(p, mins);
+                               VectorCopy(p, maxs);
                        }
                        }
-                       if (!R_ScissorForBBox(mins, maxs, scissor))
+               }
+               if (!R_ScissorForBBox(mins, maxs, scissor))
+               {
+                       if (skyscissor[2])
                        {
                        {
-                               if (skyscissor[2])
+                               if (skyscissor[0] > scissor[0])
                                {
                                {
-                                       if (skyscissor[0] > scissor[0])
-                                       {
-                                               skyscissor[2] += skyscissor[0] - scissor[0];
-                                               skyscissor[0] = scissor[0];
-                                       }
-                                       if (skyscissor[1] > scissor[1])
-                                       {
-                                               skyscissor[3] += skyscissor[1] - scissor[1];
-                                               skyscissor[1] = scissor[1];
-                                       }
-                                       if (skyscissor[0] + skyscissor[2] < scissor[0] + scissor[2])
-                                               skyscissor[2] = scissor[0] + scissor[2] - skyscissor[0];
-                                       if (skyscissor[1] + skyscissor[3] < scissor[1] + scissor[3])
-                                               skyscissor[3] = scissor[1] + scissor[3] - skyscissor[1];
+                                       skyscissor[2] += skyscissor[0] - scissor[0];
+                                       skyscissor[0] = scissor[0];
                                }
                                }
-                               else
-                                       Vector4Copy(scissor, skyscissor);
+                               if (skyscissor[1] > scissor[1])
+                               {
+                                       skyscissor[3] += skyscissor[1] - scissor[1];
+                                       skyscissor[1] = scissor[1];
+                               }
+                               if (skyscissor[0] + skyscissor[2] < scissor[0] + scissor[2])
+                                       skyscissor[2] = scissor[0] + scissor[2] - skyscissor[0];
+                               if (skyscissor[1] + skyscissor[3] < scissor[1] + scissor[3])
+                                       skyscissor[3] = scissor[1] + scissor[3] - skyscissor[1];
                        }
                        }
+                       else
+                               Vector4Copy(scissor, skyscissor);
                }
        }
 
                }
        }