Class: TPointLight

Declaration: LightSource.h

Taxonomy Categories:

Member Functions:


Interface Category:

API.

Inherits From:

TLight

Inherited By:

None.

Purpose:

TPointLight is a concrete derived class of TLight. TPointLight represents a nearby light source at a specific location, whose rays are not parallel. The light source is a single point (approximating a small light bulb, for example), as opposed to a larger light whose geometry might have to be taken into account. To the TLight protocol, the TPointLight class adds a position and a color (which includes intensity). The intensity is attenuated as a function of the distance between a surface point and the light. The default position is TGPoint3D(1000.,1000.,1000.), and 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: TPointLight::TPointLight

  1. TPointLight ()
  2. TPointLight (const TGPoint3D & position, const TColor & color)
  3. TPointLight (const TPointLight & pointLight)

Interface Category:

API.

Purpose:

  1. Default constructor. Sets the default position to (1000., 1000., 1000.) and the default color to white.
  2. Constructor that sets the position and color of the point light.
  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: TPointLight::~TPointLight

virtual ~ TPointLight ()

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: TPointLight::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: TPointLight::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: TPointLight::ComputeIntensity

virtual void ComputeIntensity (const TGPoint3D & position, TColor & resultantColor, double scale =1.)

Interface Category:

API. 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:

API.

Other Considerations:

None.

Member Function: TPointLight::SetPosition

virtual void SetPosition (const TGPoint3D & position)

Interface Category:

API.

Purpose:

Sets the position of the point 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: TPointLight::SetColor

virtual void SetColor (const TColor & color)

Interface Category:

API.

Purpose:

Sets the color of the point 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: TPointLight::GetPosition

virtual TGPoint3D GetPosition () const

Interface Category:

API.

Purpose:

Returns the position of the point light.

Calling Context:

Call this function directly.

Parameters:

Return Value:

The position of the light.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TPointLight::GetColor

virtual void GetColor (TColor & color)

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: TPointLight::operator=

TPointLight & operator =(const TPointLight & 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: TPointLight::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.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TPointLight::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.