LightArray Class Reference

#include <LightArray.h>

List of all members.

Public Member Functions

 LightArray (unsigned cache=0)
virtual ~LightArray ()
bool isSet (ESGint i) const
bool isOn (ESGint i) const
bool isAnyOn (void) const
void turnLightOn (ESGint i)
void turnLightOff (ESGint i)
void turnAllOn (void)
void turnAllOff (void)
void turnOn (ESGbitmask m)
ESGbitmask getOnMask (void) const
ESGbitmask getSetMask (void) const
void clear (void)
Lightlight (ESGint i)
void setEmittance (ESGint i, Emittance *e)
EmittancegetEmittance (ESGint i)
void setTransformation (ESGint i, const Matrix4 &m)
Matrix4getTransformation (ESGint i)
void setGeometry (ESGint i, Geometry *g)
GeometrygetGeometry (ESGint i)
void setOID (ESGint i, SceneGraphObject::OID oid)
SceneGraphObject::OID getOID (ESGint i) const
bool emitPhoton (Vector3 &o, Vector3 &d, Color3f &p, ESGint i) const
const BlockingObjgetBlockingObject (unsigned cache, ESGint light) const
bool setBlockingObj (unsigned cache, ESGint light, SceneGraphObject *pObj, const Matrix4 *pMat)

Static Public Attributes

static const ESGint MAX_LIGHTS = 8
 number of supported lights
static const ESGint LIGHT0
 index of first light
static const ESGint LIGHT1
 index of second light
static const ESGint LIGHT2
 index of third light
static const ESGint LIGHT3
 index of fourth light
static const ESGint LIGHT4
 index of fifth light
static const ESGint LIGHT5
 index of sixth light
static const ESGint LIGHT6
 index of seventh light
static const ESGint LIGHT7
 index of eighth light

Protected Attributes

Light _lightArray [MAX_LIGHTS]
 array of pointers to lights
ESGbitmask _set
 which lights are set
ESGbitmask _on
 which lights are turned on
BlockingObj(* _blockingObjCache )[MAX_LIGHTS]
 cache of blocking objects for each light
unsigned _numCaches
 size of each cache

Friends

class LightsExplorer

Classes

struct  BlockingObj
struct  Light


Detailed Description

Restricted but efficient container for light sources found in a scene. The container stores references to original light sources located in the scene graph.

Definition at line 17 of file LightArray.h.


Constructor & Destructor Documentation

LightArray unsigned  cache = 0  )  [inline]
 

Constructor

Parameters:
cache size of the blocking objects cache associated with each light

Definition at line 75 of file LightArray.h.

virtual ~LightArray  )  [inline, virtual]
 

Destructor

Definition at line 87 of file LightArray.h.


Member Function Documentation

void clear void   )  [inline]
 

Clears the container, forgets all references to light sources

Definition at line 155 of file LightArray.h.

bool emitPhoton Vector3 o,
Vector3 d,
Color3f &  p,
ESGint  i
const [inline]
 

Tries to stochastically emit photon from light surface. Output parameters are valid only if the method returns true.

Parameters:
o origin of emitted photon
d direction of emitted photon
p intensity (energy) of emitted photon
i index of light
Returns:
true on success, false otherwise

Definition at line 247 of file LightArray.h.

References ENV_HAVE_NORMAL, ENV_HAVE_SURFACE_POINT, ENV_WANT_NORMAL, ENV_WANT_NOTHING, ENV_WANT_SURFACE_POINT, Emittance::fitToGeometry(), Emittance::haveDirection(), Emittance::intensity(), LightArray::Light::pEmittance, LightArray::Light::pGeometry, Geometry::randomSample(), Emittance::setBeamDirection(), and Emittance::stochasticEmission().

const BlockingObj* getBlockingObject unsigned  cache,
ESGint  light
const [inline]
 

Each light source can remember, which objects are blocking its visibility from some point in space. This method returns these blocking objects.

Parameters:
cache index to the cache of blocking objects of the light
light index of light
Returns:
reference to blocking object or NULL

Definition at line 282 of file LightArray.h.

Emittance* getEmittance ESGint  i  )  [inline]
 

Parameters:
i index of light
Returns:
actual emittance of the light or NULL

Definition at line 184 of file LightArray.h.

Geometry* getGeometry ESGint  i  )  [inline]
 

Parameters:
i index of light return actual geometry of the light or NULL

Definition at line 217 of file LightArray.h.

SceneGraphObject::OID getOID ESGint  i  )  const [inline]
 

Parameters:
i index of light
Returns:
actual OID of the light

Definition at line 233 of file LightArray.h.

ESGbitmask getOnMask void   )  const [inline]
 

Returns:
actual bitmask of lights turned on

Definition at line 145 of file LightArray.h.

ESGbitmask getSetMask void   )  const [inline]
 

Returns:
actual bitmask of valid lights

Definition at line 150 of file LightArray.h.

Matrix4* getTransformation ESGint  i  )  [inline]
 

Parameters:
i index of light
Returns:
actual transformation matrix of the light or NULL

Definition at line 201 of file LightArray.h.

bool isAnyOn void   )  const [inline]
 

Returns:
true if threre is a light that is switched on, false otherwise

Definition at line 109 of file LightArray.h.

bool isOn ESGint  i  )  const [inline]
 

Parameters:
i index of light
Returns:
true if light is on, false otherwise

Definition at line 103 of file LightArray.h.

bool isSet ESGint  i  )  const [inline]
 

Parameters:
i index of light
Returns:
true if light exists, false otherwise

Definition at line 97 of file LightArray.h.

Light& light ESGint  i  )  [inline]
 

Parameters:
i index of light
Returns:
reference to stored light

Definition at line 167 of file LightArray.h.

bool setBlockingObj unsigned  cache,
ESGint  light,
SceneGraphObject pObj,
const Matrix4 pMat
[inline]
 

Each light source can remember, which objects are blocking its visibility from some point in space. This method allows to associate these blocking objects with the light source.

Parameters:
cache index to the cache of blocking objects of the light
light index of light
pObj blocking object
pMat transformation matrix of the blocking object
Returns:
true on successful storage, false otherwise

Definition at line 299 of file LightArray.h.

void setEmittance ESGint  i,
Emittance e
[inline]
 

Sets the light emittance

Parameters:
i index of light
e light emittance

Definition at line 175 of file LightArray.h.

Referenced by LightsExplorer::_process_leaf().

void setGeometry ESGint  i,
Geometry g
[inline]
 

Sets geometry of the light

Parameters:
i index of light
g geometry of light

Definition at line 209 of file LightArray.h.

Referenced by LightsExplorer::_process_leaf().

void setOID ESGint  i,
SceneGraphObject::OID  oid
[inline]
 

Sets OID attribute of the light

Parameters:
i index of light
oid OID of light

Definition at line 225 of file LightArray.h.

Referenced by LightsExplorer::_process_leaf().

void setTransformation ESGint  i,
const Matrix4 m
[inline]
 

Sets transformation matrix of the light

Parameters:
i index of light
m transformation matrix

Definition at line 192 of file LightArray.h.

Referenced by LightsExplorer::_process_leaf().

void turnAllOff void   )  [inline]
 

Turns all light off

Definition at line 133 of file LightArray.h.

void turnAllOn void   )  [inline]
 

Turns all lights on

Definition at line 128 of file LightArray.h.

void turnLightOff ESGint  i  )  [inline]
 

Turns the light off

Parameters:
i index of light

Definition at line 123 of file LightArray.h.

void turnLightOn ESGint  i  )  [inline]
 

Turns the light on

Parameters:
i index of light

Definition at line 116 of file LightArray.h.

void turnOn ESGbitmask  m  )  [inline]
 

Turns on the lights indexed by bitmask

Parameters:
m bitmap of required lights

Definition at line 140 of file LightArray.h.


Friends And Related Function Documentation

friend class LightsExplorer [friend]
 

Definition at line 18 of file LightArray.h.


Member Data Documentation

BlockingObj(* _blockingObjCache)[MAX_LIGHTS] [protected]
 

cache of blocking objects for each light

Definition at line 66 of file LightArray.h.

Light _lightArray[MAX_LIGHTS] [protected]
 

array of pointers to lights

Definition at line 63 of file LightArray.h.

unsigned _numCaches [protected]
 

size of each cache

Definition at line 67 of file LightArray.h.

ESGbitmask _on [protected]
 

which lights are turned on

Definition at line 65 of file LightArray.h.

Referenced by LightsExplorer::_process_leaf().

ESGbitmask _set [protected]
 

which lights are set

Definition at line 64 of file LightArray.h.

Referenced by LightsExplorer::_process_leaf().

const ESGint LIGHT0 [static]
 

index of first light

Definition at line 22 of file LightArray.h.

const ESGint LIGHT1 [static]
 

index of second light

Definition at line 23 of file LightArray.h.

const ESGint LIGHT2 [static]
 

index of third light

Definition at line 24 of file LightArray.h.

const ESGint LIGHT3 [static]
 

index of fourth light

Definition at line 25 of file LightArray.h.

const ESGint LIGHT4 [static]
 

index of fifth light

Definition at line 26 of file LightArray.h.

const ESGint LIGHT5 [static]
 

index of sixth light

Definition at line 27 of file LightArray.h.

const ESGint LIGHT6 [static]
 

index of seventh light

Definition at line 28 of file LightArray.h.

const ESGint LIGHT7 [static]
 

index of eighth light

Definition at line 29 of file LightArray.h.

const ESGint MAX_LIGHTS = 8 [static]
 

number of supported lights

Definition at line 21 of file LightArray.h.

Referenced by LightsExplorer::_process_leaf().


The documentation for this class was generated from the following file:
Generated on Wed Jun 28 12:24:34 2006 for esg by  doxygen 1.4.6