Changeset 515 for trunk/src


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/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • 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.