-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathLight.cpp
More file actions
54 lines (45 loc) · 1.14 KB
/
Light.cpp
File metadata and controls
54 lines (45 loc) · 1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#include "rev/Light.h"
using namespace std;
using namespace glm;
namespace rev
{
// Light
Light::Light(Type type)
: _baseColor(0.f), _type(type)
{
}
Light::Type Light::getType() const
{
return _type;
}
const glm::vec3& Light::getBaseColor() const
{
return _baseColor;
}
void Light::setBaseColor(const glm::vec3& baseColor)
{
_baseColor = baseColor;
}
const glm::vec3& Light::getPosition() const
{
assert(_position.has_value());
return *_position;
}
void Light::setPosition(const glm::vec3& position)
{
assert(_type == Type::Point);
_position = make_optional<glm::vec3>(position);
}
const glm::vec3& Light::getDirection() const
{
assert(_direction.has_value());
return *_direction;
}
void Light::setDirection(const glm::vec3& direction)
{
//TODO: Is there a way to ensure that the programmer is not
// calling these methods on the wrong type of light statically?
assert(_type == Type::Directional);
_direction = make_optional<glm::vec3>(direction);
}
}