mirror of
https://github.com/TTimo/GtkRadiant.git
synced 2024-11-10 07:11:54 +00:00
usemtl for obj models
This commit is contained in:
parent
424958f54b
commit
e09ed3bffd
1 changed files with 16 additions and 1 deletions
|
@ -49,7 +49,6 @@
|
||||||
* - '_obj_load' code crashes in a weird way after
|
* - '_obj_load' code crashes in a weird way after
|
||||||
* '_obj_mtl_load' for a few .mtl files
|
* '_obj_mtl_load' for a few .mtl files
|
||||||
* - process 'mtllib' rather than using <model>.mtl
|
* - process 'mtllib' rather than using <model>.mtl
|
||||||
* - handle 'usemtl' statements
|
|
||||||
*/
|
*/
|
||||||
/* uncomment when debugging this module */
|
/* uncomment when debugging this module */
|
||||||
/* #define DEBUG_PM_OBJ */
|
/* #define DEBUG_PM_OBJ */
|
||||||
|
@ -859,6 +858,22 @@ static picoModel_t *_obj_load( PM_PARAMS_LOAD ){
|
||||||
/* increase vertex count */
|
/* increase vertex count */
|
||||||
curVertex += max;
|
curVertex += max;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else if ( !_pico_stricmp( p->token, "usemtl" ) ) {
|
||||||
|
char *materialName;
|
||||||
|
materialName = _pico_parse( p, 0 );
|
||||||
|
if( materialName || strlen( materialName ) ) {
|
||||||
|
picoShader_t *shader;
|
||||||
|
shader = PicoFindShader( model, materialName, 0 );
|
||||||
|
if( !shader ) {
|
||||||
|
shader = PicoNewShader( model );
|
||||||
|
PicoSetShaderName( shader, materialName );
|
||||||
|
}
|
||||||
|
if( shader && curSurface ) {
|
||||||
|
PicoSetSurfaceShader( curSurface, shader );
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
/* skip unparsed rest of line and continue */
|
/* skip unparsed rest of line and continue */
|
||||||
_pico_parse_skip_rest( p );
|
_pico_parse_skip_rest( p );
|
||||||
|
|
Loading…
Reference in a new issue