- Timestamp:
- 10/26/16 18:41:20 (9 years ago)
- Location:
- trunk
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/nv/engine/animation.hh
r520 r524 84 84 float time; 85 85 86 animator_transition_instance() {}86 animator_transition_instance() : source(0), time( 0.0 ) {} 87 87 88 88 animator_transition_instance( const animator_transition_data& data, uint32 src ) … … 123 123 /* this duration might be inaccurate? */ 124 124 return duration; 125 } 126 else 127 { 128 // duration -= last.time; 129 // last.time = 0.0f; 130 int hack; 131 m_time = 0.0f; 125 132 } 126 133 } … … 298 305 } 299 306 307 bool has_state( const animator_data* data, shash64 id ) const 308 { 309 for ( uint32 i = 0; i < data->layers.size(); ++i ) 310 for ( uint32 j = 0; j < data->layers[i].states.size(); ++j ) 311 if ( data->layers[i].states[j].name == id ) return true; 312 return false; 313 } 300 314 301 315 // protected: … … 373 387 } 374 388 375 376 389 vector< animator_layer_instance > m_layers; 377 390 skeleton_transforms m_transforms; -
trunk/nv/engine/model_manager.hh
r521 r524 41 41 42 42 struct model; 43 44 struct ragdoll_data; 43 45 44 46 struct model_node … … 83 85 resource< animator_data > animator; 84 86 resource< animator_bind_data > bind_data; 87 // TODO: change to resource 88 string32 ragdoll_id; 85 89 transform root; 86 90 shash64 attach; -
trunk/nv/engine/ragdoll_manager.hh
r520 r524 36 36 struct ragdoll_data 37 37 { 38 string32 id; 38 39 vector< ragdoll_part_data > parts; 39 40 vector< bool > bone_mask; -
trunk/nv/engine/resource_system.hh
r518 r524 58 58 virtual void clear() = 0; 59 59 void load_all( bool do_clear = true ); 60 void preload_ids(); 60 61 virtual bool load_resource( const string_view& id ); 61 62 virtual ~lua_resource_manager_base() {} 62 63 protected: 63 64 virtual bool load_resource( lua::table_guard& table, shash64 id ) = 0; 65 hash_store< shash64, string64 > m_id_hash; 64 66 lua::state* m_lua; 65 67 }; … … 87 89 } 88 90 } 89 // NV_ASSERT( false, "resource_manager.getfailed!" );91 NV_LOG_ERROR( "resource_manager.get(\"",id,"\") failed!" ); 90 92 return resource_type(); 91 93 } 92 94 93 resource_type get( uint64 id )94 {95 if ( exists( shash64( id ) ) ) return this->template create< T >( shash64( id ) );96 // NV_ASSERT( false, "resource_manager.getfailed!" );97 return resource_type();98 }95 // resource_type get_( uint64 id ) 96 // { 97 // if ( exists( shash64( id ) ) ) return this->template create< T >( shash64( id ) ); 98 // NV_LOG_ERROR( "resource_manager.get(\"", id, "\") failed!" ); 99 // return resource_type(); 100 // } 99 101 100 102 virtual void clear() … … 192 194 virtual resource< T > load_resource( source_type u ) 193 195 { 194 resource< T > result = get( u.id().value() ); 195 if ( result ) return result; 196 if ( exists( u.id() ) ) return this->template create< T >( u.id() ); 196 197 return create_resource( u ); 197 198 } -
trunk/src/engine/model_manager.cc
r523 r524 7 7 #include "nv/engine/model_manager.hh" 8 8 9 #include "nv/engine/ragdoll_manager.hh" 9 10 #include "nv/lua/lua_math.hh" 10 11 #include "nv/lua/lua_flags.hh" … … 26 27 def_data = m_rm->get< mesh_data >( table.get_string128( "path" ) ); 27 28 29 if ( table.is_string( "ragdoll" ) ) 30 gm->ragdoll_id = table.get_string32( "ragdoll" ); 31 28 32 if ( table.has_field( "animator" ) ) 29 33 { -
trunk/src/engine/ragdoll_manager.cc
r520 r524 66 66 if ( auto bind_data = rbind.lock() ) 67 67 { 68 data->id = table.get_string32( "id" ); 68 69 int index = data->parts.size(); 69 70 data->parts.emplace_back(); -
trunk/src/engine/resource_system.cc
r486 r524 34 34 } 35 35 } 36 37 void nv::lua_resource_manager_base::preload_ids() 38 { 39 m_id_hash.clear(); 40 lua::table_guard table( m_lua, get_storage_name() ); 41 uint32 count = table.get_unsigned( "__counter" ); 42 for ( auto i : range( count ) ) 43 { 44 lua::table_guard sub_table( table, i + 1 ); 45 string64 id = sub_table.get_string64( "id" ); 46 NV_ASSERT( m_id_hash.find( id ) == m_id_hash.end(), "HASH COLLISION - ", id, " - ", m_id_hash[id] ); 47 m_id_hash[id] = id; 48 } 49 }
Note: See TracChangeset
for help on using the changeset viewer.