Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | Related Pages

Light Class Reference

#include <light.h>

Inheritance diagram for Light:

Inheritance graph
[legend]
Collaboration diagram for Light:

Collaboration graph
[legend]
List of all members.

Detailed Description

Dynamic light object Dynamic lights are scene entities. The Render method will register the light as active with the render device for this frame, allowing bounding volume culling of light entities.

Author:
Mattias Jansson (mattias@realityrift.com)
Todo:
Support all light types

Change direction to be world rotation z-axis to enable light to be positioned in hierarchies


Public Types

enum  LIGHTTYPE { DIRECTIONAL = 0, POINT = 1, SPOT = 2, AMBIENT = 3 }
 Light type identifiers. More...

enum  LIGHTFLAG { NOFLAGS = 0, CASTSHADOWS = 1 }
 Light flags. More...


Public Member Functions

 Light (LIGHTTYPE eType, int iFlags=NOFLAGS, const Vector3d &rkDirection=Vector3d::ZERO)
LIGHTTYPE GetType () const
int GetFlags () const
Vector3d GetDirection ()
virtual bool Render (Frustum *pkFrustum=0, bool bForce=false)
SceneNodeGetSceneNode ()
BoundingVolumeGetBoundingVolume ()
void SetBoundingVolume (BoundingVolume *pkBoundingVolume)
virtual SceneEntityDuplicate ()
virtual bool Intersection (BoundingVolume *pkObj, ContactSet *pkContactSet=0, bool bInvertNormal=false)
virtual bool Intersection (const Ray &rkRay, ContactSet *pkContactSet=0)
virtual void Update (float fDeltaTime)
bool IsActive () const
virtual void Activate ()
virtual void Deactivate ()
bool Toggle ()
virtual void Accept (BaseVisitor &rkVisitor)=0

Public Attributes

Vector3d m_kDirection
Color m_kAmbient
Color m_kDiffuse
Color m_kSpecular
float m_fConstantAttenuation
float m_fLinearAttenuation
float m_fQuadraticAttenuation
unsigned int m_uiLastFrame

Static Public Attributes

unsigned int s_uiFrameCount

Protected Member Functions

virtual void SetNode ()

Static Protected Member Functions

template<class NodeType> void AcceptImpl (NodeType &rkVisited, BaseVisitor &rkVisitor)

Protected Attributes

LIGHTTYPE m_eType
int m_iFlags
SceneNodem_pkNode
BoundingVolumem_pkBoundingVolume
bool m_bActive


Member Enumeration Documentation

enum LIGHTTYPE
 

Light type identifiers.

Enumeration values:
DIRECTIONAL  Directional light. Only the direction (and rotation of node) is used (no translation)
POINT  Point light. Cast light in all directions (no rotation) from a point (translation of node)
SPOT  Directional light from a point (NOT IMPLEMENTED)
AMBIENT  Ambient light. No translation or rotation, cannot cast shadows

enum LIGHTFLAG
 

Light flags.

Enumeration values:
NOFLAGS  No light flags
CASTSHADOWS  Light should cause dynamic shadows to be generated by geometry with materials that have shadow flag set


Constructor & Destructor Documentation

Light LIGHTTYPE  eType,
int  iFlags = NOFLAGS,
const Vector3d rkDirection = Vector3d::ZERO
 

Parameters:
eType Light type
iFlags Flags
rkDirection Light direction (for DIRECTIONAL and SPOT)


Member Function Documentation

LIGHTTYPE GetType  )  const [inline]
 

Returns:
Light type

int GetFlags  )  const [inline]
 

Returns:
Light flags

Vector3d GetDirection  ) 
 

Returns:
Light direction

virtual bool Render Frustum pkFrustum = 0,
bool  bForce = false
[virtual]
 

Add light to this frame rendering queue

Parameters:
pkFrustum Ignored
bForce Ignored
Returns:
true

Reimplemented from RenderEntity.

virtual void SetNode  )  [inline, protected, virtual, inherited]
 

Called by scene node when entity has been set to a node

Reimplemented in MeshEntity.

SceneNode* GetSceneNode  )  [inline, inherited]
 

Returns:
parent scene node

BoundingVolume* GetBoundingVolume  )  [inline, inherited]
 

Returns:
Bounding volume

void SetBoundingVolume BoundingVolume pkBoundingVolume  )  [inherited]
 

Set new bounding volume object. Old bounding volume object will be deleted. The new bounding volume SRT data should be in LOCAL space, the world space SRT data will be calculated internally

Parameters:
pkBoundingVolume New bounding volume object

virtual SceneEntity* Duplicate  )  [inline, virtual, inherited]
 

Duplicate entity

Returns:
New entity that is exact copy of entity, or null if not supported by entity type

Reimplemented in MeshEntity.

virtual bool Intersection BoundingVolume pkObj,
ContactSet pkContactSet = 0,
bool  bInvertNormal = false
[inline, virtual, inherited]
 

Intersection test with unknown object type

Parameters:
pkObj Bounding volume object to test for intersection with
pkContactSet Collision set object receiving collision contact data, 0 if not needed
bInvertNormal If false, collision normal will point from passed object to this. If true, normal will point in other direction
Returns:
true if volumes intersect, false if not

Reimplemented in MeshEntity.

virtual bool Intersection const Ray rkRay,
ContactSet pkContactSet = 0
[inline, virtual, inherited]
 

Intersection test with ray

Parameters:
rkRay Ray
pkContactSet Collision set object receiving collision contact data, 0 if not needed
Returns:
true if volumes intersect, false if not

Reimplemented in MeshEntity.

virtual void Update float  fDeltaTime  )  [inline, virtual, inherited]
 

Update object

Parameters:
fDeltaTime Time passed since last update

Reimplemented in AnimatedNode, AnimatedSubMesh, Animation, AnimatorController, MassParticle, MeshEntity, NodeAnimatorController, ParticleSystem, PhysicsManager, PhysicsNode, RigidBody, SceneNode, Skeleton, SkeletalSubMesh, SubMesh, SubMeshAnimatorController, Animation< SubMeshKeyframe >, Animation< NodeKeyframe >, AnimatorController< SubMeshAnimation >, AnimatorController< NodeAnimation >, and AnimatorController< SkeletonAnimation >.

bool IsActive  )  const [inline, inherited]
 

Query state of object

Returns:
true if active, false if not

void Activate  )  [inline, virtual, inherited]
 

Activate object

void Deactivate  )  [inline, virtual, inherited]
 

Deactivate object

bool Toggle  )  [inline, inherited]
 

Toggle active state. This method does not need to be overloaded, it is only a wrapper to Activate and Deactivate

Returns:
true if activated, false if deactivated

void AcceptImpl NodeType &  rkVisited,
BaseVisitor rkVisitor
[inline, static, protected, inherited]
 

Accept visitors if implementation available

Parameters:
rkVisited Node being visited
rkVisitor Visitor

virtual void Accept BaseVisitor rkVisitor  )  [pure virtual, inherited]
 

Accept a visitor

Parameters:
rkVisitor Visitor


Member Data Documentation

LIGHTTYPE m_eType [protected]
 

Type

int m_iFlags [protected]
 

Flags

Vector3d m_kDirection
 

Direction (for directional and spot lights)

Color m_kAmbient
 

Ambient color

Color m_kDiffuse
 

Diffuse color

Color m_kSpecular
 

Specular color

float m_fConstantAttenuation
 

Constant attenuation, default 1.0f

float m_fLinearAttenuation
 

Linear attenuation, default 0.0f

float m_fQuadraticAttenuation
 

Quadratic attenuation

SceneNode* m_pkNode [protected, inherited]
 

Parent scene node object

BoundingVolume* m_pkBoundingVolume [protected, inherited]
 

Bounding volume for this entity

bool m_bActive [protected, inherited]
 

Active flag

unsigned int s_uiFrameCount [static, inherited]
 

Frame counter (at 500 frames per second, can be active ~100 days continously before loop, and then it will just skip one frame -> safe enough)

unsigned int m_uiLastFrame [inherited]
 

Last frame count we were rendered


The documentation for this class was generated from the following file:
Generated on Wed Jan 21 14:21:11 2004 for NeoEngine by doxygen 1.3.5