OGRE 14.3
Object-Oriented Graphics Rendering Engine
Loading...
Searching...
No Matches
Ogre::Sampler Class Reference

Class which determines how a TextureUnitState accesses data from a Texture. More...

#include <OgreTextureUnitState.h>

Classes

struct  UVWAddressingMode
 Texture addressing mode for each texture coordinate. More...
 

Public Member Functions

 Sampler ()
 must be created through TextureManager
 
virtual ~Sampler ()
 
const UVWAddressingModegetAddressingMode () const
 Gets the texture addressing mode for a given coordinate, i.e.
 
unsigned int getAnisotropy () const
 Get this layer texture anisotropy level.
 
const ColourValuegetBorderColour (void) const
 
bool getCompareEnabled () const
 
CompareFunction getCompareFunction () const
 
FilterOptions getFiltering (FilterType ftype) const
 Get the texture filtering for the given type.
 
float getMipmapBias (void) const
 Gets the bias value applied to the mipmap calculation.
 
void setAddressingMode (const UVWAddressingMode &uvw)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
void setAddressingMode (TextureAddressingMode tam)
 Sets the texture addressing mode, i.e.
 
void setAddressingMode (TextureAddressingMode u, TextureAddressingMode v, TextureAddressingMode w)
 Sets the texture addressing mode, i.e.
 
void setAnisotropy (unsigned int maxAniso)
 Sets the anisotropy level to be used for this texture level.
 
void setBorderColour (const ColourValue &colour)
 Sets the texture border colour.
 
void setCompareEnabled (bool enabled)
 Enables or disables the comparison test for depth textures.
 
void setCompareFunction (CompareFunction function)
 
void setFiltering (FilterOptions minFilter, FilterOptions magFilter, FilterOptions mipFilter)
 Set a the detailed filtering options on this texture unit.
 
void setFiltering (FilterType ftype, FilterOptions opts)
 Set a single filtering option on this texture unit.
 
void setFiltering (TextureFilterOptions filterType)
 Set the texture filtering for this unit, using the simplified interface.
 
void setMipmapBias (float bias)
 Sets the bias value applied to the mipmap calculation.
 

Detailed Description

Class which determines how a TextureUnitState accesses data from a Texture.

There are a number of parameters affecting how texture data is fetched. Most notably FilterOptions and TextureAddressingMode.

Constructor & Destructor Documentation

◆ Sampler()

Ogre::Sampler::Sampler ( )

must be created through TextureManager

◆ ~Sampler()

virtual Ogre::Sampler::~Sampler ( )
virtual

Member Function Documentation

◆ setFiltering() [1/3]

void Ogre::Sampler::setFiltering ( TextureFilterOptions  filterType)

Set the texture filtering for this unit, using the simplified interface.

You also have the option of specifying the minification, magnification and mip filter individually if you want more control over filtering options. See the alternative setTextureFiltering methods for details.

Parameters
filterTypeThe high-level filter type to use.

◆ setFiltering() [2/3]

void Ogre::Sampler::setFiltering ( FilterType  ftype,
FilterOptions  opts 
)

Set a single filtering option on this texture unit.

Parameters
ftypeThe filtering type to set.
optsThe filtering option to set.

◆ setFiltering() [3/3]

void Ogre::Sampler::setFiltering ( FilterOptions  minFilter,
FilterOptions  magFilter,
FilterOptions  mipFilter 
)

Set a the detailed filtering options on this texture unit.

Parameters
minFilterThe filtering to use when reducing the size of the texture. Can be Ogre::FO_POINT, Ogre::FO_LINEAR or Ogre::FO_ANISOTROPIC.
magFilterThe filtering to use when increasing the size of the texture. Can be Ogre::FO_POINT, Ogre::FO_LINEAR or Ogre::FO_ANISOTROPIC.
mipFilterThe filtering to use between mip levels. Can be Ogre::FO_NONE (turns off mipmapping), Ogre::FO_POINT or Ogre::FO_LINEAR (trilinear filtering).

◆ getFiltering()

FilterOptions Ogre::Sampler::getFiltering ( FilterType  ftype) const

Get the texture filtering for the given type.

◆ getAddressingMode()

const UVWAddressingMode & Ogre::Sampler::getAddressingMode ( ) const
inline

Gets the texture addressing mode for a given coordinate, i.e.

what happens at uv values above 1.0.

Note
The default is TAM_WRAP i.e. the texture repeats over values of 1.0.

◆ setAddressingMode() [1/3]

void Ogre::Sampler::setAddressingMode ( TextureAddressingMode  tam)
inline

Sets the texture addressing mode, i.e.

what happens at uv values above 1.0.

The default is TAM_WRAP i.e. the texture repeats over values of 1.0. This is a shortcut method which sets the addressing mode for all coordinates at once; you can also call the more specific method to set the addressing mode per coordinate.

This is a shortcut method which sets the addressing mode for all coordinates at once; you can also call the more specific method to set the addressing mode per coordinate.

References setAddressingMode().

Referenced by setAddressingMode().

◆ setAddressingMode() [2/3]

void Ogre::Sampler::setAddressingMode ( TextureAddressingMode  u,
TextureAddressingMode  v,
TextureAddressingMode  w 
)
inline

Sets the texture addressing mode, i.e.

what happens at uv values above 1.0.

The default is TAM_WRAP i.e. the texture repeats over values of 1.0.

◆ setAddressingMode() [3/3]

void Ogre::Sampler::setAddressingMode ( const UVWAddressingMode uvw)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ setAnisotropy()

void Ogre::Sampler::setAnisotropy ( unsigned int  maxAniso)
inline

Sets the anisotropy level to be used for this texture level.

The degree of anisotropy is the ratio between the height of the texture segment visible in a screen space region versus the width - so for example a floor plane, which stretches on into the distance and thus the vertical texture coordinates change much faster than the horizontal ones, has a higher anisotropy than a wall which is facing you head on (which has an anisotropy of 1 if your line of sight is perfectly perpendicular to it).The maximum value is determined by the hardware, but it is usually 8 or 16.

In order for this to be used, you have to set the minification and/or the magnification option on this texture to Ogre::FO_ANISOTROPIC.

Parameters
maxAnisoThe maximal anisotropy level, should be between 2 and the maximum supported by hardware (1 is the default, ie. no anisotropy).

◆ getAnisotropy()

unsigned int Ogre::Sampler::getAnisotropy ( ) const
inline

Get this layer texture anisotropy level.

◆ setMipmapBias()

void Ogre::Sampler::setMipmapBias ( float  bias)
inline

Sets the bias value applied to the mipmap calculation.

You can alter the mipmap calculation by biasing the result with a single floating point value. After the mip level has been calculated, this bias value is added to the result to give the final mip level. Lower mip levels are larger (higher detail), so a negative bias will force the larger mip levels to be used, and a positive bias will cause smaller mip levels to be used. The bias values are in mip levels, so a -1 bias will force mip levels one larger than by the default calculation.

In order for this option to be used, your hardware has to support mipmap biasing (exposed through Ogre::RSC_MIPMAP_LOD_BIAS), and your minification filtering has to be set to point or linear.

◆ getMipmapBias()

float Ogre::Sampler::getMipmapBias ( void  ) const
inline

Gets the bias value applied to the mipmap calculation.

See also
TextureUnitState::setTextureMipmapBias

◆ setCompareEnabled()

void Ogre::Sampler::setCompareEnabled ( bool  enabled)
inline

Enables or disables the comparison test for depth textures.

When enabled, sampling the texture returns how the sampled value compares against a reference value instead of the sampled value itself. Combined with linear filtering this can be used to implement hardware PCF for shadow maps.

◆ getCompareEnabled()

bool Ogre::Sampler::getCompareEnabled ( ) const
inline

◆ setCompareFunction()

void Ogre::Sampler::setCompareFunction ( CompareFunction  function)
inline

◆ getCompareFunction()

CompareFunction Ogre::Sampler::getCompareFunction ( ) const
inline

◆ setBorderColour()

void Ogre::Sampler::setBorderColour ( const ColourValue colour)
inline

Sets the texture border colour.

The default is ColourValue::Black, and this value only used when addressing mode is TAM_BORDER.

◆ getBorderColour()

const ColourValue & Ogre::Sampler::getBorderColour ( void  ) const
inline

The documentation for this class was generated from the following file: