# TBasicDistantLight Class Reference
[Base Classes for plugins]

Inheritance diagram for TBasicDistantLight:

List of all members.

## Classes
struct | Data
## Public Member Functions
| TBasicDistantLight ()
| ~TBasicDistantLight ()
virtual MCCOMErr MCCOMAPI | QueryInterface (const MCIID &riid, void **ppvObj)
virtual uint32 MCCOMAPI | AddRef ()
virtual MCCOMErr MCCOMAPI | ExtensionDataChanged ()
virtual MCCOMErr MCCOMAPI | SimpleHandleEvent (MessageID message, IMFResponder *source, void *data)
virtual MCCOMErr MCCOMAPI | SetTransform (TTransform3D *transform)
virtual MCCOMErr MCCOMAPI | GetDirection (const TVector3 &point, TVector3 &resultDirection, real &resultDistance)
virtual boolean MCCOMAPI | GetColor (const TVector3 &point, const TVector3 &direction, const real distance, TMCColorRGB &result, real &ShadowIntensity)
virtual boolean MCCOMAPI | IsVisibleInPerspective ()
virtual uint32 MCCOMAPI | GetPrimitiveID ()
virtual MCCOMErr MCCOMAPI | ForEachShadowBuffer (ForEachShadowBufferCallback proc, void *priv)
virtual boolean MCCOMAPI | GetUVfromDirection (TVector2 &uv, const TVector3 &direction) const
virtual MCCOMErr MCCOMAPI | GetStandardLight (TStandardLight &light) const
virtual void MCCOMAPI | InitSampling (const TBBox3D &sceneBoundingBox, real &solidAngle, int32 &regionCount)
virtual void MCCOMAPI | GetRandomRay (int32 regionIndex, Ray3D &ray) const
virtual int32 MCCOMAPI | GetShadowBufferCount () const
virtual void MCCOMAPI | GetShadowBuffer (int32 bufferIndex, I3DShCamera **camera, TBBox2D &uvBox) const
virtual real32 MCCOMAPI | GetScalingFactor () const
virtual void MCCOMAPI | SetScalingFactor (real32 inValue)
virtual real MCCOMAPI | UpdateLightRadius (const real radiusFromShadowFeature) const
## Public Attributes
Data | fData
## Static Public Attributes
static const MCGUID | ClassId
## Protected Attributes
TMCColorRGB | fBritColor
TTransform3D | fTransform
TVector3 | fI
TVector3 | fJ
TVector3 | fD
TVector2 | fMin
TVector2 | fMax
real | fSamplingDistance
boolean | fNegativeAllowed
TMCArray< TMCAtomicCounterHolder > | fSampleIndices
## Static Protected Attributes
static const real32 | sRealMax

## Detailed Description

Basic Distant Light class. Derive from this for a default implementation of an I3DExLightsource for a distant type light

See also:
  I3DExLightsource

## Constructor & Destructor Documentation

TBasicDistantLight::TBasicDistantLight | ( |  | ) |

TBasicDistantLight::~TBasicDistantLight | ( |  | ) |

## Member Function Documentation

virtual uint32 MCCOMAPI TBasicDistantLight::AddRef | ( |  | ) | `[inline, virtual]`

Increments the reference count of the object

Reimplemented from TBasicLight.

virtual MCCOMErr MCCOMAPI TBasicDistantLight::ExtensionDataChanged | ( |  | ) | `[virtual]`

Called each time a parameter of the parameter map (Pmap) is modified. This should only be used to invalidate caches and should be quick since it can be called many times.

Reimplemented from TBasicDataExchanger.

virtual MCCOMErr MCCOMAPI TBasicDistantLight::ForEachShadowBuffer | ( | ForEachShadowBufferCallback | proc,
|  | void * | priv |
| ) |  |  | `[virtual]`

Deprecated:

Reimplemented from TBasicLight.

virtual boolean MCCOMAPI TBasicDistantLight::GetColor | ( | const TVector3 & | point,
|  | const TVector3 & | direction,
|  | const real | distance,
|  | TMCColorRGB & | result,
|  | real & | ShadowIntensity |
| ) |  |  | `[virtual]`

Returns the color of light seen through a given point.

When using a spot, use the position parameter and the light source position and orientation to determine whether a point is in the light beam or not. When using a sun, use the direction parameter to calculate the intensity. When lighting is based on distance, (such as distance fall-off), use the distance parameter.

Parameters:

  | point | The point on the surface for which the lighting is going to be calculated.
  | direction | The direction from which the light arrives on the point (as calculated in GetDirection()).
  | distance | The distance from the point to the light (as calculated in GetDirection()).
  | result | The color of the light that reaches this point
  | ShadowIntensity | The intensity of the shadow cast by that light

Reimplemented from TBasicLight.

virtual MCCOMErr MCCOMAPI TBasicDistantLight::GetDirection | ( | const TVector3 & | point,
|  | TVector3 & | resultDirection,
|  | real & | resultDistance |
| ) |  |  | `[virtual]`

Returns the direction from the point to the light source as well as the distance between the surface point and light source. GetDirection() is called prior to GetColor() to perform preliminary calculations. The surface point is the point on the object where the light is about to be calculated.

A light bulb typically calculates resultDirection by subtracting the postion point to the light source origin, then normalizes the results. A simulated sun light returns its light direction in resultDirection, and the maximum possible value in resultDistance.

Parameters:

  | point | The point on the surface for which the lighting is going to be calculated
  | resultDirection | The direction from which the light arrives on the point
  | resultDistance | The distance from the point to the light

Reimplemented from TBasicLight.

virtual uint32 MCCOMAPI TBasicDistantLight::GetPrimitiveID | ( |  | ) | `[virtual]`

Returns the ID of the primitive that is displayed in place of the light.

Reimplemented from TBasicLight.

virtual void MCCOMAPI TBasicDistantLight::GetRandomRay | ( | int32 | regionIndex,
|  | Ray3D & | ray |
| ) |  |  | const`[virtual]`

Returns a random ray starting from the light The rays should sample uniformly a solid angle that contains at least the intersection of the light cone (or sphere) and the scene.

Note:
  Must be called after InitSampling

Parameters:

  | ray | A reference to the ray that should be returned
  | regionIndex | Index of the region in which the ray should be picked

Reimplemented from TBasicLight.

virtual real32 MCCOMAPI TBasicDistantLight::GetScalingFactor | ( |  | ) | const`[inline, virtual]`

Returns the scaling that should be applied to the object, i.e. the number of inches in the primitive's unit.

Reimplemented from TBasicLight.

virtual void MCCOMAPI TBasicDistantLight::GetShadowBuffer | ( | int32 | bufferIndex,
|  | I3DShCamera ** | camera,
|  | TBBox2D & | uvBox |
| ) |  |  | const`[virtual]`

Returns a camera equivalent to a shadow buffer

Parameters:

  | bufferIndex | index of the shadow buffer (0 based)
  | camera | returns a pointer to the camera corresponding to the shadow buffer
  | uvBox | returns the box in screen coordinates corresponding to the shadow buffer

Reimplemented from TBasicLight.

virtual int32 MCCOMAPI TBasicDistantLight::GetShadowBufferCount | ( |  | ) | const`[virtual]`

Returns the number of shadow buffer needed for this light

Reimplemented from TBasicLight.

virtual MCCOMErr MCCOMAPI TBasicDistantLight::GetStandardLight | ( | TStandardLight & | light | ) | const`[virtual]`

Retrieves a standard description of the light for use in the interactive renderer.

Parameters:

  | light | A reference to the simplified description of the light for the interactive rendering

Reimplemented from TBasicLight.

virtual boolean MCCOMAPI TBasicDistantLight::GetUVfromDirection | ( | TVector2 & | uv,
|  | const TVector3 & | direction |
| ) |  |  | const`[virtual]`

returns the uv for the gel given a direction

Parameters:

  | uv | The uv that are returned.
  | direction | The direction as calculated in GetDirection()

Reimplemented from TBasicLight.

virtual void MCCOMAPI TBasicDistantLight::InitSampling | ( | const TBBox3D & | sceneBoundingBox,
|  | real & | solidAngle,
|  | int32 & | regionCount |
| ) |  |  | `[virtual]`

Initialize sampling of the light and returns the solid angle containing the sampling rays. It must be called before GetRandomRay

Parameters:

  | sceneBoundingBox | The bounding box of the scene
  | solidAngle | Returns the solid Angle of the sampling rays
  | regionCount | Returns the number of region for ray sampling (each region represent an equal number of rays)

Reimplemented from TBasicLight.

virtual boolean MCCOMAPI TBasicDistantLight::IsVisibleInPerspective | ( |  | ) | `[virtual]`

Returns true if the light should be displayed in the 3D View. In this case, the lights is displayed with the geometry of the primitive given by GetPrimitiveID().

If it returns false, then the light is not displayed, this is used for sun lights for example.

Reimplemented from TBasicLight.

virtual MCCOMErr MCCOMAPI TBasicDistantLight::QueryInterface | ( | const MCIID & | riid,
|  | void ** | ppvObj |
| ) |  |  | `[virtual]`

Check if the object supports a given interface and returns a pointer to that interface if it does. Note that QueryInterface will increment the reference count of the object by one if the interface is found.

Parameters:

  | riid | GUID of the interface
  | ppvObj | A pointer to the pointer being returned.

Reimplemented from TBasicLight.

virtual void MCCOMAPI TBasicDistantLight::SetScalingFactor | ( | real32 | inValue | ) | `[inline, virtual]`

Sets the scaling factor of the object

Parameters:

  | inValue | the number of inches to which the primitive's unit is equivalent

Reimplemented from TBasicLight.

virtual MCCOMErr MCCOMAPI TBasicDistantLight::SetTransform | ( | TTransform3D * | transform | ) | `[virtual]`

Called to tell a light source its position and orientation in space. This function is used to cache transform information to speed up GetDirection() and GetColor().

Parameters:

  | transform | A pointer to the Global Transform of the light

Reimplemented from TBasicLight.

virtual MCCOMErr MCCOMAPI TBasicDistantLight::SimpleHandleEvent | ( | MessageID | message,
|  | IMFResponder * | source,
|  | void * | data |
| ) |  |  | `[virtual]`

Replaces the deprecated HandleEvent ONLY IN SIMPLE CASES. This function MUST NOT change the user interface (its called for every selected component). Example of allowed use : if (source && (source->GetInstanceID() == 'shfl')) { fPMap.fSeed = gShellUtilities->TickCount(); ExtensionDataChanged(); }

Parameters:

  | message,: | the ID of the message being sent (All MessageIDs are preceeded with "kMsg")
  | source,: | the part that sent the message (can be NULL !)
  | data,: | a pointer to private data corresponding to the message

Reimplemented from TBasicDataExchanger.

virtual real MCCOMAPI TBasicDistantLight::UpdateLightRadius | ( | const real | radiusFromShadowFeature | ) | const`[virtual]`

Calculates a corrected radius for soft shadows. This is used in particular for distant lights to rescale the parameter

Parameters:

  | radiusFromShadowFeature | radius of the light as specified by the user in the shadow feature

Reimplemented from TBasicLight.

## Member Data Documentation

const MCGUID TBasicDistantLight::ClassId`[static]`

TMCColorRGB TBasicDistantLight::fBritColor`[protected]`

TVector3 TBasicDistantLight::fD`[protected]`

Data TBasicDistantLight::fData

TVector3 TBasicDistantLight::fI`[protected]`

TVector3 TBasicDistantLight::fJ`[protected]`

TVector2 TBasicDistantLight::fMax`[protected]`

TVector2 TBasicDistantLight::fMin`[protected]`

boolean TBasicDistantLight::fNegativeAllowed`[protected]`

TMCArray<TMCAtomicCounterHolder> TBasicDistantLight::fSampleIndices`[mutable, protected]`

real TBasicDistantLight::fSamplingDistance`[protected]`

TTransform3D TBasicDistantLight::fTransform`[protected]`

const real32 TBasicDistantLight::sRealMax`[static, protected]`

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

- BasicDistantLight.h