Skip to content
Permalink
Browse files

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.
  • Loading branch information...
zturtleman committed Oct 31, 2018
1 parent 2e64b0b commit 3705dcfeb9af6317dafb48686997da5d2b681436
Showing with 2 additions and 1 deletion.
  1. +2 −1 libs/picomodel/pm_obj.c
@@ -524,8 +524,9 @@ static picoModel_t *_obj_load( PM_PARAMS_LOAD ){
newSurface = PicoNewSurface( model ); \
if ( newSurface == NULL ) { \
_obj_error_return( "Error allocating surface" ); } \
/* reset face index for surface */ \
/* reset face index and vertex index for surface */ \
curFace = 0; \
curVertex = 0; \
/* if we can, assign the previous shader to this surface */ \
if ( curSurface ) { \
PicoSetSurfaceShader( newSurface, curSurface->shader ); } \

0 comments on commit 3705dcf

Please sign in to comment.
You can’t perform that action at this time.