Changeset 519


Ignore:
Timestamp:
08/26/16 21:56:27 (9 years ago)
Author:
epyon
Message:
  • types.hh fix
  • more debug in particle engine
Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/nv/core/types.hh

    r518 r519  
    150150                        type_entry* i_type = new type_entry;
    151151                        i_type->type_db = this;
    152                         i_type->hash = thash64( shash64( name ).value() );
     152                        i_type->hash = thash64::create< TYPE >();
    153153                        i_type->name = m_names.insert( name );
    154154                        i_type->size = sizeof( TYPE );
     
    168168                }
    169169
     170                const type_entry* get_type( shash64 name ) const
     171                {
     172                        auto it = m_index_by_name.find( name );
     173                        return it != m_index_by_name.end() ? it->second : nullptr;
     174                }
     175
    170176                type_entry* get_type( thash64 hash )
     177                {
     178                        auto it = m_index_by_type.find( hash );
     179                        return it != m_index_by_type.end() ? it->second : nullptr;
     180                }
     181
     182                const type_entry* get_type( thash64 hash ) const
    171183                {
    172184                        auto it = m_index_by_type.find( hash );
  • trunk/nv/engine/particle_engine.hh

    r518 r519  
    203203                static string_view get_debug_name( particle_emitter_func f );
    204204                static string_view get_debug_name( particle_affector_func f );
     205                static const vector< particle_emitter_func >* get_debug_emitter_list() { return m_debug_emitter_list; }
     206                static const vector< particle_affector_func >* get_debug_affector_list() { return m_debug_affector_list; }
    205207                static const type_entry* get_debug_type( particle_affector_init_func f );
    206208                static void register_types( type_database* db );
     
    225227                static hash_store< shash64, particle_affector_funcs >        m_affectors;
    226228
     229                static vector< particle_emitter_func >*  m_debug_emitter_list;
     230                static vector< particle_affector_func >* m_debug_affector_list;
    227231                static hash_map< particle_emitter_func,  const_string >* m_debug_emitter_names;
    228232                static hash_map< particle_affector_func, const_string >* m_debug_affector_names;
  • trunk/src/engine/default_resource_manager.cc

    r518 r519  
    2727{
    2828        m_lua = lua;
    29 
    30         particle_engine::register_types( const_cast< type_database* >( lua->get_type_data()->get_type_database() ) );
    3129
    3230        int below_already_registered;
  • trunk/src/engine/particle_engine.cc

    r518 r519  
    1515nv::hash_store< nv::shash64, nv::particle_emitter_func >   nv::particle_engine::m_emitters;
    1616nv::hash_store< nv::shash64, nv::particle_affector_funcs > nv::particle_engine::m_affectors;
     17
     18nv::vector< nv::particle_emitter_func >*  nv::particle_engine::m_debug_emitter_list;
     19nv::vector< nv::particle_affector_func >* nv::particle_engine::m_debug_affector_list;
     20
    1721
    1822nv::hash_map< nv::particle_emitter_func,  nv::const_string >* nv::particle_engine::m_debug_emitter_names  = nullptr;
     
    158162};
    159163
     164NV_RTTI_DECLARE( nvpe_linear_force_data )
     165
    160166static bool nv_particle_affector_linear_force_init( lua::table_guard* table, particle_affector_data* data )
    161167{
     
    189195        float    distance;
    190196};
     197
     198NV_RTTI_DECLARE( nvpe_deflector_plane_data )
    191199
    192200static bool nv_particle_affector_deflector_plane_init( lua::table_guard* table, particle_affector_data* data )
     
    226234};
    227235
     236NV_RTTI_DECLARE( nvpe_color_fader_data )
     237
    228238static bool nv_particle_affector_color_fader_init( lua::table_guard* table, particle_affector_data* data )
    229239{
     
    247257        nv::vec2 adjustment;
    248258};
     259
     260NV_RTTI_DECLARE( nvpe_scaler_data )
    249261
    250262static bool nv_particle_affector_scaler_init( lua::table_guard* table, particle_affector_data* data )
     
    274286                m_debug_affector_names = new nv::hash_map< nv::particle_affector_func, nv::const_string >;
    275287                m_debug_affector_types = new nv::hash_map< nv::particle_affector_func, nv::type_entry* >;
     288                m_debug_emitter_list   = new nv::vector< nv::particle_emitter_func >;
     289                m_debug_affector_list  = new nv::vector< nv::particle_affector_func >;
    276290        }
    277291
     
    695709        if ( m_debug_emitter_names )
    696710                ( *m_debug_emitter_names )[func] = name;
     711        if ( m_debug_emitter_list )
     712                ( *m_debug_emitter_list ).push_back( func );
     713
    697714        m_emitters[ name ] = func;
    698715}
     
    716733        if ( m_debug_affector_names )
    717734                ( *m_debug_affector_names )[process] = name;
     735        if ( m_debug_affector_list )
     736                ( *m_debug_affector_list ).push_back( process );
    718737
    719738        m_affectors[ name ].init    = init;
     
    777796void nv::particle_engine::register_types( type_database* db )
    778797{
    779         db->create_type<nv::particle_orientation>()
     798        db->create_type<particle_orientation>()
    780799                .value( "PS_POINT",                sint32( particle_orientation::POINT ),                "Point" )
    781800                .value( "PS_ORIENTED",             sint32( particle_orientation::ORIENTED ),             "Oriented" )
     
    785804                ;
    786805
    787         db->create_type<nv::particle_origin>()
     806        db->create_type<particle_origin>()
    788807                .value( "PS_CENTER",        sint32( particle_origin::CENTER ),        "Center" )
    789808                .value( "PS_TOP_LEFT",      sint32( particle_origin::TOP_LEFT ),      "Top left" )
     
    800819        {
    801820                int you_could_get_rid_of_the_init_function_using_these; int error;
     821                int universal_vm_based_affector;
     822                // compile_affector( ... ) in lua, returns array of bytecode
     823                // function is a normal bytecode runner!
     824
    802825
    803826                (*m_debug_affector_types)[ nv_particle_affector_linear_force ]
Note: See TracChangeset for help on using the changeset viewer.