ComputerGraphik TU WIEN
light.hpp
Go to the documentation of this file.
1 #ifndef LIGHT_HPP
2 #define LIGHT_HPP
3 
4 #define USE_OMNI_SHADOW
5 //#define USE_SHADOW_MAP
6 
7 #include <glm/vec3.hpp>
8 #include "sceneObject.hpp"
9 
11 
16 class Light : public SceneObject
17 {
18 public:
19 
21  Light(const std::string& name, Scene* scene = 0, Model* model = 0, const glm::mat4& modelMatrix = glm::mat4(1))
23  {
24  }
25 
26  virtual ~Light() { }
27 
28  glm::vec3 getPower() const { return power; }
29  glm::vec3 getDiffuse() const { return diffuse; }
30  glm::vec3 getAmbient() const { return ambient; }
31  glm::vec3 getSpecular() const { return specular; }
32  glm::vec3 getPosition() const { return glm::vec3(getGlobalModelMatrix() * glm::vec4(0, 0, 0, 1)); }
33 
34  void setPower(const glm::vec3& val) { power = val; }
35  void setDiffuse(const glm::vec3& val) { diffuse = val; }
36  void setAmbient(const glm::vec3& val) { ambient = val; }
37  void setSpecular(const glm::vec3& val) { specular = val; }
38 
39 protected:
40  glm::vec3 power;
41  glm::vec3 diffuse;
42  glm::vec3 ambient;
43  glm::vec3 specular;
44 };
45 
46 #endif //LIGHT_HPP
Encapsulates a graphical object model in the GPU.
Definition: model.hpp:14
Used for further implementations of light in the scene (Sun is a direct derivation).
Definition: light.hpp:16
void setPower(const glm::vec3 &val)
Definition: light.hpp:34
virtual ~Light()
Definition: light.hpp:26
glm::vec3 ambient
Definition: light.hpp:42
glm::vec3 getDiffuse() const
Definition: light.hpp:29
Model * model
Definition: sceneObject.hpp:69
Light(const std::string &name, Scene *scene=0, Model *model=0, const glm::mat4 &modelMatrix=glm::mat4(1))
Construct new light.
Definition: light.hpp:21
void setDiffuse(const glm::vec3 &val)
Definition: light.hpp:35
glm::vec3 getAmbient() const
Definition: light.hpp:30
void setSpecular(const glm::vec3 &val)
Definition: light.hpp:37
glm::vec3 getSpecular() const
Definition: light.hpp:31
glm::vec3 power
Definition: light.hpp:40
glm::vec3 getPower() const
Definition: light.hpp:28
Encapsulates the Rendering Engine, holds a complete scene and it's assets.
Definition: scene.hpp:71
Scene * scene
Definition: sceneObject.hpp:68
glm::vec3 specular
Definition: light.hpp:43
std::string name
Definition: sceneObject.hpp:73
glm::mat4 modelMatrix
Definition: sceneObject.hpp:71
The base class of the objects which are rendered.
Definition: sceneObject.hpp:30
glm::vec3 getPosition() const
Definition: light.hpp:32
glm::mat4 getGlobalModelMatrix() const
Definition: sceneObject.hpp:85
glm::vec3 diffuse
Definition: light.hpp:41
void setAmbient(const glm::vec3 &val)
Definition: light.hpp:36