79 строки
1.3 KiB

  1. //
  2. // Lol Engine
  3. //
  4. // Copyright © 2010—2019 Sam Hocevar <sam@hocevar.net>
  5. //
  6. // Lol Engine is free software. It comes without any warranty, to
  7. // the extent permitted by applicable law. You can redistribute it
  8. // and/or modify it under the terms of the Do What the Fuck You Want
  9. // to Public License, Version 2, as published by the WTFPL Task Force.
  10. // See http://www.wtfpl.net/ for more details.
  11. //
  12. #include <lol/engine-internal.h>
  13. #include <cstring>
  14. #include <cstdlib>
  15. namespace lol
  16. {
  17. Light::Light()
  18. : m_color(1.f),
  19. m_type(LightType::Directional)
  20. {
  21. m_gamegroup = tickable::group::game::light;
  22. m_drawgroup = tickable::group::draw::light;
  23. SetPosition(vec3::zero);
  24. }
  25. Light::~Light()
  26. {
  27. }
  28. void Light::SetType(LightType const &type)
  29. {
  30. m_type = type;
  31. }
  32. LightType Light::GetType()
  33. {
  34. return m_type;
  35. }
  36. void Light::SetPosition(vec3 const &pos)
  37. {
  38. m_position = pos;
  39. }
  40. vec3 Light::GetPosition()
  41. {
  42. return m_position;
  43. }
  44. void Light::SetColor(vec4 const &color)
  45. {
  46. m_color = color;
  47. }
  48. vec4 Light::GetColor()
  49. {
  50. return m_color;
  51. }
  52. void Light::tick_game(float seconds)
  53. {
  54. WorldEntity::tick_game(seconds);
  55. }
  56. void Light::tick_draw(float seconds, Scene &scene)
  57. {
  58. WorldEntity::tick_draw(seconds, scene);
  59. scene.AddLight(this);
  60. }
  61. } /* namespace lol */