OGRE  1.9.0
OgrePass.h
Go to the documentation of this file.
1/*
2-----------------------------------------------------------------------------
3This source file is part of OGRE
4(Object-oriented Graphics Rendering Engine)
5For the latest info, see http://www.ogre3d.org
6
7Copyright (c) 2000-2014 Torus Knot Software Ltd
8
9Permission is hereby granted, free of charge, to any person obtaining a copy
10of this software and associated documentation files (the "Software"), to deal
11in the Software without restriction, including without limitation the rights
12to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13copies of the Software, and to permit persons to whom the Software is
14furnished to do so, subject to the following conditions:
15
16The above copyright notice and this permission notice shall be included in
17all copies or substantial portions of the Software.
18
19THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25THE SOFTWARE.
26-----------------------------------------------------------------------------
27*/
28#ifndef __Pass_H__
29#define __Pass_H__
30
31#include "OgrePrerequisites.h"
32#include "OgreGpuProgram.h"
33#include "OgreColourValue.h"
34#include "OgreBlendMode.h"
35#include "OgreCommon.h"
36#include "OgreLight.h"
39
40namespace Ogre {
41
50 {
59 };
60
80 class _OgreExport Pass : public PassAlloc
81 {
82 public:
93 struct HashFunc
94 {
95 virtual uint32 operator()(const Pass* p) const = 0;
97 virtual ~HashFunc() {}
98 };
99 protected:
101 unsigned short mIndex;
105 //-------------------------------------------------------------------------
106 // Colour properties, only applicable in fixed-function passes
113 //-------------------------------------------------------------------------
114
115 //-------------------------------------------------------------------------
116 // Blending factors
121
122 // Used to determine if separate alpha blending should be used for color and alpha channels
124
125 //-------------------------------------------------------------------------
126 // Blending operations
129
132
133 //-------------------------------------------------------------------------
134
135 //-------------------------------------------------------------------------
136 // Depth buffer settings
143
146
147 // Alpha reject settings
149 unsigned char mAlphaRejectVal;
151
156 //-------------------------------------------------------------------------
157
158 //-------------------------------------------------------------------------
159 // Culling mode
162 //-------------------------------------------------------------------------
163
169 unsigned short mStartLight;
173 unsigned short mLightsPerIteration;
179
187 //-------------------------------------------------------------------------
188 // Fog
195 //-------------------------------------------------------------------------
196
200
232 Real mPointAttenuationCoeffs[3];
233 // TU Content type lookups
245
246
249
250 public:
252 protected:
259 public:
260 OGRE_STATIC_MUTEX(msDirtyHashListMutex);
261 OGRE_STATIC_MUTEX(msPassGraveyardMutex);
262 OGRE_MUTEX(mTexUnitChangeMutex);
263 OGRE_MUTEX(mGpuProgramChangeMutex);
265 Pass(Technique* parent, unsigned short index);
267 Pass(Technique* parent, unsigned short index, const Pass& oth );
269 Pass& operator=(const Pass& oth);
270 virtual ~Pass();
271
273 bool isProgrammable(void) const { return mVertexProgramUsage || mFragmentProgramUsage || mGeometryProgramUsage ||
274 mTesselationHullProgramUsage || mTesselationDomainProgramUsage || mComputeProgramUsage; }
275
277 bool hasVertexProgram(void) const { return mVertexProgramUsage != NULL; }
279 bool hasFragmentProgram(void) const { return mFragmentProgramUsage != NULL; }
281 bool hasGeometryProgram(void) const { return mGeometryProgramUsage != NULL; }
283 bool hasTesselationHullProgram(void) const { return mTesselationHullProgramUsage != NULL; }
285 bool hasTesselationDomainProgram(void) const { return mTesselationDomainProgramUsage != NULL; }
287 bool hasComputeProgram(void) const { return mComputeProgramUsage != NULL; }
289 bool hasShadowCasterVertexProgram(void) const { return mShadowCasterVertexProgramUsage != NULL; }
291 bool hasShadowCasterFragmentProgram(void) const { return mShadowCasterFragmentProgramUsage != NULL; }
293 bool hasShadowReceiverVertexProgram(void) const { return mShadowReceiverVertexProgramUsage != NULL; }
295 bool hasShadowReceiverFragmentProgram(void) const { return mShadowReceiverFragmentProgramUsage != NULL; }
296
297 size_t calculateSize(void) const;
298
300 unsigned short getIndex(void) const { return mIndex; }
301 /* Set the name of the pass
302 @remarks
303 The name of the pass is optional. Its useful in material scripts where a material could inherit
304 from another material and only want to modify a particular pass.
305 */
306 void setName(const String& name);
308 const String& getName(void) const { return mName; }
309
321 void setAmbient(Real red, Real green, Real blue);
322
335 void setAmbient(const ColourValue& ambient);
336
347 void setDiffuse(Real red, Real green, Real blue, Real alpha);
348
359 void setDiffuse(const ColourValue& diffuse);
360
373 void setSpecular(Real red, Real green, Real blue, Real alpha);
374
387 void setSpecular(const ColourValue& specular);
388
395
405 void setSelfIllumination(Real red, Real green, Real blue);
406
411 void setEmissive(Real red, Real green, Real blue)
412 {
413 setSelfIllumination(red, green, blue);
414 }
415
425 void setSelfIllumination(const ColourValue& selfIllum);
426
431 void setEmissive(const ColourValue& emissive)
432 {
433 setSelfIllumination(emissive);
434 }
435
439
445 Real getPointSize(void) const;
446
463
469 void setPointSpritesEnabled(bool enabled);
470
474 bool getPointSpritesEnabled(void) const;
475
493 void setPointAttenuation(bool enabled,
494 Real constant = 0.0f, Real linear = 1.0f, Real quadratic = 0.0f);
495
498
505
518
521 const ColourValue& getAmbient(void) const;
522
525 const ColourValue& getDiffuse(void) const;
526
529 const ColourValue& getSpecular(void) const;
530
534
539 const ColourValue& getEmissive(void) const
540 {
541 return getSelfIllumination();
542 }
543
546 Real getShininess(void) const;
547
551
567 TextureUnitState* createTextureUnitState( const String& textureName, unsigned short texCoordSet = 0);
576 TextureUnitState* getTextureUnitState(unsigned short index);
583 const TextureUnitState* getTextureUnitState(unsigned short index) const;
587 const TextureUnitState* getTextureUnitState(const String& name) const;
588
595 unsigned short getTextureUnitStateIndex(const TextureUnitState* state) const;
596
600
604
609 void removeTextureUnitState(unsigned short index);
610
614
617 unsigned short getNumTextureUnitStates(void) const
618 {
619 return static_cast<unsigned short>(mTextureUnitStates.size());
620 }
621
639
659
682 void setSceneBlending( const SceneBlendFactor sourceFactor, const SceneBlendFactor destFactor);
683
710 void setSeparateSceneBlending( const SceneBlendFactor sourceFactor, const SceneBlendFactor destFactor, const SceneBlendFactor sourceFactorAlpha, const SceneBlendFactor destFactorAlpha );
711
714
718
722
726
730
742
757
760
763
766
768 bool isTransparent(void) const;
769
781 void setDepthCheckEnabled(bool enabled);
782
787 bool getDepthCheckEnabled(void) const;
788
799 void setDepthWriteEnabled(bool enabled);
800
805 bool getDepthWriteEnabled(void) const;
806
820
831 void setColourWriteEnabled(bool enabled);
833 bool getColourWriteEnabled(void) const;
834
849
853
868
874
883 void setLightingEnabled(bool enabled);
884
887 bool getLightingEnabled(void) const;
888
897 void setMaxSimultaneousLights(unsigned short maxLights);
899 unsigned short getMaxSimultaneousLights(void) const;
900
911 void setStartLight(unsigned short startLight);
913 unsigned short getStartLight(void) const;
914
919
925
929
935
939
945 virtual void setPolygonModeOverrideable(bool override)
946 {
947 mPolygonModeOverrideable = override;
948 }
949
953 virtual bool getPolygonModeOverrideable(void) const
954 {
955 return mPolygonModeOverrideable;
956 }
986 void setFog(
987 bool overrideScene,
988 FogMode mode = FOG_NONE,
989 const ColourValue& colour = ColourValue::White,
990 Real expDensity = 0.001, Real linearStart = 0.0, Real linearEnd = 1.0 );
991
994 bool getFogOverride(void) const;
995
1000 FogMode getFogMode(void) const;
1001
1004 const ColourValue& getFogColour(void) const;
1005
1010 Real getFogStart(void) const;
1011
1016 Real getFogEnd(void) const;
1017
1022 Real getFogDensity(void) const;
1023
1043 void setDepthBias(float constantBias, float slopeScaleBias = 0.0f);
1044
1046 float getDepthBiasConstant(void) const;
1048 float getDepthBiasSlopeScale(void) const;
1055 void setIterationDepthBias(float biasPerIteration);
1060
1070 void setAlphaRejectSettings(CompareFunction func, unsigned char value, bool alphaToCoverageEnabled = false);
1071
1075
1078 void setAlphaRejectValue(unsigned char val);
1079
1082 CompareFunction getAlphaRejectFunction(void) const { return mAlphaRejectFunc; }
1083
1086 unsigned char getAlphaRejectValue(void) const { return mAlphaRejectVal; }
1087
1095 void setAlphaToCoverageEnabled(bool enabled);
1096
1099 bool isAlphaToCoverageEnabled() const { return mAlphaToCoverageEnabled; }
1100
1114
1118
1129
1133
1176 void setIteratePerLight(bool enabled,
1177 bool onlyForOneLightType = true, Light::LightTypes lightType = Light::LT_POINT);
1178
1180 bool getIteratePerLight(void) const { return mIteratePerLight; }
1182 bool getRunOnlyForOneLightType(void) const { return mRunOnlyForOneLightType; }
1185 Light::LightTypes getOnlyLightType() const { return mOnlyLightType; }
1186
1196 void setLightCountPerIteration(unsigned short c);
1200 unsigned short getLightCountPerIteration(void) const;
1201
1203 Technique* getParent(void) const { return mParent; }
1204
1206 const String& getResourceGroup(void) const;
1207
1224 void setVertexProgram(const String& name, bool resetParams = true);
1233 const String& getVertexProgramName(void) const;
1238
1239
1284
1329
1363
1392
1400
1408
1425 void setFragmentProgram(const String& name, bool resetParams = true);
1432 const String& getFragmentProgramName(void) const;
1437
1454 void setGeometryProgram(const String& name, bool resetParams = true);
1461 const String& getGeometryProgramName(void) const;
1466
1478 Pass* _split(unsigned short numUnits);
1479
1481 void _notifyIndex(unsigned short index);
1482
1484 void _prepare(void);
1486 void _unprepare(void);
1488 void _load(void);
1490 void _unload(void);
1492 bool isLoaded(void) const;
1493
1500 uint32 getHash(void) const { return mHash; }
1502 void _dirtyHash(void);
1512
1517 void _updateAutoParams(const AutoParamDataSource* source, uint16 variabilityMask) const;
1518
1526 TextureUnitState::ContentType contentType, unsigned short index) const;
1527
1545 void setTextureAnisotropy(unsigned int maxAniso);
1557 void setNormaliseNormals(bool normalise) { mNormaliseNormals = normalise; }
1558
1560 bool getNormaliseNormals(void) const {return mNormaliseNormals; }
1561
1565 static const PassSet& getDirtyHashList(void)
1566 { return msDirtyHashList; }
1569 static const PassSet& getPassGraveyard(void)
1570 { return msPassGraveyard; }
1578 static void clearDirtyHashList(void);
1579
1581 static void processPendingPassUpdates(void);
1582
1585
1588 bool isAmbientOnly(void) const;
1589
1603 void setPassIterationCount(const size_t count) { mPassIterationCount = count; }
1604
1607 size_t getPassIterationCount(void) const { return mPassIterationCount; }
1608
1620 bool applyTextureAliases(const AliasTextureNamePairList& aliasList, const bool apply = true) const;
1621
1642 void setLightScissoringEnabled(bool enabled) { mLightScissoring = enabled; }
1646 bool getLightScissoringEnabled() const { return mLightScissoring; }
1647
1671 void setLightClipPlanesEnabled(bool enabled) { mLightClipPlanes = enabled; }
1675 bool getLightClipPlanesEnabled() const { return mLightClipPlanes; }
1676
1698 void setIlluminationStage(IlluminationStage is) { mIlluminationStage = is; }
1700 IlluminationStage getIlluminationStage() const { return mIlluminationStage; }
1705 {
1712 MIN_GPU_PROGRAM_CHANGE
1727
1739 static void setHashFunction(HashFunc* hashFunc) { msHashFunc = hashFunc; }
1740
1743 static HashFunc* getHashFunction(void) { return msHashFunc; }
1744
1748
1753 UserObjectBindings& getUserObjectBindings() { return mUserObjectBindings; }
1754
1759 const UserObjectBindings& getUserObjectBindings() const { return mUserObjectBindings; }
1760
1762
1778 void setTesselationHullProgram(const String& name, bool resetParams = true);
1790
1807 void setTesselationDomainProgram(const String& name, bool resetParams = true);
1819
1836 void setComputeProgram(const String& name, bool resetParams = true);
1843 const String& getComputeProgramName(void) const;
1848 };
1849
1860 {
1868
1870 };
1871
1873
1877}
1878
1879#endif
#define _OgreExport
Superclass for all objects that wish to use custom memory allocators when their new / delete operator...
This utility class is used to hold the information used to generate the matrices and other informatio...
Class representing colour.
Concrete IteratorWrapper for const access to the underlying container.
This class makes the usage of a vertex and fragment programs (low-level or high-level),...
LightTypes
Defines the type of light.
Definition OgreLight.h:83
Class defining a single pass of a Technique (of a Material), i.e.
Definition OgrePass.h:81
void addTextureUnitState(TextureUnitState *state)
Adds the passed in TextureUnitState, to the existing Pass.
SceneBlendOperation mAlphaBlendOperation
Definition OgrePass.h:128
ShadeOptions mShadeOptions
Shading options.
Definition OgrePass.h:181
bool mPointAttenuationEnabled
Definition OgrePass.h:230
SceneBlendFactor mSourceBlendFactorAlpha
Definition OgrePass.h:119
float getDepthBiasConstant(void) const
Retrieves the const depth bias value as set by setDepthBias.
void setName(const String &name)
SceneBlendFactor getSourceBlendFactorAlpha() const
Retrieves the alpha source blending factor for the material (as set using Materiall::setSeparateScene...
GpuProgramUsage * mTesselationHullProgramUsage
Tesselation hull program details.
Definition OgrePass.h:216
GpuProgramParametersSharedPtr getTesselationDomainProgramParameters(void) const
Gets the Tesselation Domain program parameters used by this pass.
SceneBlendFactor mSourceBlendFactor
Definition OgrePass.h:117
const String & getComputeProgramName(void) const
Gets the name of the Tesselation Hull program used by this pass.
bool getRunOnlyForOneLightType(void) const
Does this pass run only for a single light type (if getIteratePerLight is true).
Definition OgrePass.h:1182
bool getLightClipPlanesEnabled() const
Gets whether or not this pass will be clipped by user clips planes bounding the area covered by the l...
Definition OgrePass.h:1675
const String & getFragmentProgramName(void) const
Gets the name of the fragment program used by this pass.
void setPointAttenuation(bool enabled, Real constant=0.0f, Real linear=1.0f, Real quadratic=0.0f)
Sets how points are attenuated with distance.
void setLightCountPerIteration(unsigned short c)
If light iteration is enabled, determine the number of lights per iteration.
SceneBlendOperation getSceneBlendingOperation() const
Returns the current blending operation.
OGRE_STATIC_MUTEX(msDirtyHashListMutex)
TextureUnitState * createTextureUnitState(const String &textureName, unsigned short texCoordSet=0)
Inserts a new TextureUnitState object into the Pass.
GpuProgramParametersSharedPtr getTesselationHullProgramParameters(void) const
Gets the Tesselation Hull program parameters used by this pass.
const GpuProgramPtr & getTesselationHullProgram(void) const
Gets the Tesselation Hull program used by this pass, only available after _load().
uint32 mHash
Optional name for the pass.
Definition OgrePass.h:103
GpuProgramParametersSharedPtr getShadowReceiverFragmentProgramParameters(void) const
Gets the fragment program parameters used by this pass when rendering shadow receivers.
bool mLightScissoring
Scissoring for the light?
Definition OgrePass.h:238
const ColourValue & getAmbient(void) const
Gets the ambient colour reflectance of the pass.
FogMode getFogMode(void) const
Returns the fog mode for this pass.
Light::LightTypes mOnlyLightType
Definition OgrePass.h:176
bool mLightClipPlanes
User clip planes for light?
Definition OgrePass.h:240
ConstTextureUnitStateIterator getTextureUnitStateIterator(void) const
Get an iterator over the TextureUnitStates contained in this Pass.
virtual bool getPolygonModeOverrideable(void) const
Gets whether this renderable's chosen detail level can be overridden (downgraded) by the camera setti...
Definition OgrePass.h:953
SceneBlendOperation getSceneBlendingOperationAlpha() const
Returns the current alpha blending operation.
GpuProgramUsage * mComputeProgramUsage
Compute program details.
Definition OgrePass.h:220
BuiltinHashFunction
There are some default hash functions used to order passes so that render state changes are minimised...
Definition OgrePass.h:1705
@ MIN_TEXTURE_CHANGE
Try to minimise the number of texture changes.
Definition OgrePass.h:1707
Real getFogEnd(void) const
Returns the fog end distance for this pass.
TextureUnitStates mTextureUnitStates
Definition OgrePass.h:199
const ColourValue & getSelfIllumination(void) const
Gets the self illumination colour of the pass.
void setLightClipPlanesEnabled(bool enabled)
Gets whether or not this pass will be clipped by user clips planes bounding the area covered by the l...
Definition OgrePass.h:1671
unsigned char mAlphaRejectVal
Definition OgrePass.h:149
const String & getResourceGroup(void) const
Gets the resource group of the ultimate parent Material.
vector< TextureUnitState * >::type TextureUnitStates
Storage of texture unit states.
Definition OgrePass.h:198
float getDepthBiasSlopeScale(void) const
Retrieves the slope-scale depth bias value as set by setDepthBias.
bool applyTextureAliases(const AliasTextureNamePairList &aliasList, const bool apply=true) const
Applies texture names to Texture Unit State with matching texture name aliases.
void setLightScissoringEnabled(bool enabled)
Sets whether or not this pass will be clipped by a scissor rectangle encompassing the lights that are...
Definition OgrePass.h:1642
bool getLightScissoringEnabled() const
Gets whether or not this pass will be clipped by a scissor rectangle encompassing the lights that are...
Definition OgrePass.h:1646
size_t mPassIterationCount
Number of pass iterations to perform.
Definition OgrePass.h:224
void setPassIterationCount(const size_t count)
set the number of iterations that this pass should perform when doing fast multi pass operation.
Definition OgrePass.h:1603
float mDepthBiasPerIteration
Definition OgrePass.h:142
Pass(Technique *parent, unsigned short index, const Pass &oth)
Copy constructor.
void setPointSize(Real ps)
Sets the point size of this pass.
void setTransparentSortingEnabled(bool enabled)
Sets whether or not transparent sorting is enabled.
Real mPointMinSize
Definition OgrePass.h:227
const UserObjectBindings & getUserObjectBindings() const
Return an instance of user objects binding associated with this class.
Definition OgrePass.h:1759
void setFragmentProgram(const String &name, bool resetParams=true)
Sets the details of the fragment program to use.
void setVertexColourTracking(TrackVertexColourType tracking)
Sets which material properties follow the vertex colour.
void setIlluminationStage(IlluminationStage is)
Manually set which illumination stage this pass is a member of.
Definition OgrePass.h:1698
float mDepthBiasConstant
Definition OgrePass.h:140
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 this pass.
set< Pass * >::type PassSet
Definition OgrePass.h:251
GpuProgramUsage * mVertexProgramUsage
Vertex program details.
Definition OgrePass.h:202
bool mDepthWrite
Definition OgrePass.h:138
bool isLoaded(void) const
Is this loaded?
void _recalculateHash(void)
Internal method for recalculating the hash.
TrackVertexColourType getVertexColourTracking(void) const
Gets which material properties follow the vertex colour.
Light::LightTypes getOnlyLightType() const
Gets the single light type this pass runs for if getIteratePerLight and getRunOnlyForOneLightType are...
Definition OgrePass.h:1185
bool hasTesselationHullProgram(void) const
Returns true if this pass uses a programmable tesselation control pipeline.
Definition OgrePass.h:283
FogMode mFogMode
Definition OgrePass.h:190
void setTextureAnisotropy(unsigned int maxAniso)
Sets the anisotropy level to be used for all textures.
static PassSet msPassGraveyard
The place where passes go to die.
Definition OgrePass.h:256
bool getFogOverride(void) const
Returns true if this pass is to override the scene fog settings.
void setManualCullingMode(ManualCullingMode mode)
Sets the manual culling mode, performed by CPU rather than hardware.
bool mNormaliseNormals
Normalisation.
Definition OgrePass.h:185
unsigned short mMaxSimultaneousLights
Max simultaneous lights.
Definition OgrePass.h:167
void setColourWriteEnabled(bool enabled)
Sets whether or not colour buffer writing is enabled for this Pass.
String mName
Pass index.
Definition OgrePass.h:102
void setTesselationDomainProgram(const String &name, bool resetParams=true)
Sets the details of the tesselation domain program to use.
const GpuProgramPtr & getTesselationDomainProgram(void) const
Gets the Tesselation Domain program used by this pass, only available after _load().
void _dirtyHash(void)
Mark the hash as dirty.
unsigned short getLightCountPerIteration(void) const
If light iteration is enabled, determine the number of lights per iteration.
void setPointMaxSize(Real max)
Set the maximum point size, when point attenuation is in use.
const GpuProgramPtr & getShadowCasterVertexProgram(void) const
Gets the vertex program used by this pass when rendering shadow casters, only available after _load()...
PolygonMode getPolygonMode(void) const
Returns the type of light shading to be used.
GpuProgramParametersSharedPtr getGeometryProgramParameters(void) const
Gets the geometry program parameters used by this pass.
Real getPointAttenuationQuadratic(void) const
Returns the quadratic coefficient of point attenuation.
bool isProgrammable(void) const
Returns true if this pass is programmable i.e. includes either a vertex or fragment program.
Definition OgrePass.h:273
bool getTransparentSortingEnabled(void) const
Returns whether or not transparent sorting is enabled.
const String & getShadowCasterFragmentProgramName(void) const
Gets the name of the fragment program used by this pass when rendering shadow casters.
Pass & operator=(const Pass &oth)
Operator = overload.
void setShadowCasterFragmentProgramParameters(GpuProgramParametersSharedPtr params)
Sets the fragment program parameters for rendering as a shadow caster.
Technique * mParent
Definition OgrePass.h:100
void setSelfIllumination(const ColourValue &selfIllum)
Sets the amount of self-illumination an object has.
TrackVertexColourType mTracking
Definition OgrePass.h:112
void setAlphaRejectFunction(CompareFunction func)
Sets the alpha reject function.
bool hasShadowCasterVertexProgram(void) const
Returns true if this pass uses a shadow caster vertex program.
Definition OgrePass.h:289
void setSelfIllumination(Real red, Real green, Real blue)
Sets the amount of self-illumination an object has.
bool getColourWriteEnabled(void) const
Determines if colour buffer writing is enabled for this pass.
GpuProgramUsage * mShadowCasterFragmentProgramUsage
Fragment program details.
Definition OgrePass.h:206
unsigned short getStartLight(void) const
Gets the light index that this pass will start at in the light list.
ShadeOptions getShadingMode(void) const
Returns the type of light shading to be used.
ColourValue mAmbient
Needs to be dirtied when next loaded.
Definition OgrePass.h:107
void _unload(void)
Internal method for unloading this pass.
void setShadowCasterVertexProgramParameters(GpuProgramParametersSharedPtr params)
Sets the vertex program parameters for rendering as a shadow caster.
const String & getTesselationDomainProgramName(void) const
Gets the name of the Domain Evaluation program used by this pass.
void setTextureFiltering(TextureFilterOptions filterType)
Set texture filtering for every texture unit.
UserObjectBindings mUserObjectBindings
User objects binding.
Definition OgrePass.h:244
ColourValue mEmissive
Definition OgrePass.h:110
static HashFunc * msHashFunc
The Pass hash functor.
Definition OgrePass.h:258
void setAmbient(Real red, Real green, Real blue)
Sets the ambient colour reflectance properties of this pass.
bool getIteratePerLight(void) const
Does this pass run once for every light in range?
Definition OgrePass.h:1180
uint32 getHash(void) const
Gets the 'hash' of this pass, ie a precomputed number to use for sorting.
Definition OgrePass.h:1500
unsigned short getTextureUnitStateIndex(const TextureUnitState *state) const
Retrieve the index of the Texture Unit State in the pass.
void setPolygonMode(PolygonMode mode)
Sets the type of polygon rendering required.
bool hasVertexProgram(void) const
Returns true if this pass uses a programmable vertex pipeline.
Definition OgrePass.h:277
const GpuProgramPtr & getShadowReceiverVertexProgram(void) const
Gets the vertex program used by this pass when rendering shadow receivers, only available after _load...
void setLightingEnabled(bool enabled)
Sets whether or not dynamic lighting is enabled.
bool getDepthCheckEnabled(void) const
Returns whether or not this pass renders with depth-buffer checking on or not.
void removeTextureUnitState(unsigned short index)
Removes the indexed texture unit state from this pass.
void setSpecular(const ColourValue &specular)
Sets the specular colour reflectance properties of this pass.
ColourValue mDiffuse
Definition OgrePass.h:108
bool mPolygonModeOverrideable
Definition OgrePass.h:186
const GpuProgramPtr & getVertexProgram(void) const
Gets the vertex program used by this pass, only available after _load().
void setDiffuse(const ColourValue &diffuse)
Sets the diffuse colour reflectance properties of this pass.
static void setHashFunction(BuiltinHashFunction builtin)
Sets one of the default hash functions to be used.
const GpuProgramPtr & getShadowReceiverFragmentProgram(void) const
Gets the fragment program used by this pass when rendering shadow receivers, only available after _lo...
CullingMode mCullMode
Definition OgrePass.h:160
void setSceneBlending(const SceneBlendFactor sourceFactor, const SceneBlendFactor destFactor)
Allows very fine control of blending this Pass with the existing contents of the scene.
bool mRunOnlyForOneLightType
Should it only be run for a certain light type?
Definition OgrePass.h:175
ColourValue mFogColour
Definition OgrePass.h:191
void setShadowCasterVertexProgram(const String &name)
Sets the details of the vertex program to use when rendering as a shadow caster.
ContentTypeLookup mShadowContentTypeLookup
Definition OgrePass.h:235
void _notifyNeedsRecompile(void)
Tells the pass that it needs recompilation.
UserObjectBindings & getUserObjectBindings()
Return an instance of user objects binding associated with this class.
Definition OgrePass.h:1753
void setAlphaRejectValue(unsigned char val)
Gets the alpha reject value.
unsigned short mIndex
Definition OgrePass.h:101
bool mTransparentSorting
Transparent depth sorting.
Definition OgrePass.h:153
virtual ~Pass()
void setPointMinSize(Real min)
Set the minimum point size, when point attenuation is in use.
const String & getShadowReceiverFragmentProgramName(void) const
Gets the name of the fragment program used by this pass when rendering shadow receivers.
bool hasGeometryProgram(void) const
Returns true if this pass uses a programmable geometry pipeline.
Definition OgrePass.h:281
size_t calculateSize(void) const
bool hasShadowReceiverVertexProgram(void) const
Returns true if this pass uses a shadow receiver vertex program.
Definition OgrePass.h:293
IlluminationStage getIlluminationStage() const
Get the manually assigned illumination stage, if any.
Definition OgrePass.h:1700
Real getFogStart(void) const
Returns the fog start distance for this pass.
IlluminationStage mIlluminationStage
Illumination stage?
Definition OgrePass.h:242
float mDepthBiasSlopeScale
Definition OgrePass.h:141
static PassSet msDirtyHashList
List of Passes whose hashes need recalculating.
Definition OgrePass.h:254
bool mColourWrite
Colour buffer settings.
Definition OgrePass.h:145
void setTesselationDomainProgramParameters(GpuProgramParametersSharedPtr params)
Sets the Tesselation Domain program parameters.
Real mPointMaxSize
Definition OgrePass.h:228
bool mFogOverride
Definition OgrePass.h:189
Pass(Technique *parent, unsigned short index)
Default constructor.
TextureUnitState * getTextureUnitState(unsigned short index)
Retrieves a pointer to a texture unit state so it may be modified.
const ColourValue & getDiffuse(void) const
Gets the diffuse colour reflectance of the pass.
void setShininess(Real val)
Sets the shininess of the pass, affecting the size of specular highlights.
GpuProgramParametersSharedPtr getShadowReceiverVertexProgramParameters(void) const
Gets the vertex program parameters used by this pass when rendering shadow receivers.
unsigned char getAlphaRejectValue(void) const
Gets the alpha reject value.
Definition OgrePass.h:1086
unsigned short mLightsPerIteration
Iterate per how many lights?
Definition OgrePass.h:173
bool getNormaliseNormals(void) const
Returns true if this pass has auto-normalisation of normals set.
Definition OgrePass.h:1560
bool isTransparent(void) const
Returns true if this pass has some element of transparency.
bool hasFragmentProgram(void) const
Returns true if this pass uses a programmable fragment pipeline.
Definition OgrePass.h:279
void setTesselationHullProgram(const String &name, bool resetParams=true)
Support for shader model 5.0, hull and domain shaders.
void removeAllTextureUnitStates(void)
Removes all texture unit settings.
void setShadowReceiverFragmentProgramParameters(GpuProgramParametersSharedPtr params)
Sets the fragment program parameters for rendering as a shadow receiver.
GpuProgramParametersSharedPtr getComputeProgramParameters(void) const
Gets the Tesselation Hull program parameters used by this pass.
GpuProgramParametersSharedPtr getFragmentProgramParameters(void) const
Gets the fragment program parameters used by this pass.
void setCullingMode(CullingMode mode)
Sets the culling mode for this pass based on the 'vertex winding'.
CompareFunction mDepthFunc
Definition OgrePass.h:139
TextureUnitState * getTextureUnitState(const String &name)
Retrieves the Texture Unit State matching name.
void setStartLight(unsigned short startLight)
Sets the light index that this pass will start at in the light list.
void setShadowReceiverVertexProgram(const String &name)
Sets the details of the vertex program to use when rendering as a shadow receiver.
void setSpecular(Real red, Real green, Real blue, Real alpha)
Sets the specular colour reflectance properties of this pass.
GpuProgramUsage * mShadowReceiverVertexProgramUsage
Vertex program details.
Definition OgrePass.h:208
bool hasSeparateSceneBlendingOperations() const
Returns true if this pass uses separate scene blending operations.
Real getPointMinSize(void) const
Get the minimum point size, when point attenuation is in use.
static const PassSet & getDirtyHashList(void)
Static method to retrieve all the Passes which need their hash values recalculated.
Definition OgrePass.h:1565
SceneBlendFactor getDestBlendFactor() const
Retrieves the destination blending factor for the material (as set using Materiall::setSceneBlending)...
unsigned short _getTextureUnitWithContentTypeIndex(TextureUnitState::ContentType contentType, unsigned short index) const
Gets the 'nth' texture which references the given content type.
uint32 getLightMask() const
Gets the light mask controlling which lights are used for this pass.
bool isAmbientOnly(void) const
Returns whether this pass is ambient only.
TextureUnitState * createTextureUnitState(void)
Inserts a new TextureUnitState object into the Pass.
void _unprepare(void)
Internal method for undoing the load preparartion for this pass.
const GpuProgramPtr & getComputeProgram(void) const
Gets the Tesselation EHull program used by this pass, only available after _load().
SceneBlendFactor mDestBlendFactorAlpha
Definition OgrePass.h:120
unsigned short mStartLight
Starting light index.
Definition OgrePass.h:169
void setMaxSimultaneousLights(unsigned short maxLights)
Sets the maximum number of lights to be used by this pass.
void setPointSpritesEnabled(bool enabled)
Sets whether or not rendering points using OT_POINT_LIST will render point sprites (textured quads) o...
bool getTransparentSortingForced(void) const
Returns whether or not transparent sorting is forced.
void setComputeProgram(const String &name, bool resetParams=true)
Sets the details of the compute program to use.
static void processPendingPassUpdates(void)
Process all dirty and pending deletion passes.
ConstVectorIterator< TextureUnitStates > ConstTextureUnitStateIterator
Definition OgrePass.h:601
void setSceneBlendingOperation(SceneBlendOperation op)
Sets the specific operation used to blend source and destination pixels together.
bool mAlphaToCoverageEnabled
Definition OgrePass.h:150
Real mFogDensity
Definition OgrePass.h:194
void setLightMask(uint32 mask)
Sets the light mask which can be matched to specific light flags to be handled by this pass.
void setAlphaRejectSettings(CompareFunction func, unsigned char value, bool alphaToCoverageEnabled=false)
Sets the way the pass will have use alpha to totally reject pixels from the pipeline.
void setTesselationHullProgramParameters(GpuProgramParametersSharedPtr params)
Sets the Tesselation Hull program parameters.
SceneBlendFactor mDestBlendFactor
Definition OgrePass.h:118
void setEmissive(Real red, Real green, Real blue)
Sets the amount of self-illumination an object has.
Definition OgrePass.h:411
uint32 mLightMask
With a specific light mask?
Definition OgrePass.h:178
void setDepthBias(float constantBias, float slopeScaleBias=0.0f)
Sets the depth bias to be used for this material.
void _getBlendFlags(SceneBlendType type, SceneBlendFactor &source, SceneBlendFactor &dest)
Used to get scene blending flags from a blending type.
void setSeparateSceneBlending(const SceneBlendFactor sourceFactor, const SceneBlendFactor destFactor, const SceneBlendFactor sourceFactorAlpha, const SceneBlendFactor destFactorAlpha)
Allows very fine control of blending this Pass with the existing contents of the scene.
Real mFogStart
Definition OgrePass.h:192
CompareFunction mAlphaRejectFunc
Definition OgrePass.h:148
SceneBlendFactor getDestBlendFactorAlpha() const
Retrieves the alpha destination blending factor for the material (as set using Materiall::setSeparate...
bool mTransparentSortingForced
Transparent depth sorting forced.
Definition OgrePass.h:155
bool mQueuedForDeletion
Is this pass queued for deletion?
Definition OgrePass.h:222
Technique * getParent(void) const
Gets the parent Technique.
Definition OgrePass.h:1203
bool mSeparateBlend
Definition OgrePass.h:123
GpuProgramParametersSharedPtr getShadowCasterVertexProgramParameters(void) const
Gets the vertex program parameters used by this pass when rendering shadow casters.
void setDepthWriteEnabled(bool enabled)
Sets whether or not this pass renders with depth-buffer writing on or not.
void setShadowCasterFragmentProgram(const String &name)
Sets the details of the fragment program to use when rendering as a shadow caster.
void setShadowReceiverVertexProgramParameters(GpuProgramParametersSharedPtr params)
Sets the vertex program parameters for rendering as a shadow receiver.
const TextureUnitState * getTextureUnitState(const String &name) const
Retrieves the Texture Unit State matching name.
bool hasSeparateSceneBlending() const
Return true if this pass uses separate scene blending.
ColourValue mSpecular
Definition OgrePass.h:109
OGRE_STATIC_MUTEX(msPassGraveyardMutex)
bool getDepthWriteEnabled(void) const
Returns whether or not this pass renders with depth-buffer writing on or not.
OGRE_MUTEX(mGpuProgramChangeMutex)
Pass * _split(unsigned short numUnits)
Splits this Pass to one which can be handled in the number of texture units specified.
Real getPointAttenuationConstant(void) const
Returns the constant coefficient of point attenuation.
bool mHashDirtyQueued
Pass hash.
Definition OgrePass.h:104
const String & getName(void) const
Get the name of the pass.
Definition OgrePass.h:308
void _prepare(void)
Internal method for preparing to load this pass.
void setVertexProgram(const String &name, bool resetParams=true)
Sets the details of the vertex program to use.
Real getPointSize(void) const
Gets the point size of the pass.
const ColourValue & getEmissive(void) const
Gets the self illumination colour of the pass.
Definition OgrePass.h:539
bool getLightingEnabled(void) const
Returns whether or not dynamic lighting is enabled.
bool mPointSpritesEnabled
Definition OgrePass.h:229
unsigned short getMaxSimultaneousLights(void) const
Gets the maximum number of lights to be used by this pass.
void setAmbient(const ColourValue &ambient)
Sets the ambient colour reflectance properties of this pass.
GpuProgramParametersSharedPtr getVertexProgramParameters(void) const
Gets the vertex program parameters used by this pass.
GpuProgramUsage * mGeometryProgramUsage
Geometry program details.
Definition OgrePass.h:214
bool mContentTypeLookupBuilt
Definition OgrePass.h:236
TextureUnitStateIterator getTextureUnitStateIterator(void)
Get an iterator over the TextureUnitStates contained in this Pass.
void _load(void)
Internal method for loading this pass.
const GpuProgramPtr & getGeometryProgram(void) const
Gets the geometry program used by this pass, only available after _load().
GpuProgramParametersSharedPtr getShadowCasterFragmentProgramParameters(void) const
Gets the fragment program parameters used by this pass when rendering shadow casters.
static const PassSet & getPassGraveyard(void)
Static method to retrieve all the Passes which are pending deletion.
Definition OgrePass.h:1569
VectorIterator< TextureUnitStates > TextureUnitStateIterator
Definition OgrePass.h:597
bool mSeparateBlendOperation
Determines if we should use separate blending operations for color and alpha channels.
Definition OgrePass.h:131
void setIterationDepthBias(float biasPerIteration)
Sets a factor which derives an additional depth bias from the number of times a pass is iterated.
GpuProgramUsage * mFragmentProgramUsage
Fragment program details.
Definition OgrePass.h:210
ManualCullingMode getManualCullingMode(void) const
Retrieves the manual culling mode for this pass.
void setSeparateSceneBlendingOperation(SceneBlendOperation op, SceneBlendOperation alphaOp)
Sets the specific operation used to blend source and destination pixels together.
void setNormaliseNormals(bool normalise)
If set to true, this forces normals to be normalised dynamically by the hardware for this pass.
Definition OgrePass.h:1557
Real mPointSize
Point size, applies when not using per-vertex point size.
Definition OgrePass.h:226
vector< unsignedshort >::type ContentTypeLookup
Definition OgrePass.h:234
const TextureUnitState * getTextureUnitState(unsigned short index) const
Retrieves a const pointer to a texture unit state.
const GpuProgramPtr & getFragmentProgram(void) const
Gets the fragment program used by this pass, only available after _load().
void _updateAutoParams(const AutoParamDataSource *source, uint16 variabilityMask) const
Update automatic parameters.
bool hasComputeProgram(void) const
Returns true if this pass uses a programmable compute pipeline.
Definition OgrePass.h:287
const String & getGeometryProgramName(void) const
Gets the name of the geometry program used by this pass.
const String & getVertexProgramName(void) const
Gets the name of the vertex program used by this pass.
PolygonMode mPolygonMode
Polygon mode.
Definition OgrePass.h:183
ManualCullingMode mManualCullMode
Definition OgrePass.h:161
size_t getPassIterationCount(void) const
Gets the pass iteration count value.
Definition OgrePass.h:1607
void setComputeProgramParameters(GpuProgramParametersSharedPtr params)
Sets the Tesselation Evaluation program parameters.
bool isAlphaToCoverageEnabled() const
Gets whether to use alpha to coverage (A2C) when blending alpha rejected values.
Definition OgrePass.h:1099
Real getPointAttenuationLinear(void) const
Returns the linear coefficient of point attenuation.
bool hasShadowReceiverFragmentProgram(void) const
Returns true if this pass uses a shadow receiver fragment program.
Definition OgrePass.h:295
const ColourValue & getSpecular(void) const
Gets the specular colour reflectance of the pass.
static HashFunc * getHashFunction(void)
Get the hash function used for all passes.
Definition OgrePass.h:1743
void setTransparentSortingForced(bool enabled)
Sets whether or not transparent sorting is forced.
float getIterationDepthBias() const
Gets a factor which derives an additional depth bias from the number of times a pass is iterated.
void setShadingMode(ShadeOptions mode)
Sets the type of light shading required.
GpuProgramUsage * mShadowReceiverFragmentProgramUsage
Fragment program details.
Definition OgrePass.h:212
Real getFogDensity(void) const
Returns the fog density for this pass.
void setAlphaToCoverageEnabled(bool enabled)
Sets whether to use alpha to coverage (A2C) when blending alpha rejected values.
GpuProgramUsage * mTesselationDomainProgramUsage
Tesselation domain program details.
Definition OgrePass.h:218
CompareFunction getAlphaRejectFunction(void) const
Gets the alpha reject function.
Definition OgrePass.h:1082
const GpuProgramPtr & getShadowCasterFragmentProgram(void) const
Gets the fragment program used by this pass when rendering shadow casters, only available after _load...
void setSceneBlending(const SceneBlendType sbt)
Sets the kind of blending this pass has with the existing contents of the scene.
bool hasShadowCasterFragmentProgram(void) const
Returns true if this pass uses a shadow caster fragment program.
Definition OgrePass.h:291
void setDiffuse(Real red, Real green, Real blue, Real alpha)
Sets the diffuse colour reflectance properties of this pass.
bool hasTesselationDomainProgram(void) const
Returns true if this pass uses a programmable tesselation control pipeline.
Definition OgrePass.h:285
void setDepthCheckEnabled(bool enabled)
Sets whether or not this pass renders with depth-buffer checking on or not.
virtual void setPolygonModeOverrideable(bool override)
Sets whether this pass's chosen detail level can be overridden (downgraded) by the camera setting.
Definition OgrePass.h:945
void setEmissive(const ColourValue &emissive)
Sets the amount of self-illumination an object has.
Definition OgrePass.h:431
Real mShininess
Definition OgrePass.h:111
GpuProgramUsage * mShadowCasterVertexProgramUsage
Vertex program details.
Definition OgrePass.h:204
void setFragmentProgramParameters(GpuProgramParametersSharedPtr params)
Sets the fragment program parameters.
unsigned short getNumTextureUnitStates(void) const
Returns the number of texture unit settings.
Definition OgrePass.h:617
Real getPointMaxSize(void) const
Get the maximum point size, when point attenuation is in use.
void queueForDeletion(void)
Queue this pass for deletion when appropriate.
SceneBlendFactor getSourceBlendFactor() const
Retrieves the source blending factor for the material (as set using Materiall::setSceneBlending).
const ColourValue & getFogColour(void) const
Returns the fog colour for the scene.
void setIteratePerLight(bool enabled, bool onlyForOneLightType=true, Light::LightTypes lightType=Light::LT_POINT)
Sets whether or not this pass should iterate per light or number of lights which can affect the objec...
CompareFunction getDepthFunction(void) const
Returns the function used to compare depth values when depth checking is on.
CullingMode getCullingMode(void) const
Returns the culling mode for geometry rendered with this pass.
void setDepthFunction(CompareFunction func)
Sets the function used to compare depth values when depth checking is on.
void setSeparateSceneBlending(const SceneBlendType sbt, const SceneBlendType sbta)
Sets the kind of blending this pass has with the existing contents of the scene, separately for color...
bool mIteratePerLight
Run this pass once per light?
Definition OgrePass.h:171
const String & getShadowReceiverVertexProgramName(void) const
Gets the name of the vertex program used by this pass when rendering shadow receivers.
Real getShininess(void) const
Gets the 'shininess' property of the pass (affects specular highlights).
static void clearDirtyHashList(void)
Static method to reset the list of passes which need their hash values recalculated.
const String & getTesselationHullProgramName(void) const
Gets the name of the Tesselation Hull program used by this pass.
OGRE_MUTEX(mTexUnitChangeMutex)
bool mDepthCheck
Definition OgrePass.h:137
const String & getShadowCasterVertexProgramName(void) const
Gets the name of the vertex program used by this pass when rendering shadow casters.
bool isPointAttenuationEnabled(void) const
Returns whether points are attenuated with distance.
void setShadowReceiverFragmentProgram(const String &name)
This method allows you to specify a fragment program for use when rendering a texture shadow receiver...
void setGeometryProgram(const String &name, bool resetParams=true)
Sets the details of the geometry program to use.
bool getPointSpritesEnabled(void) const
Returns whether point sprites are enabled when rendering a point list.
Real mFogEnd
Definition OgrePass.h:193
static HashFunc * getBuiltinHashFunction(BuiltinHashFunction builtin)
Get the builtin hash function.
bool mLightingEnabled
Lighting enabled?
Definition OgrePass.h:165
void _notifyIndex(unsigned short index)
Internal method to adjust pass index.
SceneBlendOperation mBlendOperation
Definition OgrePass.h:127
unsigned short getIndex(void) const
Gets the index of this Pass in the parent Technique.
Definition OgrePass.h:300
void setVertexProgramParameters(GpuProgramParametersSharedPtr params)
Sets the vertex program parameters.
void setGeometryProgramParameters(GpuProgramParametersSharedPtr params)
Sets the geometry program parameters.
static void setHashFunction(HashFunc *hashFunc)
Set the hash function used for all passes.
Definition OgrePass.h:1739
Class representing an approach to rendering this particular Material.
Class representing the state of a single texture unit during a Pass of a Technique,...
ContentType
Enum identifying the type of content this texture unit contains.
Class that provides convenient interface to establish a linkage between custom user application objec...
Concrete IteratorWrapper for nonconst access to the underlying container.
CompareFunction
Comparison functions used for the depth/stencil buffer operations and others.
Definition OgreCommon.h:65
ManualCullingMode
Manual culling modes based on vertex normals.
Definition OgreCommon.h:151
TextureFilterOptions
High-level filtering options providing shortcuts to settings the minification, magnification and mip ...
Definition OgreCommon.h:79
map< String, String >::type AliasTextureNamePairList
Alias / Texture name pair (first = alias, second = texture name)
Definition OgreCommon.h:553
PolygonMode
The polygon mode to use when rasterising.
Definition OgreCommon.h:180
ShadeOptions
Light shading modes.
Definition OgreCommon.h:114
FogMode
Fog modes.
Definition OgreCommon.h:122
CullingMode
Hardware culling modes based on vertex winding.
Definition OgreCommon.h:136
int TrackVertexColourType
An enumeration describing which material properties should track the vertex colours.
Definition OgreCommon.h:276
IlluminationStage
Categorisation of passes for the purpose of additive lighting.
Definition OgrePass.h:50
SceneBlendFactor
Blending factors for manually blending objects with the scene.
vector< IlluminationPass * >::type IlluminationPassList
Definition OgrePass.h:1872
SceneBlendOperation
Blending operations controls how objects are blended into the scene.
SceneBlendType
Types of blending that you can specify between an object and the existing contents of the scene.
@ IS_PER_LIGHT
Part of the rendering which occurs per light.
Definition OgrePass.h:54
@ IS_DECAL
Post-lighting rendering.
Definition OgrePass.h:56
@ IS_UNKNOWN
Not determined.
Definition OgrePass.h:58
@ IS_AMBIENT
Part of the rendering which occurs without any kind of direct lighting.
Definition OgrePass.h:52
float Real
Software floating point type.
unsigned short uint16
unsigned int uint32
_StringBase String
Struct recording a pass which can be used for a specific illumination stage.
Definition OgrePass.h:1860
Pass * originalPass
The original pass which spawned this one.
Definition OgrePass.h:1867
Pass * pass
The pass to use in this stage.
Definition OgrePass.h:1863
IlluminationStage stage
Definition OgrePass.h:1861
bool destroyOnShutdown
Whether this pass is one which should be deleted itself.
Definition OgrePass.h:1865
Definition of a functor for calculating the hashcode of a Pass.
Definition OgrePass.h:94
virtual ~HashFunc()
Need virtual destructor in case subclasses use it.
Definition OgrePass.h:97
virtual uint32 operator()(const Pass *p) const =0
std::set< T, P, A > type
std::vector< T, A > type