Class: TBumpMapShader

Declaration: SampleShaders.h

Taxonomy Categories:

Member Functions:


Interface Category:

API.

Inherits From:

TShader

Inherited By:

None.

Purpose:

TBumpMapShader is a concrete class, derived from TShader, that applies a bump map to a 3-D object in order to simulate a bumpy or dimpled surface. The bump map is stored in a TBumpMap object (which is NIL by default and which you should set by a constructor argument or by invoking TBumpMapShader::SetBumpMap). TBumpMapShader::ComputeShade overrides that of the TShader base class. TBumpMapShader::ComputeShade first extracts a value from the TBumpMap, using the texture coordinate to determine which spot in the map should be used. The value extracted from TBumpMap is used as the surface shading normal for the current point on the object's surface, replacing the existing value of TShadingSample.fShadingNormal. The TBumpMapShader has a subsidiary shader that it uses to perform additional shading after extracting the surface shading normal from the bump map. By default, this shader is a TReflectanceShader, but by invoking TBumpMapShader::SetChildShader (or with a constructor argument) you can replaced the default shader with an instance of any other class that descends from TShader. The TBumpMapShader automatically invokes this subsidiary shader's ComputeShade member function to perform the additional shading, which uses the new shading normal.

Instantiation:

Allocate on the heap or the stack.

Deriving Classes:

None.

Concurrency:

Not multithread safe.

Resource Use:

No special requirements.

Member Function: TBumpMapShader::TBumpMapShader

  1. TBumpMapShader ()
  2. TBumpMapShader (const TBumpMap & map)
  3. TBumpMapShader (const TBumpMap & map, const TShader & childShader)
  4. TBumpMapShader (const TBumpMapShader & source)

Interface Category:

API.

Purpose:

  1. Default constructor. Sets the bump map to NIL and the child shader to a TReflectanceShader.
  2. Constructor used to set the bump map to the given value.
  3. Constructor used to set the bump map and the child shader to the given values.
  4. Copy constructor.

Calling Context:

  1. Called by the stream-in operators. You can call this function directly.
  2. Call this function directly.
  3. Call this function directly.
  4. Called to copy an object. You can 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: TBumpMapShader::~TBumpMapShader

virtual ~ TBumpMapShader ()

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: TBumpMapShader::SetBumpMap

virtual void SetBumpMap (const TBumpMap & bumpMap)

Interface Category:

API.

Purpose:

Sets the bump map to the given value.

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: TBumpMapShader::GetBumpMap

virtual const TBumpMap * GetBumpMap () const

Interface Category:

API.

Purpose:

Returns a pointer to the bump map that is held by this object.

Calling Context:

Call this function directly.

Parameters:

Return Value:

Returns a pointer to a TBumpMap object that is used by this object.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TBumpMapShader::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:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TBumpMapShader::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 bump map, to the given shader.

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: TBumpMapShader::GetChildShader

virtual TShader * GetChildShader () const

Interface Category:

API.

Purpose:

Returns a pointer to the child shader, which is used to shade the color after it has been chosen from the bump map.

Calling Context:

Call this function directly.

Parameters:

Return Value:

Returns a pointer to a TShader object that is the child shader.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

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

Member Function: TBumpMapShader::operator=

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

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