-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlightSource.h
65 lines (51 loc) · 1.77 KB
/
lightSource.h
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
55
56
57
58
59
60
61
62
63
64
65
#ifndef LIGHT_SOURCE_HEADER
#define LIGHT_SOURCE_HEADER
#include <stdint.h>
#include "math.h"
#include "util.h"
#include <limits>
class LightSource
{
public:
LightSource();
LightSource(float intensity);
LightSource(float intensity, Util::Color color);
float getIntensity() const;
void setIntensity(float intensity);
virtual float timeToLightSource(Math::Ray ray) const = 0;
virtual Math::Vector3 getLightDirectionToSurfacePoint(Math::Vector3 surfacePoint) const = 0;
private:
float intensity;
Util::Color color; // TODO: wait when is this used?
};
class UnidirectionalLightSource : public LightSource
{
public:
UnidirectionalLightSource();
UnidirectionalLightSource(Math::Vector3 direction);
UnidirectionalLightSource(Math::Vector3 direction, float intensity);
UnidirectionalLightSource(Math::Vector3 direction, float intensity, Util::Color color);
Math::Vector3 getDirection() const;
void setDirection(Math::Vector3 direction);
void setMaxRenderDistance(float maxRenderDistance);
float timeToLightSource(Math::Ray ray) const;
Math::Vector3 getLightDirectionToSurfacePoint(Math::Vector3 surfacePoint) const;
private:
Math::Vector3 direction;
float maxRenderDistance = std::numeric_limits<float>::max();
};
class PointLightSource : public LightSource
{
public:
PointLightSource();
PointLightSource(Math::Vector3 point);
PointLightSource(Math::Vector3 point, float intensity);
PointLightSource(Math::Vector3 point, float intensity, Util::Color color);
Math::Vector3 getPoint() const;
void setPoint(Math::Vector3 point);
float timeToLightSource(Math::Ray ray) const;
Math::Vector3 getLightDirectionToSurfacePoint(Math::Vector3 surfacePoint) const;
private:
Math::Vector3 point;
};
#endif