Changeset 522 for trunk/src/engine/particle_engine.cc
- Timestamp:
- 10/14/16 18:17:17 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/engine/particle_engine.cc
r520 r522 306 306 else 307 307 info->emitters[i].pause = m_rng->frange( data->emitters[i].duration_min, data->emitters[i].duration_max ); 308 309 308 } 310 309 … … 313 312 314 313 return result; 314 } 315 316 void nv::particle_engine::set_on_collide( particle_system system, const particle_on_collide_func& f ) 317 { 318 particle_system_info* info = m_systems.get( system ); 319 if ( info ) 320 info->on_collide = f; 315 321 } 316 322 … … 364 370 m_systems.destroy( system ); 365 371 } 372 } 373 374 bool nv::particle_engine::is_finished( particle_system system ) 375 { 376 particle_system_info* info = m_systems.get( system ); 377 if ( info ) 378 { 379 if ( info->count > 0 ) return false; 380 for ( uint32 i = 0; i < info->data->emitter_count; ++i ) 381 { 382 const auto& edata = info->emitters[i]; 383 if ( edata.active || edata.pause > 0.0f ) 384 { 385 return false; 386 } 387 } 388 } 389 return true; 366 390 } 367 391 … … 403 427 void nv::particle_engine::set_texcoords( particle_system system, vec2 a, vec2 b ) 404 428 { 405 406 429 particle_system_info* info = m_systems.get( system ); 407 430 if ( info ) … … 513 536 pdata.position += pdata.velocity * factor; 514 537 } 538 539 if ( info->on_collide ) 540 { 541 for ( uint32 i = 0; i < info->count; ++i ) 542 { 543 particle& pdata = info->particles[i]; 544 if ( pdata.position.y <= 0.0f ) 545 { 546 info->on_collide( pdata.position, pdata.velocity ); 547 pdata.death = pdata.lifetime; 548 } 549 } 550 } 551 515 552 } 516 553
Note: See TracChangeset
for help on using the changeset viewer.