Skip to content

Commit 99c619f

Browse files
authored
Revert changes that break material system renderer (#1648)
* Revert "Fix incorrect index in deform shader lookup" This reverts commit 3b96d92. * Revert "Fix memory leaks in material system portals" This reverts commit 30dcac4. * Revert "Rework material system material and surface generation" This reverts commit 7e00d8e.
1 parent 6b82e5c commit 99c619f

File tree

13 files changed

+591
-363
lines changed

13 files changed

+591
-363
lines changed

src/engine/renderer/GeometryOptimiser.cpp

Lines changed: 8 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -315,13 +315,13 @@ void MergeDuplicateVertices( bspSurface_t** rendererSurfaces, int numSurfaces, s
315315
srfVert_t& vert = face->verts[triangle->indexes[j]];
316316
uint32_t index = verts[vert];
317317

318-
ASSERT_LT( idx, ( uint32_t ) numIndicesIn );
318+
ASSERT_LT( idx, numIndicesIn );
319319
if ( !index ) {
320320
verts[vert] = vertIdx + 1;
321321
vertices[vertIdx] = vert;
322322
indices[idx] = vertIdx;
323323

324-
ASSERT_LT( vertIdx, ( uint32_t ) numVerticesIn );
324+
ASSERT_LT( vertIdx, numVerticesIn );
325325

326326
vertIdx++;
327327
} else {
@@ -356,7 +356,7 @@ void MergeDuplicateVertices( bspSurface_t** rendererSurfaces, int numSurfaces, s
356356
}
357357
} */
358358

359-
std::vector<MaterialSurface> OptimiseMapGeometryMaterial(bspSurface_t** rendererSurfaces, int numSurfaces ) {
359+
std::vector<MaterialSurface> OptimiseMapGeometryMaterial( world_t* world, int numSurfaces ) {
360360
std::vector<MaterialSurface> materialSurfaces;
361361
materialSurfaces.reserve( numSurfaces );
362362

@@ -365,43 +365,24 @@ std::vector<MaterialSurface> OptimiseMapGeometryMaterial(bspSurface_t** renderer
365365

366366
// std::unordered_map<TriEdge, TriIndex> triEdges;
367367

368-
vec3_t worldBounds[2] = {};
369-
for ( int i = 0; i < numSurfaces; i++ ) {
370-
bspSurface_t* surface = rendererSurfaces[i];
371-
372-
if ( surface->BSPModel ) {
373-
// Not implemented yet
374-
continue;
375-
}
368+
int surfaceIndex = 0;
369+
for ( int k = 0; k < world->numSurfaces; k++ ) {
370+
bspSurface_t* surface = &world->surfaces[k];
376371

377372
MaterialSurface srf {};
378373

379374
srf.shader = surface->shader;
380375
srf.bspSurface = true;
381-
srf.lightMapNum = surface->lightmapNum;
382376
srf.fog = surface->fogIndex;
383-
srf.portalNum = surface->portalNum;
384377

385378
srf.firstIndex = ( ( srfGeneric_t* ) surface->data )->firstIndex;
386-
srf.count = ( ( srfGeneric_t* ) surface->data )->numTriangles * 3;
379+
srf.count = ( ( srfGeneric_t* ) surface->data )->numTriangles;
387380
srf.verts = ( ( srfGeneric_t* ) surface->data )->verts;
388381
srf.tris = ( ( srfGeneric_t* ) surface->data )->triangles;
389382

390-
VectorCopy( ( ( srfGeneric_t* ) surface->data )->origin, srf.origin );
391-
srf.radius = ( ( srfGeneric_t* ) surface->data )->radius;
392-
393-
BoundsAdd( worldBounds[0], worldBounds[1],
394-
( ( srfGeneric_t* ) surface->data )->bounds[0], ( ( srfGeneric_t* ) surface->data )->bounds[1] );
395-
396-
materialSystem.GenerateMaterial( &srf );
397-
398383
materialSurfaces.emplace_back( srf );
384+
surfaceIndex++;
399385
}
400386

401-
materialSystem.GenerateWorldMaterialsBuffer();
402-
materialSystem.GeneratePortalBoundingSpheres();
403-
materialSystem.SetWorldBounds( worldBounds );
404-
materialSystem.GenerateWorldCommandBuffer( materialSurfaces );
405-
406387
return materialSurfaces;
407388
}

src/engine/renderer/GeometryOptimiser.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,6 @@ void OptimiseMapGeometryCore( world_t* world, bspSurface_t** rendererSurfaces, i
106106
void MergeLeafSurfacesCore( world_t* world, bspSurface_t** rendererSurfaces, int numSurfaces );
107107
void MergeDuplicateVertices( bspSurface_t** rendererSurfaces, int numSurfaces, srfVert_t* vertices, int numVerticesIn,
108108
glIndex_t* indices, int numIndicesIn, int& numVerticesOut, int& numIndicesOut );
109-
std::vector<MaterialSurface> OptimiseMapGeometryMaterial( bspSurface_t** rendererSurfaces, int numSurfaces );
109+
std::vector<MaterialSurface> OptimiseMapGeometryMaterial( world_t* world, int numSurfaces );
110110

111111
#endif // GEOMETRY_OPTIMISER_H

0 commit comments

Comments
 (0)