TBasicLight Class Reference
[Base Classes for plugins]

Inheritance diagram for TBasicLight:
I3DExLightsource TBasicDataExchanger IMCUnknown TBasicUnknown IExDataExchanger TMCObject IMCUnknown IMCUnknown TBasicDistantLight

List of all members.

Public Member Functions

virtual MCCOMErr MCCOMAPI QueryInterface (const MCIID &riid, void **ppvObj)
virtual uint32 MCCOMAPI AddRef ()
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 MCCOMErr MCCOMAPI GetLightParameter (int32 keyword, void *parameter)
virtual MCCOMErr MCCOMAPI GetLightInfo (boolean &hasLightCone, boolean &hasLightSphere, real &halfAngle, TTransform3D &transform)
virtual boolean MCCOMAPI GetUVfromDirection (TVector2 &uv, const TVector3 &direction) const
virtual LightTraceElement *MCCOMAPI GetNewTrace (int16 *nb)
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 MCCOMErr MCCOMAPI UpdateAtmosphere (I3DShScene *inScene)
virtual real MCCOMAPI UpdateLightRadius (const real radiusFromShadowFeature) const

Detailed Description

Basic Light class. Derive from this for a default implementation of an I3DExLightsource.

See also:
I3DExLightsource

Member Function Documentation

virtual uint32 MCCOMAPI TBasicLight::AddRef (  )  [inline, virtual]

Increments the reference count of the object

Reimplemented from TBasicDataExchanger.

Reimplemented in TBasicDistantLight.

virtual MCCOMErr MCCOMAPI TBasicLight::ForEachShadowBuffer ( ForEachShadowBufferCallback  proc,
void *  priv 
) [virtual]
Deprecated:

Implements I3DExLightsource.

Reimplemented in TBasicDistantLight.

virtual boolean MCCOMAPI TBasicLight::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

Implements I3DExLightsource.

Reimplemented in TBasicDistantLight.

virtual MCCOMErr MCCOMAPI TBasicLight::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

Implements I3DExLightsource.

Reimplemented in TBasicDistantLight.

virtual MCCOMErr MCCOMAPI TBasicLight::GetLightInfo ( boolean hasLightCone,
boolean hasLightSphere,
real halfAngle,
TTransform3D transform 
) [virtual]

Returns information about light cones and sphere...

Parameters:
hasLightCone True on exit if the light supports a light cone (spot lights)
hasLightSphere True on ext if the light supports a light sphere (bulb lights)
halfAngle Half angle of the light cone if there is one
transform Global Transform of the light.

Implements I3DExLightsource.

virtual MCCOMErr MCCOMAPI TBasicLight::GetLightParameter ( int32  keyword,
void *  parameter 
) [inline, virtual]
virtual LightTraceElement* MCCOMAPI TBasicLight::GetNewTrace ( int16 nb  )  [virtual]
Deprecated:
Parameters:
nb not used

Implements I3DExLightsource.

virtual uint32 MCCOMAPI TBasicLight::GetPrimitiveID (  )  [virtual]

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

Implements I3DExLightsource.

Reimplemented in TBasicDistantLight.

virtual void MCCOMAPI TBasicLight::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

Implements I3DExLightsource.

Reimplemented in TBasicDistantLight.

virtual real32 MCCOMAPI TBasicLight::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.

Implements I3DExLightsource.

Reimplemented in TBasicDistantLight.

virtual void MCCOMAPI TBasicLight::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

Implements I3DExLightsource.

Reimplemented in TBasicDistantLight.

virtual int32 MCCOMAPI TBasicLight::GetShadowBufferCount (  )  const [virtual]

Returns the number of shadow buffer needed for this light

Implements I3DExLightsource.

Reimplemented in TBasicDistantLight.

virtual MCCOMErr MCCOMAPI TBasicLight::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

Implements I3DExLightsource.

Reimplemented in TBasicDistantLight.

virtual boolean MCCOMAPI TBasicLight::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()

Implements I3DExLightsource.

Reimplemented in TBasicDistantLight.

virtual void MCCOMAPI TBasicLight::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)

Implements I3DExLightsource.

Reimplemented in TBasicDistantLight.

virtual boolean MCCOMAPI TBasicLight::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.

Implements I3DExLightsource.

Reimplemented in TBasicDistantLight.

virtual MCCOMErr MCCOMAPI TBasicLight::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 TBasicDataExchanger.

Reimplemented in TBasicDistantLight.

virtual void MCCOMAPI TBasicLight::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

Implements I3DExLightsource.

Reimplemented in TBasicDistantLight.

virtual MCCOMErr MCCOMAPI TBasicLight::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

Implements I3DExLightsource.

Reimplemented in TBasicDistantLight.

virtual MCCOMErr MCCOMAPI TBasicLight::UpdateAtmosphere ( I3DShScene inScene  )  [inline, virtual]

This function should update the atmosphere in the current scene according to the light data, if needed (useful for atmospheric lights : sun, moon)

Parameters:
inScene a pointer to the current scene

Implements I3DExLightsource.

virtual real MCCOMAPI TBasicLight::UpdateLightRadius ( const real  radiusFromShadowFeature  )  const [inline, 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

Implements I3DExLightsource.

Reimplemented in TBasicDistantLight.


The documentation for this class was generated from the following file:
Generated on Mon Apr 26 22:47:56 2010 for Carrara SDK Doc by  doxygen 1.6.3