Class: TParallelLight

Declaration: LightSource.h

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.

Member Function: TParallelLight::TParallelLight

  1. TParallelLight ()
  2. TParallelLight (const TGPoint3D & directionVector, const TColor & color)
  3. TParallelLight (const TParallelLight & parallelLight)

Interface Category:

API.

Purpose:

  1. Default constructor. Sets the direction vector of the light to (1./Sqrt(3.), 1./Sqrt(3.), 1./Sqrt(3.)) and the color to white.
  2. Constructor that sets the light's direction vector and color.
  3. Copy constructor.

Calling Context:

  1. Called by the stream-in operators. You can also call this function directly.
  2. Call this function directly.
  3. Called to copy an object.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TParallelLight::~TParallelLight

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:

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:

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:

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:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TParallelLight::SetColor

virtual void SetColor (const TColor & color)

Interface Category:

API.

Purpose:

Sets the color of the light.

Calling Context:

Call this function directly.

Parameters:

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.

Member Function: TParallelLight::GetColor

virtual void GetColor (TColor & color) const

Interface Category:

API.

Purpose:

Returns the color of the light.

Calling Context:

Call this function directly.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TParallelLight::operator=

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:

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:

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.