You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

82 lines
1.8 KiB

  1. //
  2. // Lol Engine
  3. //
  4. // Copyright: (c) 2010-2013 Sam Hocevar <sam@hocevar.net>
  5. // This program is free software; you can redistribute it and/or
  6. // modify it under the terms of the Do What The Fuck You Want To
  7. // Public License, Version 2, as published by Sam Hocevar. See
  8. // http://www.wtfpl.net/ for more details.
  9. //
  10. //
  11. // The Scene class
  12. // ---------------
  13. //
  14. #if !defined __LOL_SCENE_H__
  15. #define __LOL_SCENE_H__
  16. #include <stdint.h>
  17. #include "tileset.h"
  18. #include "light.h"
  19. #include "camera.h"
  20. #include "mesh/primitive.h"
  21. #define LOL_MAX_LIGHT_COUNT 8
  22. namespace lol
  23. {
  24. class SceneData;
  25. class Scene
  26. {
  27. friend class Video;
  28. private:
  29. Scene(ivec2 size);
  30. ~Scene();
  31. public:
  32. Camera *GetCamera(int cam_idx=-1);
  33. int PushCamera(Camera *cam);
  34. void PopCamera(Camera *cam);
  35. void SetTileCam(int cam_idx);
  36. void Reset();
  37. void RenderPrimitives();
  38. void RenderTiles();
  39. void RenderLines(float seconds);
  40. /* New scenegraph */
  41. void AddPrimitive(Mesh const &mesh, mat4 const &matrix);
  42. /* FIXME: this should be deprecated -- it doesn't really match
  43. * the architecture we want to build */
  44. void AddTile(TileSet *tileset, int id, vec3 pos, int o, vec2 scale, float angle);
  45. void SetLineTime(float new_time=-1.f);
  46. void SetLineMask(int new_mask=0xFFFFFFFF);
  47. void SetLineSegmentSize(float new_segment_size=100000.f);
  48. float GetLineSegmentSize();
  49. void SetLineColor(vec4 new_color=vec4(1.f));
  50. vec4 GetLineColor();
  51. void AddLine(vec3 a, vec3 b, vec4 color);
  52. void AddLine(vec2 a, vec3 b, vec4 color, float az=-1.f);
  53. void AddLine(vec2 a, vec2 b, vec4 color, float az=-1.f, float bz=-1.f);
  54. void AddLight(Light *light);
  55. Array<Light *> const &GetLights() const;
  56. private:
  57. SceneData *data;
  58. };
  59. extern Scene *g_scene;
  60. } /* namespace lol */
  61. #endif // __LOL_SCENE_H__