Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

Ogre::Technique Class Reference

Class representing an approach to rendering this particular Material. More...

#include <OgreTechnique.h>

List of all members.

Public Types

typedef VectorIterator< PassesPassIterator
typedef VectorIterator< IlluminationPassListIlluminationPassIterator

Public Member Functions

 Technique (Material *parent)
 Constructor.

 Technique (Material *parent, const Technique &oth)
 Copy constructor.

 ~Technique ()
bool isSupported (void) const
 Indicates if this technique is supported by the current graphics card.

void _compile (bool autoManageTextureUnits)
 Internal compilation method; see Material::compile.

void _compileIlluminationPasses (void)
 Internal method for splitting the passes into illumination passes.

PasscreatePass (void)
 Creates a new Pass for this Technique.

PassgetPass (unsigned short index)
 Retrieves the Pass with the given index.

PassgetPass (const String &name)
 Retrieves the Pass matching name.

unsigned short getNumPasses (void) const
 Retrieves the number of passes.

void removePass (unsigned short index)
 Removes the Pass with the given index.

void removeAllPasses (void)
 Removes all Passes from this Technique.

bool movePass (const unsigned short sourceIndex, const unsigned short destinationIndex)
 Move a pass from source index to destination index.

const PassIterator getPassIterator (void)
 Gets an iterator over the passes in this Technique.

const IlluminationPassIterator getIlluminationPassIterator (void)
 Gets an iterator over the illumination-stage categorised passes.

MaterialgetParent (void) const
 Gets the parent Material.

Techniqueoperator= (const Technique &rhs)
 Overloaded operator to copy on Technique to another.

const StringgetResourceGroup (void) const
 Gets the resource group of the ultimate parent Material.

bool isTransparent (void) const
 Returns true if this Technique involves transparency.

void _load (void)
 Internal load method, derived from call to Material::load.

void _unload (void)
 Internal unload method, derived from call to Material::unload.

bool isLoaded (void) const
void _notifyNeedsRecompile (void)
 Tells the technique that it needs recompilation.

void setPointSize (Real ps)
 Sets the point size properties for every Pass in this Technique.

void setAmbient (Real red, Real green, Real blue)
 Sets the ambient colour reflectance properties for every Pass in every Technique.

void setAmbient (const ColourValue &ambient)
 Sets the ambient colour reflectance properties for every Pass in every Technique.

void setDiffuse (Real red, Real green, Real blue, Real alpha)
 Sets the diffuse colour reflectance properties of every Pass in every Technique.

void setDiffuse (const ColourValue &diffuse)
 Sets the diffuse colour reflectance properties of every Pass in every Technique.

void setSpecular (Real red, Real green, Real blue, Real alpha)
 Sets the specular colour reflectance properties of every Pass in every Technique.

void setSpecular (const ColourValue &specular)
 Sets the specular colour reflectance properties of every Pass in every Technique.

void setShininess (Real val)
 Sets the shininess properties of every Pass in every Technique.

void setSelfIllumination (Real red, Real green, Real blue)
 Sets the amount of self-illumination of every Pass in every Technique.

void setSelfIllumination (const ColourValue &selfIllum)
 Sets the amount of self-illumination of every Pass in every Technique.

void setDepthCheckEnabled (bool enabled)
 Sets whether or not each Pass renders with depth-buffer checking on or not.

void setDepthWriteEnabled (bool enabled)
 Sets whether or not each Pass renders with depth-buffer writing on or not.

void setDepthFunction (CompareFunction func)
 Sets the function used to compare depth values when depth checking is on.

void setColourWriteEnabled (bool enabled)
 Sets whether or not colour buffer writing is enabled for each Pass.

void setCullingMode (CullingMode mode)
 Sets the culling mode for each pass based on the 'vertex winding'.

void setManualCullingMode (ManualCullingMode mode)
 Sets the manual culling mode, performed by CPU rather than hardware.

void setLightingEnabled (bool enabled)
 Sets whether or not dynamic lighting is enabled for every Pass.

void setShadingMode (ShadeOptions mode)
 Sets the type of light shading required.

void setFog (bool overrideScene, FogMode mode=FOG_NONE, const ColourValue &colour=ColourValue::White, Real expDensity=0.001, Real linearStart=0.0, Real linearEnd=1.0)
 Sets the fogging mode applied to each pass.

void setDepthBias (ushort bias)
 Sets the depth bias to be used for each Pass.

void setTextureFiltering (TextureFilterOptions filterType)
 Set texture filtering for every texture unit in every Pass.

void setTextureAnisotropy (unsigned int maxAniso)
 Sets the anisotropy level to be used for all textures.

void setSceneBlending (const SceneBlendType sbt)
 Sets the kind of blending every pass has with the existing contents of the scene.

void setSceneBlending (const SceneBlendFactor sourceFactor, const SceneBlendFactor destFactor)
 Allows very fine control of blending every Pass with the existing contents of the scene.

void setLodIndex (unsigned short index)
 Assigns a level-of-detail (LOD) index to this Technique.

unsigned short getLodIndex (void) const
 Gets the level-of-detail index assigned to this Technique.

void setSchemeName (const String &schemeName)
 Set the 'scheme name' for this technique.

const StringgetSchemeName (void) const
 Returns the scheme to which this technique is assigned.

unsigned short _getSchemeIndex (void) const
 Internal method for getting the scheme index.

bool isDepthWriteEnabled (void) const
 Is depth writing going to occur on this technique?

bool isDepthCheckEnabled (void) const
 Is depth checking going to occur on this technique?

bool hasColourWriteDisabled (void) const
 Exists colour writing disabled pass on this technique?

void setName (const String &name)
 Set the name of the technique.

const StringgetName (void) const
 Gets the name of the technique.

bool applyTextureAliases (const AliasTextureNamePairList &aliasList, const bool apply=true) const
 Applies texture names to Texture Unit State with matching texture name aliases.


Protected Types

typedef std::vector< Pass * > Passes
enum  IlluminationPassesState { IPS_COMPILE_DISABLED = -1, IPS_NOT_COMPILED = 0, IPS_COMPILED = 1 }

Protected Member Functions

void clearIlluminationPasses (void)
 Internal method for clearing illumination pass list.


Protected Attributes

Passes mPasses
 List of primary passes.

IlluminationPassList mIlluminationPasses
 List of derived passes, categorised into IlluminationStage (ordered).

MaterialmParent
bool mIsSupported
IlluminationPassesState mIlluminationPassesCompilationPhase
unsigned short mLodIndex
 LOD level.

unsigned short mSchemeIndex
 Scheme index, derived from scheme name but the names are held on MaterialManager, for speed an index is used here.

String mName


Detailed Description

Class representing an approach to rendering this particular Material.

Remarks:
Ogre will attempt to use the best technique supported by the active hardware, unless you specifically request a lower detail technique (say for distant rendering).

Definition at line 41 of file OgreTechnique.h.


Member Typedef Documentation

typedef VectorIterator<IlluminationPassList> Ogre::Technique::IlluminationPassIterator
 

Definition at line 118 of file OgreTechnique.h.

typedef std::vector<Pass*> Ogre::Technique::Passes [protected]
 

Definition at line 52 of file OgreTechnique.h.

typedef VectorIterator<Passes> Ogre::Technique::PassIterator
 

Definition at line 115 of file OgreTechnique.h.


Member Enumeration Documentation

enum Ogre::Technique::IlluminationPassesState [protected]
 

Enumeration values:
IPS_COMPILE_DISABLED 
IPS_NOT_COMPILED 
IPS_COMPILED 

Definition at line 45 of file OgreTechnique.h.


Constructor & Destructor Documentation

Ogre::Technique::Technique Material parent  ) 
 

Constructor.

Ogre::Technique::Technique Material parent,
const Technique oth
 

Copy constructor.

Ogre::Technique::~Technique  ) 
 


Member Function Documentation

void Ogre::Technique::_compile bool  autoManageTextureUnits  ) 
 

Internal compilation method; see Material::compile.

void Ogre::Technique::_compileIlluminationPasses void   ) 
 

Internal method for splitting the passes into illumination passes.

unsigned short Ogre::Technique::_getSchemeIndex void   )  const
 

Internal method for getting the scheme index.

void Ogre::Technique::_load void   ) 
 

Internal load method, derived from call to Material::load.

void Ogre::Technique::_notifyNeedsRecompile void   ) 
 

Tells the technique that it needs recompilation.

void Ogre::Technique::_unload void   ) 
 

Internal unload method, derived from call to Material::unload.

bool Ogre::Technique::applyTextureAliases const AliasTextureNamePairList aliasList,
const bool  apply = true
const
 

Applies texture names to Texture Unit State with matching texture name aliases.

All passes, and Texture Unit States within the technique are checked. If matching texture aliases are found then true is returned.

Parameters:
aliasList is 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.
Returns:
True if matching texture aliases were found in the Technique.

void Ogre::Technique::clearIlluminationPasses void   )  [protected]
 

Internal method for clearing illumination pass list.

Pass* Ogre::Technique::createPass void   ) 
 

Creates a new Pass for this Technique.

Remarks:
A Pass is a single rendering pass, ie a single draw of the given material. Note that if you create a pass without a fragment program, during compilation of the material the pass may be split into multiple passes if the graphics card cannot handle the number of texture units requested. For passes with fragment programs, however, the number of passes you create will never be altered, so you have to make sure that you create an alternative fallback Technique for if a card does not have enough facilities for what you're asking for.

const IlluminationPassIterator Ogre::Technique::getIlluminationPassIterator void   ) 
 

Gets an iterator over the illumination-stage categorised passes.

unsigned short Ogre::Technique::getLodIndex void   )  const
 

Gets the level-of-detail index assigned to this Technique.

Definition at line 418 of file OgreTechnique.h.

const String& Ogre::Technique::getName void   )  const
 

Gets the name of the technique.

Definition at line 462 of file OgreTechnique.h.

References Ogre::String.

unsigned short Ogre::Technique::getNumPasses void   )  const
 

Retrieves the number of passes.

Material* Ogre::Technique::getParent void   )  const
 

Gets the parent Material.

Definition at line 122 of file OgreTechnique.h.

Pass* Ogre::Technique::getPass const String name  ) 
 

Retrieves the Pass matching name.

Returns 0 if name match is not found.

Pass* Ogre::Technique::getPass unsigned short  index  ) 
 

Retrieves the Pass with the given index.

const PassIterator Ogre::Technique::getPassIterator void   ) 
 

Gets an iterator over the passes in this Technique.

const String& Ogre::Technique::getResourceGroup void   )  const
 

Gets the resource group of the ultimate parent Material.

const String& Ogre::Technique::getSchemeName void   )  const
 

Returns the scheme to which this technique is assigned.

See also:
Technique::setSchemeName

bool Ogre::Technique::hasColourWriteDisabled void   )  const
 

Exists colour writing disabled pass on this technique?

bool Ogre::Technique::isDepthCheckEnabled void   )  const
 

Is depth checking going to occur on this technique?

bool Ogre::Technique::isDepthWriteEnabled void   )  const
 

Is depth writing going to occur on this technique?

bool Ogre::Technique::isLoaded void   )  const
 

bool Ogre::Technique::isSupported void   )  const
 

Indicates if this technique is supported by the current graphics card.

Remarks:
This will only be correct after the Technique has been compiled, which is usually done from Material::compile.

bool Ogre::Technique::isTransparent void   )  const
 

Returns true if this Technique involves transparency.

Remarks:
This basically boils down to whether the first pass has a scene blending factor. Even if the other passes do not, the base colour, including parts of the original scene, may be used for blending, therefore we have to treat the whole Technique as transparent.

bool Ogre::Technique::movePass const unsigned short  sourceIndex,
const unsigned short  destinationIndex
 

Move a pass from source index to destination index.

If successful then returns true.

Technique& Ogre::Technique::operator= const Technique rhs  ) 
 

Overloaded operator to copy on Technique to another.

void Ogre::Technique::removeAllPasses void   ) 
 

Removes all Passes from this Technique.

void Ogre::Technique::removePass unsigned short  index  ) 
 

Removes the Pass with the given index.

void Ogre::Technique::setAmbient const ColourValue ambient  ) 
 

Sets the ambient colour reflectance properties for every Pass in every Technique.

Note:
This property actually exists on the Pass class. For simplicity, this method allows you to set these properties for every current Pass within this Technique. If you need more precision, retrieve the Pass instance and set the property there.
See also:
Pass::setAmbient

void Ogre::Technique::setAmbient Real  red,
Real  green,
Real  blue
 

Sets the ambient colour reflectance properties for every Pass in every Technique.

Note:
This property actually exists on the Pass class. For simplicity, this method allows you to set these properties for every current Pass within this Technique. If you need more precision, retrieve the Pass instance and set the property there.
See also:
Pass::setAmbient

void Ogre::Technique::setColourWriteEnabled bool  enabled  ) 
 

Sets whether or not colour buffer writing is enabled for each Pass.

Note:
This property actually exists on the Pass class. For simplicity, this method allows you to set these properties for every current Pass within this Technique. If you need more precision, retrieve the Pass instance and set the property there.
See also:
Pass::setColourWriteEnabled

void Ogre::Technique::setCullingMode CullingMode  mode  ) 
 

Sets the culling mode for each pass based on the 'vertex winding'.

Note:
This property actually exists on the Pass class. For simplicity, this method allows you to set these properties for every current Pass within this Technique. If you need more precision, retrieve the Pass instance and set the property there.
See also:
Pass::setCullingMode

void Ogre::Technique::setDepthBias ushort  bias  ) 
 

Sets the depth bias to be used for each Pass.

Note:
This property actually exists on the Pass class. For simplicity, this method allows you to set these properties for every current Pass within this Technique. If you need more precision, retrieve the Pass instance and set the property there.
See also:
Pass::setDepthBias

void Ogre::Technique::setDepthCheckEnabled bool  enabled  ) 
 

Sets whether or not each Pass renders with depth-buffer checking on or not.

Note:
This property actually exists on the Pass class. For simplicity, this method allows you to set these properties for every current Pass within this Technique. If you need more precision, retrieve the Pass instance and set the property there.
See also:
Pass::setDepthCheckEnabled

void Ogre::Technique::setDepthFunction CompareFunction  func  ) 
 

Sets the function used to compare depth values when depth checking is on.

Note:
This property actually exists on the Pass class. For simplicity, this method allows you to set these properties for every current Pass within this Technique. If you need more precision, retrieve the Pass instance and set the property there.
See also:
Pass::setDepthFunction

void Ogre::Technique::setDepthWriteEnabled bool  enabled  ) 
 

Sets whether or not each Pass renders with depth-buffer writing on or not.

Note:
This property actually exists on the Pass class. For simplicity, this method allows you to set these properties for every current Pass within this Technique. If you need more precision, retrieve the Pass instance and set the property there.
See also:
Pass::setDepthWriteEnabled

void Ogre::Technique::setDiffuse const ColourValue diffuse  ) 
 

Sets the diffuse colour reflectance properties of every Pass in every Technique.

Note:
This property actually exists on the Pass class. For simplicity, this method allows you to set these properties for every current Pass within this Technique. If you need more precision, retrieve the Pass instance and set the property there.
See also:
Pass::setDiffuse

void Ogre::Technique::setDiffuse Real  red,
Real  green,
Real  blue,
Real  alpha
 

Sets the diffuse colour reflectance properties of every Pass in every Technique.

Note:
This property actually exists on the Pass class. For simplicity, this method allows you to set these properties for every current Pass within this Technique. If you need more precision, retrieve the Pass instance and set the property there.
See also:
Pass::setDiffuse

void Ogre::Technique::setFog bool  overrideScene,
FogMode  mode = FOG_NONE,
const ColourValue colour = ColourValue::White,
Real  expDensity = 0.001,
Real  linearStart = 0.0,
Real  linearEnd = 1.0
 

Sets the fogging mode applied to each pass.

Note:
This property actually exists on the Pass class. For simplicity, this method allows you to set these properties for every current Pass within this Technique. If you need more precision, retrieve the Pass instance and set the property there.
See also:
Pass::setFog

void Ogre::Technique::setLightingEnabled bool  enabled  ) 
 

Sets whether or not dynamic lighting is enabled for every Pass.

Note:
This property actually exists on the Pass class. For simplicity, this method allows you to set these properties for every current Pass within this Technique. If you need more precision, retrieve the Pass instance and set the property there.
See also:
Pass::setLightingEnabled

void Ogre::Technique::setLodIndex unsigned short  index  ) 
 

Assigns a level-of-detail (LOD) index to this Technique.

Remarks:
As noted previously, as well as providing fallback support for various graphics cards, multiple Technique objects can also be used to implement material LOD, where the detail of the material diminishes with distance to save rendering power.
By default, all Techniques have a LOD index of 0, which means they are the highest level of detail. Increasing LOD indexes are lower levels of detail. You can assign more than one Technique to the same LOD index, meaning that the best Technique that is supported at that LOD index is used.
You should not leave gaps in the LOD sequence; Ogre will allow you to do this and will continue to function as if the LODs were sequential, but it will confuse matters.

void Ogre::Technique::setManualCullingMode ManualCullingMode  mode  ) 
 

Sets the manual culling mode, performed by CPU rather than hardware.

Note:
This property actually exists on the Pass class. For simplicity, this method allows you to set these properties for every current Pass within this Technique. If you need more precision, retrieve the Pass instance and set the property there.
See also:
Pass::setManualCullingMode

void Ogre::Technique::setName const String name  ) 
 

Set the name of the technique.

Remarks:
The use of technique name is optional. Its usefull in material scripts where a material could inherit from another material and only want to modify a particalar technique.

void Ogre::Technique::setPointSize Real  ps  ) 
 

Sets the point size properties for every Pass in this Technique.

Note:
This property actually exists on the Pass class. For simplicity, this method allows you to set these properties for every current Pass within this Technique. If you need more precision, retrieve the Pass instance and set the property there.
See also:
Pass::setPointSize

void Ogre::Technique::setSceneBlending const SceneBlendFactor  sourceFactor,
const SceneBlendFactor  destFactor
 

Allows very fine control of blending every Pass with the existing contents of the scene.

Note:
This property actually exists on the Pass class. For simplicity, this method allows you to set these properties for every current Pass within this Technique. If you need more precision, retrieve the Pass instance and set the property there.
See also:
Pass::setSceneBlending

void Ogre::Technique::setSceneBlending const SceneBlendType  sbt  ) 
 

Sets the kind of blending every pass has with the existing contents of the scene.

Note:
This property actually exists on the Pass class. For simplicity, this method allows you to set these properties for every current Pass within this Technique. If you need more precision, retrieve the Pass instance and set the property there.
See also:
Pass::setSceneBlending

void Ogre::Technique::setSchemeName const String schemeName  ) 
 

Set the 'scheme name' for this technique.

Remarks:
Material schemes are used to control top-level switching from one set of techniques to another. For example, you might use this to define 'high', 'medium' and 'low' complexity levels on materials to allow a user to pick a performance / quality ratio. Another possibility is that you have a fully HDR-enabled pipeline for top machines, rendering all objects using unclamped shaders, and a simpler pipeline for others; this can be implemented using schemes.
Every technique belongs to a scheme - if you don't specify one, the Technique belongs to the scheme called 'Default', which is also the scheme used to render by default. The active scheme is set one of two ways - either by calling Viewport::setMaterialScheme, or by manually calling MaterialManager::setActiveScheme.

void Ogre::Technique::setSelfIllumination const ColourValue selfIllum  ) 
 

Sets the amount of self-illumination of every Pass in every Technique.

Note:
This property actually exists on the Pass class. For simplicity, this method allows you to set these properties for every current Pass within this Technique. If you need more precision, retrieve the Pass instance and set the property there.
See also:
Pass::setSelfIllumination

void Ogre::Technique::setSelfIllumination Real  red,
Real  green,
Real  blue
 

Sets the amount of self-illumination of every Pass in every Technique.

Note:
This property actually exists on the Pass class. For simplicity, this method allows you to set these properties for every current Pass within this Technique. If you need more precision, retrieve the Pass instance and set the property there.
See also:
Pass::setSelfIllumination

void Ogre::Technique::setShadingMode ShadeOptions  mode  ) 
 

Sets the type of light shading required.

Note:
This property actually exists on the Pass class. For simplicity, this method allows you to set these properties for every current Pass within this Technique. If you need more precision, retrieve the Pass instance and set the property there.
See also:
Pass::setShadingMode

void Ogre::Technique::setShininess Real  val  ) 
 

Sets the shininess properties of every Pass in every Technique.

Note:
This property actually exists on the Pass class. For simplicity, this method allows you to set these properties for every current Pass within this Technique. If you need more precision, retrieve the Pass instance and set the property there.
See also:
Pass::setShininess

void Ogre::Technique::setSpecular const ColourValue specular  ) 
 

Sets the specular colour reflectance properties of every Pass in every Technique.

Note:
This property actually exists on the Pass class. For simplicity, this method allows you to set these properties for every current Pass within this Technique. If you need more precision, retrieve the Pass instance and set the property there.
See also:
Pass::setSpecular

void Ogre::Technique::setSpecular Real  red,
Real  green,
Real  blue,
Real  alpha
 

Sets the specular colour reflectance properties of every Pass in every Technique.

Note:
This property actually exists on the Pass class. For simplicity, this method allows you to set these properties for every current Pass within this Technique. If you need more precision, retrieve the Pass instance and set the property there.
See also:
Pass::setSpecular

void Ogre::Technique::setTextureAnisotropy unsigned int  maxAniso  ) 
 

Sets the anisotropy level to be used for all textures.

Note:
This property has been moved to the TextureUnitState class, which is accessible via the Technique and Pass. For simplicity, this method allows you to set these properties for every current TeextureUnitState, If you need more precision, retrieve the Technique, Pass and TextureUnitState instances and set the property there.
See also:
TextureUnitState::setTextureAnisotropy

void Ogre::Technique::setTextureFiltering TextureFilterOptions  filterType  ) 
 

Set texture filtering for every texture unit in every Pass.

Note:
This property actually exists on the TextureUnitState class For simplicity, this method allows you to set these properties for every current TeextureUnitState, If you need more precision, retrieve the Pass and TextureUnitState instances and set the property there.
See also:
TextureUnitState::setTextureFiltering


Member Data Documentation

IlluminationPassList Ogre::Technique::mIlluminationPasses [protected]
 

List of derived passes, categorised into IlluminationStage (ordered).

Definition at line 56 of file OgreTechnique.h.

IlluminationPassesState Ogre::Technique::mIlluminationPassesCompilationPhase [protected]
 

Definition at line 59 of file OgreTechnique.h.

bool Ogre::Technique::mIsSupported [protected]
 

Definition at line 58 of file OgreTechnique.h.

unsigned short Ogre::Technique::mLodIndex [protected]
 

LOD level.

Definition at line 61 of file OgreTechnique.h.

String Ogre::Technique::mName [protected]
 

Definition at line 66 of file OgreTechnique.h.

Material* Ogre::Technique::mParent [protected]
 

Definition at line 57 of file OgreTechnique.h.

Passes Ogre::Technique::mPasses [protected]
 

List of primary passes.

Definition at line 54 of file OgreTechnique.h.

unsigned short Ogre::Technique::mSchemeIndex [protected]
 

Scheme index, derived from scheme name but the names are held on MaterialManager, for speed an index is used here.

Definition at line 65 of file OgreTechnique.h.


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

Copyright © 2000-2005 by The OGRE Team
Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 2.5 License.
Last modified Sun Mar 12 14:45:18 2006