Neo  0.5.0
Developer Documentation
OLight.h
Go to the documentation of this file.
1 //========================================================================
2 // Copyright (c) 2003-2011 Anael Seghezzi <www.maratis3d.com>
3 // Copyright (c) 2014-2015 Yannick Pflanzer <www.neo-engine.de>
4 //
5 // This software is provided 'as-is', without any express or implied
6 // warranty. In no event will the authors be held liable for any damages
7 // arising from the use of this software.
8 //
9 // Permission is granted to anyone to use this software for any purpose,
10 // including commercial applications, and to alter it and redistribute it
11 // freely, subject to the following restrictions:
12 //
13 // 1. The origin of this software must not be misrepresented; you must not
14 // claim that you wrote the original software. If you use this software
15 // in a product, an acknowledgment in the product documentation would
16 // be appreciated but is not required.
17 //
18 // 2. Altered source versions must be plainly marked as such, and must not
19 // be misrepresented as being the original software.
20 //
21 // 3. This notice may not be removed or altered from any source
22 // distribution.
23 //
24 //========================================================================
25 
26 
27 #ifndef __OLIGHT_H
28 #define __OLIGHT_H
29 
30 namespace Neo
31 {
32 
33 // light types
35 {
39 };
40 
52 class NEO_ENGINE_EXPORT OLight : public Object3d
53 {
54 public:
55 
56  // constructor / destructor
57  OLight(void);
58  ~OLight(void);
59 
60  // copy constructor
61  OLight(const OLight & light);
62 
63 private:
64 
65  // lightType
66  LIGHT_TYPES m_lightType;
67 
68  // radius
69  float m_radius;
70 
71  // color
72  float m_intensity;
73  Vector3 m_color;
74 
75  // spot
76  float m_spotAngle;
77  float m_spotExponent;
78 
79  // shadow
80  bool m_shadow;
81  float m_shadowBias;
82  float m_shadowBlur;
83  unsigned int m_shadowQuality;
84 
85 public:
86 
87  // type
88  virtual int getType(void){ return OBJECT3D_LIGHT; }
89 
94  inline void setLightType(LIGHT_TYPES lightType) { m_lightType = lightType; }
95 
100  inline LIGHT_TYPES getLightType(void) { return m_lightType; }
101 
106  inline void castShadow(bool shadow) { m_shadow = shadow; }
107 
114  inline void setShadowQuality(unsigned int shadowQuality)
115  {
116  m_shadowQuality = shadowQuality;
117  }
118 
127  inline void setShadowBias(float shadowBias) { m_shadowBias = shadowBias; }
128 
133  inline void setShadowBlur(float shadowBlur) { m_shadowBlur = shadowBlur; }
134 
139  inline bool isCastingShadow(void) { return m_shadow; }
140 
146  inline unsigned int getShadowQuality(void) { return m_shadowQuality; }
147 
153  inline float getShadowBias(void) { return m_shadowBias; }
154 
160  inline float getShadowBlur(void) { return m_shadowBlur; }
161 
166  inline void setRadius(float radius) { m_radius = radius; }
167 
172  inline float getRadius(void) { return m_radius; }
173 
178  inline void setIntensity(float intensity) { m_intensity = intensity; }
179 
184  inline void setColor(const Vector3 &color) { m_color = color; }
185 
190  inline float getIntensity(void) { return m_intensity; }
191 
196  inline Vector3 getColor(void) const { return m_color; }
197 
202  inline Vector3 getFinalColor(void) const { return m_color * m_intensity; }
203 
210  inline void setSpotAngle(float angle)
211  {
212  m_spotAngle = CLAMP(angle, 0.0f, 180.0f);
213  }
214 
219  inline void setSpotExponent(float exponent)
220  {
221  m_spotExponent = CLAMP(exponent, 0.0f, 1.0f);
222  }
223 
228  inline float getSpotAngle(void) { return m_spotAngle; }
229 
234  inline float getSpotExponent(void) { return m_spotExponent; }
235 
236  // visibility
237  virtual void updateVisibility(OCamera *camera);
238 };
239 }
240 #endif
float getSpotAngle(void)
Returns the spot angle.
Definition: OLight.h:228
void setRadius(float radius)
Changes the light radius in which the OLight object takes effect.
Definition: OLight.h:166
void setSpotExponent(float exponent)
Changes the exponent value.
Definition: OLight.h:219
float getRadius(void)
Returns the light radius.
Definition: OLight.h:172
void setColor(const Vector3 &color)
Changes the light color.
Definition: OLight.h:184
void castShadow(bool shadow)
Change if the light should cast shadows.
Definition: OLight.h:106
Definition: OLight.h:36
Definition: Vector3.h:31
Definition: OLight.h:37
float getIntensity(void)
Returns the light intensity.
Definition: OLight.h:190
Vector3 getFinalColor(void) const
Returns the light color how it appears with the chosen intensity.
Definition: OLight.h:202
float getShadowBlur(void)
Returns the shadow blur.
Definition: OLight.h:160
unsigned int getShadowQuality(void)
Returns the shadow quality of the OLight.
Definition: OLight.h:146
void setShadowBlur(float shadowBlur)
Changes the shadow blur factor..
Definition: OLight.h:133
void setShadowBias(float shadowBias)
Changes the shadow bias.
Definition: OLight.h:127
Definition: NeoEngine.h:47
void setSpotAngle(float angle)
Changes the spot angle.
Definition: OLight.h:210
float getShadowBias(void)
Returns the shadow bias.
Definition: OLight.h:153
The Object3d class represents a general object in a 3D scene.
Definition: Object3d.h:43
Represents a 3D light in the scene.
Definition: OLight.h:52
float getSpotExponent(void)
Returns the spot exponent.
Definition: OLight.h:234
bool isCastingShadow(void)
Checks if the OLight is casting shadows.
Definition: OLight.h:139
Vector3 getColor(void) const
Returns the light color.
Definition: OLight.h:196
LIGHT_TYPES getLightType(void)
Returns the light type.
Definition: OLight.h:100
void setShadowQuality(unsigned int shadowQuality)
Changes the shadow quality.
Definition: OLight.h:114
Definition: OLight.h:38
void setLightType(LIGHT_TYPES lightType)
Changes the light type the OLight has.
Definition: OLight.h:94
virtual int getType(void)
Returns the type of the object.
Definition: OLight.h:88
Definition: OCamera.h:30
void setIntensity(float intensity)
Changes the light intensity.
Definition: OLight.h:178
Definition: Color.h:29
LIGHT_TYPES
Definition: OLight.h:34