scene.h 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. #ifndef SCENE_H
  2. #define SCENE_H
  3. // ===============================
  4. // AUTHOR : Angel Ortiz (angelo12 AT vt DOT edu)
  5. // CREATE DATE : 2018-07-10
  6. // PURPOSE : Contains all of the world information. The objects that you want to
  7. // render, the camera that represents the viewer and the lights within
  8. // a scene. It also performs the view frustrum culling check to see which
  9. // objects should be visible by the camera at any given time and keeps
  10. // that list updated.
  11. // ===============================
  12. // SPECIAL NOTES: I use vectors here instead of arrays. Which I though would be necessary
  13. // given that I would not know how many items would be loaded. It probably should be
  14. // changed in any future update to the engine.
  15. // ===============================
  16. //Headers
  17. #include <vector>
  18. #include <queue>
  19. #include "model.h"
  20. #include "camera.h"
  21. #include "light.h"
  22. class Scene{
  23. public:
  24. //Builds scene using path to folder containing content and txt setup file
  25. Scene(const std::string &sceneFolder);
  26. ~Scene();
  27. //Updates all models, lights and cameras
  28. void update(unsigned int deltaT);
  29. //Getters used in the setup of the render queue
  30. std::queue<Model*>* getVisiblemodels();
  31. Camera * getCurrentCamera();
  32. BaseLight * getCurrentLights();
  33. int getLightCount();
  34. //Signals issues to scene Manager
  35. bool checkIfEmpty();
  36. private:
  37. bool emptyScene;
  38. Camera mainCamera;
  39. int lightCount;
  40. BaseLight *lights; //Array of lights in scene
  41. //Contains the models that remain after frustrum culling
  42. std::queue<Model*> visibleModels;
  43. std::vector<Model*> modelsInScene;
  44. //Loads scene models, checks by looking for the mesh .If it finds it assumes
  45. // (dangerously) that all the other texture data also exists
  46. bool loadContent(const std::string &baseFilePath, const std::string &sceneName);
  47. //Check if scene folder acually exists and also checks accessibility
  48. bool findSceneFolder(const std::string &scenePath);
  49. void loadSceneModel(const std::string &baseFilePath, const TransformParameters &init ,const std::string modelMeshID, const std::string modelMaterialID);
  50. //Finds objects that the camera can see
  51. void frustrumCulling();
  52. };
  53. #endif