OGRE: Ogre::TextureUnitState Class Reference

| OGRE 14.5 Object-Oriented Graphics Rendering Engine

Loading...
Searching...
No Matches
Ogre::TextureUnitState Class Reference
Core » Materials

Class representing the state of a single texture unit during a Pass of a Technique, of a Material. More...

`#include <OgreTextureUnitState.h>`

Inheritance diagram for Ogre::TextureUnitState:
[legend]

## Classes
struct | TextureEffect
| Internal structure defining a texture effect. More...

## Public Types
enum | ContentType : uint8 { CONTENT_NAMED = 0 , CONTENT_SHADOW = 1 , CONTENT_COMPOSITOR = 2 }
| Enum identifying the type of content this texture unit contains. More...
typedef std::multimap< TextureEffectType, TextureEffect > | EffectMap
| Texture effects in a multimap paired array.
enum | EnvMapType : uint8 { ENV_PLANAR = TEXCALC_ENVIRONMENT_MAP_PLANAR , ENV_CURVED = TEXCALC_ENVIRONMENT_MAP , ENV_REFLECTION = TEXCALC_ENVIRONMENT_MAP_REFLECTION , ENV_NORMAL = TEXCALC_ENVIRONMENT_MAP_NORMAL }
| rather use TexCoordCalcMethod More...
typedef Ogre::TextureAddressingMode | TextureAddressingMode
enum | TextureCubeFace { CUBE_FRONT = 0 , CUBE_BACK = 1 , CUBE_LEFT = 2 , CUBE_RIGHT = 3 , CUBE_UP = 4 , CUBE_DOWN = 5 }
| Enum identifying the frame indexes for faces of a cube map (not the composite 3D type. More...
enum | TextureEffectType { ET_ENVIRONMENT_MAP , ET_PROJECTIVE_TEXTURE , ET_UVSCROLL , ET_USCROLL , ET_VSCROLL , ET_ROTATE , ET_TRANSFORM }
| Definition of the broad types of texture effect you can apply to a texture unit. More...
enum | TextureTransformType { TT_TRANSLATE_U , TT_TRANSLATE_V , TT_SCALE_U , TT_SCALE_V , TT_ROTATE }
| Useful enumeration when dealing with procedural transforms. More...
typedef Sampler::UVWAddressingMode | UVWAddressingMode

## Public Member Functions
| TextureUnitState (Pass *parent)
| Default constructor.
| TextureUnitState (Pass *parent, const String &texName, uint8 texCoordSet=0)
| Name-based constructor.
| TextureUnitState (Pass *parent, const TextureUnitState &oth)
| ~TextureUnitState ()
| Default destructor.
TexCoordCalcMethod | _deriveTexCoordCalcMethod () const
ControllerFloat * | _getAnimController () const
| Gets the animation controller (as created because of setAnimatedTexture) if it exists.
const SamplerPtr & | _getLocalSampler ()
| return a sampler local to this TUS instead of the shared global one
const TexturePtr & | _getTexturePtr (size_t frame) const
| Get the texture pointer for a given frame.
const TexturePtr & | _getTexturePtr (void) const
| Get the texture pointer for the current frame.
void | _load (void)
| Internal method for loading this object as part of Material::load.
void | _notifyNeedsRecompile (void)
| Tells the class that it needs recompilation.
void | _notifyParent (Pass *parent)
| Notify this object that its parent has changed.
void | _prepare (void)
| Internal method for preparing this object for load, as part of Material::prepare.
void | _setTexturePtr (const TexturePtr &texptr)
| Set the texture pointer for the current frame (internal use only!).
void | _setTexturePtr (const TexturePtr &texptr, size_t frame)
| Set the texture pointer for a given frame (internal use only!).
void | _unload (void)
| Internal method for unloading this object as part of Material::unload.
void | _unprepare (void)
| Internal method for undoing the preparation this object as part of Material::unprepare.
void | addFrameTextureName (const String &name)
| Add a Texture name to the end of the frame container.
size_t | calculateSize (void) const
void | deleteFrameTextureName (const size_t frameNumber)
| Deletes a specific texture frame.
const LayerBlendModeEx & | getAlphaBlendMode (void) const
| Get multitexturing alpha blending mode.
Real | getAnimationDuration (void) const
| Get the animated-texture animation duration.
SceneBlendFactor | getColourBlendFallbackDest (void) const
| Get the multipass fallback for colour blending operation destination factor.
SceneBlendFactor | getColourBlendFallbackSrc (void) const
| Get the multipass fallback for colour blending operation source factor.
const LayerBlendModeEx & | getColourBlendMode (void) const
| Get multitexturing colour blending mode.
ContentType | getContentType (void) const
| Get the type of content this TextureUnitState references.
unsigned int | getCurrentFrame (void) const
| Gets the active frame in an animated or multi-image texture layer.
PixelFormat | getDesiredFormat (void) const
| Returns the desired pixel format for the texture surface.
const String & | getFrameTextureName (unsigned int frameNumber) const
| Gets the name of the texture associated with a frame number.
float | getGamma () const
| Returns the gamma adjustment factor applied to this texture on loading.
const String & | getName (void) const
| Get the name of the Texture Unit State.
unsigned int | getNumFrames (void) const
| Gets the number of frames for a texture.
int | getNumMipmaps (void) const
| Gets how many mipmaps have been requested for the texture.
Pass * | getParent (void) const
| Gets the parent Pass object.
const String & | getReferencedCompositorName () const
| Gets the name of the compositor that this texture references.
uint32 | getReferencedMRTIndex () const
| Gets the MRT index of the texture in the compositor that this texture references.
const String & | getReferencedTextureName () const
| Gets the name of the texture in the compositor that this texture references.
const SamplerPtr & | getSampler () const
| get the associated sampler
const Sampler::UVWAddressingMode & | getTextureAddressingMode (void) const
| Sets the texture addressing mode, i.e.
unsigned int | getTextureAnisotropy () const
| Get this layer texture anisotropy level.
const ColourValue & | getTextureBorderColour () const
bool | getTextureCompareEnabled () const
CompareFunction | getTextureCompareFunction () const
uint8 | getTextureCoordSet (void) const
| Gets the index of the set of texture co-ords this layer uses.
std::pair< uint32, uint32 > | getTextureDimensions (unsigned int frame=0) const
| Returns the width and height of the texture in the given frame.
FilterOptions | getTextureFiltering (FilterType ftype) const
| Get the texture filtering for the given type.
float | getTextureMipmapBias (void) const
| Gets the bias value applied to the mipmap calculation.
const String & | getTextureName (void) const
| Get the name of current texture image for this layer.
const String & | getTextureNameAlias (void) const
TextureType | getTextureType (void) const
| Returns the type of this texture.
int | getUnorderedAccessMipLevel () const
bool | is3D (void) const
bool | isBlank (void) const
| Determines if this texture layer is currently blank.
bool | isCubic (void) const
bool | isDefaultFiltering () const
| Returns true if this texture unit is using the default Sampler.
bool | isHardwareGammaEnabled () const
| Gets whether this texture will be set up so that on sampling it, hardware gamma correction is applied.
bool | isLoaded (void) const
| Is this loaded?
bool | isTextureLoadFailing () const
| Tests if the texture associated with this unit has failed to load.
TextureUnitState & | operator= (const TextureUnitState &oth)
void | retryTextureLoad ()
| Tells the unit to retry loading the texture if it had failed to load.
void | setAlphaOperation (LayerBlendOperationEx op, LayerBlendSource source1=LBS_TEXTURE, LayerBlendSource source2=LBS_CURRENT, Real arg1=1.0, Real arg2=1.0, Real manualBlend=0.0)
| Sets the alpha operation to be applied to this texture.
void | setAnimatedTextureName (const std::vector< String > &names, Real duration=0)
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void | setAnimatedTextureName (const String &name, size_t numFrames, Real duration=0)
| Sets the names of the texture images for an animated texture.
void | setAnimatedTextureName (const String *const names, size_t numFrames, Real duration=0)
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void | setBlank (void)
| Sets this texture layer to be blank.
void | setColourOperation (const LayerBlendOperation op)
| Determines how this texture layer is combined with the one below it (or the diffuse colour of the geometry if this is layer 0).
void | setColourOperationEx (LayerBlendOperationEx op, LayerBlendSource source1=LBS_TEXTURE, LayerBlendSource source2=LBS_CURRENT, const ColourValue &arg1=ColourValue::White, const ColourValue &arg2=ColourValue::White, Real manualBlend=0.0)
| Setting advanced blending options.
void | setColourOpMultipassFallback (const SceneBlendFactor sourceFactor, const SceneBlendFactor destFactor)
| Sets the multipass fallback operation for this layer, if you used TextureUnitState::setColourOperationEx and not enough multitexturing hardware is available.
void | setCompositorReference (const String &compositorName, const String &textureName, uint32 mrtIndex=0)
| Set the compositor reference for this texture unit state.
void | setContentType (ContentType ct)
| Set the type of content this TextureUnitState references.
void | setCubicTexture (const TexturePtr *const texPtrs, bool forUVW=false)
void | setCubicTextureName (const String &name, bool forUVW=false)
void | setCubicTextureName (const String *const names, bool forUVW=false)
void | setCurrentFrame (unsigned int frameNumber)
| Changes the active frame in an animated or multi-image texture.
void | setDesiredFormat (PixelFormat desiredFormat)
| Sets the desired pixel format for the texture surface; can only be set before load().
void | setFrameTextureName (const String &name, unsigned int frameNumber)
| Sets the name of the texture associated with a frame.
void | setGamma (float gamma)
| Sets the gamma adjustment factor applied to this texture on loading the data.
void | setHardwareGammaEnabled (bool enabled)
| Sets whether this texture will be set up so that on sampling it, hardware gamma correction is applied.
void | setIsAlpha (bool isAlpha)
void | setLayerArrayNames (TextureType type, const std::vector< String > &names)
| Sets this texture layer to use an array of texture maps.
void | setName (const String &name)
| Set the name of the Texture Unit State.
void | setNumMipmaps (int numMipmaps)
| Sets the number of mipmaps to be used for this texture.
void | setSampler (const SamplerPtr &sampler)
void | setTexture (const TexturePtr &texPtr)
| Sets this texture layer to use a single texture, given the pointer to the texture to use on this layer.
void | setTextureAddressingMode (const Sampler::UVWAddressingMode &uvw)
| Sets the texture addressing mode, i.e.
void | setTextureAddressingMode (Ogre::TextureAddressingMode tam)
| Sets the texture addressing mode, i.e.
void | setTextureAddressingMode (Ogre::TextureAddressingMode u, Ogre::TextureAddressingMode v, Ogre::TextureAddressingMode w)
| Sets the texture addressing mode, i.e.
void | setTextureAnisotropy (unsigned int maxAniso)
| Sets the anisotropy level to be used for this texture level.
void | setTextureBorderColour (const ColourValue &colour)
| Sets the texture border colour.
void | setTextureCompareEnabled (bool enabled)
| Enables or disables the comparison test for depth textures.
void | setTextureCompareFunction (CompareFunction function)
void | setTextureCoordSet (uint8 set)
| Sets which texture coordinate set is to be used for this texture layer.
void | setTextureFiltering (FilterOptions minFilter, FilterOptions magFilter, FilterOptions mipFilter)
| Set a the detailed filtering options on this texture unit.
void | setTextureFiltering (FilterType ftype, FilterOptions opts)
| Set a single filtering option on this texture unit.
void | setTextureFiltering (TextureFilterOptions filterType)
| Set the texture filtering for this unit, using the simplified interface.
void | setTextureMipmapBias (float bias)
| Sets the bias value applied to the mipmap calculation.
void | setTextureName (const String &name)
| Sets this texture layer to use a single texture, given the name of the texture to use on this layer.
void | setTextureName (const String &name, TextureType ttype)
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void | setTextureNameAlias (const String &name)
void | setUnorderedAccessMipLevel (int mipLevel)
| Enables Unordered Access to the provided mipLevel of the texture.
Texture coordinate transformation
void | setTextureTransform (const Matrix4 &xform)
| Sets a matrix used to transform any texture coordinates on this layer.
const Matrix4 & | getTextureTransform (void) const
| Gets the current texture transformation matrix.
void | setTextureScroll (float u, float v)
| Sets the translation offset of the texture, ie scrolls the texture.
void | setTextureUScroll (float value)
| As setTextureScroll, but sets only U value.
float | getTextureUScroll (void) const
| Get texture uscroll value.
void | setTextureVScroll (float value)
| As setTextureScroll, but sets only V value.
float | getTextureVScroll (void) const
| Get texture vscroll value.
void | setTextureUScale (float value)
| As setTextureScale, but sets only U value.
float | getTextureUScale (void) const
| Get texture uscale value.
void | setTextureVScale (float value)
| As setTextureScale, but sets only V value.
float | getTextureVScale (void) const
| Get texture vscale value.
void | setTextureScale (float uScale, float vScale)
| Sets the scaling factor applied to texture coordinates.
void | setTextureRotate (const Radian &angle)
| Sets the anticlockwise rotation factor applied to texture coordinates.
const Radian & | getTextureRotate (void) const
| Get texture rotation effects angle value.
Dynamic texture coordinate generation
void | addEffect (TextureEffect effect)
| Generic method for setting up texture effects.
void | setEnvironmentMap (bool enable, int texGenType=TEXCALC_ENVIRONMENT_MAP)
| Turns on/off texture coordinate generation for addressing an environment map.
void | setScrollAnimation (float uSpeed, float vSpeed)
| Sets up an animated scroll for the texture layer.
void | setRotateAnimation (float speed)
| Sets up an animated texture rotation for this layer.
void | setTransformAnimation (const TextureTransformType ttype, const WaveformType waveType, float base=0, float frequency=1, float phase=0, float amplitude=1)
| Sets up a general time-relative texture modification effect.
void | setProjectiveTexturing (bool enabled, const Frustum *projectionSettings=0)
| Enables or disables projective texturing on this texture unit.
const Frustum * | getProjectiveTexturingFrustum (void) const
| Gets the Frustum which is being used to derive projective texturing parameters.
void | removeAllEffects (void)
| Removes all effects applied to this texture layer.
void | removeEffect (const TextureEffectType type)
| Removes a single effect applied to this texture layer.
const EffectMap & | getEffects (void) const
| Get texture effects in a multimap paired array.

## Static Public Attributes
static const Ogre::TextureAddressingMode | TAM_BORDER = Ogre::TAM_BORDER
static const Ogre::TextureAddressingMode | TAM_CLAMP = Ogre::TAM_CLAMP
static const Ogre::TextureAddressingMode | TAM_MIRROR = Ogre::TAM_MIRROR
static const Ogre::TextureAddressingMode | TAM_WRAP = Ogre::TAM_WRAP

## Detailed Description

Class representing the state of a single texture unit during a Pass of a Technique, of a Material.

Texture units are pipelines for retrieving texture data for rendering onto your objects in the world. Using them is common to both the fixed-function and the programmable (vertex and fragment program) pipeline, but some of the settings will only have an effect in the fixed-function pipeline (for example, setting a texture rotation will have no effect if you use the programmable pipeline, because this is overridden by the fragment program). The effect of each setting as regards the 2 pipelines is commented in each setting.

When I use the term 'fixed-function pipeline' I mean traditional rendering where you do not use vertex or fragment programs (shaders). Programmable pipeline means that for this pass you are using vertex or fragment programs.

## Member Typedef Documentation

## ◆ TextureAddressingMode

typedef Ogre::TextureAddressingMode Ogre::TextureUnitState::TextureAddressingMode

## ◆ UVWAddressingMode

typedef Sampler::UVWAddressingMode Ogre::TextureUnitState::UVWAddressingMode

## ◆ EffectMap

typedef std::multimap<TextureEffectType, TextureEffect> Ogre::TextureUnitState::EffectMap

Texture effects in a multimap paired array.

## Member Enumeration Documentation

## ◆ TextureEffectType

enum Ogre::TextureUnitState::TextureEffectType

Definition of the broad types of texture effect you can apply to a texture unit.

Enumerator
ET_ENVIRONMENT_MAP | Generate all texture coords based on angle between camera and vertex.
ET_PROJECTIVE_TEXTURE | Generate texture coords based on a frustum.
ET_UVSCROLL | Constant u/v scrolling effect.
ET_USCROLL | Constant u scrolling effect.
ET_VSCROLL | Constant u/v scrolling effect.
ET_ROTATE | Constant rotation.
ET_TRANSFORM | More complex transform.

## ◆ EnvMapType

enum Ogre::TextureUnitState::EnvMapType : uint8

rather use TexCoordCalcMethod

Enumerator
ENV_PLANAR | same as TEXCALC_ENVIRONMENT_MAP_PLANAR
ENV_CURVED | same as TEXCALC_ENVIRONMENT_MAP
ENV_REFLECTION | same as TEXCALC_ENVIRONMENT_MAP_REFLECTION
ENV_NORMAL | same as TEXCALC_ENVIRONMENT_MAP_NORMAL

## ◆ TextureTransformType

enum Ogre::TextureUnitState::TextureTransformType

Useful enumeration when dealing with procedural transforms.

Enumerator
TT_TRANSLATE_U |
TT_TRANSLATE_V |
TT_SCALE_U |
TT_SCALE_V |
TT_ROTATE |

## ◆ TextureCubeFace

enum Ogre::TextureUnitState::TextureCubeFace

Enum identifying the frame indexes for faces of a cube map (not the composite 3D type.

Enumerator
CUBE_FRONT |
CUBE_BACK |
CUBE_LEFT |
CUBE_RIGHT |
CUBE_UP |
CUBE_DOWN |

## ◆ ContentType

enum Ogre::TextureUnitState::ContentType : uint8

Enum identifying the type of content this texture unit contains.

Enumerator
CONTENT_NAMED | The default option, this derives texture content from a texture name, loaded by ordinary means from a file or having been manually created with a given name.
CONTENT_SHADOW | A shadow texture, automatically bound by engine.
CONTENT_COMPOSITOR | This option allows you to reference a texture from a compositor, and is only valid when the pass is rendered within a compositor sequence.

## Constructor & Destructor Documentation

## ◆ TextureUnitState() [1/3]

Ogre::TextureUnitState::TextureUnitState | ( | Pass * | parent | ) |

Default constructor.

Referenced by TextureUnitState(), and operator=().

## ◆ TextureUnitState() [2/3]

Ogre::TextureUnitState::TextureUnitState | ( | Pass * | parent,
|  | const TextureUnitState & | oth )

References TextureUnitState().

## ◆ ~TextureUnitState()

Ogre::TextureUnitState::~TextureUnitState | ( |  | ) |

Default destructor.

## ◆ TextureUnitState() [3/3]

Ogre::TextureUnitState::TextureUnitState | ( | Pass * | parent,
|  | const String & | texName,
|  | uint8 | texCoordSet = 0 )

Name-based constructor.

Parameters

  parent | the parent Pass object.
  texName | The basic name of the texture e.g. brickwall.jpg, stonefloor.png.
  texCoordSet | The index of the texture coordinate set to use.

## Member Function Documentation

## ◆ operator=()

TextureUnitState & Ogre::TextureUnitState::operator= | ( | const TextureUnitState & | oth | ) |

References TextureUnitState().

## ◆ getTextureName()

const String & Ogre::TextureUnitState::getTextureName | ( | void |  | ) | const

Get the name of current texture image for this layer.

This will either always be a single name for this layer, or will be the name of the current frame for an animated or otherwise multi-frame texture.

## ◆ setTextureName() [1/2]

void Ogre::TextureUnitState::setTextureName | ( | const String & | name | ) |

Sets this texture layer to use a single texture, given the name of the texture to use on this layer.

Referenced by setCubicTextureName().

## ◆ setTextureName() [2/2]

void Ogre::TextureUnitState::setTextureName | ( | const String & | name,
|  | TextureType | ttype )

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

## ◆ setTexture()

void Ogre::TextureUnitState::setTexture | ( | const TexturePtr & | texPtr | ) |

Sets this texture layer to use a single texture, given the pointer to the texture to use on this layer.

Referenced by setCubicTexture().

## ◆ setCubicTextureName() [1/2]

void Ogre::TextureUnitState::setCubicTextureName | ( | const String & | name,
|  | bool | forUVW = false )
| inline

Deprecated
  use setTextureName()

References setTextureName(), and Ogre::TEX_TYPE_CUBE_MAP.

## ◆ setCubicTextureName() [2/2]

void Ogre::TextureUnitState::setCubicTextureName | ( | const String *const | names,
|  | bool | forUVW = false )

Deprecated
  use setLayerArrayNames()

## ◆ setCubicTexture()

void Ogre::TextureUnitState::setCubicTexture | ( | const TexturePtr *const | texPtrs,
|  | bool | forUVW = false )
| inline

Deprecated
  use setTexture()

References setTexture().

## ◆ setAnimatedTextureName() [1/3]

void Ogre::TextureUnitState::setAnimatedTextureName | ( | const String & | name,
|  | size_t | numFrames,
|  | Real | duration = 0 )

Sets the names of the texture images for an animated texture.

Animated textures are just a series of images making up the frames of the animation. All the images must be the same size, and their names must have a frame number appended before the extension, e.g. if you specify a name of "flame.jpg" with 3 frames, the image names must be "flame_0.jpg", "flame_1.jpg" and "flame_2.jpg".

You can change the active frame on a texture layer by calling the Ogre::TextureUnitState::setCurrentFrame method.

Note
  If you can't make your texture images conform to the naming standard laid out here, you can call the alternative setAnimatedTextureName method which takes an array of names instead.

Parameters

  name | The base name of the textures to use e.g. flame.jpg for frames flame_0.jpg, flame_1.jpg etc.
  numFrames | The number of frames in the sequence.
  duration | The length of time it takes to display the whole animation sequence, in seconds. If 0, no automatic transition occurs.

Referenced by setAnimatedTextureName().

## ◆ setAnimatedTextureName() [2/3]

void Ogre::TextureUnitState::setAnimatedTextureName | ( | const String *const | names,
|  | size_t | numFrames,
|  | Real | duration = 0 )

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

Deprecated
  use setAnimatedTextureName( const std::vector<String>&, Real )

## ◆ setAnimatedTextureName() [3/3]

void Ogre::TextureUnitState::setAnimatedTextureName | ( | const std::vector< String > & | names,
|  | Real | duration = 0 )
| inline

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

References setAnimatedTextureName().

## ◆ setLayerArrayNames()

void Ogre::TextureUnitState::setLayerArrayNames | ( | TextureType | type,
|  | const std::vector< String > & | names )

Sets this texture layer to use an array of texture maps.

## ◆ getTextureDimensions()

std::pair< uint32, uint32 > Ogre::TextureUnitState::getTextureDimensions | ( | unsigned int | frame = 0 | ) | const

Returns the width and height of the texture in the given frame.

## ◆ setCurrentFrame()

void Ogre::TextureUnitState::setCurrentFrame | ( | unsigned int | frameNumber | ) |

Changes the active frame in an animated or multi-image texture.

An animated texture (or a cubic texture where the images are not combined for 3D use) is made up of a number of frames. This method sets the active frame.

## ◆ getCurrentFrame()

unsigned int Ogre::TextureUnitState::getCurrentFrame | ( | void |  | ) | const

Gets the active frame in an animated or multi-image texture layer.

## ◆ getFrameTextureName()

const String & Ogre::TextureUnitState::getFrameTextureName | ( | unsigned int | frameNumber | ) | const

Gets the name of the texture associated with a frame number.

Throws an exception if frameNumber exceeds the number of stored frames.

## ◆ setFrameTextureName()

void Ogre::TextureUnitState::setFrameTextureName | ( | const String & | name,
|  | unsigned int | frameNumber )

Sets the name of the texture associated with a frame.

Parameters

  name | The name of the texture.
  frameNumber | The frame the texture name is to be placed in.

Note
  Throws an exception if frameNumber exceeds the number of stored frames.

## ◆ addFrameTextureName()

void Ogre::TextureUnitState::addFrameTextureName | ( | const String & | name | ) |

Add a Texture name to the end of the frame container.

Parameters

  name | The name of the texture.

## ◆ deleteFrameTextureName()

void Ogre::TextureUnitState::deleteFrameTextureName | ( | const size_t | frameNumber | ) |

Deletes a specific texture frame.

The texture used is not deleted but the texture will no longer be used by the Texture Unit. An exception is raised if the frame number exceeds the number of actual frames.

Parameters

  frameNumber | The frame number of the texture to be deleted.

## ◆ getNumFrames()

unsigned int Ogre::TextureUnitState::getNumFrames | ( | void |  | ) | const

Gets the number of frames for a texture.

## ◆ setContentType()

void Ogre::TextureUnitState::setContentType | ( | ContentType | ct | ) |

Set the type of content this TextureUnitState references.

The default is to reference a standard named texture, but this unit can also reference automated content like a shadow texture.

## ◆ getContentType()

ContentType Ogre::TextureUnitState::getContentType | ( | void |  | ) | const

Get the type of content this TextureUnitState references.

## ◆ isCubic()

bool Ogre::TextureUnitState::isCubic | ( | void |  | ) | const
| inline

Deprecated
  use getTextureType()

References getTextureType(), and Ogre::TEX_TYPE_CUBE_MAP.

## ◆ is3D()

bool Ogre::TextureUnitState::is3D | ( | void |  | ) | const
| inline

Deprecated
  use getTextureType()

References getTextureType(), and Ogre::TEX_TYPE_CUBE_MAP.

## ◆ getTextureType()

TextureType Ogre::TextureUnitState::getTextureType | ( | void |  | ) | const

Returns the type of this texture.

Referenced by is3D(), and isCubic().

## ◆ setDesiredFormat()

void Ogre::TextureUnitState::setDesiredFormat | ( | PixelFormat | desiredFormat | ) |

Sets the desired pixel format for the texture surface; can only be set before load().

## ◆ getDesiredFormat()

PixelFormat Ogre::TextureUnitState::getDesiredFormat | ( | void |  | ) | const

Returns the desired pixel format for the texture surface.

## ◆ setNumMipmaps()

void Ogre::TextureUnitState::setNumMipmaps | ( | int | numMipmaps | ) |

Sets the number of mipmaps to be used for this texture.

Note
  Must be set before calling any 'load' method.

## ◆ getNumMipmaps()

int Ogre::TextureUnitState::getNumMipmaps | ( | void |  | ) | const

Gets how many mipmaps have been requested for the texture.

## ◆ setIsAlpha()

void Ogre::TextureUnitState::setIsAlpha | ( | bool | isAlpha | ) |

Deprecated
  use setDesiredFormat(PF_A8)

## ◆ getGamma()

float Ogre::TextureUnitState::getGamma | ( |  | ) | const

Returns the gamma adjustment factor applied to this texture on loading.

## ◆ setGamma()

void Ogre::TextureUnitState::setGamma | ( | float | gamma | ) |

Sets the gamma adjustment factor applied to this texture on loading the data.

Note
  Must be called before any 'load' method. This gamma factor will be premultiplied in and may reduce the precision of your textures. You can use setHardwareGamma if supported to apply gamma on sampling the texture instead.

## ◆ setHardwareGammaEnabled()

void Ogre::TextureUnitState::setHardwareGammaEnabled | ( | bool | enabled | ) |

Sets whether this texture will be set up so that on sampling it, hardware gamma correction is applied.

24-bit textures are often saved in gamma colour space; this preserves precision in the 'darks'. However, if you're performing blending on the sampled colours, you really want to be doing it in linear space. One way is to apply a gamma correction value on loading (see setGamma), but this means you lose precision in those dark colours. An alternative is to get the hardware to do the gamma correction when reading the texture and converting it to a floating point value for the rest of the pipeline. This option allows you to do that; it's only supported in relatively recent hardware (others will ignore it) but can improve the quality of colour reproduction.

Note
  Must be called before any 'load' method since it may affect the construction of the underlying hardware resources. Also note this only useful on textures using 8-bit colour channels.

## ◆ isHardwareGammaEnabled()

bool Ogre::TextureUnitState::isHardwareGammaEnabled | ( |  | ) | const

Gets whether this texture will be set up so that on sampling it, hardware gamma correction is applied.

## ◆ getTextureCoordSet()

uint8 Ogre::TextureUnitState::getTextureCoordSet | ( | void |  | ) | const

Gets the index of the set of texture co-ords this layer uses.

Note
  Only applies to the fixed function pipeline and has no effect if a fragment program is used.

## ◆ setTextureCoordSet()

void Ogre::TextureUnitState::setTextureCoordSet | ( | uint8 | set | ) |

Sets which texture coordinate set is to be used for this texture layer.

A mesh can define multiple sets of texture coordinates, this sets which one this material uses.

## ◆ setUnorderedAccessMipLevel()

void Ogre::TextureUnitState::setUnorderedAccessMipLevel | ( | int | mipLevel | ) |
| inline

Enables Unordered Access to the provided mipLevel of the texture.

## ◆ getUnorderedAccessMipLevel()

int Ogre::TextureUnitState::getUnorderedAccessMipLevel | ( |  | ) | const
| inline

## ◆ setTextureTransform()

void Ogre::TextureUnitState::setTextureTransform | ( | const Matrix4 & | xform | ) |

Sets a matrix used to transform any texture coordinates on this layer.

Texture coordinates can be modified on a texture layer to create effects like scrolling textures. A texture transform can either be applied to a layer which takes the source coordinates from a fixed set in the geometry, or to one which generates them dynamically (e.g. environment mapping).

It's obviously a bit impractical to create scrolling effects by calling this method manually since you would have to call it every frame with a slight alteration each time, which is tedious. Instead you can use setTransformAnimation which will manage the effect over time for you.

In addition, if you can et the individual texture transformations rather than concatenating them yourself.

See also
  Ogre::TextureUnitState::setTextureScroll
  Ogre::TextureUnitState::setTextureScale
  Ogre::TextureUnitState::setTextureRotate

## ◆ getTextureTransform()

const Matrix4 & Ogre::TextureUnitState::getTextureTransform | ( | void |  | ) | const

Gets the current texture transformation matrix.

Causes a reclaculation of the matrix if any parameters have been changed via setTextureScroll, setTextureScale and setTextureRotate.

## ◆ setTextureScroll()

void Ogre::TextureUnitState::setTextureScroll | ( | float | u,
|  | float | v )

Sets the translation offset of the texture, ie scrolls the texture.

This method sets the translation element of the texture transformation, and is easier to use than setTextureTransform if you are combining translation, scaling and rotation in your texture transformation. If you want to animate these values use Ogre::TextureUnitState::setScrollAnimation

Parameters

  u | The amount the texture should be moved horizontally (u direction).
  v | The amount the texture should be moved vertically (v direction).

## ◆ setTextureUScroll()

void Ogre::TextureUnitState::setTextureUScroll | ( | float | value | ) |

As setTextureScroll, but sets only U value.

## ◆ getTextureUScroll()

float Ogre::TextureUnitState::getTextureUScroll | ( | void |  | ) | const

Get texture uscroll value.

## ◆ setTextureVScroll()

void Ogre::TextureUnitState::setTextureVScroll | ( | float | value | ) |

As setTextureScroll, but sets only V value.

## ◆ getTextureVScroll()

float Ogre::TextureUnitState::getTextureVScroll | ( | void |  | ) | const

Get texture vscroll value.

## ◆ setTextureUScale()

void Ogre::TextureUnitState::setTextureUScale | ( | float | value | ) |

As setTextureScale, but sets only U value.

## ◆ getTextureUScale()

float Ogre::TextureUnitState::getTextureUScale | ( | void |  | ) | const

Get texture uscale value.

## ◆ setTextureVScale()

void Ogre::TextureUnitState::setTextureVScale | ( | float | value | ) |

As setTextureScale, but sets only V value.

## ◆ getTextureVScale()

float Ogre::TextureUnitState::getTextureVScale | ( | void |  | ) | const

Get texture vscale value.

## ◆ setTextureScale()

void Ogre::TextureUnitState::setTextureScale | ( | float | uScale,
|  | float | vScale )

Sets the scaling factor applied to texture coordinates.

This method sets the scale element of the texture transformation, and is easier to use than setTextureTransform if you are combining translation, scaling and rotation in your texture transformation.

If you want to animate these values use Ogre::TextureUnitState::setTransformAnimation

Parameters

  uScale | The value by which the texture is to be scaled horizontally.
  vScale | The value by which the texture is to be scaled vertically.

## ◆ setTextureRotate()

void Ogre::TextureUnitState::setTextureRotate | ( | const Radian & | angle | ) |

Sets the anticlockwise rotation factor applied to texture coordinates.

This sets a fixed rotation angle - if you wish to animate this, use Ogre::TextureUnitState::setRotateAnimation

Parameters

  angle | The angle of rotation (anticlockwise).

## ◆ getTextureRotate()

const Radian & Ogre::TextureUnitState::getTextureRotate | ( | void |  | ) | const

Get texture rotation effects angle value.

## ◆ getSampler()

const SamplerPtr & Ogre::TextureUnitState::getSampler | ( |  | ) | const
| inline

get the associated sampler

## ◆ setSampler()

void Ogre::TextureUnitState::setSampler | ( | const SamplerPtr & | sampler | ) |
| inline

References OgreAssert.

## ◆ getTextureAddressingMode()

const Sampler::UVWAddressingMode & Ogre::TextureUnitState::getTextureAddressingMode | ( | void |  | ) | const
| 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.

## ◆ setTextureAddressingMode() [1/3]

void Ogre::TextureUnitState::setTextureAddressingMode | ( | Ogre::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 _getLocalSampler().

## ◆ setTextureAddressingMode() [2/3]

void Ogre::TextureUnitState::setTextureAddressingMode | ( | Ogre::TextureAddressingMode | u,
|  | Ogre::TextureAddressingMode | v,
|  | Ogre::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. 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 _getLocalSampler().

## ◆ setTextureAddressingMode() [3/3]

void Ogre::TextureUnitState::setTextureAddressingMode | ( | const Sampler::UVWAddressingMode & | uvw | ) |
| 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 _getLocalSampler().

## ◆ setTextureBorderColour()

void Ogre::TextureUnitState::setTextureBorderColour | ( | 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.

References _getLocalSampler().

## ◆ getTextureBorderColour()

const ColourValue & Ogre::TextureUnitState::getTextureBorderColour | ( |  | ) | const
| inline

## ◆ setTextureFiltering() [1/3]

void Ogre::TextureUnitState::setTextureFiltering | ( | TextureFilterOptions | filterType | ) |
| inline

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

  filterType | The high-level filter type to use.

References _getLocalSampler().

## ◆ setTextureFiltering() [2/3]

void Ogre::TextureUnitState::setTextureFiltering | ( | FilterType | ftype,
|  | FilterOptions | opts )
| inline

Set a single filtering option on this texture unit.

Parameters

  ftype | The filtering type to set.
  opts | The filtering option to set.

References _getLocalSampler().

## ◆ setTextureFiltering() [3/3]

void Ogre::TextureUnitState::setTextureFiltering | ( | FilterOptions | minFilter,
|  | FilterOptions | magFilter,
|  | FilterOptions | mipFilter )
| inline

Set a the detailed filtering options on this texture unit.

Parameters

  minFilter | The filtering to use when reducing the size of the texture. Can be Ogre::FO_POINT, Ogre::FO_LINEAR or Ogre::FO_ANISOTROPIC.
  magFilter | The filtering to use when increasing the size of the texture. Can be Ogre::FO_POINT, Ogre::FO_LINEAR or Ogre::FO_ANISOTROPIC.
  mipFilter | The filtering to use between mip levels. Can be Ogre::FO_NONE (turns off mipmapping), Ogre::FO_POINT or Ogre::FO_LINEAR (trilinear filtering).

References _getLocalSampler().

## ◆ getTextureFiltering()

FilterOptions Ogre::TextureUnitState::getTextureFiltering | ( | FilterType | ftype | ) | const
| inline

Get the texture filtering for the given type.

## ◆ setTextureCompareEnabled()

void Ogre::TextureUnitState::setTextureCompareEnabled | ( | 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.

References _getLocalSampler().

## ◆ getTextureCompareEnabled()

bool Ogre::TextureUnitState::getTextureCompareEnabled | ( |  | ) | const
| inline

## ◆ setTextureCompareFunction()

void Ogre::TextureUnitState::setTextureCompareFunction | ( | CompareFunction | function | ) |
| inline

References _getLocalSampler().

## ◆ getTextureCompareFunction()

CompareFunction Ogre::TextureUnitState::getTextureCompareFunction | ( |  | ) | const
| inline

## ◆ setTextureAnisotropy()

void Ogre::TextureUnitState::setTextureAnisotropy | ( | 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

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

References _getLocalSampler().

## ◆ getTextureAnisotropy()

unsigned int Ogre::TextureUnitState::getTextureAnisotropy | ( |  | ) | const
| inline

Get this layer texture anisotropy level.

## ◆ setTextureMipmapBias()

void Ogre::TextureUnitState::setTextureMipmapBias | ( | 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.

References _getLocalSampler().

## ◆ getTextureMipmapBias()

float Ogre::TextureUnitState::getTextureMipmapBias | ( | void |  | ) | const
| inline

Gets the bias value applied to the mipmap calculation.

See also
  TextureUnitState::setTextureMipmapBias

## ◆ setColourOperationEx()

void Ogre::TextureUnitState::setColourOperationEx | ( | LayerBlendOperationEx | op,
|  | LayerBlendSource | source1 = LBS_TEXTURE,
|  | LayerBlendSource | source2 = LBS_CURRENT,
|  | const ColourValue & | arg1 = ColourValue::White,
|  | const ColourValue & | arg2 = ColourValue::White,
|  | Real | manualBlend = 0.0 )

Setting advanced blending options.

This is an extended version of the Ogre::TextureUnitState::setColourOperation method which allows extremely detailed control over the blending applied between this and earlier layers. See the Warning below about the issues between mulitpass and multitexturing that using this method can create.

Texture colour operations determine how the final colour of the surface appears when rendered. Texture units are used to combine colour values from various sources (ie. the diffuse colour of the surface from lighting calculations, combined with the colour of the texture). This method allows you to specify the 'operation' to be used, ie. the calculation such as adds or multiplies, and which values to use as arguments, such as a fixed value or a value from a previous calculation.

The defaults for each layer are:

- op = Ogre::LBX_MODULATE
- source1 = Ogre::LBS_TEXTURE
- source2 = Ogre::LBS_CURRENT

ie. each layer takes the colour results of the previous layer, and multiplies them with the new texture being applied. Bear in mind that colours are RGB values from 0.0 - 1.0 so multiplying them together will result in values in the same range, 'tinted' by the multiply. Note however that a straight multiply normally has the effect of darkening the textures - for this reason there are brightening operations like Ogre::LBX_MODULATE_X2. See the Ogre::LayerBlendOperation and Ogre::LayerBlendSource enumerated types for full details.

The final 3 parameters are only required if you decide to pass values manually into the operation, i.e. you want one or more of the inputs to the colour calculation to come from a fixed value that you supply. Hence you only need to fill these in if you supply Ogre::LBS_MANUAL to the corresponding source, or use the Ogre::LBX_BLEND_MANUAL operation.

Warning
  Ogre tries to use multitexturing hardware to blend texture layers together. However, if it runs out of texturing units (e.g. 2 of a GeForce2, 4 on a GeForce3) it has to fall back on multipass rendering, i.e. rendering the same object multiple times with different textures. This is both less efficient and there is a smaller range of blending operations which can be performed. For this reason, if you use this method you MUST also call Ogre::TextureUnitState::setColourOpMultipassFallback to specify which effect you want to fall back on if sufficient hardware is not available.
  If you wish to avoid having to do this, use the simpler Ogre::TextureUnitState::setColourOperation method which allows less flexible blending options but sets up the multipass fallback automatically, since it only allows operations which have direct multipass equivalents.

Parameters

  op | The operation to be used, e.g. modulate (multiply), add, subtract.
  source1 | The source of the first colour to the operation e.g. texture colour.
  source2 | The source of the second colour to the operation e.g. current surface colour.
  arg1 | Manually supplied colour value (only required if source1 = LBS_MANUAL).
  arg2 | Manually supplied colour value (only required if source2 = LBS_MANUAL).
  manualBlend | Manually supplied 'blend' value - only required for operations which require manual blend e.g. LBX_BLEND_MANUAL.

References Ogre::LBS_CURRENT, Ogre::LBS_TEXTURE, and Ogre::ColourValue::White.

## ◆ setColourOperation()

void Ogre::TextureUnitState::setColourOperation | ( | const LayerBlendOperation | op | ) |

Determines how this texture layer is combined with the one below it (or the diffuse colour of the geometry if this is layer 0).

This method is the simplest way to blend texture layers, because it requires only one parameter, gives you the most common blending types, and automatically sets up 2 blending methods: one for if single-pass multitexturing hardware is available, and another for if it is not and the blending must be achieved through multiple rendering passes. It is, however, quite limited and does not expose the more flexible multitexturing operations, simply because these can't be automatically supported in multipass fallback mode. If want to use the fancier options, use Ogre::TextureUnitState::setColourOperationEx, but you'll either have to be sure that enough multitexturing units will be available, or you should explicitly set a fallback using Ogre::TextureUnitState::setColourOpMultipassFallback.

Note
  The default method is Ogre::LBO_MODULATE for all layers.

Parameters

  op | One of the Ogre::LayerBlendOperation enumerated blending types.

## ◆ setColourOpMultipassFallback()

void Ogre::TextureUnitState::setColourOpMultipassFallback | ( | const SceneBlendFactor | sourceFactor,
|  | const SceneBlendFactor | destFactor )

Sets the multipass fallback operation for this layer, if you used TextureUnitState::setColourOperationEx and not enough multitexturing hardware is available.

Because some effects exposed using Ogre::TextureUnitState::setColourOperationEx are only supported under multitexturing hardware, if the hardware is lacking the system must fallback on multipass rendering, which unfortunately doesn't support as many effects. This method is for you to specify the fallback operation which most suits you.

You'll notice that the interface is the same as the Ogre::TMaterial::setSceneBlending method; this is because multipass rendering IS effectively scene blending, since each layer is rendered on top of the last using the same mechanism as making an object transparent, it's just being rendered in the same place repeatedly to get the multitexture effect.

If you use the simpler (and hence less flexible) Ogre::TextureUnitState::setColourOperation method you don't need to call this as the system sets up the fallback for you.

Note
  This option has no effect in the programmable pipeline, because there is no multipass fallback and multitexture blending is handled by the fragment shader.

## ◆ getColourBlendMode()

const LayerBlendModeEx & Ogre::TextureUnitState::getColourBlendMode | ( | void |  | ) | const

Get multitexturing colour blending mode.

## ◆ getAlphaBlendMode()

const LayerBlendModeEx & Ogre::TextureUnitState::getAlphaBlendMode | ( | void |  | ) | const

Get multitexturing alpha blending mode.

## ◆ getColourBlendFallbackSrc()

SceneBlendFactor Ogre::TextureUnitState::getColourBlendFallbackSrc | ( | void |  | ) | const

Get the multipass fallback for colour blending operation source factor.

## ◆ getColourBlendFallbackDest()

SceneBlendFactor Ogre::TextureUnitState::getColourBlendFallbackDest | ( | void |  | ) | const

Get the multipass fallback for colour blending operation destination factor.

## ◆ setAlphaOperation()

void Ogre::TextureUnitState::setAlphaOperation | ( | LayerBlendOperationEx | op,
|  | LayerBlendSource | source1 = LBS_TEXTURE,
|  | LayerBlendSource | source2 = LBS_CURRENT,
|  | Real | arg1 = 1.0,
|  | Real | arg2 = 1.0,
|  | Real | manualBlend = 0.0 )

Sets the alpha operation to be applied to this texture.

This works in exactly the same way as setColourOperationEx, except that the effect is applied to the level of alpha (i.e. transparency) of the texture rather than its colour. When the alpha of a texel (a pixel on a texture) is 1.0, it is opaque, whereas it is fully transparent if the alpha is 0.0. Please refer to the Ogre::TextureUnitState::setColourOperationEx method for more info.

Parameters

  op | The operation to be used, e.g. modulate (multiply), add, subtract
  source1 | The source of the first alpha value to the operation e.g. texture alpha
  source2 | The source of the second alpha value to the operation e.g. current surface alpha
  arg1 | Manually supplied alpha value (only required if source1 = Ogre::LBS_MANUAL)
  arg2 | Manually supplied alpha value (only required if source2 = Ogre::LBS_MANUAL)
  manualBlend | Manually supplied 'blend' value - only required for operations which require manual blend e.g. Ogre::LBX_BLEND_MANUAL

References Ogre::LBS_CURRENT, and Ogre::LBS_TEXTURE.

## ◆ addEffect()

void Ogre::TextureUnitState::addEffect | ( | TextureEffect | effect | ) |

Generic method for setting up texture effects.

Allows you to specify effects directly by using the TextureEffectType enumeration. The arguments that go with it depend on the effect type. Only one effect of each type can be applied to a texture layer.

  This method is used internally by Ogre but it is better generally for applications to use the more intuitive specialised methods such as setEnvironmentMap and setTextureScroll.

## ◆ setEnvironmentMap()

void Ogre::TextureUnitState::setEnvironmentMap | ( | bool | enable,
|  | int | texGenType = TEXCALC_ENVIRONMENT_MAP )

Turns on/off texture coordinate generation for addressing an environment map.

Environment maps make an object look reflective by using the object's vertex normals relative to the camera view to generate texture coordinates.

The vectors generated can either be used to address a single 2D texture which is a 'fish-eye' lens view of a scene, or a 3D cubic environment map which requires 6 textures for each side of the inside of a cube.

This effect works best if the object has lots of gradually changing normals. The texture also has to be designed for this effect - see the example `spheremap.png` included with the sample application for a 2D environment map; a cubic map can be generated by rendering 6 views of a scene to each of the cube faces with orthogonal views.

Enabling this disables any other texture coordinate generation effects. However it can be combined with texture coordinate modification functions, which then operate on the generated coordinates rather than static model texture coordinates.

Parameters

  enable | True to enable, false to disable
  texGenType | texture coordinate generation type

References Ogre::TEXCALC_ENVIRONMENT_MAP.

## ◆ setScrollAnimation()

void Ogre::TextureUnitState::setScrollAnimation | ( | float | uSpeed,
|  | float | vSpeed )

Sets up an animated scroll for the texture layer.

Useful for creating constant scrolling effects on a texture layer (for varying scrolls, see Ogre::TextureUnitState::setTransformAnimation).

Parameters

  uSpeed | The number of horizontal loops per second (+ve=moving right, -ve = moving left).
  vSpeed | The number of vertical loops per second (+ve=moving up, -ve= moving down).

## ◆ setRotateAnimation()

void Ogre::TextureUnitState::setRotateAnimation | ( | float | speed | ) |

Sets up an animated texture rotation for this layer.

Useful for constant rotations (for varying rotations, see Ogre::TextureUnitState::setTransformAnimation).

Parameters

  speed | The number of complete anticlockwise revolutions per second (use -ve for clockwise)

## ◆ setTransformAnimation()

void Ogre::TextureUnitState::setTransformAnimation | ( | const TextureTransformType | ttype,
|  | const WaveformType | waveType,
|  | float | base = 0,
|  | float | frequency = 1,
|  | float | phase = 0,
|  | float | amplitude = 1 )

Sets up a general time-relative texture modification effect.

This can be called multiple times for different values of ttype, but only the latest effect applies if called multiple time for the same ttype.

Parameters

  ttype | The type of transform, either translate (scroll), scale (stretch) or rotate (spin).
  waveType | The shape of the wave, see Ogre::WaveformType enum for details.
  base | The base value for the function (range of output = {base, base + amplitude}).
  frequency | The speed of the wave in cycles per second.
  phase | The offset of the start of the wave, e.g. 0.5 to start half-way through the wave.
  amplitude | Scales the output so that instead of lying within 0..1 it lies within 0..1*amplitude for exaggerated effects.

## ◆ setProjectiveTexturing()

void Ogre::TextureUnitState::setProjectiveTexturing | ( | bool | enabled,
|  | const Frustum * | projectionSettings = 0 )

Enables or disables projective texturing on this texture unit.

Projective texturing allows you to generate texture coordinates based on a Frustum, which gives the impression that a texture is being projected onto the surface. Note that once you have called this method, the texture unit continues to monitor the Frustum you passed in and the projection will change if you can alter it. It also means that you must ensure that the Frustum object you pass a pointer to remains in existence for as long as this TextureUnitState does.

  This effect cannot be combined with other texture generation effects, such as environment mapping. It also has no effect on passes which have a vertex program enabled - projective texturing has to be done in the vertex program instead.

Parameters

  enabled | Whether to enable / disable.
  projectionSettings | The Frustum which will be used to derive the projection parameters.

## ◆ getProjectiveTexturingFrustum()

const Frustum * Ogre::TextureUnitState::getProjectiveTexturingFrustum | ( | void |  | ) | const

Gets the Frustum which is being used to derive projective texturing parameters.

## ◆ removeAllEffects()

void Ogre::TextureUnitState::removeAllEffects | ( | void |  | ) |

Removes all effects applied to this texture layer.

## ◆ removeEffect()

void Ogre::TextureUnitState::removeEffect | ( | const TextureEffectType | type | ) |

Removes a single effect applied to this texture layer.

Note
  Because you can only have 1 effect of each type (e.g. 1 texture coordinate generation) applied to a layer, only the effect type is required.

## ◆ getEffects()

const EffectMap & Ogre::TextureUnitState::getEffects | ( | void |  | ) | const

Get texture effects in a multimap paired array.

## ◆ isBlank()

bool Ogre::TextureUnitState::isBlank | ( | void |  | ) | const

Determines if this texture layer is currently blank.

Note
  This can happen if a texture fails to load or some other non-fatal error. Worth checking after setting texture name.

## ◆ setBlank()

void Ogre::TextureUnitState::setBlank | ( | void |  | ) |

Sets this texture layer to be blank.

## ◆ isTextureLoadFailing()

bool Ogre::TextureUnitState::isTextureLoadFailing | ( |  | ) | const
| inline

Tests if the texture associated with this unit has failed to load.

## ◆ retryTextureLoad()

void Ogre::TextureUnitState::retryTextureLoad | ( |  | ) |
| inline

Tells the unit to retry loading the texture if it had failed to load.

## ◆ getAnimationDuration()

Real Ogre::TextureUnitState::getAnimationDuration | ( | void |  | ) | const

Get the animated-texture animation duration.

## ◆ isDefaultFiltering()

bool Ogre::TextureUnitState::isDefaultFiltering | ( |  | ) | const

Returns true if this texture unit is using the default Sampler.

## ◆ setCompositorReference()

void Ogre::TextureUnitState::setCompositorReference | ( | const String & | compositorName,
|  | const String & | textureName,
|  | uint32 | mrtIndex = 0 )

Set the compositor reference for this texture unit state.

Only valid when content type is compositor.

Parameters

  compositorName | The name of the compositor to reference.
  textureName | The name of the texture to reference.
  mrtIndex | The index of the wanted texture, if referencing an MRT.

## ◆ getReferencedCompositorName()

const String & Ogre::TextureUnitState::getReferencedCompositorName | ( |  | ) | const
| inline

Gets the name of the compositor that this texture references.

## ◆ getReferencedTextureName()

const String & Ogre::TextureUnitState::getReferencedTextureName | ( |  | ) | const
| inline

Gets the name of the texture in the compositor that this texture references.

## ◆ getReferencedMRTIndex()

uint32 Ogre::TextureUnitState::getReferencedMRTIndex | ( |  | ) | const
| inline

Gets the MRT index of the texture in the compositor that this texture references.

## ◆ getParent()

Pass * Ogre::TextureUnitState::getParent | ( | void |  | ) | const
| inline

Gets the parent Pass object.

## ◆ _prepare()

void Ogre::TextureUnitState::_prepare | ( | void |  | ) |

Internal method for preparing this object for load, as part of Material::prepare.

## ◆ _unprepare()

void Ogre::TextureUnitState::_unprepare | ( | void |  | ) |

Internal method for undoing the preparation this object as part of Material::unprepare.

## ◆ _load()

void Ogre::TextureUnitState::_load | ( | void |  | ) |

Internal method for loading this object as part of Material::load.

## ◆ _unload()

void Ogre::TextureUnitState::_unload | ( | void |  | ) |

Internal method for unloading this object as part of Material::unload.

## ◆ isLoaded()

bool Ogre::TextureUnitState::isLoaded | ( | void |  | ) | const

Is this loaded?

## ◆ _notifyNeedsRecompile()

void Ogre::TextureUnitState::_notifyNeedsRecompile | ( | void |  | ) |

Tells the class that it needs recompilation.

## ◆ setName()

void Ogre::TextureUnitState::setName | ( | const String & | name | ) |

Set the name of the Texture Unit State.

The name of the Texture Unit State is optional. Its useful in material scripts where a material could inherit from another material and only want to modify a particular Texture Unit State.

Referenced by setTextureNameAlias().

## ◆ getName()

const String & Ogre::TextureUnitState::getName | ( | void |  | ) | const
| inline

Get the name of the Texture Unit State.

Referenced by getTextureNameAlias().

## ◆ setTextureNameAlias()

void Ogre::TextureUnitState::setTextureNameAlias | ( | const String & | name | ) |
| inline

Deprecated
  use setName()

References setName().

## ◆ getTextureNameAlias()

const String & Ogre::TextureUnitState::getTextureNameAlias | ( | void |  | ) | const
| inline

Deprecated
  use getName()

References getName().

## ◆ _notifyParent()

void Ogre::TextureUnitState::_notifyParent | ( | Pass * | parent | ) |

Notify this object that its parent has changed.

## ◆ _getTexturePtr() [1/2]

const TexturePtr & Ogre::TextureUnitState::_getTexturePtr | ( | void |  | ) | const

Get the texture pointer for the current frame.

## ◆ _getTexturePtr() [2/2]

const TexturePtr & Ogre::TextureUnitState::_getTexturePtr | ( | size_t | frame | ) | const

Get the texture pointer for a given frame.

## ◆ _setTexturePtr() [1/2]

void Ogre::TextureUnitState::_setTexturePtr | ( | const TexturePtr & | texptr | ) |

Set the texture pointer for the current frame (internal use only!).

## ◆ _setTexturePtr() [2/2]

void Ogre::TextureUnitState::_setTexturePtr | ( | const TexturePtr & | texptr,
|  | size_t | frame )

Set the texture pointer for a given frame (internal use only!).

## ◆ calculateSize()

size_t Ogre::TextureUnitState::calculateSize | ( | void |  | ) | const

## ◆ _getAnimController()

ControllerFloat * Ogre::TextureUnitState::_getAnimController | ( |  | ) | const
| inline

Gets the animation controller (as created because of setAnimatedTexture) if it exists.

## ◆ _getLocalSampler()

const SamplerPtr & Ogre::TextureUnitState::_getLocalSampler | ( |  | ) |

return a sampler local to this TUS instead of the shared global one

Referenced by setTextureAddressingMode(), setTextureAddressingMode(), setTextureAddressingMode(), setTextureAnisotropy(), setTextureBorderColour(), setTextureCompareEnabled(), setTextureCompareFunction(), setTextureFiltering(), setTextureFiltering(), setTextureFiltering(), and setTextureMipmapBias().

## ◆ _deriveTexCoordCalcMethod()

TexCoordCalcMethod Ogre::TextureUnitState::_deriveTexCoordCalcMethod | ( |  | ) | const

## Member Data Documentation

## ◆ TAM_WRAP

const Ogre::TextureAddressingMode Ogre::TextureUnitState::TAM_WRAP = Ogre::TAM_WRAP
| static

## ◆ TAM_MIRROR

const Ogre::TextureAddressingMode Ogre::TextureUnitState::TAM_MIRROR = Ogre::TAM_MIRROR
| static

## ◆ TAM_CLAMP

const Ogre::TextureAddressingMode Ogre::TextureUnitState::TAM_CLAMP = Ogre::TAM_CLAMP
| static

## ◆ TAM_BORDER

const Ogre::TextureAddressingMode Ogre::TextureUnitState::TAM_BORDER = Ogre::TAM_BORDER
| static

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

- OgreTextureUnitState.h