Antkeeper  0.0.1
light.cpp
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 #include <engine/scene/light.hpp>
21 #include <engine/config.hpp>
22 #include <engine/color/cct.hpp>
23 
24 namespace scene {
25 
27 {
28  m_color = color;
29  color_updated();
30 }
31 
32 void light::set_color_temperature(float temperature)
33 {
34  set_color(config::scene_linear_color_space<float>.from_xyz * color::cct_to_xyz(temperature));
35 }
36 
37 void light::transformed()
38 {
39  m_bounds = {get_translation(), get_translation()};
40 }
41 
42 } // namespace scene
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
constexpr const vector_type & get_translation() const noexcept
Returns the translation of the object.
Definition: object.hpp:133
Color science.
Definition: aces.hpp:27
math::vec3< T > cct_to_xyz(T t)
Calculates CIE XYZ colorspace chromaticity coordinates given a correlated color temperature using Kry...
Definition: cct.hpp:70
3D scene.
Definition: context.hpp:28
n-dimensional vector.
Definition: vector.hpp:44