X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=libs%2Fpicomodel%2Fpm_obj.c;h=32bdbd258213588c314d24a5c2f374d090ac4f3b;hb=refs%2Fmerge-requests%2F107%2Fhead;hp=a089f5f44c1be4dbd1b493f84b23638aa7a631fd;hpb=b7e36c120eb1546a6c6f97f30e42ab7f9a559c61;p=xonotic%2Fnetradiant.git diff --git a/libs/picomodel/pm_obj.c b/libs/picomodel/pm_obj.c index a089f5f4..32bdbd25 100644 --- a/libs/picomodel/pm_obj.c +++ b/libs/picomodel/pm_obj.c @@ -32,16 +32,12 @@ ----------------------------------------------------------------------------- */ - - -/* marker */ -#define PM_OBJ_C - /* dependencies */ #include "picointernal.h" +#include "globaldefs.h" /* disable warnings */ -#ifdef WIN32 +#if GDEF_COMPILER_MSVC #pragma warning( disable:4100 ) /* unref param */ #endif @@ -135,7 +131,7 @@ static int _obj_canload( PM_PARAMS_CANLOAD ){ * allocates - and reallocates as soon as required - * my vertex data array in even steps. */ -#define SIZE_OBJ_STEP 4096 +const int SIZE_OBJ_STEP = 4096; static TObjVertexData *SizeObjVertexData( TObjVertexData *vertexData, int reqEntries, @@ -528,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 ); } \ @@ -544,7 +541,7 @@ static picoModel_t *_obj_load( PM_PARAMS_LOAD ){ /* helper */ #define _obj_error_return( m ) \ { \ - _pico_printf( PICO_ERROR,"%s in OBJ, line %d.",m,p->curLine ); \ + _pico_printf( PICO_ERROR, "%s in OBJ %s, line %d.", m, model->fileName, p->curLine ); \ _pico_free_parser( p ); \ FreeObjVertexData( vertexData ); \ PicoFreeModel( model ); \ @@ -676,7 +673,7 @@ static picoModel_t *_obj_load( PM_PARAMS_LOAD ){ #endif } - if ( curFace == 0 ) { + if ( curFace == 0 && curSurface != NULL ) { PicoSetSurfaceName( curSurface,groupName ); } else