Taxonomy Categories:
Member Functions:
Interface Category:
API.
Inherits From:
TLight
Inherited By:
None.
Purpose:
TParallelLight is a concrete derived class of TLight. TParallelLight represents a distant light source, such as the sun, whose rays are parallel everywhere in the scene. The class adds a color and a direction vector to the TLight protocol. The direction vector specifies the direction (but not the distance) of the light source. For example, TGPoint3D (1,0,0) means the light is directly to the right of the scene, aiming along the x-axis at the origin of the coordinate system. Because the rays are parallel, the direction with respect to the origin is the same as the direction with respect to all other points in the scene. The default direction is TGPoint3D (1./Sqrt(3.), 1./Sqrt(3.), 1./Sqrt(3.)). The default color is white.
Instantiation:
Allocate on the heap or the stack.
Deriving Classes:
None.
Concurrency:
Not multithread safe.
Resource Use:
No special requirements.
- TParallelLight ()
- TParallelLight (const TGPoint3D & directionVector, const TColor & color)
- TParallelLight (const TParallelLight & parallelLight)
Interface Category:
API.
Purpose:
- Default constructor. Sets the direction vector of the light to (1./Sqrt(3.), 1./Sqrt(3.), 1./Sqrt(3.)) and the color to white.
- Constructor that sets the light's direction vector and color.
- Copy constructor.
Calling Context:
- Called by the stream-in operators. You can also call this function directly.
- Call this function directly.
- Called to copy an object.
Parameters:
- Takes no parameters.
- const TGPoint3D & directionVector -The direction from which the light is shining (relative to the origin of the scene).
- const TColor & color -The color of the light.
- const TParallelLight & parallelLight -The object to be copied.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
virtual ~ TParallelLight ()
Interface Category:
API.
Purpose:
Destructor.
Calling Context:
Called to destroy an object.
Parameters:
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TParallelLight::ComputeDiffuse
virtual void ComputeDiffuse (const TShadingSample & shadingInfo, const TSceneState & sceneState, TColor & resultantColor)
Interface Category:
API.
Purpose:
Calculates the diffuse contribution of the light at a particular surface location. The function returns kBlack if there is no diffuse light reaching the location.
Calling Context:
Call this function directly.
Parameters:
- const TShadingSample & shadingSample -The shading information for the point in question.
- const TSceneState & sceneState -The state of the scene.
- TColor & resultantColor -The resulting contribution of diffuse lighting for the sample location.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TParallelLight::ComputeSpecular
virtual void ComputeSpecular (const TShadingSample & shadingInfo, const TSceneState & sceneState, double specularExp, TColor & resultantColor)
Interface Category:
API.
Purpose:
Calculates the specular intensity of the light at a particular surface location. The function returns kBlack if there is no specular light component at the location.
Calling Context:
Call this function directly.
Parameters:
- const TShadingSample & shadingSample -The shading information for the point in question.
- const TSceneState & sceneState -The state of the scene.
- double specularExp -The exponential value used to amplify the effect of the reflected light intensity.
- TColor & resultantColor -The resulting specular intensity at the surface location.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TParallelLight::ComputeIntensity
virtual void ComputeIntensity (const TGPoint3D & position, TColor & resultantColor, double scale =1.)
Interface Category:
API.
Purpose:
Calculates the intensity of the light at a particular surface point.
Calling Context:
Call this function directly.
Parameters:
- const TGPoint3D & position -The 3-D location in question.
- TColor & resultantColor -The resulting intensity.
- double scale =-The scale value used to multiply the intensity value by. The default scale value is 1.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TParallelLight::SetDirection
virtual void SetDirection (const TGPoint3D & directionVector)
Interface Category:
API.
Purpose:
Sets the direction from which the light source is shining.
Calling Context:
Call this function directly.
Parameters:
- const TGPoint3D & directionVector -The direction vector of the light source, with respect to the scene origin.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
virtual void SetColor (const TColor & color)
Interface Category:
API.
Purpose:
Sets the color of the light.
Calling Context:
Call this function directly.
Parameters:
- const TColor & color -The color to set the light to.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TParallelLight::GetNormalizedDirection
virtual TGPoint3D GetNormalizedDirection () const
Interface Category:
API.
Purpose:
Returns the normalized light direction vector. This is the direction vector from the origin pointing at the light.
Calling Context:
Call this function directly.
Parameters:
Return Value:
The normalized light direction vector.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
virtual void GetColor (TColor & color) const
Interface Category:
API.
Purpose:
Returns the color of the light.
Calling Context:
Call this function directly.
Parameters:
- TColor & color -The color of the light.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
TParallelLight & operator =(const TParallelLight & Src)
Interface Category:
API.
Purpose:
Assignment operator.
Calling Context:
Call this function by using the operator in an assignment statement.
Parameters:
Return Value:
A non-const reference to the left-hand side object.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TParallelLight::operator>>=
virtual TStream & operator >>=(TStream &) const
Interface Category:
API.
Purpose:
Stream-out operator.
Calling Context:
Called to stream out data.
Parameters:
- TStream & -The stream that the object streams itself out to.
Return Value:
Returns a reference to the stream the object streams itself out to.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TParallelLight::operator<<=
virtual TStream & operator <<= (TStream &)
Interface Category:
API.
Purpose:
Stream-in operator.
Calling Context:
Called to stream in data.
Parameters:
- TStream & -The stream that the object streams itself in from.
Return Value:
Returns a reference to the stream the object streams itself in from.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Click the icon to mail questions or corrections about this material to Taligent personnel.
Copyright©1995 Taligent,Inc. All rights reserved.