V-ART
light.h
Go to the documentation of this file.
1 
5 #ifndef VART_LIGHT_H
6 #define VART_LIGHT_H
7 
8 #include "vart/point4d.h"
9 #include "vart/color.h"
10 #include "vart/scenenode.h"
11 #include "vart/transform.h"
12 #include <string>
13 
14 namespace VART {
15  class BoundingBox;
22  class Light : public SceneNode {
23  public:
24  Light();
25  Light(const Light& light);
26  Light(float i, float ai, Color c, bool o);
27  Light(const std::string& newDescription, float newIntensity,
28  float newAmbientIntensity, const Color& newColor,
29  const Point4D& newLocation);
30  virtual ~Light();
33  virtual SceneNode * Copy();
34  Light& operator=(const Light& light);
35  void SetIntensity(float i);
36  float GetIntensity() const;
37  void SetAmbientIntensity(float ai);
38  float GetAmbientIntensity() const;
39  void SetColor(const Color& c);
40  Color GetColor() const;
42  void Turn(bool on_off);
43  bool IsOn() const;
44 
46  virtual bool RecursiveBoundingBox(BoundingBox* bBox);
47 
49 
52  void SetLocation(const Point4D& newLocation);
53  Point4D GetLocation() const { return location; }
54 
56 
59  Transform* GetTransform() const { return transform; }
60 
64  virtual bool DrawOGL(unsigned int oglLightID) const;
65 
70  virtual void DrawForPicking() const {};
71 
72  // CLASS CONSTANT INITIALIZERS
74  static const Light& SUN();
76  static const Light& BRIGHT_AMBIENT();
77  protected:
78  unsigned int getOpenGLID(unsigned int lightID) const;
79 
80  private:
81  float intensity;
82  float ambientIntensity;
83  Color color;
84  bool on;
85  protected:
87  Point4D location; //unified representation of location/direction.
88  }; // end class declaration
89 } // end namespace
90 #endif // VART_LIGHT_H
virtual SceneNode * Copy()
Returns a copy of an Light. Every derived class must reimplements this method, to avoid errors with V...
Definition: light.cpp:63
Base class for objects that compose a scene graph.
Definition: scenenode.h:25
void SetColor(const Color &c)
Definition: light.cpp:107
Point4D location
Definition: light.h:87
Points and vectors using homogeneous coordinates.
Definition: point4d.h:22
unsigned int getOpenGLID(unsigned int lightID) const
Definition: light.cpp:180
Header file for V-ART class "SceneNode".
virtual void DrawForPicking() const
Draws and object, setting pick info.
Definition: light.h:70
Transform * GetTransform() const
Gets a pointer to the light transform.
Definition: light.h:59
RGBA color representation.
Definition: color.h:24
void SetLocation(const Point4D &newLocation)
Sets the location of the light.
Definition: light.cpp:123
Axis aligned bounding box.
Definition: boundingbox.h:23
Transform * transform
Definition: light.h:86
bool IsOn() const
Definition: light.cpp:119
Geometric transformations.
Definition: transform.h:24
Light & operator=(const Light &light)
Definition: light.cpp:72
virtual bool RecursiveBoundingBox(BoundingBox *bBox)
Always returns false, therefore recursive bbox does not exist.
Definition: light.cpp:175
void SetIntensity(float i)
Definition: light.cpp:91
virtual ~Light()
Definition: light.cpp:68
Header file for V-ART class "Transform".
void SetAmbientIntensity(float ai)
Definition: light.cpp:99
float GetAmbientIntensity() const
Definition: light.cpp:103
float GetIntensity() const
Definition: light.cpp:95
static const Light & BRIGHT_AMBIENT()
Strong, white ambient light.
Definition: light.cpp:86
void Turn(bool on_off)
Turns a light on or off.
Definition: light.cpp:115
Header file for V-ART class "Color".
virtual bool DrawOGL() const
Recursive drawing using OpenGL commands.
Definition: scenenode.cpp:76
Header file for V-ART class "Point4D".
Color GetColor() const
Definition: light.cpp:111
Point4D GetLocation() const
Definition: light.h:53
static const Light & SUN()
White directional light towards negative Y. Small ambient intensity.
Definition: light.cpp:82
Represents a light source.
Definition: light.h:22