Inheritance diagram for I3DExLightsource:

Public Member Functions | |
| virtual MCCOMErr MCCOMAPI | SetTransform (TTransform3D *transform)=0 |
| virtual MCCOMErr MCCOMAPI | GetDirection (const TVector3 &point, TVector3 &resultDirection, real &resultDistance)=0 |
| virtual boolean MCCOMAPI | GetColor (const TVector3 &point, const TVector3 &direction, const real distance, TMCColorRGB &result, real &ShadowIntensity)=0 |
| virtual boolean MCCOMAPI | IsVisibleInPerspective ()=0 |
| virtual uint32 MCCOMAPI | GetPrimitiveID ()=0 |
| virtual MCCOMErr MCCOMAPI | ForEachShadowBuffer (ForEachShadowBufferCallback proc, void *priv)=0 |
| virtual MCCOMErr MCCOMAPI | GetLightParameter (int32 keyword, void *parameter)=0 |
| virtual MCCOMErr MCCOMAPI | GetLightInfo (boolean &hasLightCone, boolean &hasLightSphere, real &halfAngle, TTransform3D &transform)=0 |
| virtual boolean MCCOMAPI | GetUVfromDirection (TVector2 &uv, const TVector3 &direction) const =0 |
| virtual LightTraceElement *MCCOMAPI | GetNewTrace (int16 *nb)=0 |
| virtual MCCOMErr MCCOMAPI | GetStandardLight (TStandardLight &light) const =0 |
| virtual void MCCOMAPI | InitSampling (const TBBox3D &sceneBoundingBox, real &solidAngle, int32 ®ionCount)=0 |
| virtual void MCCOMAPI | GetRandomRay (int32 regionIndex, Ray3D &ray) const =0 |
| virtual int32 MCCOMAPI | GetShadowBufferCount () const =0 |
| virtual void MCCOMAPI | GetShadowBuffer (int32 bufferIndex, I3DShCamera **camera, TBBox2D &uvBox) const =0 |
Light sources create light that illuminate object surfaces. The user can combine lights with gels to make additional lighting effects (see the I3DExLightsourceGel interface).
The structure of a light is a little bit more complex that the typical component. It is similar to the structure of Cameras and Primitives.
There are 2 COM objects to consider:
For advanced users: You should note that there are actually 3 C++ object (The light instance, the light component and the external light). However the light component and the external light are aggregated by COM which means that you can be considered as one single COM object).
To get a pointer to a I3DShLightsource from a I3DExLightsource, you can use the following code:
TMCCountedPtr<I3DShTreeElementMember> lightComponent; exLight->QueryInterface(IID_I3DShTreeElementMember,(void**)&lightComponent); ThrowIfNil(lightComponent); TMCCountedPtr<I3DShTreeElement> lightTree; lightComponent->GetTreeElement(&lightTree); ThrowIfNil(lightTree); TMCCountedPtr<I3DShLightsource> shLight; lightTree->QueryInterface(IID_I3DShLightsource.(void**)&shLight);
To access I3DExLightsource from I3DShLightsource, you can use the following code:
TMCCountedPtr<IShComponent> lightComponent; shLight->GetLightComponent(&lightComponent); ThrowIfNil(lightComponent); TMCCountedPtr<I3DExLightsource> exLight; lightComponent->QueryInterface(IID_I3DExLightsource,(void**)&exLight);
This code might seem a bit complicated at first but it is actually simple. You have two COM objects that point on each other. I3DShLightsource::GetLightComponent() and I3DShTreeElementMember::GetTreeElement() allow you to get a pointer from one object to the other. The rest is only calling QueryInterface to get the right interface on each object.
Whenever it is possible you should use the Shell interface (I3DShLightsource) to access the light because the Shell will make sure that the parameter map of the external component is valid. This is especially important if the component is animated. For more information on components see the Overview of the SDK.
|
||||||||||||
|
Implemented in TBasicLight, and TBasicDistantLight. |
|
||||||||||||||||||||||||
|
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.
Implemented in TBasicLight, and TBasicDistantLight. |
|
||||||||||||||||
|
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.
Implemented in TBasicLight, and TBasicDistantLight. |
|
||||||||||||||||||||
|
Returns information about light cones and sphere...
Implemented in TBasicLight. |
|
||||||||||||
|
Implemented in TBasicLight. |
|
|
Implemented in TBasicLight. |
|
|
Returns the ID of the primitive that is display in place of the light. Implemented in TBasicLight, and TBasicDistantLight. |
|
||||||||||||
|
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.
Implemented in TBasicLight, and TBasicDistantLight. |
|
||||||||||||||||
|
Returns a camera equivalent to a shadow buffer
Implemented in TBasicLight, and TBasicDistantLight. |
|
|
Returns the number of shadow buffer needed for this light Implemented in TBasicLight, and TBasicDistantLight. |
|
|
Retrieves a standard description of the light for use in the interactive renderer.
Implemented in TBasicLight, and TBasicDistantLight. |
|
||||||||||||
|
returns the uv for the gel given a direction
Implemented in TBasicLight, and TBasicDistantLight. |
|
||||||||||||||||
|
Initialize sampling of the light and returns the solid angle containing the sampling rays. It must be called before GetRandomRay
Implemented in TBasicLight, and TBasicDistantLight. |
|
|
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. Implemented in TBasicLight, and TBasicDistantLight. |
|
|
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().
Implemented in TBasicLight, and TBasicDistantLight. |
1.3.9.1