Changeset 486 for trunk/src/engine


Ignore:
Timestamp:
02/24/16 18:47:54 (9 years ago)
Author:
epyon
Message:
  • mass update once again...
Location:
trunk/src/engine
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/engine/material_manager.cc

    r485 r486  
    1212using namespace nv;
    1313
     14
     15nv::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
    1425bool gpu_material_manager::load_resource( const string_view& id )
    1526{
     
    2031                for ( uint32 i = 0; i < size( mat->paths ); ++i )
    2132                        if ( !mat->paths[i].empty() )
     33                        {
    2234                                if ( auto data = m_image_manager->get( mat->paths[i] ).lock() )
    2335                                {
    2436                                        result->textures[i] = m_context->get_device()->create_texture( &*data, smp );
    2537                                }
     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                       
    2645                add( id, result );
    2746                return true;
     
    4463        m->paths[ TEX_SPECULAR ] = table.get_string128( "specular" );
    4564        m->paths[ TEX_NORMAL ]   = table.get_string128( "normal" );
     65        m->paths[ TEX_EMISSIVE ] = table.get_string128( "emissive" );
    4666        m->paths[ TEX_GLOSS ]    = table.get_string128( "gloss" );
    4767        add( id, m );
  • trunk/src/engine/resource_system.cc

    r485 r486  
    2323}
    2424
    25 void nv::lua_resource_manager_base::load_all()
     25void nv::lua_resource_manager_base::load_all( bool do_clear )
    2626{
    27         clear();
     27        if ( do_clear ) clear();
    2828        lua::table_guard table( m_lua, get_storage_name() );
    2929        uint32 count = table.get_unsigned( "__counter" );
Note: See TracChangeset for help on using the changeset viewer.