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
File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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 ) +
Note: See TracChangeset for help on using the changeset viewer.