Changeset 524 for trunk


Ignore:
Timestamp:
10/26/16 18:41:20 (9 years ago)
Author:
epyon
Message:
  • god I really suck with proper commits -_-
Location:
trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/nv/engine/animation.hh

    r520 r524  
    8484                float         time;
    8585
    86                 animator_transition_instance() {}
     86                animator_transition_instance() : source(0), time( 0.0 ) {}
    8787
    8888                animator_transition_instance( const animator_transition_data& data, uint32 src )
     
    123123                                        /* this duration might be inaccurate? */
    124124                                        return duration;
     125                                }
     126                                else
     127                                {
     128//                                      duration -= last.time;
     129//                                      last.time = 0.0f;
     130                                        int hack;
     131                                        m_time = 0.0f;
    125132                                }
    126133                        }
     
    298305                }
    299306
     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                }
    300314
    301315//      protected:
     
    373387                }
    374388
    375 
    376389                vector< animator_layer_instance > m_layers;
    377390                skeleton_transforms               m_transforms;
  • trunk/nv/engine/model_manager.hh

    r521 r524  
    4141
    4242        struct model;
     43
     44        struct ragdoll_data;
    4345
    4446        struct model_node
     
    8385                resource< animator_data >      animator;
    8486                resource< animator_bind_data > bind_data;
     87                // TODO: change to resource
     88                string32                       ragdoll_id;
    8589                transform                      root;
    8690                shash64                        attach;
  • trunk/nv/engine/ragdoll_manager.hh

    r520 r524  
    3636        struct ragdoll_data
    3737        {
     38                string32                    id;
    3839                vector< ragdoll_part_data > parts;
    3940                vector< bool >              bone_mask;
  • trunk/nv/engine/resource_system.hh

    r518 r524  
    5858                virtual void clear() = 0;
    5959                void load_all( bool do_clear = true );
     60                void preload_ids();
    6061                virtual bool load_resource( const string_view& id );
    6162                virtual ~lua_resource_manager_base() {}
    6263        protected:
    6364                virtual bool load_resource( lua::table_guard& table, shash64 id ) = 0;
     65                hash_store< shash64, string64 > m_id_hash;
    6466                lua::state* m_lua;
    6567        };
     
    8789                                }
    8890                        }
    89                         // NV_ASSERT( false, "resource_manager.get failed!" );
     91                        NV_LOG_ERROR( "resource_manager.get(\"",id,"\") failed!" );
    9092                        return resource_type();
    9193                }
    9294
    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.get failed!" );
    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//              }
    99101
    100102                virtual void clear()
     
    192194                virtual resource< T > load_resource( source_type u )
    193195                {
    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() );
    196197                        return create_resource( u );
    197198                }
  • trunk/src/engine/model_manager.cc

    r523 r524  
    77#include "nv/engine/model_manager.hh"
    88
     9#include "nv/engine/ragdoll_manager.hh"
    910#include "nv/lua/lua_math.hh"
    1011#include "nv/lua/lua_flags.hh"
     
    2627                def_data = m_rm->get< mesh_data >( table.get_string128( "path" ) );
    2728
     29        if ( table.is_string( "ragdoll" ) )
     30                gm->ragdoll_id = table.get_string32( "ragdoll" );
     31       
    2832        if ( table.has_field( "animator" ) )
    2933        {
  • trunk/src/engine/ragdoll_manager.cc

    r520 r524  
    6666        if ( auto bind_data = rbind.lock() )
    6767        {
     68                data->id = table.get_string32( "id" );
    6869                int index = data->parts.size();
    6970                data->parts.emplace_back();
  • trunk/src/engine/resource_system.cc

    r486 r524  
    3434        }
    3535}
     36
     37void 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.