Antkeeper  0.0.1
scene/light.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2023 Christopher J. Howard
3  *
4  * This file is part of Antkeeper source code.
5  *
6  * Antkeeper source code is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * Antkeeper source code is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with Antkeeper source code. If not, see <http://www.gnu.org/licenses/>.
18  */
19 
20 #ifndef ANTKEEPER_SCENE_LIGHT_HPP
21 #define ANTKEEPER_SCENE_LIGHT_HPP
22 
23 #include <engine/scene/object.hpp>
25 
26 namespace scene {
27 
31 class light: public object<light>
32 {
33 public:
35  [[nodiscard]] virtual light_type get_light_type() const noexcept = 0;
36 
37  [[nodiscard]] inline const aabb_type& get_bounds() const noexcept override
38  {
39  return m_bounds;
40  }
41 
47  void set_color(const math::fvec3& color);
48 
54  void set_color_temperature(float temperature);
55 
57  [[nodiscard]] inline constexpr const math::fvec3& get_color() const noexcept
58  {
59  return m_color;
60  }
61 
62 protected:
64  inline virtual void color_updated() {};
65 
66 private:
67  void transformed() override;
68 
69  aabb_type m_bounds{};
70 
71  math::fvec3 m_color{1.0f, 1.0f, 1.0f};
72 };
73 
74 } // namespace scene
75 
76 #endif // ANTKEEPER_SCENE_LIGHT_HPP
Abstract base class for light objects.
Definition: scene/light.hpp:32
virtual light_type get_light_type() const noexcept=0
Returns an enumeration denoting the light object type.
constexpr const math::fvec3 & get_color() const noexcept
Returns the scene-linear RGB color of the light.
Definition: scene/light.hpp:57
void set_color(const math::fvec3 &color)
Sets the color of the light.
Definition: light.cpp:26
virtual void color_updated()
Called each time the light color is modified.
Definition: scene/light.hpp:64
void set_color_temperature(float temperature)
Sets the color of the light from a color temperature.
Definition: light.cpp:32
const aabb_type & get_bounds() const noexcept override
Returns the bounds of the object.
Definition: scene/light.hpp:37
geom::box< float > aabb_type
Definition: object.hpp:42
Abstract base class for lights, cameras, model instances, and other scene objects.
Definition: object.hpp:172
Color science.
Definition: aces.hpp:27
3D scene.
Definition: context.hpp:28
light_type
Light types.
Definition: light-type.hpp:29
n-dimensional axis-aligned rectangle.
n-dimensional vector.
Definition: vector.hpp:44