Changeset 486 for trunk/src/engine/material_manager.cc
- Timestamp:
- 02/24/16 18:47:54 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/engine/material_manager.cc
r485 r486 12 12 using namespace nv; 13 13 14 15 nv::gpu_material_manager::gpu_material_manager( context* context, material_manager* matmgr, image_manager* imgmgr ) 16 : m_context( context ) 17 , m_material_manager( matmgr ) 18 , m_image_manager( imgmgr ) 19 { 20 uint8 data[2 * 2 * 3]; 21 nv::raw_fill_n( data, 2 * 2 * 3, 0 ); 22 m_default = m_context->get_device()->create_texture( ivec2(2,2), nv::image_format( nv::RGB ), nv::sampler(), data ); 23 } 24 14 25 bool gpu_material_manager::load_resource( const string_view& id ) 15 26 { … … 20 31 for ( uint32 i = 0; i < size( mat->paths ); ++i ) 21 32 if ( !mat->paths[i].empty() ) 33 { 22 34 if ( auto data = m_image_manager->get( mat->paths[i] ).lock() ) 23 35 { 24 36 result->textures[i] = m_context->get_device()->create_texture( &*data, smp ); 25 37 } 38 } 39 40 // HACK 41 for ( uint32 i = 0; i < 5; ++i ) 42 if ( result->textures[i].is_nil() ) 43 result->textures[i] = m_default; 44 26 45 add( id, result ); 27 46 return true; … … 44 63 m->paths[ TEX_SPECULAR ] = table.get_string128( "specular" ); 45 64 m->paths[ TEX_NORMAL ] = table.get_string128( "normal" ); 65 m->paths[ TEX_EMISSIVE ] = table.get_string128( "emissive" ); 46 66 m->paths[ TEX_GLOSS ] = table.get_string128( "gloss" ); 47 67 add( id, m );
Note: See TracChangeset
for help on using the changeset viewer.