Changeset 477 for trunk/src/engine
- Timestamp:
- 10/23/15 19:35:39 (10 years ago)
- Location:
- trunk/src/engine
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/engine/program_manager.cc
r474 r477 16 16 } 17 17 18 nv::res_id nv::program_manager::load_resource( lua::table_guard& table)18 bool nv::program_manager::load_resource( lua::table_guard& table, shash64 id ) 19 19 { 20 20 NV_LOG_DEBUG( table.get_string("id") ); … … 36 36 } 37 37 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; 40 40 } 41 41 42 void nv::program_manager::release( program *p )42 void nv::program_manager::release( program p ) 43 43 { 44 m_context->get_device()->release( *p ); 45 delete p; 44 m_context->get_device()->release( p ); 46 45 } 47 46 -
trunk/src/engine/resource_system.cc
r474 r477 9 9 #include "nv/lua/lua_nova.hh" 10 10 11 void nv:: resource_manager_base::initialize( lua::state* a_lua_state )11 void nv::lua_resource_manager_base::initialize( lua::state* a_lua_state ) 12 12 { 13 13 m_lua = a_lua_state; … … 16 16 } 17 17 18 nv::res_id nv::resource_manager_base::load_resource( const string_view& id )18 bool nv::lua_resource_manager_base::load_resource( const string_view& id ) 19 19 { 20 20 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; 24 23 } 25 24 26 void nv:: resource_manager_base::load_all()25 void nv::lua_resource_manager_base::load_all() 27 26 { 28 27 clear(); … … 31 30 for ( auto i : range( count ) ) 32 31 { 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" ) ); 36 34 } 37 35 } 36
Note: See TracChangeset
for help on using the changeset viewer.