V-ART
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
VART::Light Class Reference

Represents a light source. More...

#include <light.h>

Inheritance diagram for VART::Light:
VART::SceneNode VART::MemoryObj VART::PointLight VART::SpotLight

Public Member Functions

 Light ()
 
 Light (const Light &light)
 
 Light (float i, float ai, Color c, bool o)
 
 Light (const std::string &newDescription, float newIntensity, float newAmbientIntensity, const Color &newColor, const Point4D &newLocation)
 
virtual ~Light ()
 
virtual SceneNodeCopy ()
 Returns a copy of an Light. Every derived class must reimplements this method, to avoid errors with VART::SceneNode::RecursiveCopy. More...
 
Lightoperator= (const Light &light)
 
void SetIntensity (float i)
 
float GetIntensity () const
 
void SetAmbientIntensity (float ai)
 
float GetAmbientIntensity () const
 
void SetColor (const Color &c)
 
Color GetColor () const
 
void Turn (bool on_off)
 Turns a light on or off. More...
 
bool IsOn () const
 
virtual bool RecursiveBoundingBox (BoundingBox *bBox)
 Always returns false, therefore recursive bbox does not exist. More...
 
void SetLocation (const Point4D &newLocation)
 Sets the location of the light. More...
 
Point4D GetLocation () const
 
TransformGetTransform () const
 Gets a pointer to the light transform. More...
 
virtual bool DrawOGL (unsigned int oglLightID) const
 Draws (sets up) a light using OpenGL commands. More...
 
virtual void DrawForPicking () const
 Draws and object, setting pick info. More...
 
- Public Member Functions inherited from VART::SceneNode
 SceneNode ()
 Creates an uninitialized scene node. More...
 
 SceneNode (SceneNode &node)
 
virtual ~SceneNode ()
 
SceneNodeoperator= (const SceneNode &node)
 
virtual SceneNodeRecursiveCopy ()
 
const std::string & GetDescription () const
 Returns a copy of the object's description. More...
 
void SetDescription (const std::string &desc)
 Changes the object's description. More...
 
void AddChild (SceneNode &child)
 Add a child at the end of child list. More...
 
bool DetachChild (SceneNode *childPtr)
 Removes a child from the child list. More...
 
virtual bool DrawOGL () const
 Recursive drawing using OpenGL commands. More...
 
virtual TypeID GetID () const
 Returns type identification of the node. More...
 
void AutoDeleteChildren () const
 Deletes (dealocate memory) recursively all children marked as 'autoDelete'. More...
 
SceneNodeFindChildByName (const std::string &name) const
 Recusively searches its children for a given name. More...
 
std::list< SceneNode * > GetChilds ()
 
bool FindPathTo (SceneNode *targetPtr, SGPath *resultPtr) const
 Search target among children. More...
 
bool FindPathTo (const std::string &targetName, SGPath *resultPtr) const
 Search target among children. More...
 
int GetNodeTypeList (TypeID type, std::list< SceneNode * > &nodeList)
 Find all the nodes of with typeID 'type'. More...
 
virtual void TraverseDepthFirst (SNOperator *operatorPtr) const
 Process all children in depth-first order. More...
 
virtual void TraverseBreadthFirst (SNOperator *operatorPtr) const
 Process all children in breadth-first order. More...
 
virtual void LocateDepthFirst (SNLocator *locatorPtr) const
 Seaches for a particular scene node (depth first) More...
 
virtual void LocateBreadthFirst (SNLocator *locatorPtr) const
 Seaches for a particular scene node (breadth first) More...
 
virtual void XmlPrintOn (std::ostream &os, unsigned int indent) const
 Recursively outputs XML representation of the scene node. More...
 
- Public Member Functions inherited from VART::MemoryObj
 MemoryObj ()
 Default constructor. More...
 
 MemoryObj (const VART::MemoryObj &obj)
 Copy constructor. More...
 

Static Public Member Functions

static const LightSUN ()
 White directional light towards negative Y. Small ambient intensity. More...
 
static const LightBRIGHT_AMBIENT ()
 Strong, white ambient light. More...
 

Protected Member Functions

unsigned int getOpenGLID (unsigned int lightID) const
 
- Protected Member Functions inherited from VART::SceneNode
virtual bool DrawInstanceOGL () const
 Non-recursive drawing - should be overriden by every derived class. More...
 
bool RecursiveFindPathTo (SceneNode *targetPtr, SGPath *resultPtr) const
 Recursive auxiliar method for FindPathTo. More...
 
bool RecursiveFindPathTo (const std::string &targetName, SGPath *resultPtr) const
 Recursive auxiliar method for FindPathTo. More...
 

Protected Attributes

Transformtransform
 
Point4D location
 
- Protected Attributes inherited from VART::SceneNode
std::list< SceneNode * > childList
 Child list. More...
 
std::string description
 Textual identification. More...
 

Additional Inherited Members

- Public Types inherited from VART::SceneNode
enum  TypeID {
  NONE, GRAPHIC_OBJ, BOX, CONE,
  CURVE, BEZIER, CYLINDER, IMAGE,
  IMAGE_2D, VOLUME, MESH_OBJECT, SPHERE,
  JOINT, BIAXIAL_JOINT, CONDYLAR_JOINT, ELLIPSOID_JOINT,
  SADDLE_JOINT, PLANE_JOINT, POLYAXIAL_JOINT, UNIAXIAL_JOINT,
  HINGE_JOINT, PIVOT_JOINT, TRANSFORM
}
 
- Public Attributes inherited from VART::MemoryObj
bool autoDelete
 
- Static Public Attributes inherited from VART::SceneNode
static bool recursivePrinting = true
 

Detailed Description

Represents a light source.

This class represents simple light sources, i.e.: directional lights or point lights with no attenuation. See the derived classes for more complex light sources. Lights can have children, but they should not.

Definition at line 22 of file light.h.

Constructor & Destructor Documentation

VART::Light::Light ( )

Definition at line 15 of file light.cpp.

VART::Light::Light ( const Light light)

Definition at line 52 of file light.cpp.

References VART::SceneNode::description, location, and transform.

VART::Light::Light ( float  i,
float  ai,
VART::Color  c,
bool  o 
)

Definition at line 27 of file light.cpp.

VART::Light::Light ( const std::string &  newDescription,
float  newIntensity,
float  newAmbientIntensity,
const Color newColor,
const Point4D newLocation 
)
VART::Light::~Light ( )
virtual

Definition at line 68 of file light.cpp.

Member Function Documentation

const VART::Light & VART::Light::BRIGHT_AMBIENT ( )
static

Strong, white ambient light.

Definition at line 86 of file light.cpp.

References VART::Point4D::ORIGIN(), and VART::Color::WHITE().

VART::SceneNode * VART::Light::Copy ( )
virtual

Returns a copy of an Light. Every derived class must reimplements this method, to avoid errors with VART::SceneNode::RecursiveCopy.

Implements VART::SceneNode.

Definition at line 63 of file light.cpp.

virtual void VART::Light::DrawForPicking ( ) const
inlinevirtual

Draws and object, setting pick info.

This method should be called in selection mode in order to identify objects that are selected by the mouse (see Scene::Pick).

Implements VART::SceneNode.

Definition at line 70 of file light.h.

bool VART::Light::DrawOGL ( unsigned int  oglLightID) const
virtual

Draws (sets up) a light using OpenGL commands.

Returns
false if V-ART was not compiled with OpenGL support.
Parameters
oglLightID[in] OpenGL ID for light in the range 0..7.

Reimplemented in VART::PointLight.

Definition at line 127 of file light.cpp.

float VART::Light::GetAmbientIntensity ( ) const

Definition at line 103 of file light.cpp.

VART::Color VART::Light::GetColor ( ) const

Definition at line 111 of file light.cpp.

float VART::Light::GetIntensity ( ) const

Definition at line 95 of file light.cpp.

Point4D VART::Light::GetLocation ( ) const
inline

Definition at line 53 of file light.h.

References location.

unsigned int VART::Light::getOpenGLID ( unsigned int  lightID) const
protected

Definition at line 180 of file light.cpp.

Transform* VART::Light::GetTransform ( ) const
inline

Gets a pointer to the light transform.

This transforms gets applied to the light each time it's drawn. It does nothing by default.

Definition at line 59 of file light.h.

References transform.

bool VART::Light::IsOn ( ) const

Definition at line 119 of file light.cpp.

VART::Light & VART::Light::operator= ( const Light light)

Definition at line 72 of file light.cpp.

References VART::SceneNode::description, and location.

bool VART::Light::RecursiveBoundingBox ( VART::BoundingBox bBox)
virtual

Always returns false, therefore recursive bbox does not exist.

Definition at line 175 of file light.cpp.

void VART::Light::SetAmbientIntensity ( float  ai)

Definition at line 99 of file light.cpp.

Referenced by VART::XmlScene::LoadSceneNode().

void VART::Light::SetColor ( const Color c)

Definition at line 107 of file light.cpp.

Referenced by VART::XmlScene::LoadSceneNode().

void VART::Light::SetIntensity ( float  i)

Definition at line 91 of file light.cpp.

Referenced by VART::XmlScene::LoadSceneNode().

void VART::Light::SetLocation ( const Point4D newLocation)

Sets the location of the light.

newLocation should be a point for positional lights or a direction for directional lights.

Definition at line 123 of file light.cpp.

Referenced by VART::XmlScene::LoadSceneNode().

const VART::Light & VART::Light::SUN ( )
static

White directional light towards negative Y. Small ambient intensity.

Definition at line 82 of file light.cpp.

References VART::Color::WHITE().

void VART::Light::Turn ( bool  on_off)

Turns a light on or off.

Definition at line 115 of file light.cpp.

Referenced by VART::XmlScene::LoadSceneNode().

Member Data Documentation

Point4D VART::Light::location
protected
Transform* VART::Light::transform
protected

Definition at line 86 of file light.h.

Referenced by GetTransform(), and Light().


The documentation for this class was generated from the following files: