scene.h 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. #pragma once
  2. #include <irrlicht/irrlicht.h>
  3. #include <nlohmann/json.hpp>
  4. #include "project.h"
  5. #include "object.h"
  6. #include "scenes/camera.h"
  7. #include "scenes/projection.h"
  8. namespace wp::core
  9. {
  10. using json = nlohmann::json;
  11. class project;
  12. class object;
  13. class scene
  14. {
  15. public:
  16. static scene* fromFile (const irr::io::path& filename);
  17. project* getProject ();
  18. const irr::video::SColorf &getAmbientColor() const;
  19. bool isBloom() const;
  20. irr::f64 getBloomStrength() const;
  21. irr::f64 getBloomThreshold() const;
  22. bool isCameraFade() const;
  23. bool isCameraParallax() const;
  24. irr::f64 getCameraParallaxAmount() const;
  25. irr::f64 getCameraParallaxDelay() const;
  26. irr::f64 getCameraParallaxMouseInfluence() const;
  27. bool isCameraPreview() const;
  28. bool isCameraShake() const;
  29. irr::f64 getCameraShakeAmplitude() const;
  30. irr::f64 getCameraShakeRoughness() const;
  31. irr::f64 getCameraShakeSpeed() const;
  32. const irr::video::SColorf &getClearColor() const;
  33. scenes::projection *getOrthogonalProjection() const;
  34. const irr::video::SColorf &getSkylightColor() const;
  35. protected:
  36. friend class project;
  37. void setProject (project* project);
  38. scenes::camera* getCamera ();
  39. scene (
  40. scenes::camera* camera,
  41. irr::video::SColorf ambientColor,
  42. bool bloom,
  43. irr::f64 bloomStrength,
  44. irr::f64 bloomThreshold,
  45. bool cameraFade,
  46. bool cameraParallax,
  47. irr::f64 cameraParallaxAmount,
  48. irr::f64 cameraParallaxDelay,
  49. irr::f64 cameraParallaxMouseInfluence,
  50. bool cameraPreview,
  51. bool cameraShake,
  52. irr::f64 cameraShakeAmplitude,
  53. irr::f64 cameraShakeRoughness,
  54. irr::f64 cameraShakeSpeed,
  55. irr::video::SColorf clearColor,
  56. scenes::projection* orthogonalProjection,
  57. irr::video::SColorf skylightColor
  58. );
  59. void insertObject (object* object);
  60. private:
  61. project* m_project;
  62. scenes::camera* m_camera;
  63. // data from general section on the json
  64. irr::video::SColorf m_ambientColor;
  65. bool m_bloom;
  66. irr::f64 m_bloomStrength;
  67. irr::f64 m_bloomThreshold;
  68. bool m_cameraFade;
  69. bool m_cameraParallax;
  70. irr::f64 m_cameraParallaxAmount;
  71. irr::f64 m_cameraParallaxDelay;
  72. irr::f64 m_cameraParallaxMouseInfluence;
  73. bool m_cameraPreview;
  74. bool m_cameraShake;
  75. irr::f64 m_cameraShakeAmplitude;
  76. irr::f64 m_cameraShakeRoughness;
  77. irr::f64 m_cameraShakeSpeed;
  78. irr::video::SColorf m_clearColor;
  79. scenes::projection* m_orthogonalProjection;
  80. irr::video::SColorf m_skylightColor;
  81. std::vector<object*> m_objects;
  82. };
  83. };