MOS
environment_light.hpp
1 #pragma once
2 #include <mos/gfx/box.hpp>
3 #include <mos/gfx/cube_camera.hpp>
4 #include <mos/gfx/target.hpp>
5 
6 namespace mos::gfx {
7 
8 class Environment_light;
9 using Optional_environment_light = std::optional<Environment_light>;
10 
12 class Environment_light final {
13 public:
16  explicit Environment_light(const glm::vec3 &position = glm::vec3(0.0f, 0.0f,
17  1.0f),
18  const glm::vec3 &extent = glm::vec3(50.0f),
19  float strength = 0.0f, float falloff = 0.1f,
20  float near = 0.1f);
21 
22  static auto load(const std::string &directory, const std::string &path,
23  const glm::mat4 &parent_transform = glm::mat4(1.0f))
25 
27  auto position(const glm::vec3 &position) -> void;
28 
30  auto position() const -> glm::vec3;
31 
33  auto extent(const glm::vec3 &extent) -> void;
34 
36  auto extent() const -> glm::vec3;
37 
39  auto inside(const glm::vec3 &point) const -> bool;
40 
42  auto camera(size_t index) const -> Camera;
43 
45  float strength{0.0f};
46 
48  float falloff{0.1f};
49 
50 private:
51  Box box_;
52  Cube_camera cube_camera_;
53 };
54 } // namespace mos::gfx
auto inside(const glm::vec3 &point) const -> bool
Check if a point is inside the environment light box.
Environment light, based on a cube map.
Definition: environment_light.hpp:12
float strength
Strength.
Definition: environment_light.hpp:45
Rendering camera view.
Definition: camera.hpp:12
auto camera(size_t index) const -> Camera
Get one of the six cube cameras, for rendering.
Environment_light(const glm::vec3 &position=glm::vec3(0.0f, 0.0f, 1.0f), const glm::vec3 &extent=glm::vec3(50.0f), float strength=0.0f, float falloff=0.1f, float near=0.1f)
Definition: assets.hpp:17
auto position() const -> glm::vec3
Get position.
Camera for environment rendering.
Definition: cube_camera.hpp:10
Visual bounding box.
Definition: box.hpp:8
auto extent() const -> glm::vec3
Get extent.
float falloff
Falloff.
Definition: environment_light.hpp:48