- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files
- Directories
- Examples

- Class List
- Class Hierarchy
- Class Members

Public Types | Public Member Functions | Protected Member Functions

# Light Class Reference

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

Search for all occurrences

## Detailed Description

Represents a light source in the scene.

Definition at line 18 of file light.h.

`#include <light.h>`

Inheritance diagram for Light:
[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.
virtual float | Attenuation (void) const
| Returns the light attenuation value.
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.

## Member Enumeration Documentation

enum LightType

Search for all occurrences

Enumerator:

  LIGHT_DIRECTIONAL | Search for all occurrences
  LIGHT_POINT | Search for all occurrences
  LIGHT_SPOT | Search for all occurrences
  LIGHT_IBL | Search for all occurrences
  LIGHT_NONE | Search for all occurrences

Definition at line 33 of file light.h.

        {
            LIGHT_DIRECTIONAL=0,
            LIGHT_POINT,
            LIGHT_SPOT,
            LIGHT_IBL,
            LIGHT_NONE,
        };

## 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]`

Search for all occurrences

Returns the diffuse color value of the light.

virtual void SetDiffuse | ( | const Color & | cDiffuse | ) | `[virtual]`

Search for all occurrences

Sets the diffuse color value of the light.

Parameters:

  [in] | cDiffuse | The new color

virtual float Intensity | ( | void |  | ) | const `[virtual]`

Search for all occurrences

Returns the light intensity in range 0..1.

virtual void SetIntensity | ( | float | fIntensity | ) | `[virtual]`

Search for all occurrences

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]`

Search for all occurrences

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

virtual void SetLockedToCamera | ( | bool | bOnOrOff | ) | `[virtual]`

Search for all occurrences

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]`

Search for all occurrences

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

virtual Manipulator* GetManipulator | ( |  | ) | `[virtual]`

Search for all occurrences

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

virtual void ValidateShadowMap | ( |  | ) | `[virtual]`

Search for all occurrences

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

virtual Texture* ShadowDepthMap | ( |  | ) | `[virtual]`

Search for all occurrences

Returns the depth map associated with the light.

virtual const Matrix& ShadowMatrix | ( |  | ) | const `[virtual]`

Search for all occurrences

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]`

Search for all occurrences

Returns true if shadow castinging is enabled for this light.

virtual float ShadowBias | ( |  | ) | `[virtual]`

Search for all occurrences

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]`

Search for all occurrences

Returns the type of this light.

Possible return values are Light::LIGHT_DIRECTIONAL, Light::LIGHT_POINT, Light::LIGHT_SPOT, Light::LIGHT_IBL, or Light::LIGHT_NONE.

virtual void SetAttenuation | ( | float |  | ) | `[virtual]`

Search for all occurrences

Sets the light attenuation value.

Range is from 0-1.

This is called "Light Decay" in the UI.

virtual float Attenuation | ( | void |  | ) | const `[virtual]`

Search for all occurrences

Returns the light attenuation value.

Range is from 0-1.

This is called "Light Decay" in the UI.

virtual Matrix LockedToCameraMatrix | ( |  | ) | const `[virtual]`

Search for all occurrences

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]`

Search for all occurrences

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]`

Search for all occurrences

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

- Mudbox/light.h

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