Changeset 477 for trunk/src/engine


Ignore:
Timestamp:
10/23/15 19:35:39 (10 years ago)
Author:
epyon
Message:
  • resource handling rewrite
  • skeletal_mesh/mesh_data updates
Location:
trunk/src/engine
Files:
2 edited

Legend:

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

    r474 r477  
    1616}
    1717
    18 nv::res_id nv::program_manager::load_resource( lua::table_guard& table )
     18bool nv::program_manager::load_resource( lua::table_guard& table, shash64 id )
    1919{
    2020        NV_LOG_DEBUG( table.get_string("id") );
     
    3636        }
    3737
    38         nv::program* program = new nv::program( m_context->get_device()->create_program( vsource, fsource ) );
    39         return add( program );
     38        add( m_context->get_device()->create_program( vsource, fsource ), id );
     39        return true;
    4040}
    4141
    42 void nv::program_manager::release( program* p )
     42void nv::program_manager::release( program p )
    4343{
    44         m_context->get_device()->release( *p );
    45         delete p;
     44        m_context->get_device()->release( p );
    4645}
    4746
  • trunk/src/engine/resource_system.cc

    r474 r477  
    99#include "nv/lua/lua_nova.hh"
    1010
    11 void nv::resource_manager_base::initialize( lua::state* a_lua_state )
     11void nv::lua_resource_manager_base::initialize( lua::state* a_lua_state )
    1212{
    1313        m_lua = a_lua_state;
     
    1616}
    1717
    18 nv::res_id nv::resource_manager_base::load_resource( const string_view& id )
     18bool nv::lua_resource_manager_base::load_resource( const string_view& id )
    1919{
    2020        lua::table_guard table( m_lua, lua::path( get_storage_name(), id ) );
    21         res_id rid = load_resource( table );
    22         if ( rid != 0 ) m_names[ id ] = rid;
    23         return rid;
     21        load_resource( table, id );
     22        return true;
    2423}
    2524
    26 void nv::resource_manager_base::load_all()
     25void nv::lua_resource_manager_base::load_all()
    2726{
    2827        clear();
     
    3130        for ( auto i : range( count ) )
    3231        {
    33                 lua::table_guard sub_table( table, i+1 );
    34                 res_id rid = load_resource( sub_table );
    35                 if ( rid != 0 ) m_names[ sub_table.get_string_hash_64("id") ] = rid;
     32                lua::table_guard sub_table( table, i + 1 );
     33                load_resource( sub_table, sub_table.get_string_hash_64( "id" ) );
    3634        }
    3735}
     36
Note: See TracChangeset for help on using the changeset viewer.