From 5fe03b91308a1b425029a4d2278970b568d0e431 Mon Sep 17 00:00:00 2001 From: Rudolf Polzer Date: Sun, 5 Jun 2011 18:57:26 +0200 Subject: [PATCH] ASE support: support *node_name --- libs/picomodel/picomodel.c | 5 +++-- libs/picomodel/pm_ase.c | 8 ++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/libs/picomodel/picomodel.c b/libs/picomodel/picomodel.c index aed467ca..26146225 100644 --- a/libs/picomodel/picomodel.c +++ b/libs/picomodel/picomodel.c @@ -2214,7 +2214,7 @@ Chooses an appropriate surface based on the shader, or adds a new surface if nec void PicoAddTriangleToModel( picoModel_t *model, picoVec3_t** xyz, picoVec3_t** normals, int numSTs, picoVec2_t **st, int numColors, picoColor_t **colors, - picoShader_t* shader, picoIndex_t* smoothingGroup ) + picoShader_t* shader, const char *name, picoIndex_t* smoothingGroup ) { int i,j; int vertDataIndex; @@ -2224,6 +2224,7 @@ void PicoAddTriangleToModel( picoModel_t *model, picoVec3_t** xyz, picoVec3_t** for ( i = 0 ; i < model->numSurfaces ; i++ ) { workSurface = model->surface[i]; + if ( !name || !strcmp(workSurface->name, name) ) if ( workSurface->shader == shader ) { break; @@ -2243,7 +2244,7 @@ void PicoAddTriangleToModel( picoModel_t *model, picoVec3_t** xyz, picoVec3_t** /* do surface setup */ PicoSetSurfaceType( workSurface, PICO_TRIANGLES ); - PicoSetSurfaceName( workSurface, shader->name ); + PicoSetSurfaceName( workSurface, name ? name : shader->name ); PicoSetSurfaceShader( workSurface, shader ); } diff --git a/libs/picomodel/pm_ase.c b/libs/picomodel/pm_ase.c index 31c448e6..6905431e 100644 --- a/libs/picomodel/pm_ase.c +++ b/libs/picomodel/pm_ase.c @@ -452,7 +452,7 @@ static void _ase_submit_triangles_unshared ( picoModel_t* model , aseMaterial_t* #endif -static void _ase_submit_triangles( picoModel_t* model , aseMaterial_t* materials , aseVertex_t* vertices, aseTexCoord_t* texcoords, aseColor_t* colors, aseFace_t* faces, int numFaces ) +static void _ase_submit_triangles( picoModel_t* model , aseMaterial_t* materials , aseVertex_t* vertices, aseTexCoord_t* texcoords, aseColor_t* colors, aseFace_t* faces, int numFaces, const char *name ) { aseFacesIter_t i = faces, end = faces + numFaces; for(; i != end; ++i) @@ -492,7 +492,7 @@ static void _ase_submit_triangles( picoModel_t* model , aseMaterial_t* materials } /* submit the triangle to the model */ - PicoAddTriangleToModel ( model , xyz , normal , 1 , st , 1 , color , subMtl->shader, smooth ); + PicoAddTriangleToModel ( model , xyz , normal , 1 , st , 1 , color , subMtl->shader, name, smooth ); } } } @@ -599,7 +599,7 @@ static picoModel_t *_ase_load( PM_PARAMS_LOAD ) else if (!_pico_stricmp(p->token,"*mesh")) { /* finish existing surface */ - _ase_submit_triangles(model, materials, vertices, texcoords, colors, faces, numFaces); + _ase_submit_triangles(model, materials, vertices, texcoords, colors, faces, numFaces, lastNodeName); _pico_free(faces); _pico_free(vertices); _pico_free(texcoords); @@ -1152,7 +1152,7 @@ static picoModel_t *_ase_load( PM_PARAMS_LOAD ) } /* ydnar: finish existing surface */ - _ase_submit_triangles(model, materials, vertices, texcoords, colors, faces, numFaces); + _ase_submit_triangles(model, materials, vertices, texcoords, colors, faces, numFaces, lastNodeName); _pico_free(faces); _pico_free(vertices); _pico_free(texcoords); -- 2.39.2