LightEvent.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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. #pragma once
  6. #include <AnKi/Scene/Events/Event.h>
  7. #include <AnKi/Math.h>
  8. namespace anki {
  9. /// @addtogroup scene
  10. /// @{
  11. /// An event for light animation
  12. class LightEvent : public Event
  13. {
  14. public:
  15. LightEvent(Second startTime, Second duration, SceneNode* light);
  16. /// Implements Event::update
  17. void update(Second prevUpdateTime, Second crntTime) override;
  18. void setRadiusMultiplier(F32 v)
  19. {
  20. m_radiusMultiplier = v;
  21. }
  22. void setIntensityMultiplier(const Vec4& v)
  23. {
  24. m_intensityMultiplier = v;
  25. }
  26. /// Set the frequency of changes.
  27. /// @param freq The higher it is the faster things happen.
  28. /// @param deviation Add a randomization to the frequency.
  29. void setFrequency(F32 freq, F32 deviation)
  30. {
  31. if(ANKI_EXPECT(freq > 0.0))
  32. {
  33. m_freq = freq;
  34. }
  35. if(ANKI_EXPECT(freq > deviation))
  36. {
  37. m_freqDeviation = deviation;
  38. }
  39. }
  40. private:
  41. F32 m_freq = 1.0;
  42. F32 m_freqDeviation = 0.0;
  43. F32 m_radiusMultiplier = 0.0;
  44. Vec4 m_intensityMultiplier = Vec4(0.0);
  45. F32 m_originalRadius;
  46. Vec4 m_originalDiffColor;
  47. };
  48. /// @}
  49. } // end namespace anki