OGRE-Next
4.0.0unstable
Object-Oriented Graphics Rendering Engine
|
Class representing the state of a single texture unit during a Pass of a Technique, of a Material. More...
#include <OgreTextureUnitState.h>
Classes | |
struct | TextureEffect |
Internal structure defining a texture effect. More... | |
Public Member Functions | |
TextureUnitState (Pass *parent) | |
Default constructor. More... | |
TextureUnitState (Pass *parent, const String &texName) | |
Name-based constructor. More... | |
TextureUnitState (Pass *parent, const TextureUnitState &oth) | |
~TextureUnitState () override | |
Default destructor. More... | |
Controller< Real > * | _getAnimController () const |
Gets the animation controller (as created because of setAnimatedTexture) if it exists. More... | |
TextureGpu * | _getTexturePtr () const |
Get the texture pointer for the current frame. More... | |
TextureGpu * | _getTexturePtr (size_t frame) const |
Get the texture pointer for a given frame. More... | |
void | _load () |
Internal method for loading this object as part of Material::load. More... | |
void | _notifyParent (Pass *parent) |
Notify this object that its parent has changed. More... | |
void | _prepare () |
Internal method for preparing this object for load, as part of Material::prepare. More... | |
void | _setSamplerblock (const HlmsSamplerblock *samplerblock) |
Changes the current samplerblock for a new one. More... | |
void | _setTexturePtr (TextureGpu *texptr) |
Set the texture pointer for the current frame (internal use only!). More... | |
void | _setTexturePtr (TextureGpu *texptr, size_t frame) |
Set the texture pointer for a given frame (internal use only!). More... | |
void | _unload () |
Internal method for unloading this object as part of Material::unload. More... | |
void | _unprepare () |
Internal method for undoing the preparation this object as part of Material::unprepare. More... | |
void | addEffect (TextureEffect &effect) |
Generic method for setting up texture effects. More... | |
void | addFrameTextureName (const String &name) |
Add a Texture name to the end of the frame container. More... | |
bool | applyTextureAliases (const AliasTextureNamePairList &aliasList, const bool apply=true) |
Applies texture names to Texture Unit State with matching texture name aliases. More... | |
size_t | calculateSize () const |
void | deleteFrameTextureName (const size_t frameNumber) |
Deletes a specific texture frame. More... | |
const LayerBlendModeEx & | getAlphaBlendMode () const |
Get multitexturing alpha blending mode. More... | |
Real | getAnimationDuration () const |
Get the animated-texture animation duration. More... | |
bool | getAutomaticBatching () const |
BindingType | getBindingType () const |
Gets the type of unit these texture settings should be bound to. More... | |
SceneBlendFactor | getColourBlendFallbackDest () const |
Get the multipass fallback for colour blending operation destination factor. More... | |
SceneBlendFactor | getColourBlendFallbackSrc () const |
Get the multipass fallback for colour blending operation source factor. More... | |
const LayerBlendModeEx & | getColourBlendMode () const |
Get multitexturing colour blending mode. More... | |
ContentType | getContentType () const |
Get the type of content this TextureUnitState references. More... | |
unsigned int | getCurrentFrame () const |
Gets the active frame in an animated or multi-image texture layer. More... | |
const EffectMap & | getEffects () const |
Get texture effects in a multimap paired array. More... | |
const String & | getFrameTextureName (unsigned int frameNumber) const |
Gets the name of the texture associated with a frame number. More... | |
Real | getGamma () const |
bool | getIsAlpha () const |
Gets whether this texture is requested to be loaded as alpha if single channel. More... | |
const String & | getName () const |
Get the name of the Texture Unit State. More... | |
unsigned int | getNumFrames () const |
Gets the number of frames for a texture. More... | |
int | getNumMipmaps () const |
Gets how many mipmaps have been requested for the texture. More... | |
Pass * | getParent () const |
Gets the parent Pass object. More... | |
IdString | getReferencedTextureName () const |
Gets the name of the texture in the compositor that this texture references. More... | |
const HlmsSamplerblock * | getSamplerblock () const |
Retrieves current samplerblock. More... | |
std::pair< size_t, size_t > | getTextureDimensions (unsigned int frame=0) const |
Returns the width and height of the texture in the given frame. More... | |
const String & | getTextureName () const |
Get the name of current texture image for this layer. More... | |
const String & | getTextureNameAlias () const |
Gets the Texture Name Alias of the Texture Unit. More... | |
const Radian & | getTextureRotate () const |
Get texture rotation effects angle value. More... | |
const Matrix4 & | getTextureTransform () const |
Gets the current texture transformation matrix. More... | |
TextureTypes::TextureTypes | getTextureType () const |
Returns the type of this texture. More... | |
Real | getTextureUScale () const |
Get texture uscale value. More... | |
Real | getTextureUScroll () const |
Get texture uscroll value. More... | |
Real | getTextureVScale () const |
Get texture vscale value. More... | |
Real | getTextureVScroll () const |
Get texture vscroll value. More... | |
bool | hasViewRelativeTextureCoordinateGeneration () const |
Returns whether this unit has texture coordinate generation that depends on the camera. More... | |
bool | is3D () const |
Returns true if this texture layer uses a composite 3D cubic texture. More... | |
bool | isBlank () const |
Determines if this texture layer is currently blank. More... | |
bool | isCubic () const |
Returns true if this texture unit is either a series of 6 2D textures, each in it's own frame, or is a full 3D cube map. More... | |
bool | isHardwareGammaEnabled () const |
bool | isLoaded () const |
Is this loaded? More... | |
bool | isTextureLoadFailing () const |
Tests if the texture associated with this unit has failed to load. More... | |
TextureUnitState & | operator= (const TextureUnitState &oth) |
void | removeAllEffects () |
Removes all effects applied to this texture layer. More... | |
void | removeEffect (const TextureEffectType type) |
Removes a single effect applied to this texture layer. More... | |
void | retryTextureLoad () |
Tells the unit to retry loading the texture if it had failed to load. More... | |
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. More... | |
void | setAnimatedTextureName (const String &name, unsigned int numFrames, Real duration=0) |
Sets the names of the texture images for an animated texture. More... | |
void | setAnimatedTextureName (const String *const names, unsigned int numFrames, Real duration=0) |
Sets the names of the texture images for an animated texture. More... | |
void | setAutomaticBatching (bool automaticBatching) |
When a texture is used by both PBS datablocks and V1 materials it can lead to a few issues: More... | |
void | setBindingType (BindingType bt) |
Sets the type of unit these texture settings should be bound to. More... | |
void | setBlank () |
Sets this texture layer to be blank. More... | |
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). More... | |
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. More... | |
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. More... | |
void | setCompositorReference (const String &textureName) |
Set the compositor reference for this texture unit state. More... | |
void | setContentType (ContentType ct) |
Set the type of content this TextureUnitState references. More... | |
void | setCubicTexture (TextureGpu *const *texPtrs, bool forUVW=false) |
Sets this texture layer to use a combination of 6 texture maps, each one relating to a face of a cube. More... | |
void | setCubicTextureName (const String &name, bool forUVW=false) |
Sets this texture layer to use a combination of 6 texture maps, each one relating to a face of a cube. More... | |
void | setCubicTextureName (const String *const names, bool forUVW=false) |
Sets this texture layer to use a combination of 6 texture maps, each one relating to a face of a cube. More... | |
void | setCurrentFrame (unsigned int frameNumber) |
Changes the active frame in an animated or multi-image texture. More... | |
void | setEnvironmentMap (bool enable, EnvMapType envMapType=ENV_CURVED) |
Turns on/off texture coordinate effect that makes this layer an environment map. More... | |
void | setFrameTextureName (const String &name, unsigned int frameNumber) |
Sets the name of the texture associated with a frame. More... | |
void | setGamma (Real gamma) |
void | setHardwareGammaEnabled (bool enabled) |
void | setIsAlpha (bool isAlpha) |
Sets whether this texture is requested to be loaded as alpha if single channel. More... | |
void | setName (const String &name) |
Set the name of the Texture Unit State. More... | |
void | setNumMipmaps (int numMipmaps) |
Sets how many mipmaps have been requested for the texture. More... | |
void | setProjectiveTexturing (bool enabled, const Frustum *projectionSettings=0) |
Enables or disables projective texturing on this texture unit. More... | |
void | setRotateAnimation (Real speed) |
Sets up an animated texture rotation for this layer. More... | |
void | setSamplerblock (const HlmsSamplerblock &samplerblock) |
Changes the current samplerblock for a new one. More... | |
void | setScrollAnimation (Real uSpeed, Real vSpeed) |
Sets up an animated scroll for the texture layer. More... | |
void | setTexture (TextureGpu *texPtr) |
Sets this texture layer to use a single texture, given the pointer to the texture to use on this layer. More... | |
void | setTextureName (const String &name, TextureTypes::TextureTypes ttype=TextureTypes::Type2D) |
Sets this texture layer to use a single texture, given the name of the texture to use on this layer. More... | |
void | setTextureNameAlias (const String &name) |
Set the alias name used for texture frame names. More... | |
void | setTextureRotate (const Radian &angle) |
Sets the anticlockwise rotation factor applied to texture coordinates. More... | |
void | setTextureScale (Real uScale, Real vScale) |
Sets the scaling factor applied to texture coordinates. More... | |
void | setTextureScroll (Real u, Real v) |
Sets the translation offset of the texture, ie scrolls the texture. More... | |
void | setTextureTransform (const Matrix4 &xform) |
Sets a matrix used to transform any texture coordinates on this layer. More... | |
void | setTextureUScale (Real value) |
As setTextureScale, but sets only U value. More... | |
void | setTextureUScroll (Real value) |
As setTextureScroll, but sets only U value. More... | |
void | setTextureVScale (Real value) |
As setTextureScale, but sets only V value. More... | |
void | setTextureVScroll (Real value) |
As setTextureScroll, but sets only V value. More... | |
void | setTransformAnimation (const TextureTransformType ttype, const WaveformType waveType, Real base=0, Real frequency=1, Real phase=0, Real amplitude=1) |
Sets up a general time-relative texture modification effect. More... | |
Public Member Functions inherited from Ogre::TextureGpuListener | |
virtual | ~TextureGpuListener () |
virtual bool | shouldStayLoaded (TextureGpu *texture) |
Return true if this TextureGpu should likely stay loaded or else graphical changes could occur. More... | |
Class representing the state of a single texture unit during a Pass of a Technique, of a Material.
param_named_auto texture_matrix
as input and multiplies that matrix against the UVs to apply these transformations. typedef multimap<TextureEffectType, TextureEffect>::type Ogre::TextureUnitState::EffectMap |
Texture effects in a multimap paired array.
The type of unit to bind the texture settings to.
Enumeration to specify type of envmap.
Definition of the broad types of texture effect you can apply to a texture unit.
Ogre::TextureUnitState::TextureUnitState | ( | Pass * | parent | ) |
Default constructor.
Ogre::TextureUnitState::TextureUnitState | ( | Pass * | parent, |
const TextureUnitState & | oth | ||
) |
|
override |
Default destructor.
Name-based constructor.
texName | The basic name of the texture e.g. brickwall.jpg, stonefloor.png. |
|
inline |
Gets the animation controller (as created because of setAnimatedTexture) if it exists.
TextureGpu* Ogre::TextureUnitState::_getTexturePtr | ( | ) | const |
Get the texture pointer for the current frame.
TextureGpu* Ogre::TextureUnitState::_getTexturePtr | ( | size_t | frame | ) | const |
Get the texture pointer for a given frame.
void Ogre::TextureUnitState::_load | ( | ) |
Internal method for loading this object as part of Material::load.
void Ogre::TextureUnitState::_notifyParent | ( | Pass * | parent | ) |
Notify this object that its parent has changed.
void Ogre::TextureUnitState::_prepare | ( | ) |
Internal method for preparing this object for load, as part of Material::prepare.
void Ogre::TextureUnitState::_setSamplerblock | ( | const HlmsSamplerblock * | samplerblock | ) |
Changes the current samplerblock for a new one.
MUST'VE BEEN CREATED VIA HlmsManager!!! INCREASES THE REFERENCE COUNT OF THE SAMPLERBLOCK
void Ogre::TextureUnitState::_setTexturePtr | ( | TextureGpu * | texptr | ) |
Set the texture pointer for the current frame (internal use only!).
void Ogre::TextureUnitState::_setTexturePtr | ( | TextureGpu * | texptr, |
size_t | frame | ||
) |
Set the texture pointer for a given frame (internal use only!).
void Ogre::TextureUnitState::_unload | ( | ) |
Internal method for unloading this object as part of Material::unload.
void Ogre::TextureUnitState::_unprepare | ( | ) |
Internal method for undoing the preparation this object as part of Material::unprepare.
void Ogre::TextureUnitState::addEffect | ( | TextureEffect & | effect | ) |
Generic method for setting up texture effects.
void Ogre::TextureUnitState::addFrameTextureName | ( | const String & | name | ) |
Add a Texture name to the end of the frame container.
name | The name of the texture. |
bool Ogre::TextureUnitState::applyTextureAliases | ( | const AliasTextureNamePairList & | aliasList, |
const bool | apply = true |
||
) |
Applies texture names to Texture Unit State with matching texture name aliases.
If no matching aliases are found then the TUS state does not change.
aliasList | A map container of texture alias, texture name pairs. |
apply | Set true to apply the texture aliases else just test to see if texture alias matches are found. |
size_t Ogre::TextureUnitState::calculateSize | ( | ) | const |
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.
frameNumber | The frame number of the texture to be deleted. |
const LayerBlendModeEx& Ogre::TextureUnitState::getAlphaBlendMode | ( | ) | const |
Get multitexturing alpha blending mode.
Real Ogre::TextureUnitState::getAnimationDuration | ( | ) | const |
Get the animated-texture animation duration.
bool Ogre::TextureUnitState::getAutomaticBatching | ( | ) | const |
BindingType Ogre::TextureUnitState::getBindingType | ( | ) | const |
Gets the type of unit these texture settings should be bound to.
SceneBlendFactor Ogre::TextureUnitState::getColourBlendFallbackDest | ( | ) | const |
Get the multipass fallback for colour blending operation destination factor.
SceneBlendFactor Ogre::TextureUnitState::getColourBlendFallbackSrc | ( | ) | const |
Get the multipass fallback for colour blending operation source factor.
const LayerBlendModeEx& Ogre::TextureUnitState::getColourBlendMode | ( | ) | const |
Get multitexturing colour blending mode.
ContentType Ogre::TextureUnitState::getContentType | ( | ) | const |
Get the type of content this TextureUnitState references.
unsigned int Ogre::TextureUnitState::getCurrentFrame | ( | ) | const |
Gets the active frame in an animated or multi-image texture layer.
const EffectMap& Ogre::TextureUnitState::getEffects | ( | ) | const |
Get texture effects in a multimap paired array.
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.
|
inline |
bool Ogre::TextureUnitState::getIsAlpha | ( | ) | const |
Gets whether this texture is requested to be loaded as alpha if single channel.
|
inline |
Get the name of the Texture Unit State.
unsigned int Ogre::TextureUnitState::getNumFrames | ( | ) | const |
Gets the number of frames for a texture.
int Ogre::TextureUnitState::getNumMipmaps | ( | ) | const |
Gets how many mipmaps have been requested for the texture.
|
inline |
Gets the name of the texture in the compositor that this texture references.
const HlmsSamplerblock* Ogre::TextureUnitState::getSamplerblock | ( | ) | const |
Retrieves current samplerblock.
Don't const_cast the return value to modify it. See HlmsDatablock remarks.
std::pair<size_t, size_t> Ogre::TextureUnitState::getTextureDimensions | ( | unsigned int | frame = 0 | ) | const |
Returns the width and height of the texture in the given frame.
const String& Ogre::TextureUnitState::getTextureName | ( | ) | const |
Get the name of current texture image for this layer.
|
inline |
Gets the Texture Name Alias of the Texture Unit.
const Radian& Ogre::TextureUnitState::getTextureRotate | ( | ) | const |
Get texture rotation effects angle value.
const Matrix4& Ogre::TextureUnitState::getTextureTransform | ( | ) | const |
Gets the current texture transformation matrix.
TextureTypes::TextureTypes Ogre::TextureUnitState::getTextureType | ( | ) | const |
Returns the type of this texture.
Real Ogre::TextureUnitState::getTextureUScale | ( | ) | const |
Get texture uscale value.
Real Ogre::TextureUnitState::getTextureUScroll | ( | ) | const |
Get texture uscroll value.
Real Ogre::TextureUnitState::getTextureVScale | ( | ) | const |
Get texture vscale value.
Real Ogre::TextureUnitState::getTextureVScroll | ( | ) | const |
Get texture vscroll value.
bool Ogre::TextureUnitState::hasViewRelativeTextureCoordinateGeneration | ( | ) | const |
Returns whether this unit has texture coordinate generation that depends on the camera.
bool Ogre::TextureUnitState::is3D | ( | ) | const |
Returns true if this texture layer uses a composite 3D cubic texture.
bool Ogre::TextureUnitState::isBlank | ( | ) | const |
Determines if this texture layer is currently blank.
bool Ogre::TextureUnitState::isCubic | ( | ) | const |
Returns true if this texture unit is either a series of 6 2D textures, each in it's own frame, or is a full 3D cube map.
You can tell which by checking getTextureType.
bool Ogre::TextureUnitState::isHardwareGammaEnabled | ( | ) | const |
bool Ogre::TextureUnitState::isLoaded | ( | ) | const |
Is this loaded?
|
inline |
Tests if the texture associated with this unit has failed to load.
TextureUnitState& Ogre::TextureUnitState::operator= | ( | const TextureUnitState & | oth | ) |
void Ogre::TextureUnitState::removeAllEffects | ( | ) |
Removes all effects applied to this texture layer.
void Ogre::TextureUnitState::removeEffect | ( | const TextureEffectType | type | ) |
Removes a single effect applied to this texture layer.
|
inline |
Tells the unit to retry loading the texture if it had failed to load.
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.
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 = LBS_MANUAL) |
arg2 | Manually supplied alpha 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 |
void Ogre::TextureUnitState::setAnimatedTextureName | ( | const String & | name, |
unsigned int | numFrames, | ||
Real | duration = 0 |
||
) |
Sets the names of the texture images for an animated texture.
name | The base name of the textures to use e.g. wall.jpg for frames wall_0.jpg, wall_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. |
void Ogre::TextureUnitState::setAnimatedTextureName | ( | const String *const | names, |
unsigned int | numFrames, | ||
Real | duration = 0 |
||
) |
Sets the names of the texture images for an animated texture.
names | Pointer to array of names of the textures to use, in frame order. |
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. |
void Ogre::TextureUnitState::setAutomaticBatching | ( | bool | automaticBatching | ) |
When a texture is used by both PBS datablocks and V1 materials it can lead to a few issues:
automaticBatching |
void Ogre::TextureUnitState::setBindingType | ( | BindingType | bt | ) |
Sets the type of unit these texture settings should be bound to.
void Ogre::TextureUnitState::setBlank | ( | ) |
Sets this texture layer to be blank.
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).
op | One of the LayerBlendOperation enumerated blending types. |
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.
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. |
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.
void Ogre::TextureUnitState::setCompositorReference | ( | const String & | textureName | ) |
Set the compositor reference for this texture unit state.
textureName | The name of the texture to reference. |
void Ogre::TextureUnitState::setContentType | ( | ContentType | ct | ) |
Set the type of content this TextureUnitState references.
void Ogre::TextureUnitState::setCubicTexture | ( | TextureGpu *const * | texPtrs, |
bool | forUVW = false |
||
) |
Sets this texture layer to use a combination of 6 texture maps, each one relating to a face of a cube.
for cubic environment maps, the 6 textures are combined into a single 'cubic' texture map which is then addressed using 3D texture coordinates. This is required because you don't know what face of the box you're going to need to address when you render an object, and typically you need to reflect more than one face on the one object, so all 6 textures are needed to be 'active' at once. Cubic environment maps are enabled by calling this method with the forUVW parameter set to true, and then calling setEnvironmentMap(true).
Note that not all cards support cubic environment mapping.
for skyboxes, the 6 textures are kept separate and used independently for each face of the skybox. This is done because not all cards support 3D cubic maps and skyboxes do not need to use 3D texture coordinates so it is simpler to render each face of the box with 2D coordinates, changing texture between faces.
Skyboxes are created by calling SceneManager::setSkyBox.
texPtrs | The 6 pointers to the textures which make up the 6 sides of the box. The textures must all be the same size and be powers of 2 in width & height. Must be an Ogre::TextureGpu array with a length of 6 unless forUVW is set to true . |
forUVW | Set to true if you want a single 3D texture addressable with 3D texture coordinates rather than 6 separate textures. Useful for cubic environment mapping. |
void Ogre::TextureUnitState::setCubicTextureName | ( | const String & | name, |
bool | forUVW = false |
||
) |
Sets this texture layer to use a combination of 6 texture maps, each one relating to a face of a cube.
for cubic environment maps, the 6 textures are combined into a single 'cubic' texture map which is then addressed using 3D texture coordinates. This is required because you don't know what face of the box you're going to need to address when you render an object, and typically you need to reflect more than one face on the one object, so all 6 textures are needed to be 'active' at once. Cubic environment maps are enabled by calling this method with the forUVW parameter set to true, and then calling setEnvironmentMap(true).
Note that not all cards support cubic environment mapping.
for skyboxes, the 6 textures are kept separate and used independently for each face of the skybox. This is done because not all cards support 3D cubic maps and skyboxes do not need to use 3D texture coordinates so it is simpler to render each face of the box with 2D coordinates, changing texture between faces.
Skyboxes are created by calling SceneManager::setSkyBox.
name | The basic name of the texture e.g. brickwall.jpg, stonefloor.png. There must be 6 versions of this texture with the suffixes _fr, _bk, _up, _dn, _lf, and _rt (before the extension) which make up the 6 sides of the box. The textures must all be the same size and be powers of 2 in width & height. If you can't make your texture names conform to this, use the alternative method of the same name which takes an array of texture names instead. |
forUVW | Set to true if you want a single 3D texture addressable with 3D texture coordinates rather than 6 separate textures. Useful for cubic environment mapping. |
void Ogre::TextureUnitState::setCubicTextureName | ( | const String *const | names, |
bool | forUVW = false |
||
) |
Sets this texture layer to use a combination of 6 texture maps, each one relating to a face of a cube.
For cubic environment maps, the 6 textures are combined into a single 'cubic' texture map which is then addressed using 3D texture coordinates. This is required because you don't know what face of the box you're going to need to address when you render an object, and typically you need to reflect more than one face on the one object, so all 6 textures are needed to be 'active' at once. Cubic environment maps are enabled by calling this method with the forUVW parameter set to true
, and then calling setEnvironmentMap(true).
Note that not all cards support cubic environment mapping.
For skyboxes, the 6 textures are kept separate and used independently for each face of the skybox. This is done because not all cards support 3D cubic maps and skyboxes do not need to use 3D texture coordinates so it is simpler to render each face of the box with 2D coordinates, changing texture between faces.
Skyboxes are created by calling SceneManager::setSkyBox.
names | The 6 names of the textures which make up the 6 sides of the box. The textures must all be the same size and be powers of 2 in width & height. Must be an Ogre::String array with a length of 6 unless forUVW is set to true . |
forUVW | Set to true if you want a single 3D texture addressable with 3D texture coordinates rather than 6 separate textures. Useful for cubic environment mapping. |
void Ogre::TextureUnitState::setCurrentFrame | ( | unsigned int | frameNumber | ) |
Changes the active frame in an animated or multi-image texture.
void Ogre::TextureUnitState::setEnvironmentMap | ( | bool | enable, |
EnvMapType | envMapType = ENV_CURVED |
||
) |
Turns on/off texture coordinate effect that makes this layer an environment map.
enable | True to enable, false to disable |
envMapType | The type of environment mapping to perform. Planar, curved, reflection or normal. |
void Ogre::TextureUnitState::setFrameTextureName | ( | const String & | name, |
unsigned int | frameNumber | ||
) |
Sets the name of the texture associated with a frame.
name | The name of the texture. |
frameNumber | The frame the texture name is to be placed in. |
|
inline |
void Ogre::TextureUnitState::setHardwareGammaEnabled | ( | bool | enabled | ) |
void Ogre::TextureUnitState::setIsAlpha | ( | bool | isAlpha | ) |
Sets whether this texture is requested to be loaded as alpha if single channel.
void Ogre::TextureUnitState::setName | ( | const String & | name | ) |
Set the name of the Texture Unit State.
void Ogre::TextureUnitState::setNumMipmaps | ( | int | numMipmaps | ) |
Sets how many mipmaps have been requested for the texture.
void Ogre::TextureUnitState::setProjectiveTexturing | ( | bool | enabled, |
const Frustum * | projectionSettings = 0 |
||
) |
Enables or disables projective texturing on this texture unit.
enabled | Whether to enable / disable. |
projectionSettings | The Frustum which will be used to derive the projection parameters. |
void Ogre::TextureUnitState::setRotateAnimation | ( | Real | speed | ) |
Sets up an animated texture rotation for this layer.
speed | The number of complete anticlockwise revolutions per second (use -ve for clockwise) |
void Ogre::TextureUnitState::setSamplerblock | ( | const HlmsSamplerblock & | samplerblock | ) |
Changes the current samplerblock for a new one.
Sets up an animated scroll for the texture layer.
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). |
void Ogre::TextureUnitState::setTexture | ( | TextureGpu * | texPtr | ) |
Sets this texture layer to use a single texture, given the pointer to the texture to use on this layer.
void Ogre::TextureUnitState::setTextureName | ( | const String & | name, |
TextureTypes::TextureTypes | ttype = TextureTypes::Type2D |
||
) |
Sets this texture layer to use a single texture, given the name of the texture to use on this layer.
void Ogre::TextureUnitState::setTextureNameAlias | ( | const String & | name | ) |
Set the alias name used for texture frame names.
name | Can be any sequence of characters and does not have to be unique. |
void Ogre::TextureUnitState::setTextureRotate | ( | const Radian & | angle | ) |
Sets the anticlockwise rotation factor applied to texture coordinates.
angle | The angle of rotation (anticlockwise). |
Sets the scaling factor applied to texture coordinates.
uScale | The value by which the texture is to be scaled horizontally. |
vScale | The value by which the texture is to be scaled vertically. |
Sets the translation offset of the texture, ie scrolls the texture.
u | The amount the texture should be moved horizontally (u direction). |
v | The amount the texture should be moved vertically (v direction). |
void Ogre::TextureUnitState::setTextureTransform | ( | const Matrix4 & | xform | ) |
Sets a matrix used to transform any texture coordinates on this layer.
void Ogre::TextureUnitState::setTextureUScale | ( | Real | value | ) |
As setTextureScale, but sets only U value.
void Ogre::TextureUnitState::setTextureUScroll | ( | Real | value | ) |
As setTextureScroll, but sets only U value.
void Ogre::TextureUnitState::setTextureVScale | ( | Real | value | ) |
As setTextureScale, but sets only V value.
void Ogre::TextureUnitState::setTextureVScroll | ( | Real | value | ) |
As setTextureScroll, but sets only V value.
void Ogre::TextureUnitState::setTransformAnimation | ( | const TextureTransformType | ttype, |
const WaveformType | waveType, | ||
Real | base = 0 , |
||
Real | frequency = 1 , |
||
Real | phase = 0 , |
||
Real | amplitude = 1 |
||
) |
Sets up a general time-relative texture modification effect.
ttype | The type of transform, either translate (scroll), scale (stretch) or rotate (spin). |
waveType | The shape of the wave, see 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. |