Public Member Functions

MapSampler Class Reference

This reference page is linked to from the following overview topics: Principal Classes for Materials and Textures.


Search for all occurrences

Detailed Description

See also:
Class UVGen, Class ShadeContext.
Description:
A texture map implements this class and passes it into the UVGen methods EvalUVMap(), EvalUVMapMono(), and EvalDeriv() to evaluate itself with tiling & mirroring. Each of the methods of this class are used to sample the map at a single UV coordinate.

#include <imtl.h>

Inheritance diagram for MapSampler:
Inheritance graph
[legend]

List of all members.

Public Member Functions

virtual  ~MapSampler ()
virtual AColor  Sample (ShadeContext &sc, float u, float v)=0
virtual AColor  SampleFilter (ShadeContext &sc, float u, float v, float du, float dv)=0
virtual void  SetTileNumbers (int iu, int iv)
virtual float  SampleMono (ShadeContext &sc, float u, float v)
virtual float  SampleMonoFilter (ShadeContext &sc, float u, float v, float du, float dv)

Constructor & Destructor Documentation

virtual ~MapSampler ( ) [inline, virtual]
Remarks:
Destructor.
{;}

Member Function Documentation

virtual AColor Sample ( ShadeContext sc,
float  u,
float  v 
) [pure virtual]
Remarks:
This method is required. It is called to sample the map at a single UV coordinate. This method should not try to antialias the map, it should just return the value. Take for example a bitmap texture implementing this method. If the u values passed was 0.5 and the v value passed was 0.5, the plug-in would just return the pixel value at the center of the bitmap as an AColor.
Parameters:
ShadeContext& sc

The ShadeContext.

float u

The U value in the range of 0.0 to 1.0

float v

The V value in the range of 0.0 to 1.0
Returns:
The sampled value as an AColor.
virtual AColor SampleFilter ( ShadeContext sc,
float  u,
float  v,
float  du,
float  dv 
) [pure virtual]
Remarks:
This method is required. It is called to return a value from the map that is the averaged value over the specified region of width du and height dv, centered at u, v. Certain map types may use the du and dv values directly to perform antialiasing of the map.
Parameters:
ShadeContext& sc

The ShadeContext.

float u

The U value in the range of 0.0 to 1.0

float v

The V value in the range of 0.0 to 1.0

float du

This parameter can be considered the width of a small rectangle center on u,v. The u and v value are guaranteed to be inside this rectangle.

float dv

This parameter can be considered the height of a small rectangle center on u,v. The u and v value are guaranteed to be inside this rectangle.
Returns:
The sampled value as an AColor.
virtual void SetTileNumbers ( int  iu,
int  iv 
) [inline, virtual]
{} // called before SampleFunctions to tell what tile your in
virtual float SampleMono ( ShadeContext sc,
float  u,
float  v 
) [inline, virtual]
Remarks:
This method is optional as a default implementation is provided. It may be implemented however if a certain map type can be more efficient in evaluating a mono channel. For example a noise function that produces a single floating point value as a function of UV. This method is called to sample the map at a single UV coordinate. This method should not try to antialias the map, it should just return the value.
Parameters:
ShadeContext& sc

The ShadeContext.

float u

The U value in the range of 0.0 to 1.0

float v

The V value in the range of 0.0 to 1.0
Returns:
The sampled value as an float.
Default Implementation:
{ return Intens(Sample(sc,u,v)); }
{ return Intens(Sample(sc,u,v)); }
virtual float SampleMonoFilter ( ShadeContext sc,
float  u,
float  v,
float  du,
float  dv 
) [inline, virtual]
Remarks:
This method is optional. It is called to return a value from the map that is the averaged value over the specified region of width du and height dv, centered at u, v. Certain map types may use the du and dv values directly to perform antialiasing of the map.
Parameters:
ShadeContext& sc

The ShadeContext.

float u

The U value in the range of 0.0 to 1.0

float v

The V value in the range of 0.0 to 1.0

float du

This parameter can be considered the width of a small rectangle center on u,v. The u and v value are guaranteed to be inside this rectangle.

float dv

This parameter can be considered the height of a small rectangle center on u,v. The u and v value are guaranteed to be inside this rectangle.
Returns:
The sampled value as an float.
Default Implementation:
{ return Intens(SampleFilter(sc,u,v,du,dv)); }
                                                                                                  {
                 return Intens(SampleFilter(sc,u,v,du,dv)); 
                 }

MapSampler MapSampler MapSampler MapSampler MapSampler MapSampler MapSampler MapSampler MapSampler MapSampler
MapSampler MapSampler MapSampler MapSampler MapSampler MapSampler MapSampler MapSampler MapSampler MapSampler