Light Class Reference

This reference page is linked to from the following overview topics: Mudbox Scenes, Scene Graph, Transformations and Coordinate Space Conversions.



Detailed Description

Represents a light source in the scene.

Definition at line 35 of file light.h.

#include <light.h>

Inheritance diagram for Light:
Inheritance graph
[legend]

List of all members.

Public Types

enum   LightType {
  LIGHT_DIRECTIONAL = 0, LIGHT_POINT, LIGHT_SPOT, LIGHT_IBL,
  LIGHT_NONE
}

Public Member Functions

virtual Color  Diffuse (void) const
  Returns the diffuse color value of the light.
virtual void  SetDiffuse (const Color &cDiffuse)
  Sets the diffuse color value of the light.
virtual float  Intensity (void) const
  Returns the light intensity in range 0..1.
virtual void  SetIntensity (float fIntensity)
  Sets the light intensity in range 0..1.
virtual bool  IsLockedToCamera (void) const
  Returns true if the light direction is locked to the camera direction.
virtual void  SetLockedToCamera (bool bOnOrOff)
  Set lock/unlock to camera.
virtual bool  Render (void)
  Renders the light manipulator or light geometry, if they are turned on.
virtual Manipulator *  GetManipulator ()
  Returns a pointer to the light's manipulator, or NULL if no manipulator has been created.
virtual void  ValidateShadowMap ()
  Checks and updates the shadow map (if shadowing is turned on).
virtual Texture ShadowDepthMap ()
  Returns the depth map associated with the light.
virtual const Matrix ShadowMatrix () const
  Returns the shadow/depth map matrix associated with light.
virtual bool  CastShadow ()
  Returns true if shadow castinging is enabled for this light.
virtual float  ShadowBias ()
  Returns the shadow bias for this light.
virtual LightType  Type ()
  Returns the type of this light.
virtual void  SetAttenuation (float)
  Sets the light attenuation value. Range is from 0-1.
virtual float  Attenuation (void) const
  Returns the light attenuation value. Range is from 0-1.
virtual Matrix  LockedToCameraMatrix () const
  Returns the "locked to camera" matrix.
virtual Image HDRImage () const
  Returns the HDRI image associated with this light, if any. Returns a NULL pointer if this is not an HDRI light.
virtual const QString *  HDRImageFilename () const

Protected Member Functions

  Light (void)
  Constructor. Do not use this directly. Use CreateInstances() instead.

Member Enumeration Documentation

enum LightType
Enumerator:
LIGHT_DIRECTIONAL 
LIGHT_POINT 
LIGHT_SPOT 
LIGHT_IBL 
LIGHT_NONE 

Definition at line 65 of file light.h.


Constructor & Destructor Documentation

Light ( void  ) [protected]

Constructor. Do not use this directly. Use CreateInstances() instead.

This is the typical way to create a Light:

        Light *myLight = CreateInstance<Light>();  

Member Function Documentation

virtual Color Diffuse ( void  ) const [virtual]

Returns the diffuse color value of the light.

virtual void SetDiffuse ( const Color cDiffuse ) [virtual]

Sets the diffuse color value of the light.

Parameters:
[in] cDiffuse The new color
virtual float Intensity ( void  ) const [virtual]

Returns the light intensity in range 0..1.

virtual void SetIntensity ( float  fIntensity ) [virtual]

Sets the light intensity in range 0..1.

Parameters:
[in] fIntensity The new intensity (0 is no light; 1 is full light)
virtual bool IsLockedToCamera ( void  ) const [virtual]

Returns true if the light direction is locked to the camera direction.

virtual void SetLockedToCamera ( bool  bOnOrOff ) [virtual]

Set lock/unlock to camera.

Parameters:
[in] bOnOrOff If true, the light will be locked to the camera so that it is always pointing in the same direction.
virtual bool Render ( void  ) [virtual]

Renders the light manipulator or light geometry, if they are turned on.

virtual Manipulator* GetManipulator ( ) [virtual]

Returns a pointer to the light's manipulator, or NULL if no manipulator has been created.

virtual void ValidateShadowMap ( ) [virtual]

Checks and updates the shadow map (if shadowing is turned on).

virtual Texture* ShadowDepthMap ( ) [virtual]

Returns the depth map associated with the light.

virtual const Matrix& ShadowMatrix ( ) const [virtual]

Returns the shadow/depth map matrix associated with light.

This matrix is the 'view matrix' of the light. It is used to render the scene from the light's perspective (and thus create a depth buffer), and to transform the main scene depth values into 'light space' so we can compare the main scene depth values to the light's scene depth values. This is used to create shadow maps for the light.

virtual bool CastShadow ( ) [virtual]

Returns true if shadow castinging is enabled for this light.

virtual float ShadowBias ( ) [virtual]

Returns the shadow bias for this light.

Bias does not have a fixed range, but generally lies between -1 & 1. It is used to offset the depth map either toward the light’s position or away from it. This is used to correct any inaccuracies in the depth comparison caused by precision loss. (Either when converting the pixel’s position to light space or in the depth map itself). Similar to polygon offset in OpenGL.

virtual LightType Type ( ) [virtual]
virtual void SetAttenuation ( float  ) [virtual]

Sets the light attenuation value. Range is from 0-1.

This is called "Light Decay" in the UI.

virtual float Attenuation ( void  ) const [virtual]

Returns the light attenuation value. Range is from 0-1.

This is called "Light Decay" in the UI.

virtual Matrix LockedToCameraMatrix ( ) const [virtual]

Returns the "locked to camera" matrix.

This matrix represents the initial camera matrix (on start up or when the light is created) multiplied by the inverse of the current camera matrix and the inverse of the current light matrix. Effectively, it is the 'delta' between the camera position, and the position of a light that is locked to it. Use this to get the current world space location of a light relative to the camera.

virtual Image* HDRImage ( ) const [virtual]

Returns the HDRI image associated with this light, if any. Returns a NULL pointer if this is not an HDRI light.

virtual const QString* HDRImageFilename ( ) const [virtual]

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

Light Light Light Light Light Light Light Light Light Light
Light Light Light Light Light Light Light Light Light Light