summaryrefslogtreecommitdiff
path: root/gfx/lightDirection.cpp
blob: 3932872405675b6ca0ef03537d6e6b3103fe3689 (plain)
1
2
3
4
5
6
7
8
9
10
11
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)}
{
}