* picomodel::obj: fix black default vertex color, also use one from .mtl
This commit is contained in:
parent
6ce87c04ac
commit
47ef9a6ae2
|
|
@ -447,7 +447,7 @@ picoShader_t *PicoNewShader( picoModel_t *model ){
|
||||||
|
|
||||||
/* setup default shader colors */
|
/* setup default shader colors */
|
||||||
_pico_set_color( shader->ambientColor,0,0,0,0 );
|
_pico_set_color( shader->ambientColor,0,0,0,0 );
|
||||||
_pico_set_color( shader->diffuseColor,255,255,255,1 );
|
_pico_set_color( shader->diffuseColor,255,255,255,255 );
|
||||||
_pico_set_color( shader->specularColor,0,0,0,0 );
|
_pico_set_color( shader->specularColor,0,0,0,0 );
|
||||||
|
|
||||||
/* no need to do this, but i do it anyway */
|
/* no need to do this, but i do it anyway */
|
||||||
|
|
|
||||||
|
|
@ -85,7 +85,7 @@ static int _obj_canload( PM_PARAMS_CANLOAD ){
|
||||||
/* few lines in file and look for common keywords often */
|
/* few lines in file and look for common keywords often */
|
||||||
/* appearing at the beginning of wavefront objects */
|
/* appearing at the beginning of wavefront objects */
|
||||||
|
|
||||||
/* alllocate a new pico parser */
|
/* allocate a new pico parser */
|
||||||
p = _pico_new_parser( (const picoByte_t *)buffer,bufSize );
|
p = _pico_new_parser( (const picoByte_t *)buffer,bufSize );
|
||||||
if ( p == NULL ) {
|
if ( p == NULL ) {
|
||||||
return PICO_PMV_ERROR_MEMORY;
|
return PICO_PMV_ERROR_MEMORY;
|
||||||
|
|
@ -550,7 +550,7 @@ static picoModel_t *_obj_load( PM_PARAMS_LOAD ){
|
||||||
PicoFreeModel( model ); \
|
PicoFreeModel( model ); \
|
||||||
return NULL; \
|
return NULL; \
|
||||||
}
|
}
|
||||||
/* alllocate a new pico parser */
|
/* allocate a new pico parser */
|
||||||
p = _pico_new_parser( (const picoByte_t *)buffer,bufSize );
|
p = _pico_new_parser( (const picoByte_t *)buffer,bufSize );
|
||||||
if ( p == NULL ) {
|
if ( p == NULL ) {
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
@ -866,6 +866,8 @@ static picoModel_t *_obj_load( PM_PARAMS_LOAD ){
|
||||||
/*if( has_v )*/ PicoSetSurfaceXYZ( curSurface, ( curVertex + i ), verts [ i ] );
|
/*if( has_v )*/ PicoSetSurfaceXYZ( curSurface, ( curVertex + i ), verts [ i ] );
|
||||||
/*if( has_vt )*/ PicoSetSurfaceST( curSurface,0,( curVertex + i ), coords [ i ] );
|
/*if( has_vt )*/ PicoSetSurfaceST( curSurface,0,( curVertex + i ), coords [ i ] );
|
||||||
/*if( has_vn )*/ PicoSetSurfaceNormal( curSurface, ( curVertex + i ), normals[ i ] );
|
/*if( has_vn )*/ PicoSetSurfaceNormal( curSurface, ( curVertex + i ), normals[ i ] );
|
||||||
|
if( curSurface && curSurface->shader )
|
||||||
|
PicoSetSurfaceColor( curSurface, 0, ( curVertex + i ), curSurface->shader->diffuseColor );
|
||||||
}
|
}
|
||||||
/* add our triangle (A B C) */
|
/* add our triangle (A B C) */
|
||||||
PicoSetSurfaceIndex( curSurface,( curFace * 3 + 2 ),(picoIndex_t)( curVertex + 0 ) );
|
PicoSetSurfaceIndex( curSurface,( curFace * 3 + 2 ),(picoIndex_t)( curVertex + 0 ) );
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user