@@ -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}
0 commit comments