Changeset 515 for trunk


Ignore:
Timestamp:
08/16/16 19:45:45 (9 years ago)
Author:
epyon
Message:
  • model tag support
  • local transform particle engines
  • fix for 3d textures
  • minor cleanups/fixes
Location:
trunk
Files:
8 edited

Legend:

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

    r512 r515  
    4040                resource< data_channel_set > mesh;
    4141                resource< material >         material;
     42                string32                     tag;
    4243                transform                    local;
    4344                random_range< vec3 >         position;
     
    5455                        target->mesh      = mesh;
    5556                        target->material  = material;
     57                        target->tag       = tag;
    5658                        target->local     = local;
    5759                        target->rotation  = rotation;
     
    8486                resource< data_channel_set > mesh;
    8587                resource< material >         material;
     88                shash64                      tag;
    8689                sint16                       attach_id;
    8790                sint16                       parent_id;
     
    176179                        if ( m == selected ) parent_flags |= FMF_FOCUS;
    177180
    178                         if ( m->mesh || m->force )
     181                        if ( m->mesh || m->force || !m->tag.empty() )
    179182                        {
    180183                                uint32 id = result.count++;
     
    183186                                re.material = m->material;
    184187                                re.local = tr;
     188                                re.tag = m->tag;
    185189                                re.parent_id = parent_id;
    186190                                re.attach_id = m->attach_id;
  • trunk/nv/engine/particle_engine.hh

    r501 r515  
    187187                void release( particle_system_group group );
    188188                void release( particle_system system );
    189                 void update( particle_system system, float dtime );
     189                void update( particle_system system, transform model, float dtime );
    190190                void render( particle_system system, const scene_state& s );
    191191                void set_texcoords( particle_system system, vec2 a, vec2 b );
     
    200200                void generate_data( particle_system_info* info, const scene_state& s );
    201201                void destroy_particles( particle_system_info* info, float dtime );
    202                 void create_particles( particle_system_info* info, float dtime );
     202                void create_particles( particle_system_info* info, transform tr, float dtime );
    203203                void update_particles( particle_system_info* info, float dtime );
    204204                void update_emmiters( particle_system_info* info, float dtime );
  • trunk/nv/interface/device.hh

    r508 r515  
    130130                wrap wrap_s;
    131131                wrap wrap_t;
    132 
    133                 sampler() : filter_min( LINEAR ), filter_max( LINEAR ), wrap_s( REPEAT ), wrap_t( REPEAT ) {}
    134                 sampler( filter min, filter max, wrap s, wrap t )
    135                         : filter_min( min ), filter_max( max ), wrap_s( s ), wrap_t( t ) {}
     132                wrap wrap_r;
     133
     134                sampler() : filter_min( LINEAR ), filter_max( LINEAR ), wrap_s( REPEAT ), wrap_t( REPEAT ), wrap_r( REPEAT ) {}
     135                sampler( filter min, filter max, wrap s, wrap t, wrap r )
     136                        : filter_min( min ), filter_max( max ), wrap_s( s ), wrap_t( t ), wrap_r( r ) {}
    136137                sampler( filter f, wrap w )
    137                         : filter_min( f ), filter_max( f ), wrap_s( w ), wrap_t( w ) {}
     138                        : filter_min( f ), filter_max( f ), wrap_s( w ), wrap_t( w ), wrap_r( w )
     139                {}
    138140
    139141        };
  • trunk/nv/lua/lua_state.hh

    r511 r515  
    378378                        string128 get_string128( string_view element, string_view defval = string_view() );
    379379                        string64 get_string64( string_view element, string_view defval = string_view() );
     380                        string32 get_string32( string_view element, string_view defval = string_view() );
    380381
    381382                        char get_char( string_view element, char defval = ' ' );
  • trunk/src/engine/model_manager.cc

    r512 r515  
    5858        if ( table.is_string( "material" ) )
    5959                cmaterial = m_rm->get< material >( table.get_string128( "material" ) );
     60
     61        if ( table.is_string( "tag" ) )
     62                node->tag = table.get_string32( "tag" );
    6063
    6164        if ( table.has_field( "path" ) )
  • trunk/src/engine/particle_engine.cc

    r501 r515  
    605605}
    606606
    607 void nv::particle_engine::update( particle_system system, float dtime )
     607void nv::particle_engine::update( particle_system system, transform model, float dtime )
    608608{
    609609        particle_system_info* info = m_systems.get( system );
     
    621621                update_emmiters( info, dtime );
    622622                destroy_particles( info, dtime );
    623                 create_particles( info, dtime );
     623                create_particles( info, model, dtime );
    624624                update_particles( info, dtime );
    625625
     
    776776}
    777777
    778 void nv::particle_engine::create_particles( particle_system_info* info, float dtime )
     778void nv::particle_engine::create_particles( particle_system_info* info, transform model, float dtime )
    779779{
    780780        uint32 ecount = info->data->emmiter_count;
     
    782782
    783783        random& r = random::get();
    784         vec3 source;
    785         mat3 orient;
    786 //      bool local = info->data->local;
     784        bool local = model.is_identity();
    787785//      if ( !local )
    788786//      {
     
    806804                                        edata.emmiter_func( &(info->data->emmiters[i]), &pinfo, 1 );
    807805                                        pinfo.position = vec3();
    808 //                                      if ( !local ) pinfo.position  = orient * pinfo.position + source;
    809806                                        pinfo.position+= edata.position;
    810                                         pinfo.color    = edata.color_min == edata.color_max ?
     807                                        if ( !local )
     808                                                pinfo.position = pinfo.position * model;
     809                                        pinfo.color    = edata.color_min == edata.color_max ?
    811810                                                edata.color_min : r.range( edata.color_min, edata.color_max );
    812811                                        pinfo.size     = edata.size_min == edata.size_max ?
     
    829828                                                float sin_theta = sqrt(1.0f - cos_theta * cos_theta );
    830829                                                float phi       = r.frange( 0.0f, 2* math::pi<float>() );
    831                                                 pinfo.velocity  = orient *
     830                                                pinfo.velocity  = model.get_orientation() *
    832831                                                        ( edata.odir * ( cos(phi) * sin_theta ) +
    833832                                                        edata.cdir * ( sin(phi)*sin_theta ) +
  • trunk/src/gl/gl_context.cc

    r505 r515  
    964964        glTexParameteri( gl_type, GL_TEXTURE_WRAP_S, GLint( nv::sampler_wrap_to_enum( asampler.wrap_s ) ) );
    965965        glTexParameteri( gl_type, GL_TEXTURE_WRAP_T, GLint( nv::sampler_wrap_to_enum( asampler.wrap_t ) ) );
     966        glTexParameteri( gl_type, GL_TEXTURE_WRAP_R, GLint( nv::sampler_wrap_to_enum( asampler.wrap_r ) ) );
    966967
    967968        if ( is_depth )
  • trunk/src/lua/lua_state.cc

    r511 r515  
    344344}
    345345
     346
     347nv::string32 nv::lua::table_guard::get_string32( string_view element, string_view defval /*= string_view() */ )
     348{
     349        lua_getfield( m_state, -1, element.data() );
     350        size_t l = 0;
     351        const char* str = nullptr;
     352        if ( lua_type( m_state, -1 ) == LUA_TSTRING )
     353        {
     354                str = lua_tolstring( m_state, -1, &l );
     355        }
     356        else
     357        {
     358                l = defval.size();
     359                str = defval.data();
     360        }
     361        string32 result( str, l );
     362        lua_pop( m_state, 1 );
     363        return result;
     364}
    346365
    347366char lua::table_guard::get_char( string_view element, char defval /*= "" */ )
Note: See TracChangeset for help on using the changeset viewer.