diff options
Diffstat (limited to 'gfx/lightDirection.cpp')
-rw-r--r-- | gfx/lightDirection.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/gfx/lightDirection.cpp b/gfx/lightDirection.cpp new file mode 100644 index 0000000..3932872 --- /dev/null +++ b/gfx/lightDirection.cpp @@ -0,0 +1,12 @@ +#include "lightDirection.h" +#include "maths.h" + +constexpr auto ASTRONOMICAL_TWILIGHT = 18.0_degrees; +constexpr auto SUN_ANGLUAR_SIZE = 0.5_degrees; + +LightDirection::LightDirection(const Direction2D sunPos) : + pos {sunPos}, vec {glm::mat3 {rotate_yp(pi + sunPos.x, -sunPos.y)} * north}, + amb {glm::clamp(sunPos.y + ASTRONOMICAL_TWILIGHT, 0.F, 1.F)}, + dir {glm::clamp(sunPos.y + SUN_ANGLUAR_SIZE, 0.F, 1.F)} +{ +} |