Taxonomy Categories:
Member Functions:
Interface Category:
API.
Inherits From:
TShader
Inherited By:
None.
Purpose:
TImageMapShader is a concrete class, derived from TShader, that maps a 2-D image to a 3-D surface, much like applying wallpaper. The image is stored in a TImageMap object (which is NIL by default and which you should set by a constructor argument or by invoking TImageMapShader::SetImageMap). TImageMapShader::ComputeShade overrides that of the TShader base class. TImageMapShader::ComputeShade first extracts a value from the TImageMap, using the texture coordinate to determine which spot in the map should be used. The value extracted from TImageMap is used as the base color for the current point on the object's surface, replacing whatever color was set in the graphic's bundle.
The TImageMapShader has a subsidiary shader that it uses to perform additional shading after extracting the color from the texture map. By default, this shader is a TReflectanceShader, but by invoking TImageMapShader::SetChildShader (or with a constructor argument) you can replaced the default shader with an instance of any other class that descends from TShader. The TImageMapShader automatically invokes this subsidiary shader's ComputeShade member function to perform the additional shading.
Instantiation:
Allocate on the heap or the stack.
Deriving Classes:
None.
Concurrency:
Not multithread safe.
Resource Use:
No special requirements.
- TImageMapShader ()
- TImageMapShader (const TImageMap & map)
- TImageMapShader (const TImageMap & map, const TShader & childShader)
- TImageMapShader (const TImageMapShader & source)
Interface Category:
API.
Purpose:
- Default constructor. Sets the image map to NIL and the child shader to a TReflectanceShader.
- Constructor that sets the image map to the given map.
- Constructor that sets both the image map and the child shader to the given values.
- Copy constructor.
Calling Context:
- Called by the stream-in operators. You can also call this function directly.
- Call this function directly.
- Call this function directly.
- Called to copy an object.
Parameters:
- Takes no parameters.
- const TImageMap & map -The image map to use.
- const TImageMap & map -The image map to use.
- const TShader & childShader -The child shader to use after extracting the base color from the image.
- const TImageMapShader & source -The object to be copied.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
virtual ~ TImageMapShader ()
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.
virtual void SetImageMap (const TImageMap & imageMap)
Interface Category:
API.
Purpose:
Sets the image map to the specified TImageMap.
Calling Context:
Call this function directly.
Parameters:
- const TImageMap & imageMap -The new image map to use.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
virtual const TImageMap * GetImageMap () const
Interface Category:
API.
Purpose:
Returns a pointer to the current image map held by this object.
Calling Context:
Call this function directly.
Parameters:
Return Value:
Returns a constant pointer to a TImageMap object that represents the image map held by this object.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TImageMapShader::ComputeShade
virtual void ComputeShade (TShadingSample & shadingInfo, const TSceneState & sceneState)
Interface Category:
API.
Purpose:
Computes the resultant color and other shading variables, given the current surface point and scene state.
Calling Context:
Call this function directly.
Parameters:
- TShadingSample & shadingInfo -The shading information about the point to be shaded.
- const TSceneState & sceneState -The state of the scene.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TImageMapShader::SetChildShader
virtual void SetChildShader (const TShader & aShader)
Interface Category:
API.
Purpose:
Sets the child shader, which is used to shade the base color after it is chosen from the image map, to the given shader.
Calling Context:
Call this function directly.
Parameters:
- const TShader & aShader -The new shader to use.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TImageMapShader::GetChildShader
virtual TShader * GetChildShader () const
Interface Category:
API.
Purpose:
Returns a pointer to the child shader held by this object.
Calling Context:
Call this function directly.
Parameters:
Return Value:
Returns a pointer to a TShader object that represents the shader used to shade the base color after it has been selected from the image map.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TImageMapShader::GetShadingUsageVariables
virtual void GetShadingUsageVariables (TShadingUsageVariables & variables) const
Interface Category:
API.
Purpose:
Returns a TShadingUsageVariables object specifying what information the shader needs in order to shade the surface. This is dependent upon the needs of the child shader as well as the needs of the image map color getter.
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.
TImageMapShader & operator =(const TImageMapShader & source)
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.
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.
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.