Taxonomy Categories:
Member Functions:
Interface Category:
API.
Inherits From:
TLight
Inherited By:
None.
Purpose:
TSpotLight is a concrete derived class of TLight. TSpotLight represents a nearby light source whose rays are not parallel and whose intensity is strongest within a certain conical region (due to a lampshade, for example). For a more natural effect, the TSpotLight class actually provides two cones: within the inner cone, the intensity is the greatest; outside the outer cone, the intensity is zero; and in the region between the inner and outer cones, the intensity is interpolated between these two extremes.
A TSpotLight is defined by its position, direction vector, color, inner and the outer cone angles, and fall-off exponent. Within the outer cone, the intensity is determined by the following factors: the distance attenuation; the fall-off factor based on the off-axis angle and the fall-off exponent; and the fuzziness factor that causes a smooth interpolation of the intensity in the region between the inner cone and the outer cone. The defaults are: position =TGPoint3D(1000,1000,1000), direction vector =TGPoint(1,1,1), color =white, inner cone angle =20 degrees, outer cone angle =25 degrees, fall-off exponent =4.
Instantiation:
Allocate on the heap or the stack.
Deriving Classes:
None.
Concurrency:
Not multithread safe.
Resource Use:
No special requirements.
- TSpotLight ()
- TSpotLight (const TGPoint3D & position, const TGPoint3D & directionVector, const TColor & color, GDegrees innerConeAngle, GDegrees outerConeAngle, double falloffExp)
- TSpotLight (const TSpotLight & spotLight)
Interface Category:
API.
Purpose:
- Default constructor. The default position is set to (1000,1000,1000); the default direction vector is set to (1,1,1); the default color is set to white; the default inner cone angle is set to 20 degrees; the default outer cone angle is set to 25 degrees; the fall-off exponent is set to four.
- Constructor that sets the position, direction vector, color, inner cone angle, outer cone angle, and fall-off exponent of the spotlight.
- 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 & position -The position of the spotlight.
- const TGPoint3D & directionVector -The direction vector of the spotlight.
- const TColor & color -The color of the spotlight.
- GDegrees innerConeAngle -The inner cone angle (area of greatest intensity) of the spotlight.
- GDegrees outerConeAngle -The outer cone angle of the spotlight, outside of which, the intensity is zero.
- double falloffExp -The exponent used to scale the light intensity between the inner cone angle and the outer cone angle.
- const TSpotLight & spotLight -The object to be copied.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
virtual ~ TSpotLight ()
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: TSpotLight::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: TSpotLight::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: TSpotLight::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: TSpotLight::SetPosition
virtual void SetPosition (const TGPoint3D & position)
Interface Category:
API.
Purpose:
Sets the position of the spotlight.
Calling Context:
Call this function directly.
Parameters:
- const TGPoint3D & position -The position to use for the spotlight.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TSpotLight::SetDirection
virtual void SetDirection (const TGPoint3D & position)
Interface Category:
API.
Purpose:
Sets the direction vector of the spotlight. The direction vector is internally normalized, so you pass the vector that starts at the source and points toward the light.
Calling Context:
Call this function directly.
Parameters:
- const TGPoint3D & position -The direction vector to use for the spotlight.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TSpotLight::SetColor
virtual void SetColor (const TColor & color)
Interface Category:
API.
Purpose:
Sets the color of the spotlight.
Calling Context:
Call this function directly.
Parameters:
- const TColor & color -The color to use for the spotlight.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TSpotLight::SetConeAngles
virtual void SetConeAngles (double innerConeAngle, double outerConeAngle)
Interface Category:
API.
Purpose:
Sets both the inner and outer cone angles of the spotlight. Inside the inner cone angle the light is brightest. Outside the outer cone angle the light intensity is zero.
Calling Context:
Call this function directly.
Parameters:
- double innerConeAngle -The angle of the inner cone.
- double outerConeAngle -The angle of the outer cone.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TSpotLight::SetFalloffExponent
virtual void SetFalloffExponent (double falloffExp)
Interface Category:
API.
Purpose:
Sets the fall-off exponent of the spotlight. This is used to compute the intensity level of light in areas between the inner and outer angles of the spotlight.
Calling Context:
Call this function directly.
Parameters:
- double falloffExp -The fall-off exponent to use for the spotlight.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TSpotLight::GetPosition
virtual TGPoint3D GetPosition () const
Interface Category:
API.
Purpose:
Gets the position of the spotlight.
Calling Context:
Call this function directly.
Parameters:
Return Value:
Returns the position of the spotlight.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TSpotLight::GetNormalizedDirection
virtual TGPoint3D GetNormalizedDirection () const
Interface Category:
API.
Purpose:
Gets the normalized direction vector of the spotlight. Because the direction vector is normalized internally, this function returns the direction vector that starts at the source and points towards the spotlight.
Calling Context:
Call this function directly.
Parameters:
Return Value:
Returns the direction vector of the spotlight.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TSpotLight::GetColor
virtual void GetColor (TColor & color)
Interface Category:
API.
Purpose:
Returns the color of the spotlight.
Calling Context:
Call this function directly.
Parameters:
- TColor & color -The color of the spotlight.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TSpotLight::GetConeAngles
virtual void GetConeAngles (double & innerConeAngle, double & outerConeAngle)
Interface Category:
API.
Purpose:
Gets the inner and outer cone angles.
Calling Context:
Call this function directly.
Parameters:
- double & innerConeAngle -The inner cone angle (where the light is brightest).
- double & outerConeAngle -The outer cone angle (where the light fades to black).
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TSpotLight::GetFalloffExponent
virtual double GetFalloffExponent ()
Interface Category:
API.
Purpose:
Returns the fall-off exponent used to compute the intensity of light between the inner and outer cone angles.
Calling Context:
Call this function directly.
Parameters:
Return Value:
Returns the fall-off intensity of the spotlight.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TSpotLight::operator=
TSpotLight & operator =(const TSpotLight & 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: TSpotLight::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.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TSpotLight::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.