Particle.cpp 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #include "core/particles/Particle.h"
  2. //------------------------------------------------------------------------------
  3. Particle::Particle():
  4. m_ParentEmitter(nullptr),
  5. m_ParticleType(PT_VISUAL),
  6. m_Enabled(true),
  7. m_Emittable(false),
  8. additional_data(nullptr),
  9. position(Ogre::Vector3::ZERO),
  10. direction(Ogre::Vector3::ZERO),
  11. time_to_live(10),
  12. total_time_to_live(10)
  13. {
  14. }
  15. //------------------------------------------------------------------------------
  16. Particle::~Particle()
  17. {
  18. }
  19. //------------------------------------------------------------------------------
  20. void
  21. Particle::Update(Ogre::Real time_elapsed)
  22. {
  23. position += direction * time_elapsed;
  24. }
  25. //------------------------------------------------------------------------------
  26. void
  27. Particle::CopyAttributesTo(Particle* particle)
  28. {
  29. // do not copy m_ParentEmitter and m_ParticleType
  30. // this can be emited from other emitter and have different type
  31. particle->m_Enabled = m_Enabled;
  32. particle->SetEmittable(m_Emittable);
  33. particle->position = position;
  34. particle->direction = direction;
  35. particle->time_to_live = time_to_live;
  36. particle->total_time_to_live = total_time_to_live;
  37. }
  38. //------------------------------------------------------------------------------