25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

scenesetup.cpp 1.5 KiB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. //
  2. // Lol Engine
  3. //
  4. // Copyright: (c) 2013 Benjamin "Touky" Huet <huet.benjamin@gmail.com>
  5. // 2013 Sam Hocevar <sam@hocevar.net>
  6. // This program is free software; you can redistribute it and/or
  7. // modify it under the terms of the Do What The Fuck You Want To
  8. // Public License, Version 2, as published by Sam Hocevar. See
  9. // http://www.wtfpl.net/ for more details.
  10. //
  11. #if defined HAVE_CONFIG_H
  12. # include "config.h"
  13. #endif
  14. #include "core.h"
  15. #include "scenesetup.h"
  16. #include "scenesetup-compiler.h"
  17. namespace lol
  18. {
  19. //-----------------------------------------------------------------------------
  20. //CTor/DTor
  21. SceneSetup::SceneSetup()
  22. {
  23. m_clear_color = vec4(vec3::zero, 1.f);
  24. m_show_gizmo = true;
  25. m_show_lights = true;
  26. }
  27. //----
  28. SceneSetup::~SceneSetup()
  29. {
  30. Shutdown(true);
  31. }
  32. //-----------------------------------------------------------------------------
  33. bool SceneSetup::Compile(char const *command)
  34. {
  35. SceneSetupCompiler mc(*this);
  36. return mc.ParseString(command);
  37. }
  38. //-----------------------------------------------------------------------------
  39. bool SceneSetup::Startup()
  40. {
  41. for (int i = 0; i < m_lights.Count(); i++)
  42. Ticker::Ref(m_lights[i]);
  43. return true;
  44. }
  45. //-----------------------------------------------------------------------------
  46. bool SceneSetup::Shutdown(bool destroy)
  47. {
  48. for (int i = 0; i < m_lights.Count(); i++)
  49. if (m_lights[i]->IsTicked())
  50. Ticker::Unref(m_lights[i]);
  51. if (destroy)
  52. m_lights.Empty();
  53. return true;
  54. }
  55. } /* namespace lol */