mirror of
https://github.com/UberGames/lilium-voyager.git
synced 2024-11-10 14:41:42 +00:00
Fix bugs where some surfaces weren't merged and others were counted as merged in R_MergeLeafSurfaces().
This commit is contained in:
parent
86984eb536
commit
b269acac94
1 changed files with 28 additions and 3 deletions
|
@ -2924,6 +2924,30 @@ void R_MergeLeafSurfaces(void)
|
|||
}
|
||||
}
|
||||
|
||||
// don't add surfaces that don't merge to any others to the merged list
|
||||
for (i = 0; i < numWorldSurfaces; i++)
|
||||
{
|
||||
qboolean merges = qfalse;
|
||||
|
||||
if (s_worldData.surfacesViewCount[i] != i)
|
||||
continue;
|
||||
|
||||
for (j = 0; j < numWorldSurfaces; j++)
|
||||
{
|
||||
if (j == i)
|
||||
continue;
|
||||
|
||||
if (s_worldData.surfacesViewCount[j] == i)
|
||||
{
|
||||
merges = qtrue;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!merges)
|
||||
s_worldData.surfacesViewCount[i] = -1;
|
||||
}
|
||||
|
||||
// count merged/unmerged surfaces
|
||||
numMergedSurfaces = 0;
|
||||
numUnmergedSurfaces = 0;
|
||||
|
@ -2943,6 +2967,7 @@ void R_MergeLeafSurfaces(void)
|
|||
s_worldData.mergedSurfaces = ri.Hunk_Alloc(sizeof(*s_worldData.mergedSurfaces) * numMergedSurfaces, h_low);
|
||||
s_worldData.mergedSurfacesViewCount = ri.Hunk_Alloc(sizeof(*s_worldData.mergedSurfacesViewCount) * numMergedSurfaces, h_low);
|
||||
s_worldData.mergedSurfacesDlightBits = ri.Hunk_Alloc(sizeof(*s_worldData.mergedSurfacesDlightBits) * numMergedSurfaces, h_low);
|
||||
s_worldData.mergedSurfacesPshadowBits = ri.Hunk_Alloc(sizeof(*s_worldData.mergedSurfacesPshadowBits) * numMergedSurfaces, h_low);
|
||||
s_worldData.numMergedSurfaces = numMergedSurfaces;
|
||||
|
||||
// view surfaces are like mark surfaces, except negative ones represent merged surfaces
|
||||
|
@ -2981,7 +3006,7 @@ void R_MergeLeafSurfaces(void)
|
|||
numSurfsToMerge = 0;
|
||||
numTriangles = 0;
|
||||
numVerts = 0;
|
||||
for (j = i; j < numWorldSurfaces; j++)
|
||||
for (j = 0; j < numWorldSurfaces; j++)
|
||||
{
|
||||
msurface_t *surf2;
|
||||
|
||||
|
@ -3037,7 +3062,7 @@ void R_MergeLeafSurfaces(void)
|
|||
// Merge surfaces (indexes) and calculate bounds
|
||||
ClearBounds(bounds[0], bounds[1]);
|
||||
firstIndex = numIboIndexes;
|
||||
for (j = i; j < numWorldSurfaces; j++)
|
||||
for (j = 0; j < numWorldSurfaces; j++)
|
||||
{
|
||||
msurface_t *surf2;
|
||||
|
||||
|
@ -3140,7 +3165,7 @@ void R_MergeLeafSurfaces(void)
|
|||
mergedSurf->shader = surf1->shader;
|
||||
|
||||
// redirect view surfaces to this surf
|
||||
for (j = i; j < numWorldSurfaces; j++)
|
||||
for (j = 0; j < numWorldSurfaces; j++)
|
||||
{
|
||||
if (s_worldData.surfacesViewCount[j] != i)
|
||||
continue;
|
||||
|
|
Loading…
Reference in a new issue