Event.cpp 736 B

12345678910111213141516171819202122232425262728293031
  1. // Copyright (C) 2009-present, Panagiotis Christopoulos Charitos and contributors.
  2. // All rights reserved.
  3. // Code licensed under the BSD License.
  4. // http://www.anki3d.org/LICENSE
  5. #include <AnKi/Scene/Events/Event.h>
  6. #include <AnKi/Scene/Events/EventManager.h>
  7. #include <AnKi/Scene/SceneGraph.h>
  8. #include <AnKi/Util/HighRezTimer.h>
  9. namespace anki {
  10. void Event::init(Second startTime, Second duration)
  11. {
  12. m_startTime = startTime;
  13. m_duration = (duration < 0.0) ? kMaxSecond : duration;
  14. if(duration < 0.0)
  15. {
  16. m_reanimate = true;
  17. }
  18. }
  19. Second Event::getDelta(Second crntTime) const
  20. {
  21. const Second d = crntTime - m_startTime; // delta
  22. const Second dp = d / m_duration; // delta as persentage
  23. return dp;
  24. }
  25. } // end namespace anki