Particle.cpp 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /*
  2. * Copyright (C) 2022 The V-Gears Team
  3. *
  4. * This file is part of V-Gears
  5. *
  6. * V-Gears is free software: you can redistribute it and/or modify it under
  7. * terms of the GNU General Public License as published by the Free Software
  8. * Foundation, version 3.0 (GPLv3) of the License.
  9. *
  10. * V-Gears is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. */
  15. #include "engine/particles/Particle.h"
  16. Particle::Particle():
  17. parent_emitter_(nullptr),
  18. particle_type_(PT_VISUAL),
  19. enabled_(true),
  20. emittable_(false),
  21. additional_data(nullptr),
  22. position(Ogre::Vector3::ZERO),
  23. direction(Ogre::Vector3::ZERO),
  24. time_to_live(10),
  25. total_time_to_live(10)
  26. {}
  27. Particle::~Particle(){}
  28. void Particle::Update(Ogre::Real time_elapsed){
  29. position += direction * time_elapsed;
  30. }
  31. void Particle::CopyAttributesTo(Particle* particle){
  32. // Don't copy parent_emitter_ and particle_type_
  33. // This can be emited from other emitter and have different type
  34. particle->enabled_ = enabled_;
  35. particle->SetEmittable(emittable_);
  36. particle->position = position;
  37. particle->direction = direction;
  38. particle->time_to_live = time_to_live;
  39. particle->total_time_to_live = total_time_to_live;
  40. }