Changeset 491 for trunk/src/engine/material_manager.cc
- Timestamp:
- 04/29/16 12:42:28 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/engine/material_manager.cc
r486 r491 39 39 40 40 // HACK 41 for ( uint32 i = 0; i < 5; ++i )41 for ( uint32 i = 0; i < 8; ++i ) 42 42 if ( result->textures[i].is_nil() ) 43 43 result->textures[i] = m_default; … … 59 59 bool material_manager::load_resource( nv::lua::table_guard& table, nv::shash64 id ) 60 60 { 61 c_file_system fs; 61 62 material* m = new material; 62 m->paths[ TEX_DIFFUSE ] = table.get_string128( "diffuse" ); 63 m->paths[ TEX_SPECULAR ] = table.get_string128( "specular" ); 64 m->paths[ TEX_NORMAL ] = table.get_string128( "normal" ); 65 m->paths[ TEX_EMISSIVE ] = table.get_string128( "emissive" ); 66 m->paths[ TEX_GLOSS ] = table.get_string128( "gloss" ); 63 64 if ( table.is_string( "path" ) ) 65 { 66 string128 path = table.get_string128( "path" ); 67 for ( uint32 i = 0; i < 5; ++i ) 68 m->paths[i] = path; 69 m->paths[TEX_DIFFUSE].append( "_diffuse.png" ); 70 m->paths[TEX_NORMAL].append( "_normal.png" ); 71 m->paths[TEX_METALLIC].append( "_metallic.png" ); 72 m->paths[TEX_ROUGHNESS].append( "_roughness.png" ); 73 m->paths[TEX_EMISSIVE].append( "_emissive.png" ); 74 for ( uint32 i = 0; i < 5; ++i ) 75 { 76 if ( !fs.exists( m->paths[i] ) ) 77 { 78 if ( i != TEX_EMISSIVE ) 79 NV_LOG_ERROR( "Texture file not found! : ", m->paths[i] ); 80 m->paths[i].clear(); 81 } 82 } 83 } 84 else 85 { 86 m->paths[ TEX_DIFFUSE ] = table.get_string128( "diffuse" ); 87 m->paths[ TEX_NORMAL ] = table.get_string128( "normal" ); 88 m->paths[ TEX_METALLIC] = table.get_string128( "metallic" ); 89 m->paths[ TEX_ROUGHNESS] = table.get_string128( "roughness" ); 90 m->paths[ TEX_EMISSIVE ] = table.get_string128( "emissive" ); 91 } 67 92 add( id, m ); 68 93 return true; 69 94 } 95
Note: See TracChangeset
for help on using the changeset viewer.