TBasicDistantLight Class Reference
[Base Classes for plugins]

Inheritance diagram for TBasicDistantLight:

TBasicLight I3DExLightsource TBasicDataExchanger IMCUnknown TBasicUnknown IMCUnknown List of all members.

Public Member Functions

 TBasicDistantLight ()
virtual MCCOMErr MCCOMAPI ExtensionDataChanged ()
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 &shadowCoef)
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

Public Attributes

Data fData

Static Public Attributes

const MCGUID ClassId

Protected Attributes

TMCColorRGB fBritColor
TTransform3D fTransform
TVector3 fI
TVector3 fJ
TVector3 fD
TVector2 fMin
TVector2 fMax
TMCArray< int32 > fSampleIndices

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 (   ) 
 


Member Function Documentation

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

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 &  shadowCoef
)  [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 display 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 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::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.


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]
 

TMCArray<int32> TBasicDistantLight::fSampleIndices [mutable, protected]
 

TTransform3D TBasicDistantLight::fTransform [protected]
 


The documentation for this class was generated from the following file:
Generated on Mon Mar 14 12:29:06 2005 for Carrara SDK Doc by  doxygen 1.3.9.1