From 9aa9620d4db8b0187571408bd57f790d1d58be17 Mon Sep 17 00:00:00 2001 From: Zack Middleton Date: Tue, 30 Oct 2018 20:27:44 -0500 Subject: [PATCH] Fix over allocating vertexes for OBJ models with multiple surfaces Loading Wavefront OBJ models in picomodel (used by radiant and q3map2) did not reset the surface vertex index when starting a new surface. This caused there to be unused vertexes, equal to the number of vertexes in all previous surfaces, at the beginning of each surface. Exponential OBJ vertex memory usage as number of surfaces increases. It did not affect displaying or processing the surface faces. --- libs/picomodel/pm_obj.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libs/picomodel/pm_obj.c b/libs/picomodel/pm_obj.c index 3f551ee0..23f3ed94 100644 --- a/libs/picomodel/pm_obj.c +++ b/libs/picomodel/pm_obj.c @@ -528,6 +528,7 @@ static picoModel_t *_obj_load( PM_PARAMS_LOAD ){ _obj_error_return( "Error allocating surface" ); } \ /* reset face index for surface */ \ curFace = 0; \ + curVertex = 0; \ /* if we can, assign the previous shader to this surface */ \ if ( curSurface ) { \ PicoSetSurfaceShader( newSurface, curSurface->shader ); } \