1 Index: libs/picomodel/pm_obj.c
2 ===================================================================
3 --- libs/picomodel/pm_obj.c (revision 193)
4 +++ libs/picomodel/pm_obj.c (working copy)
6 /* get next token in material file */
7 if (_pico_parse( p,1 ) == NULL)
12 /* skip empty lines */
13 if (p->token == NULL || !strlen( p->token ))
15 else if (!_pico_stricmp(p->token,"map_kd"))
18 + picoShader_t *shader;
20 /* pointer to current shader must be valid */
21 if (curShader == NULL)
23 _pico_printf( PICO_ERROR,"Missing material map name in MTL, line %d.",p->curLine);
24 _obj_mtl_error_return;
26 + /* create a new pico shader */
27 + shader = PicoNewShader( model );
29 + _obj_mtl_error_return;
30 /* set shader map name */
31 PicoSetShaderMapName( shader,mapName );
34 PicoSetModelFileName( model,fileName );
36 /* try loading the materials; we don't handle the result */
39 _obj_mtl_load( model );
46 + else if (!_pico_stricmp(p->token,"usemtl"))
48 + picoShader_t *shader;
51 + /* get material name */
52 + name = _pico_parse( p,0 );
54 + /* validate material name */
55 + if (name == NULL || !strlen(name))
57 + _pico_printf( PICO_ERROR,"Missing material name in OBJ, line %d.",p->curLine);
61 + shader = PicoFindShader( model, name, 1 );
64 + _pico_printf( PICO_ERROR,"Undefined material name in OBJ, line %d. Making a default shader.",p->curLine);
66 + /* create a new pico shader */
67 + shader = PicoNewShader( model );
70 + PicoSetShaderName( shader,name );
71 + PicoSetShaderMapName( shader,name );
72 + PicoSetSurfaceShader( curSurface, shader );
77 + PicoSetSurfaceShader( curSurface, shader );
81 /* skip unparsed rest of line and continue */
82 _pico_parse_skip_rest( p );