]> de.git.xonotic.org Git - xonotic/netradiant.git/commitdiff
ASE support: support *node_name
authorRudolf Polzer <divverent@xonotic.org>
Sun, 5 Jun 2011 16:57:26 +0000 (18:57 +0200)
committerRudolf Polzer <divverent@xonotic.org>
Sun, 5 Jun 2011 16:57:26 +0000 (18:57 +0200)
libs/picomodel/picomodel.c
libs/picomodel/pm_ase.c

index aed467cacd49edbe0005ff2852dbb8a3d8bf6a26..261462256192aeb4d2ff1eb0f66afe7acfea9c13 100644 (file)
@@ -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,
 
 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;
 {
        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];
        for ( i = 0 ; i < model->numSurfaces ; i++ )
        {
                workSurface = model->surface[i];
+               if ( !name || !strcmp(workSurface->name, name) )
                if ( workSurface->shader == shader )
                {                       
                        break;
                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 );
 
                /* do surface setup */
                PicoSetSurfaceType( workSurface, PICO_TRIANGLES );
-               PicoSetSurfaceName( workSurface, shader->name );
+               PicoSetSurfaceName( workSurface, name ? name : shader->name );
                PicoSetSurfaceShader( workSurface, shader );
        }
 
                PicoSetSurfaceShader( workSurface, shader );
        }
 
index 31c448e68c0fb7e21d781c8106aa40f1c9575703..6905431e3234c0b2e569502bad636da009dff90e 100644 (file)
@@ -452,7 +452,7 @@ static void _ase_submit_triangles_unshared ( picoModel_t* model , aseMaterial_t*
 
 #endif
 
 
 #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)
 {
        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 */
                        }
 
                        /* 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 */
                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);
                        _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 */
        }
        
        /* 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);
        _pico_free(faces);
        _pico_free(vertices);
        _pico_free(texcoords);