blob: 7e64106d0ea9252ef8cae5232f7c79aba7b2c219 (
plain)
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
|
/*
render/light.h
This file is part of the Osirion project and is distributed under
the terms of the GNU General Public License version 2
*/
#ifndef __INCLUDED_RENDER_LIGHT_H__
#define __INCLUDED_RENDER_LIGHT_H__
#include "math/vector3f.h"
#include "math/color.h"
namespace render
{
/**
* @brief paramaters for a single light source
* */
class Light
{
public:
/**
* @brief default constructor, creates a white light at (0,0,0)
* */
Light();
/**
* @brief creates a light source with given color and location
* */
Light(const math::Vector3f & location, const math::Color & color);
/**
* @brief destructor
*/
~Light();
/* ---- inspectors ----------------------------------------- */
/**
* @brief returns the location for this light source
* */
inline const math::Vector3f & location() const {
return light_location;
}
/**
* @brief returns the color for this light source
* */
inline const math::Color & color() const {
return light_color;
}
/**
* @brief returns the attenuation settings for this light source
* */
inline const math::Vector3f & attenuation() const {
return light_attenuation;
}
/* ---- mutators ------------------------------------------- */
/**
* @brief set the location for this light source
* @see location()
* */
inline void set_location(const math::Vector3f & location) {
light_location.assign(location);
}
/**
* @brief set the location for this light source
* @see color()
* */
inline void set_color(const math::Color & color) {
light_color.assign(color);
}
/**
* @brief set the attenuation settings for this light source
* */
inline void set_attenuation(const float constant, const float linear, const float quadratic) {
light_attenuation.assign(constant, linear, quadratic);
}
private:
math::Vector3f light_location;
math::Color light_color;
math::Vector3f light_attenuation;
};
}
#endif
|