From: havoc Date: Mon, 1 Jun 2020 03:02:26 +0000 (+0000) Subject: Fix a bug with r_batch_debugdynamicvertexpath in R_DrawTextureSurfaceList_Sky where... X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=e7c65577b00c716d49e0257e01ee2db04ecdd3ee;p=xonotic%2Fdarkplaces.git Fix a bug with r_batch_debugdynamicvertexpath in R_DrawTextureSurfaceList_Sky where it was trying to use the surface->num_firstvertex rather than the batch info. git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@12620 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/gl_rmain.c b/gl_rmain.c index d14d2493..be5fea34 100644 --- a/gl_rmain.c +++ b/gl_rmain.c @@ -8663,7 +8663,7 @@ void RSurf_SetupDepthAndCulling(void) 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; @@ -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) { - 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); } }