[3] | 1 | /* |
---|
| 2 | ----------------------------------------------------------------------------- |
---|
| 3 | This source file is part of OGRE |
---|
| 4 | (Object-oriented Graphics Rendering Engine) |
---|
| 5 | For the latest info, see http://www.ogre3d.org |
---|
| 6 | |
---|
| 7 | Copyright (c) 2000-2006 Torus Knot Software Ltd |
---|
| 8 | Also see acknowledgements in Readme.html |
---|
| 9 | |
---|
| 10 | This program is free software; you can redistribute it and/or modify it under |
---|
| 11 | the terms of the GNU Lesser General Public License as published by the Free Software |
---|
| 12 | Foundation; either version 2 of the License, or (at your option) any later |
---|
| 13 | version. |
---|
| 14 | |
---|
| 15 | This program is distributed in the hope that it will be useful, but WITHOUT |
---|
| 16 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
---|
| 17 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. |
---|
| 18 | |
---|
| 19 | You should have received a copy of the GNU Lesser General Public License along with |
---|
| 20 | this program; if not, write to the Free Software Foundation, Inc., 59 Temple |
---|
| 21 | Place - Suite 330, Boston, MA 02111-1307, USA, or go to |
---|
| 22 | http://www.gnu.org/copyleft/lesser.txt. |
---|
| 23 | |
---|
| 24 | You may alternatively use this source under the terms of a specific version of |
---|
| 25 | the OGRE Unrestricted License provided you have obtained such a license from |
---|
| 26 | Torus Knot Software Ltd. |
---|
| 27 | ----------------------------------------------------------------------------- |
---|
| 28 | */ |
---|
| 29 | #ifndef __Pass_H__ |
---|
| 30 | #define __Pass_H__ |
---|
| 31 | |
---|
| 32 | #include "OgrePrerequisites.h" |
---|
| 33 | #include "OgreGpuProgram.h" |
---|
| 34 | #include "OgreColourValue.h" |
---|
| 35 | #include "OgreBlendMode.h" |
---|
| 36 | #include "OgreCommon.h" |
---|
| 37 | #include "OgreLight.h" |
---|
| 38 | #include "OgreTextureUnitState.h" |
---|
| 39 | |
---|
| 40 | namespace Ogre { |
---|
| 41 | /** Class defining a single pass of a Technique (of a Material), ie |
---|
| 42 | a single rendering call. |
---|
| 43 | @remarks |
---|
| 44 | Rendering can be repeated with many passes for more complex effects. |
---|
| 45 | Each pass is either a fixed-function pass (meaning it does not use |
---|
| 46 | a vertex or fragment program) or a programmable pass (meaning it does |
---|
| 47 | use either a vertex and fragment program, or both). |
---|
| 48 | @par |
---|
| 49 | Programmable passes are complex to define, because they require custom |
---|
| 50 | programs and you have to set all constant inputs to the programs (like |
---|
| 51 | the position of lights, any base material colours you wish to use etc), but |
---|
| 52 | they do give you much total flexibility over the algorithms used to render your |
---|
| 53 | pass, and you can create some effects which are impossible with a fixed-function pass. |
---|
| 54 | On the other hand, you can define a fixed-function pass in very little time, and |
---|
| 55 | you can use a range of fixed-function effects like environment mapping very |
---|
| 56 | easily, plus your pass will be more likely to be compatible with older hardware. |
---|
| 57 | There are pros and cons to both, just remember that if you use a programmable |
---|
| 58 | pass to create some great effects, allow more time for definition and testing. |
---|
| 59 | */ |
---|
| 60 | class _OgreExport Pass |
---|
| 61 | { |
---|
| 62 | public: |
---|
| 63 | /** Definition of a functor for calculating the hashcode of a Pass. |
---|
| 64 | @remarks |
---|
| 65 | The hashcode of a Pass is used to sort Passes for rendering, in order |
---|
| 66 | to reduce the number of render state changes. Each Pass represents a |
---|
| 67 | single unique set of states, but by ordering them, state changes can |
---|
| 68 | be minimised between passes. An implementation of this functor should |
---|
| 69 | order passes so that the elements that you want to keep constant are |
---|
| 70 | sorted next to each other. |
---|
| 71 | @see Pass::setHashFunc |
---|
| 72 | */ |
---|
| 73 | struct HashFunc |
---|
| 74 | { |
---|
| 75 | virtual uint32 operator()(const Pass* p) const = 0; |
---|
| 76 | /// Need virtual destructor in case subclasses use it |
---|
| 77 | virtual ~HashFunc() {} |
---|
| 78 | }; |
---|
| 79 | protected: |
---|
| 80 | Technique* mParent; |
---|
| 81 | unsigned short mIndex; // pass index |
---|
| 82 | String mName; // optional name for the pass |
---|
| 83 | uint32 mHash; // pass hash |
---|
| 84 | //------------------------------------------------------------------------- |
---|
| 85 | // Colour properties, only applicable in fixed-function passes |
---|
| 86 | ColourValue mAmbient; |
---|
| 87 | ColourValue mDiffuse; |
---|
| 88 | ColourValue mSpecular; |
---|
| 89 | ColourValue mEmissive; |
---|
| 90 | Real mShininess; |
---|
| 91 | TrackVertexColourType mTracking; |
---|
| 92 | //------------------------------------------------------------------------- |
---|
| 93 | |
---|
| 94 | //------------------------------------------------------------------------- |
---|
| 95 | // Blending factors |
---|
| 96 | SceneBlendFactor mSourceBlendFactor; |
---|
| 97 | SceneBlendFactor mDestBlendFactor; |
---|
| 98 | //------------------------------------------------------------------------- |
---|
| 99 | |
---|
| 100 | //------------------------------------------------------------------------- |
---|
| 101 | // Depth buffer settings |
---|
| 102 | bool mDepthCheck; |
---|
| 103 | bool mDepthWrite; |
---|
| 104 | CompareFunction mDepthFunc; |
---|
| 105 | float mDepthBiasConstant; |
---|
| 106 | float mDepthBiasSlopeScale; |
---|
| 107 | |
---|
| 108 | // Colour buffer settings |
---|
| 109 | bool mColourWrite; |
---|
| 110 | |
---|
| 111 | // Alpha reject settings |
---|
| 112 | CompareFunction mAlphaRejectFunc; |
---|
| 113 | unsigned char mAlphaRejectVal; |
---|
| 114 | //------------------------------------------------------------------------- |
---|
| 115 | |
---|
| 116 | //------------------------------------------------------------------------- |
---|
| 117 | // Culling mode |
---|
| 118 | CullingMode mCullMode; |
---|
| 119 | ManualCullingMode mManualCullMode; |
---|
| 120 | //------------------------------------------------------------------------- |
---|
| 121 | |
---|
| 122 | /// Lighting enabled? |
---|
| 123 | bool mLightingEnabled; |
---|
| 124 | /// Max simultaneous lights |
---|
| 125 | unsigned short mMaxSimultaneousLights; |
---|
| 126 | /// Starting light index |
---|
| 127 | unsigned short mStartLight; |
---|
| 128 | /// Run this pass once per light? |
---|
| 129 | bool mIteratePerLight; |
---|
| 130 | /// Iterate per how many lights? |
---|
| 131 | unsigned short mLightsPerIteration; |
---|
| 132 | // Should it only be run for a certain light type? |
---|
| 133 | bool mRunOnlyForOneLightType; |
---|
| 134 | Light::LightTypes mOnlyLightType; |
---|
| 135 | |
---|
| 136 | /// Shading options |
---|
| 137 | ShadeOptions mShadeOptions; |
---|
| 138 | /// Polygon mode |
---|
| 139 | PolygonMode mPolygonMode; |
---|
| 140 | |
---|
| 141 | //------------------------------------------------------------------------- |
---|
| 142 | // Fog |
---|
| 143 | bool mFogOverride; |
---|
| 144 | FogMode mFogMode; |
---|
| 145 | ColourValue mFogColour; |
---|
| 146 | Real mFogStart; |
---|
| 147 | Real mFogEnd; |
---|
| 148 | Real mFogDensity; |
---|
| 149 | //------------------------------------------------------------------------- |
---|
| 150 | |
---|
| 151 | /// Storage of texture unit states |
---|
| 152 | typedef std::vector<TextureUnitState*> TextureUnitStates; |
---|
| 153 | TextureUnitStates mTextureUnitStates; |
---|
| 154 | |
---|
| 155 | // Vertex program details |
---|
| 156 | GpuProgramUsage *mVertexProgramUsage; |
---|
| 157 | // Vertex program details |
---|
| 158 | GpuProgramUsage *mShadowCasterVertexProgramUsage; |
---|
| 159 | // Vertex program details |
---|
| 160 | GpuProgramUsage *mShadowReceiverVertexProgramUsage; |
---|
| 161 | // Fragment program details |
---|
| 162 | GpuProgramUsage *mFragmentProgramUsage; |
---|
| 163 | // Fragment program details |
---|
| 164 | GpuProgramUsage *mShadowReceiverFragmentProgramUsage; |
---|
| 165 | // Is this pass queued for deletion? |
---|
| 166 | bool mQueuedForDeletion; |
---|
| 167 | // number of pass iterations to perform |
---|
| 168 | size_t mPassIterationCount; |
---|
| 169 | // point size, applies when not using per-vertex point size |
---|
| 170 | Real mPointSize; |
---|
| 171 | Real mPointMinSize; |
---|
| 172 | Real mPointMaxSize; |
---|
| 173 | bool mPointSpritesEnabled; |
---|
| 174 | bool mPointAttenuationEnabled; |
---|
| 175 | // constant, linear, quadratic coeffs |
---|
| 176 | Real mPointAttenuationCoeffs[3]; |
---|
| 177 | // TU Content type lookups |
---|
| 178 | typedef std::vector<unsigned short> ContentTypeLookup; |
---|
| 179 | mutable ContentTypeLookup mShadowContentTypeLookup; |
---|
| 180 | mutable bool mContentTypeLookupBuilt; |
---|
| 181 | |
---|
| 182 | public: |
---|
| 183 | typedef std::set<Pass*> PassSet; |
---|
| 184 | protected: |
---|
| 185 | /// List of Passes whose hashes need recalculating |
---|
| 186 | static PassSet msDirtyHashList; |
---|
| 187 | /// The place where passes go to die |
---|
| 188 | static PassSet msPassGraveyard; |
---|
| 189 | /// The Pass hash functor |
---|
| 190 | static HashFunc* msHashFunc; |
---|
| 191 | public: |
---|
| 192 | OGRE_STATIC_MUTEX(msDirtyHashListMutex); |
---|
| 193 | OGRE_STATIC_MUTEX(msPassGraveyardMutex); |
---|
| 194 | /// Default constructor |
---|
| 195 | Pass(Technique* parent, unsigned short index); |
---|
| 196 | /// Copy constructor |
---|
| 197 | Pass(Technique* parent, unsigned short index, const Pass& oth ); |
---|
| 198 | /// Operator = overload |
---|
| 199 | Pass& operator=(const Pass& oth); |
---|
| 200 | ~Pass(); |
---|
| 201 | |
---|
| 202 | /// Returns true if this pass is programmable ie includes either a vertex or fragment program. |
---|
| 203 | bool isProgrammable(void) const { return mVertexProgramUsage || mFragmentProgramUsage; } |
---|
| 204 | /// Returns true if this pass uses a programmable vertex pipeline |
---|
| 205 | bool hasVertexProgram(void) const { return mVertexProgramUsage != NULL; } |
---|
| 206 | /// Returns true if this pass uses a programmable fragment pipeline |
---|
| 207 | bool hasFragmentProgram(void) const { return mFragmentProgramUsage != NULL; } |
---|
| 208 | /// Returns true if this pass uses a shadow caster vertex program |
---|
| 209 | bool hasShadowCasterVertexProgram(void) const { return mShadowCasterVertexProgramUsage != NULL; } |
---|
| 210 | /// Returns true if this pass uses a shadow receiver vertex program |
---|
| 211 | bool hasShadowReceiverVertexProgram(void) const { return mShadowReceiverVertexProgramUsage != NULL; } |
---|
| 212 | /// Returns true if this pass uses a shadow receiver fragment program |
---|
| 213 | bool hasShadowReceiverFragmentProgram(void) const { return mShadowReceiverFragmentProgramUsage != NULL; } |
---|
| 214 | |
---|
| 215 | |
---|
| 216 | /// Gets the index of this Pass in the parent Technique |
---|
| 217 | unsigned short getIndex(void) const { return mIndex; } |
---|
| 218 | /* Set the name of the pass |
---|
| 219 | @remarks |
---|
| 220 | The name of the pass is optional. Its usefull in material scripts where a material could inherit |
---|
| 221 | from another material and only want to modify a particalar pass. |
---|
| 222 | */ |
---|
| 223 | void setName(const String& name); |
---|
| 224 | /// get the name of the pass |
---|
| 225 | const String& getName(void) const { return mName; } |
---|
| 226 | |
---|
| 227 | /** Sets the ambient colour reflectance properties of this pass. |
---|
| 228 | @remarks |
---|
| 229 | The base colour of a pass is determined by how much red, green and blue light is reflects |
---|
| 230 | (provided texture layer #0 has a blend mode other than LBO_REPLACE). This property determines how |
---|
| 231 | much ambient light (directionless global light) is reflected. The default is full white, meaning |
---|
| 232 | objects are completely globally illuminated. Reduce this if you want to see diffuse or specular light |
---|
| 233 | effects, or change the blend of colours to make the object have a base colour other than white. |
---|
| 234 | @note |
---|
| 235 | This setting has no effect if dynamic lighting is disabled (see Pass::setLightingEnabled), |
---|
| 236 | or if this is a programmable pass. |
---|
| 237 | */ |
---|
| 238 | void setAmbient(Real red, Real green, Real blue); |
---|
| 239 | |
---|
| 240 | /** Sets the ambient colour reflectance properties of this pass. |
---|
| 241 | @remarks |
---|
| 242 | The base colour of a pass is determined by how much red, green and blue light is reflects |
---|
| 243 | (provided texture layer #0 has a blend mode other than LBO_REPLACE). This property determines how |
---|
| 244 | much ambient light (directionless global light) is reflected. The default is full white, meaning |
---|
| 245 | objects are completely globally illuminated. Reduce this if you want to see diffuse or specular light |
---|
| 246 | effects, or change the blend of colours to make the object have a base colour other than white. |
---|
| 247 | @note |
---|
| 248 | This setting has no effect if dynamic lighting is disabled (see Pass::setLightingEnabled), |
---|
| 249 | or if this is a programmable pass. |
---|
| 250 | */ |
---|
| 251 | |
---|
| 252 | void setAmbient(const ColourValue& ambient); |
---|
| 253 | |
---|
| 254 | /** Sets the diffuse colour reflectance properties of this pass. |
---|
| 255 | @remarks |
---|
| 256 | The base colour of a pass is determined by how much red, green and blue light is reflects |
---|
| 257 | (provided texture layer #0 has a blend mode other than LBO_REPLACE). This property determines how |
---|
| 258 | much diffuse light (light from instances of the Light class in the scene) is reflected. The default |
---|
| 259 | is full white, meaning objects reflect the maximum white light they can from Light objects. |
---|
| 260 | @note |
---|
| 261 | This setting has no effect if dynamic lighting is disabled (see Pass::setLightingEnabled), |
---|
| 262 | or if this is a programmable pass. |
---|
| 263 | */ |
---|
| 264 | void setDiffuse(Real red, Real green, Real blue, Real alpha); |
---|
| 265 | |
---|
| 266 | /** Sets the diffuse colour reflectance properties of this pass. |
---|
| 267 | @remarks |
---|
| 268 | The base colour of a pass is determined by how much red, green and blue light is reflects |
---|
| 269 | (provided texture layer #0 has a blend mode other than LBO_REPLACE). This property determines how |
---|
| 270 | much diffuse light (light from instances of the Light class in the scene) is reflected. The default |
---|
| 271 | is full white, meaning objects reflect the maximum white light they can from Light objects. |
---|
| 272 | @note |
---|
| 273 | This setting has no effect if dynamic lighting is disabled (see Pass::setLightingEnabled), |
---|
| 274 | or if this is a programmable pass. |
---|
| 275 | */ |
---|
| 276 | void setDiffuse(const ColourValue& diffuse); |
---|
| 277 | |
---|
| 278 | /** Sets the specular colour reflectance properties of this pass. |
---|
| 279 | @remarks |
---|
| 280 | The base colour of a pass is determined by how much red, green and blue light is reflects |
---|
| 281 | (provided texture layer #0 has a blend mode other than LBO_REPLACE). This property determines how |
---|
| 282 | much specular light (highlights from instances of the Light class in the scene) is reflected. |
---|
| 283 | The default is to reflect no specular light. |
---|
| 284 | @note |
---|
| 285 | The size of the specular highlights is determined by the separate 'shininess' property. |
---|
| 286 | @note |
---|
| 287 | This setting has no effect if dynamic lighting is disabled (see Pass::setLightingEnabled), |
---|
| 288 | or if this is a programmable pass. |
---|
| 289 | */ |
---|
| 290 | void setSpecular(Real red, Real green, Real blue, Real alpha); |
---|
| 291 | |
---|
| 292 | /** Sets the specular colour reflectance properties of this pass. |
---|
| 293 | @remarks |
---|
| 294 | The base colour of a pass is determined by how much red, green and blue light is reflects |
---|
| 295 | (provided texture layer #0 has a blend mode other than LBO_REPLACE). This property determines how |
---|
| 296 | much specular light (highlights from instances of the Light class in the scene) is reflected. |
---|
| 297 | The default is to reflect no specular light. |
---|
| 298 | @note |
---|
| 299 | The size of the specular highlights is determined by the separate 'shininess' property. |
---|
| 300 | @note |
---|
| 301 | This setting has no effect if dynamic lighting is disabled (see Pass::setLightingEnabled), |
---|
| 302 | or if this is a programmable pass. |
---|
| 303 | */ |
---|
| 304 | void setSpecular(const ColourValue& specular); |
---|
| 305 | |
---|
| 306 | /** Sets the shininess of the pass, affecting the size of specular highlights. |
---|
| 307 | @note |
---|
| 308 | This setting has no effect if dynamic lighting is disabled (see Pass::setLightingEnabled), |
---|
| 309 | or if this is a programmable pass. |
---|
| 310 | */ |
---|
| 311 | void setShininess(Real val); |
---|
| 312 | |
---|
| 313 | /** Sets the amount of self-illumination an object has. |
---|
| 314 | @remarks |
---|
| 315 | If an object is self-illuminating, it does not need external sources to light it, ambient or |
---|
| 316 | otherwise. It's like the object has it's own personal ambient light. This property is rarely useful since |
---|
| 317 | you can already specify per-pass ambient light, but is here for completeness. |
---|
| 318 | @note |
---|
| 319 | This setting has no effect if dynamic lighting is disabled (see Pass::setLightingEnabled), |
---|
| 320 | or if this is a programmable pass. |
---|
| 321 | */ |
---|
| 322 | void setSelfIllumination(Real red, Real green, Real blue); |
---|
| 323 | |
---|
| 324 | /** Sets the amount of self-illumination an object has. |
---|
| 325 | @remarks |
---|
| 326 | If an object is self-illuminating, it does not need external sources to light it, ambient or |
---|
| 327 | otherwise. It's like the object has it's own personal ambient light. This property is rarely useful since |
---|
| 328 | you can already specify per-pass ambient light, but is here for completeness. |
---|
| 329 | @note |
---|
| 330 | This setting has no effect if dynamic lighting is disabled (see Pass::setLightingEnabled), |
---|
| 331 | or if this is a programmable pass. |
---|
| 332 | */ |
---|
| 333 | void setSelfIllumination(const ColourValue& selfIllum); |
---|
| 334 | |
---|
| 335 | /** Sets which material properties follow the vertex colour |
---|
| 336 | */ |
---|
| 337 | void setVertexColourTracking(TrackVertexColourType tracking); |
---|
| 338 | |
---|
| 339 | /** Gets the point size of the pass. |
---|
| 340 | @remarks |
---|
| 341 | This property determines what point size is used to render a point |
---|
| 342 | list. |
---|
| 343 | */ |
---|
| 344 | Real getPointSize(void) const; |
---|
| 345 | |
---|
| 346 | /** Sets the point size of this pass. |
---|
| 347 | @remarks |
---|
| 348 | This setting allows you to change the size of points when rendering |
---|
| 349 | a point list, or a list of point sprites. The interpretation of this |
---|
| 350 | command depends on the Pass::setPointSizeAttenuation option - if it |
---|
| 351 | is off (the default), the point size is in screen pixels, if it is on, |
---|
| 352 | it expressed as normalised screen coordinates (1.0 is the height of |
---|
| 353 | the screen) when the point is at the origin. |
---|
| 354 | @note |
---|
| 355 | Some drivers have an upper limit on the size of points they support |
---|
| 356 | - this can even vary between APIs on the same card! Don't rely on |
---|
| 357 | point sizes that cause the point sprites to get very large on screen, |
---|
| 358 | since they may get clamped on some cards. Upper sizes can range from |
---|
| 359 | 64 to 256 pixels. |
---|
| 360 | */ |
---|
| 361 | void setPointSize(Real ps); |
---|
| 362 | |
---|
| 363 | /** Sets whether or not rendering points using OT_POINT_LIST will |
---|
| 364 | render point sprites (textured quads) or plain points (dots). |
---|
| 365 | @param enabled True enables point sprites, false returns to normal |
---|
| 366 | point rendering. |
---|
| 367 | */ |
---|
| 368 | void setPointSpritesEnabled(bool enabled); |
---|
| 369 | |
---|
| 370 | /** Returns whether point sprites are enabled when rendering a |
---|
| 371 | point list. |
---|
| 372 | */ |
---|
| 373 | bool getPointSpritesEnabled(void) const; |
---|
| 374 | |
---|
| 375 | /** Sets how points are attenuated with distance. |
---|
| 376 | @remarks |
---|
| 377 | When performing point rendering or point sprite rendering, |
---|
| 378 | point size can be attenuated with distance. The equation for |
---|
| 379 | doing this is attenuation = 1 / (constant + linear * dist + quadratic * d^2). |
---|
| 380 | @par |
---|
| 381 | For example, to disable distance attenuation (constant screensize) |
---|
| 382 | you would set constant to 1, and linear and quadratic to 0. A |
---|
| 383 | standard perspective attenuation would be 0, 1, 0 respectively. |
---|
| 384 | @note |
---|
| 385 | The resulting size is clamped to the minimum and maximum point |
---|
| 386 | size. |
---|
| 387 | @param enabled Whether point attenuation is enabled |
---|
| 388 | @param constant, linear, quadratic Parameters to the attentuation |
---|
| 389 | function defined above |
---|
| 390 | */ |
---|
| 391 | void setPointAttenuation(bool enabled, |
---|
| 392 | Real constant = 0.0f, Real linear = 1.0f, Real quadratic = 0.0f); |
---|
| 393 | |
---|
| 394 | /** Returns whether points are attenuated with distance. */ |
---|
| 395 | bool isPointAttenuationEnabled(void) const; |
---|
| 396 | |
---|
| 397 | /** Returns the constant coefficient of point attenuation. */ |
---|
| 398 | Real getPointAttenuationConstant(void) const; |
---|
| 399 | /** Returns the linear coefficient of point attenuation. */ |
---|
| 400 | Real getPointAttenuationLinear(void) const; |
---|
| 401 | /** Returns the quadratic coefficient of point attenuation. */ |
---|
| 402 | Real getPointAttenuationQuadratic(void) const; |
---|
| 403 | |
---|
| 404 | /** Set the minimum point size, when point attenuation is in use. */ |
---|
| 405 | void setPointMinSize(Real min); |
---|
| 406 | /** Get the minimum point size, when point attenuation is in use. */ |
---|
| 407 | Real getPointMinSize(void) const; |
---|
| 408 | /** Set the maximum point size, when point attenuation is in use. |
---|
| 409 | @remarks Setting this to 0 indicates the max size supported by the card. |
---|
| 410 | */ |
---|
| 411 | void setPointMaxSize(Real max); |
---|
| 412 | /** Get the maximum point size, when point attenuation is in use. |
---|
| 413 | @remarks 0 indicates the max size supported by the card. |
---|
| 414 | */ |
---|
| 415 | Real getPointMaxSize(void) const; |
---|
| 416 | |
---|
| 417 | /** Gets the ambient colour reflectance of the pass. |
---|
| 418 | */ |
---|
| 419 | const ColourValue& getAmbient(void) const; |
---|
| 420 | |
---|
| 421 | /** Gets the diffuse colour reflectance of the pass. |
---|
| 422 | */ |
---|
| 423 | const ColourValue& getDiffuse(void) const; |
---|
| 424 | |
---|
| 425 | /** Gets the specular colour reflectance of the pass. |
---|
| 426 | */ |
---|
| 427 | const ColourValue& getSpecular(void) const; |
---|
| 428 | |
---|
| 429 | /** Gets the self illumination colour of the pass. |
---|
| 430 | */ |
---|
| 431 | const ColourValue& getSelfIllumination(void) const; |
---|
| 432 | |
---|
| 433 | /** Gets the 'shininess' property of the pass (affects specular highlights). |
---|
| 434 | */ |
---|
| 435 | Real getShininess(void) const; |
---|
| 436 | |
---|
| 437 | /** Gets which material properties follow the vertex colour |
---|
| 438 | */ |
---|
| 439 | TrackVertexColourType getVertexColourTracking(void) const; |
---|
| 440 | |
---|
| 441 | /** Inserts a new TextureUnitState object into the Pass. |
---|
| 442 | @remarks |
---|
| 443 | This unit is is added on top of all previous units. |
---|
| 444 | */ |
---|
| 445 | TextureUnitState* createTextureUnitState(void); |
---|
| 446 | /** Inserts a new TextureUnitState object into the Pass. |
---|
| 447 | @remarks |
---|
| 448 | This unit is is added on top of all previous units. |
---|
| 449 | @param |
---|
| 450 | name The basic name of the texture e.g. brickwall.jpg, stonefloor.png |
---|
| 451 | @param |
---|
| 452 | texCoordSet The index of the texture coordinate set to use. |
---|
| 453 | @note |
---|
| 454 | Applies to both fixed-function and programmable passes. |
---|
| 455 | */ |
---|
| 456 | TextureUnitState* createTextureUnitState( const String& textureName, unsigned short texCoordSet = 0); |
---|
| 457 | /** Adds the passed in TextureUnitState, to the existing Pass. |
---|
| 458 | @param |
---|
| 459 | state The Texture Unit State to be attached to this pass. It must not be attached to another pass. |
---|
| 460 | @note |
---|
| 461 | Throws an exception if the TextureUnitState is attached to another Pass.*/ |
---|
| 462 | void addTextureUnitState(TextureUnitState* state); |
---|
| 463 | /** Retrieves a pointer to a texture unit state so it may be modified. |
---|
| 464 | */ |
---|
| 465 | TextureUnitState* getTextureUnitState(unsigned short index); |
---|
| 466 | /** Retrieves the Texture Unit State matching name. |
---|
| 467 | Returns 0 if name match is not found. |
---|
| 468 | */ |
---|
| 469 | TextureUnitState* getTextureUnitState(const String& name); |
---|
| 470 | /** Retrieves a const pointer to a texture unit state. |
---|
| 471 | */ |
---|
| 472 | const TextureUnitState* getTextureUnitState(unsigned short index) const; |
---|
| 473 | /** Retrieves the Texture Unit State matching name. |
---|
| 474 | Returns 0 if name match is not found. |
---|
| 475 | */ |
---|
| 476 | const TextureUnitState* getTextureUnitState(const String& name) const; |
---|
| 477 | |
---|
| 478 | /** Retrieve the index of the Texture Unit State in the pass. |
---|
| 479 | @param |
---|
| 480 | state The Texture Unit State this is attached to this pass. |
---|
| 481 | @note |
---|
| 482 | Throws an exception if the state is not attached to the pass. |
---|
| 483 | */ |
---|
| 484 | unsigned short getTextureUnitStateIndex(const TextureUnitState* state) const; |
---|
| 485 | |
---|
| 486 | typedef VectorIterator<TextureUnitStates> TextureUnitStateIterator; |
---|
| 487 | /** Get an iterator over the TextureUnitStates contained in this Pass. */ |
---|
| 488 | TextureUnitStateIterator getTextureUnitStateIterator(void); |
---|
| 489 | |
---|
| 490 | typedef ConstVectorIterator<TextureUnitStates> ConstTextureUnitStateIterator; |
---|
| 491 | /** Get an iterator over the TextureUnitStates contained in this Pass. */ |
---|
| 492 | ConstTextureUnitStateIterator getTextureUnitStateIterator(void) const; |
---|
| 493 | |
---|
| 494 | /** Removes the indexed texture unit state from this pass. |
---|
| 495 | @remarks |
---|
| 496 | Note that removing a texture which is not the topmost will have a larger performance impact. |
---|
| 497 | */ |
---|
| 498 | void removeTextureUnitState(unsigned short index); |
---|
| 499 | |
---|
| 500 | /** Removes all texture unit settings. |
---|
| 501 | */ |
---|
| 502 | void removeAllTextureUnitStates(void); |
---|
| 503 | |
---|
| 504 | /** Returns the number of texture unit settings. |
---|
| 505 | */ |
---|
| 506 | unsigned short getNumTextureUnitStates(void) const |
---|
| 507 | { |
---|
| 508 | return static_cast<unsigned short>(mTextureUnitStates.size()); |
---|
| 509 | } |
---|
| 510 | |
---|
| 511 | /** Sets the kind of blending this pass has with the existing contents of the scene. |
---|
| 512 | @remarks |
---|
| 513 | Wheras the texture blending operations seen in the TextureUnitState class are concerned with |
---|
| 514 | blending between texture layers, this blending is about combining the output of the Pass |
---|
| 515 | as a whole with the existing contents of the rendering target. This blending therefore allows |
---|
| 516 | object transparency and other special effects. If all passes in a technique have a scene |
---|
| 517 | blend, then the whole technique is considered to be transparent. |
---|
| 518 | @par |
---|
| 519 | This method allows you to select one of a number of predefined blending types. If you require more |
---|
| 520 | control than this, use the alternative version of this method which allows you to specify source and |
---|
| 521 | destination blend factors. |
---|
| 522 | @note |
---|
| 523 | This method is applicable for both the fixed-function and programmable pipelines. |
---|
| 524 | @param |
---|
| 525 | sbt One of the predefined SceneBlendType blending types |
---|
| 526 | */ |
---|
| 527 | void setSceneBlending( const SceneBlendType sbt ); |
---|
| 528 | |
---|
| 529 | /** Allows very fine control of blending this Pass with the existing contents of the scene. |
---|
| 530 | @remarks |
---|
| 531 | Wheras the texture blending operations seen in the TextureUnitState class are concerned with |
---|
| 532 | blending between texture layers, this blending is about combining the output of the material |
---|
| 533 | as a whole with the existing contents of the rendering target. This blending therefore allows |
---|
| 534 | object transparency and other special effects. |
---|
| 535 | @par |
---|
| 536 | This version of the method allows complete control over the blending operation, by specifying the |
---|
| 537 | source and destination blending factors. The result of the blending operation is: |
---|
| 538 | <span align="center"> |
---|
| 539 | final = (texture * sourceFactor) + (pixel * destFactor) |
---|
| 540 | </span> |
---|
| 541 | @par |
---|
| 542 | Each of the factors is specified as one of a number of options, as specified in the SceneBlendFactor |
---|
| 543 | enumerated type. |
---|
| 544 | @param |
---|
| 545 | sourceFactor The source factor in the above calculation, i.e. multiplied by the texture colour components. |
---|
| 546 | @param |
---|
| 547 | destFactor The destination factor in the above calculation, i.e. multiplied by the pixel colour components. |
---|
| 548 | @note |
---|
| 549 | This method is applicable for both the fixed-function and programmable pipelines. |
---|
| 550 | */ |
---|
| 551 | void setSceneBlending( const SceneBlendFactor sourceFactor, const SceneBlendFactor destFactor); |
---|
| 552 | |
---|
| 553 | /** Retrieves the source blending factor for the material (as set using Materiall::setSceneBlending). |
---|
| 554 | */ |
---|
| 555 | SceneBlendFactor getSourceBlendFactor() const; |
---|
| 556 | |
---|
| 557 | /** Retrieves the destination blending factor for the material (as set using Materiall::setSceneBlending). |
---|
| 558 | */ |
---|
| 559 | SceneBlendFactor getDestBlendFactor() const; |
---|
| 560 | |
---|
| 561 | /** Returns true if this pass has some element of transparency. */ |
---|
| 562 | bool isTransparent(void) const; |
---|
| 563 | |
---|
| 564 | /** Sets whether or not this pass renders with depth-buffer checking on or not. |
---|
| 565 | @remarks |
---|
| 566 | If depth-buffer checking is on, whenever a pixel is about to be written to the frame buffer |
---|
| 567 | the depth buffer is checked to see if the pixel is in front of all other pixels written at that |
---|
| 568 | point. If not, the pixel is not written. |
---|
| 569 | @par |
---|
| 570 | If depth checking is off, pixels are written no matter what has been rendered before. |
---|
| 571 | Also see setDepthFunction for more advanced depth check configuration. |
---|
| 572 | @see |
---|
| 573 | setDepthFunction |
---|
| 574 | */ |
---|
| 575 | void setDepthCheckEnabled(bool enabled); |
---|
| 576 | |
---|
| 577 | /** Returns whether or not this pass renders with depth-buffer checking on or not. |
---|
| 578 | @see |
---|
| 579 | setDepthCheckEnabled |
---|
| 580 | */ |
---|
| 581 | bool getDepthCheckEnabled(void) const; |
---|
| 582 | |
---|
| 583 | /** Sets whether or not this pass renders with depth-buffer writing on or not. |
---|
| 584 | @remarks |
---|
| 585 | If depth-buffer writing is on, whenever a pixel is written to the frame buffer |
---|
| 586 | the depth buffer is updated with the depth value of that new pixel, thus affecting future |
---|
| 587 | rendering operations if future pixels are behind this one. |
---|
| 588 | @par |
---|
| 589 | If depth writing is off, pixels are written without updating the depth buffer Depth writing should |
---|
| 590 | normally be on but can be turned off when rendering static backgrounds or when rendering a collection |
---|
| 591 | of transparent objects at the end of a scene so that they overlap each other correctly. |
---|
| 592 | */ |
---|
| 593 | void setDepthWriteEnabled(bool enabled); |
---|
| 594 | |
---|
| 595 | /** Returns whether or not this pass renders with depth-buffer writing on or not. |
---|
| 596 | @see |
---|
| 597 | setDepthWriteEnabled |
---|
| 598 | */ |
---|
| 599 | bool getDepthWriteEnabled(void) const; |
---|
| 600 | |
---|
| 601 | /** Sets the function used to compare depth values when depth checking is on. |
---|
| 602 | @remarks |
---|
| 603 | If depth checking is enabled (see setDepthCheckEnabled) a comparison occurs between the depth |
---|
| 604 | value of the pixel to be written and the current contents of the buffer. This comparison is |
---|
| 605 | normally CMPF_LESS_EQUAL, i.e. the pixel is written if it is closer (or at the same distance) |
---|
| 606 | than the current contents. If you wish you can change this comparison using this method. |
---|
| 607 | */ |
---|
| 608 | void setDepthFunction( CompareFunction func ); |
---|
| 609 | /** Returns the function used to compare depth values when depth checking is on. |
---|
| 610 | @see |
---|
| 611 | setDepthFunction |
---|
| 612 | */ |
---|
| 613 | CompareFunction getDepthFunction(void) const; |
---|
| 614 | |
---|
| 615 | /** Sets whether or not colour buffer writing is enabled for this Pass. |
---|
| 616 | @remarks |
---|
| 617 | For some effects, you might wish to turn off the colour write operation |
---|
| 618 | when rendering geometry; this means that only the depth buffer will be |
---|
| 619 | updated (provided you have depth buffer writing enabled, which you |
---|
| 620 | probably will do, although you may wish to only update the stencil |
---|
| 621 | buffer for example - stencil buffer state is managed at the RenderSystem |
---|
| 622 | level only, not the Material since you are likely to want to manage it |
---|
| 623 | at a higher level). |
---|
| 624 | */ |
---|
| 625 | void setColourWriteEnabled(bool enabled); |
---|
| 626 | /** Determines if colour buffer writing is enabled for this pass. */ |
---|
| 627 | bool getColourWriteEnabled(void) const; |
---|
| 628 | |
---|
| 629 | /** Sets the culling mode for this pass based on the 'vertex winding'. |
---|
| 630 | @remarks |
---|
| 631 | A typical way for the rendering engine to cull triangles is based on the 'vertex winding' of |
---|
| 632 | triangles. Vertex winding refers to the direction in which the vertices are passed or indexed |
---|
| 633 | to in the rendering operation as viewed from the camera, and will wither be clockwise or |
---|
| 634 | anticlockwise (that's 'counterclockwise' for you Americans out there ;) The default is |
---|
| 635 | CULL_CLOCKWISE i.e. that only triangles whose vertices are passed/indexed in anticlockwise order |
---|
| 636 | are rendered - this is a common approach and is used in 3D studio models for example. You can |
---|
| 637 | alter this culling mode if you wish but it is not advised unless you know what you are doing. |
---|
| 638 | @par |
---|
| 639 | You may wish to use the CULL_NONE option for mesh data that you cull yourself where the vertex |
---|
| 640 | winding is uncertain. |
---|
| 641 | */ |
---|
| 642 | void setCullingMode( CullingMode mode ); |
---|
| 643 | |
---|
| 644 | /** Returns the culling mode for geometry rendered with this pass. See setCullingMode for more information. |
---|
| 645 | */ |
---|
| 646 | CullingMode getCullingMode(void) const; |
---|
| 647 | |
---|
| 648 | /** Sets the manual culling mode, performed by CPU rather than hardware. |
---|
| 649 | @pemarks |
---|
| 650 | In some situations you want to use manual culling of triangles rather than sending the |
---|
| 651 | triangles to the hardware and letting it cull them. This setting only takes effect on SceneManager's |
---|
| 652 | that use it (since it is best used on large groups of planar world geometry rather than on movable |
---|
| 653 | geometry since this would be expensive), but if used can cull geometry before it is sent to the |
---|
| 654 | hardware. |
---|
| 655 | @note |
---|
| 656 | The default for this setting is MANUAL_CULL_BACK. |
---|
| 657 | @param |
---|
| 658 | mode The mode to use - see enum ManualCullingMode for details |
---|
| 659 | |
---|
| 660 | */ |
---|
| 661 | void setManualCullingMode( ManualCullingMode mode ); |
---|
| 662 | |
---|
| 663 | /** Retrieves the manual culling mode for this pass |
---|
| 664 | @see |
---|
| 665 | setManualCullingMode |
---|
| 666 | */ |
---|
| 667 | ManualCullingMode getManualCullingMode(void) const; |
---|
| 668 | |
---|
| 669 | /** Sets whether or not dynamic lighting is enabled. |
---|
| 670 | @param |
---|
| 671 | enabled |
---|
| 672 | If true, dynamic lighting is performed on geometry with normals supplied, geometry without |
---|
| 673 | normals will not be displayed. |
---|
| 674 | @par |
---|
| 675 | If false, no lighting is applied and all geometry will be full brightness. |
---|
| 676 | */ |
---|
| 677 | void setLightingEnabled(bool enabled); |
---|
| 678 | |
---|
| 679 | /** Returns whether or not dynamic lighting is enabled. |
---|
| 680 | */ |
---|
| 681 | bool getLightingEnabled(void) const; |
---|
| 682 | |
---|
| 683 | /** Sets the maximum number of lights to be used by this pass. |
---|
| 684 | @remarks |
---|
| 685 | During rendering, if lighting is enabled (or if the pass uses an automatic |
---|
| 686 | program parameter based on a light) the engine will request the nearest lights |
---|
| 687 | to the object being rendered in order to work out which ones to use. This |
---|
| 688 | parameter sets the limit on the number of lights which should apply to objects |
---|
| 689 | rendered with this pass. |
---|
| 690 | */ |
---|
| 691 | void setMaxSimultaneousLights(unsigned short maxLights); |
---|
| 692 | /** Gets the maximum number of lights to be used by this pass. */ |
---|
| 693 | unsigned short getMaxSimultaneousLights(void) const; |
---|
| 694 | |
---|
| 695 | /** Sets the light index that this pass will start at in the light list. |
---|
| 696 | @remarks |
---|
| 697 | Normally the lights passed to a pass will start from the beginning |
---|
| 698 | of the light list for this object. This option allows you to make this |
---|
| 699 | pass start from a higher light index, for example if one of your earlier |
---|
| 700 | passes could deal with lights 0-3, and this pass dealt with lights 4+. |
---|
| 701 | This option also has an interaction with pass iteration, in that |
---|
| 702 | if you choose to iterate this pass per light too, the iteration will |
---|
| 703 | only begin from light 4. |
---|
| 704 | */ |
---|
| 705 | void setStartLight(unsigned short startLight); |
---|
| 706 | /** Gets the light index that this pass will start at in the light list. */ |
---|
| 707 | unsigned short getStartLight(void) const; |
---|
| 708 | |
---|
| 709 | /** Sets the type of light shading required |
---|
| 710 | @note |
---|
| 711 | The default shading method is Gouraud shading. |
---|
| 712 | */ |
---|
| 713 | void setShadingMode( ShadeOptions mode ); |
---|
| 714 | |
---|
| 715 | /** Returns the type of light shading to be used. |
---|
| 716 | */ |
---|
| 717 | ShadeOptions getShadingMode(void) const; |
---|
| 718 | |
---|
| 719 | /** Sets the type of polygon rendering required |
---|
| 720 | @note |
---|
| 721 | The default shading method is Solid |
---|
| 722 | */ |
---|
| 723 | void setPolygonMode( PolygonMode mode ); |
---|
| 724 | |
---|
| 725 | /** Returns the type of light shading to be used. |
---|
| 726 | */ |
---|
| 727 | PolygonMode getPolygonMode(void) const; |
---|
| 728 | |
---|
| 729 | /** Sets the fogging mode applied to this pass. |
---|
| 730 | @remarks |
---|
| 731 | Fogging is an effect that is applied as polys are rendered. Sometimes, you want |
---|
| 732 | fog to be applied to an entire scene. Other times, you want it to be applied to a few |
---|
| 733 | polygons only. This pass-level specification of fog parameters lets you easily manage |
---|
| 734 | both. |
---|
| 735 | @par |
---|
| 736 | The SceneManager class also has a setFog method which applies scene-level fog. This method |
---|
| 737 | lets you change the fog behaviour for this pass compared to the standard scene-level fog. |
---|
| 738 | @param |
---|
| 739 | overrideScene If true, you authorise this pass to override the scene's fog params with it's own settings. |
---|
| 740 | If you specify false, so other parameters are necessary, and this is the default behaviour for passs. |
---|
| 741 | @param |
---|
| 742 | mode Only applicable if overrideScene is true. You can disable fog which is turned on for the |
---|
| 743 | rest of the scene by specifying FOG_NONE. Otherwise, set a pass-specific fog mode as |
---|
| 744 | defined in the enum FogMode. |
---|
| 745 | @param |
---|
| 746 | colour The colour of the fog. Either set this to the same as your viewport background colour, |
---|
| 747 | or to blend in with a skydome or skybox. |
---|
| 748 | @param |
---|
| 749 | expDensity The density of the fog in FOG_EXP or FOG_EXP2 mode, as a value between 0 and 1. |
---|
| 750 | The default is 0.001. |
---|
| 751 | @param |
---|
| 752 | linearStart Distance in world units at which linear fog starts to encroach. |
---|
| 753 | Only applicable if mode is FOG_LINEAR. |
---|
| 754 | @param |
---|
| 755 | linearEnd Distance in world units at which linear fog becomes completely opaque. |
---|
| 756 | Only applicable if mode is FOG_LINEAR. |
---|
| 757 | */ |
---|
| 758 | void setFog( |
---|
| 759 | bool overrideScene, |
---|
| 760 | FogMode mode = FOG_NONE, |
---|
| 761 | const ColourValue& colour = ColourValue::White, |
---|
| 762 | Real expDensity = 0.001, Real linearStart = 0.0, Real linearEnd = 1.0 ); |
---|
| 763 | |
---|
| 764 | /** Returns true if this pass is to override the scene fog settings. |
---|
| 765 | */ |
---|
| 766 | bool getFogOverride(void) const; |
---|
| 767 | |
---|
| 768 | /** Returns the fog mode for this pass. |
---|
| 769 | @note |
---|
| 770 | Only valid if getFogOverride is true. |
---|
| 771 | */ |
---|
| 772 | FogMode getFogMode(void) const; |
---|
| 773 | |
---|
| 774 | /** Returns the fog colour for the scene. |
---|
| 775 | */ |
---|
| 776 | const ColourValue& getFogColour(void) const; |
---|
| 777 | |
---|
| 778 | /** Returns the fog start distance for this pass. |
---|
| 779 | @note |
---|
| 780 | Only valid if getFogOverride is true. |
---|
| 781 | */ |
---|
| 782 | Real getFogStart(void) const; |
---|
| 783 | |
---|
| 784 | /** Returns the fog end distance for this pass. |
---|
| 785 | @note |
---|
| 786 | Only valid if getFogOverride is true. |
---|
| 787 | */ |
---|
| 788 | Real getFogEnd(void) const; |
---|
| 789 | |
---|
| 790 | /** Returns the fog density for this pass. |
---|
| 791 | @note |
---|
| 792 | Only valid if getFogOverride is true. |
---|
| 793 | */ |
---|
| 794 | Real getFogDensity(void) const; |
---|
| 795 | |
---|
| 796 | /** Sets the depth bias to be used for this material. |
---|
| 797 | @remarks |
---|
| 798 | When polygons are coplanar, you can get problems with 'depth fighting' where |
---|
| 799 | the pixels from the two polys compete for the same screen pixel. This is particularly |
---|
| 800 | a problem for decals (polys attached to another surface to represent details such as |
---|
| 801 | bulletholes etc.). |
---|
| 802 | @par |
---|
| 803 | A way to combat this problem is to use a depth bias to adjust the depth buffer value |
---|
| 804 | used for the decal such that it is slightly higher than the true value, ensuring that |
---|
| 805 | the decal appears on top. There are two aspects to the biasing, a constant |
---|
| 806 | bias value and a slope-relative biasing value, which varies according to the |
---|
| 807 | maximum depth slope relative to the camera, ie: |
---|
| 808 | <pre>finalBias = maxSlope * slopeScaleBias + constantBias</pre> |
---|
| 809 | Note that slope scale bias, whilst more accurate, may be ignored by old hardware. |
---|
| 810 | @param constantBias The constant bias value, expressed as a factor of the |
---|
| 811 | minimum observable depth |
---|
| 812 | @param slopeScaleBias The slope-relative bias value, expressed as a factor |
---|
| 813 | of the depth slope |
---|
| 814 | */ |
---|
| 815 | void setDepthBias(float constantBias, float slopeScaleBias = 0.0f); |
---|
| 816 | |
---|
| 817 | /** Retrieves the const depth bias value as set by setDepthBias. */ |
---|
| 818 | float getDepthBiasConstant(void) const; |
---|
| 819 | /** Retrieves the slope-scale depth bias value as set by setDepthBias. */ |
---|
| 820 | float getDepthBiasSlopeScale(void) const; |
---|
| 821 | |
---|
| 822 | /** Sets the way the pass will have use alpha to totally reject pixels from the pipeline. |
---|
| 823 | @remarks |
---|
| 824 | The default is CMPF_ALWAYS_PASS i.e. alpha is not used to reject pixels. |
---|
| 825 | @param func The comparison which must pass for the pixel to be written. |
---|
| 826 | @param value 1 byte value against which alpha values will be tested(0-255) |
---|
| 827 | @note |
---|
| 828 | This option applies in both the fixed function and the programmable pipeline. |
---|
| 829 | */ |
---|
| 830 | void setAlphaRejectSettings(CompareFunction func, unsigned char value); |
---|
| 831 | |
---|
| 832 | /** Sets the alpha reject function. See setAlphaRejectSettings for more information. |
---|
| 833 | */ |
---|
| 834 | void setAlphaRejectFunction(CompareFunction func); |
---|
| 835 | |
---|
| 836 | /** Gets the alpha reject value. See setAlphaRejectSettings for more information. |
---|
| 837 | */ |
---|
| 838 | void setAlphaRejectValue(unsigned char val); |
---|
| 839 | |
---|
| 840 | /** Gets the alpha reject function. See setAlphaRejectSettings for more information. |
---|
| 841 | */ |
---|
| 842 | CompareFunction getAlphaRejectFunction(void) const { return mAlphaRejectFunc; } |
---|
| 843 | |
---|
| 844 | /** Gets the alpha reject value. See setAlphaRejectSettings for more information. |
---|
| 845 | */ |
---|
| 846 | unsigned char getAlphaRejectValue(void) const { return mAlphaRejectVal; } |
---|
| 847 | /** Sets whether or not this pass should iterate per light or number of |
---|
| 848 | lights which can affect the object being rendered. |
---|
| 849 | @remarks |
---|
| 850 | The default behaviour for a pass (when this option is 'false'), is |
---|
| 851 | for a pass to be rendered only once (or the number of times set in |
---|
| 852 | setPassIterationCount), with all the lights which could |
---|
| 853 | affect this object set at the same time (up to the maximum lights |
---|
| 854 | allowed in the render system, which is typically 8). |
---|
| 855 | @par |
---|
| 856 | Setting this option to 'true' changes this behaviour, such that |
---|
| 857 | instead of trying to issue render this pass once per object, it |
---|
| 858 | is run <b>per light</b>, or for a group of 'n' lights each time |
---|
| 859 | which can affect this object, the number of |
---|
| 860 | times set in setPassIterationCount (default is once). In |
---|
| 861 | this case, only light index 0 is ever used, and is a different light |
---|
| 862 | every time the pass is issued, up to the total number of lights |
---|
| 863 | which is affecting this object. This has 2 advantages: |
---|
| 864 | <ul><li>There is no limit on the number of lights which can be |
---|
| 865 | supported</li> |
---|
| 866 | <li>It's easier to write vertex / fragment programs for this because |
---|
| 867 | a single program can be used for any number of lights</li> |
---|
| 868 | </ul> |
---|
| 869 | However, this technique is more expensive, and typically you |
---|
| 870 | will want an additional ambient pass, because if no lights are |
---|
| 871 | affecting the object it will not be rendered at all, which will look |
---|
| 872 | odd even if ambient light is zero (imagine if there are lit objects |
---|
| 873 | behind it - the objects silhouette would not show up). Therefore, |
---|
| 874 | use this option with care, and you would be well advised to provide |
---|
| 875 | a less expensive fallback technique for use in the distance. |
---|
| 876 | @note |
---|
| 877 | The number of times this pass runs is still limited by the maximum |
---|
| 878 | number of lights allowed as set in setMaxSimultaneousLights, so |
---|
| 879 | you will never get more passes than this. Also, the iteration is |
---|
| 880 | started from the 'start light' as set in Pass::setStartLight, and |
---|
| 881 | the number of passes is the number of lights to iterate over divided |
---|
| 882 | by the number of lights per iteration (default 1, set by |
---|
| 883 | setLightCountPerIteration). |
---|
| 884 | @param enabled Whether this feature is enabled |
---|
| 885 | @param onlyForOneLightType If true, the pass will only be run for a single type |
---|
| 886 | of light, other light types will be ignored. |
---|
| 887 | @param lightType The single light type which will be considered for this pass |
---|
| 888 | */ |
---|
| 889 | void setIteratePerLight(bool enabled, |
---|
| 890 | bool onlyForOneLightType = true, Light::LightTypes lightType = Light::LT_POINT); |
---|
| 891 | |
---|
| 892 | /** Does this pass run once for every light in range? */ |
---|
| 893 | bool getIteratePerLight(void) const { return mIteratePerLight; } |
---|
| 894 | /** Does this pass run only for a single light type (if getIteratePerLight is true). */ |
---|
| 895 | bool getRunOnlyForOneLightType(void) const { return mRunOnlyForOneLightType; } |
---|
| 896 | /** Gets the single light type this pass runs for if getIteratePerLight and |
---|
| 897 | getRunOnlyForOneLightType are both true. */ |
---|
| 898 | Light::LightTypes getOnlyLightType() const { return mOnlyLightType; } |
---|
| 899 | |
---|
| 900 | /** If light iteration is enabled, determine the number of lights per |
---|
| 901 | iteration. |
---|
| 902 | @remarks |
---|
| 903 | The default for this setting is 1, so if you enable light iteration |
---|
| 904 | (Pass::setIteratePerLight), the pass is rendered once per light. If |
---|
| 905 | you set this value higher, the passes will occur once per 'n' lights. |
---|
| 906 | The start of the iteration is set by Pass::setStartLight and the end |
---|
| 907 | by Pass::setMaxSimultaneousLights. |
---|
| 908 | */ |
---|
| 909 | void setLightCountPerIteration(unsigned short c); |
---|
| 910 | /** If light iteration is enabled, determine the number of lights per |
---|
| 911 | iteration. |
---|
| 912 | */ |
---|
| 913 | unsigned short getLightCountPerIteration(void) const; |
---|
| 914 | |
---|
| 915 | /// Gets the parent Technique |
---|
| 916 | Technique* getParent(void) const { return mParent; } |
---|
| 917 | |
---|
| 918 | /// Gets the resource group of the ultimate parent Material |
---|
| 919 | const String& getResourceGroup(void) const; |
---|
| 920 | |
---|
| 921 | /** Sets the details of the vertex program to use. |
---|
| 922 | @remarks |
---|
| 923 | Only applicable to programmable passes, this sets the details of |
---|
| 924 | the vertex program to use in this pass. The program will not be |
---|
| 925 | loaded until the parent Material is loaded. |
---|
| 926 | @param name The name of the program - this must have been |
---|
| 927 | created using GpuProgramManager by the time that this Pass |
---|
| 928 | is loaded. If this parameter is blank, any vertex program in this pass is disabled. |
---|
| 929 | @param resetParams |
---|
| 930 | If true, this will create a fresh set of parameters from the |
---|
| 931 | new program being linked, so if you had previously set parameters |
---|
| 932 | you will have to set them again. If you set this to false, you must |
---|
| 933 | be absolutely sure that the parameters match perfectly, and in the |
---|
| 934 | case of named parameters refers to the indexes underlying them, |
---|
| 935 | not just the names. |
---|
| 936 | */ |
---|
| 937 | void setVertexProgram(const String& name, bool resetParams = true); |
---|
| 938 | /** Sets the vertex program parameters. |
---|
| 939 | @remarks |
---|
| 940 | Only applicable to programmable passes, and this particular call is |
---|
| 941 | designed for low-level programs; use the named parameter methods |
---|
| 942 | for setting high-level program parameters. |
---|
| 943 | */ |
---|
| 944 | void setVertexProgramParameters(GpuProgramParametersSharedPtr params); |
---|
| 945 | /** Gets the name of the vertex program used by this pass. */ |
---|
| 946 | const String& getVertexProgramName(void) const; |
---|
| 947 | /** Gets the vertex program parameters used by this pass. */ |
---|
| 948 | GpuProgramParametersSharedPtr getVertexProgramParameters(void) const; |
---|
| 949 | /** Gets the vertex program used by this pass, only available after _load(). */ |
---|
| 950 | const GpuProgramPtr& getVertexProgram(void) const; |
---|
| 951 | |
---|
| 952 | |
---|
| 953 | /** Sets the details of the vertex program to use when rendering as a |
---|
| 954 | shadow caster. |
---|
| 955 | @remarks |
---|
| 956 | Texture-based shadows require that the caster is rendered to a texture |
---|
| 957 | in a solid colour (the shadow colour in the case of modulative texture |
---|
| 958 | shadows). Whilst Ogre can arrange this for the fixed function |
---|
| 959 | pipeline, passes which use vertex programs might need the vertex |
---|
| 960 | programs still to run in order to preserve any deformation etc |
---|
| 961 | that it does. However, lighting calculations must be a lot simpler, |
---|
| 962 | with only the ambient colour being used (which the engine will ensure |
---|
| 963 | is bound to the shadow colour). |
---|
| 964 | @par |
---|
| 965 | Therefore, it is up to implemetors of vertex programs to provide an |
---|
| 966 | alternative vertex program which can be used to render the object |
---|
| 967 | to a shadow texture. Do all the same vertex transforms, but set the |
---|
| 968 | colour of the vertex to the ambient colour, as bound using the |
---|
| 969 | standard auto parameter binding mechanism. |
---|
| 970 | @note |
---|
| 971 | Some vertex programs will work without doing this, because Ogre ensures |
---|
| 972 | that all lights except for ambient are set black. However, the chances |
---|
| 973 | are that your vertex program is doing a lot of unnecessary work in this |
---|
| 974 | case, since the other lights are having no effect, and it is good practice |
---|
| 975 | to supply an alternative. |
---|
| 976 | @note |
---|
| 977 | This is only applicable to programmable passes. |
---|
| 978 | @par |
---|
| 979 | The default behaviour is for Ogre to switch to fixed-function |
---|
| 980 | rendering if an explict vertex program alternative is not set. |
---|
| 981 | */ |
---|
| 982 | void setShadowCasterVertexProgram(const String& name); |
---|
| 983 | /** Sets the vertex program parameters for rendering as a shadow caster. |
---|
| 984 | @remarks |
---|
| 985 | Only applicable to programmable passes, and this particular call is |
---|
| 986 | designed for low-level programs; use the named parameter methods |
---|
| 987 | for setting high-level program parameters. |
---|
| 988 | */ |
---|
| 989 | void setShadowCasterVertexProgramParameters(GpuProgramParametersSharedPtr params); |
---|
| 990 | /** Gets the name of the vertex program used by this pass when rendering shadow casters. */ |
---|
| 991 | const String& getShadowCasterVertexProgramName(void) const; |
---|
| 992 | /** Gets the vertex program parameters used by this pass when rendering shadow casters. */ |
---|
| 993 | GpuProgramParametersSharedPtr getShadowCasterVertexProgramParameters(void) const; |
---|
| 994 | /** Gets the vertex program used by this pass when rendering shadow casters, |
---|
| 995 | only available after _load(). */ |
---|
| 996 | const GpuProgramPtr& getShadowCasterVertexProgram(void) const; |
---|
| 997 | |
---|
| 998 | /** Sets the details of the vertex program to use when rendering as a |
---|
| 999 | shadow receiver. |
---|
| 1000 | @remarks |
---|
| 1001 | Texture-based shadows require that the shadow receiver is rendered using |
---|
| 1002 | a projective texture. Whilst Ogre can arrange this for the fixed function |
---|
| 1003 | pipeline, passes which use vertex programs might need the vertex |
---|
| 1004 | programs still to run in order to preserve any deformation etc |
---|
| 1005 | that it does. So in this case, we need a vertex program which does the |
---|
| 1006 | appropriate vertex transformation, but generates projective texture |
---|
| 1007 | coordinates. |
---|
| 1008 | @par |
---|
| 1009 | Therefore, it is up to implemetors of vertex programs to provide an |
---|
| 1010 | alternative vertex program which can be used to render the object |
---|
| 1011 | as a shadow receiver. Do all the same vertex transforms, but generate |
---|
| 1012 | <strong>2 sets</strong> of texture coordinates using the auto parameter |
---|
| 1013 | ACT_TEXTURE_VIEWPROJ_MATRIX, which Ogre will bind to the parameter name / |
---|
| 1014 | index you supply as the second parameter to this method. 2 texture |
---|
| 1015 | sets are needed because Ogre needs to use 2 texture units for some |
---|
| 1016 | shadow effects. |
---|
| 1017 | @note |
---|
| 1018 | This is only applicable to programmable passes. |
---|
| 1019 | @par |
---|
| 1020 | The default behaviour is for Ogre to switch to fixed-function |
---|
| 1021 | rendering if an explict vertex program alternative is not set. |
---|
| 1022 | */ |
---|
| 1023 | void setShadowReceiverVertexProgram(const String& name); |
---|
| 1024 | /** Sets the vertex program parameters for rendering as a shadow receiver. |
---|
| 1025 | @remarks |
---|
| 1026 | Only applicable to programmable passes, and this particular call is |
---|
| 1027 | designed for low-level programs; use the named parameter methods |
---|
| 1028 | for setting high-level program parameters. |
---|
| 1029 | */ |
---|
| 1030 | void setShadowReceiverVertexProgramParameters(GpuProgramParametersSharedPtr params); |
---|
| 1031 | |
---|
| 1032 | /** This method allows you to specify a fragment program for use when |
---|
| 1033 | rendering a texture shadow receiver. |
---|
| 1034 | @remarks |
---|
| 1035 | Texture shadows are applied by rendering the receiver. Modulative texture |
---|
| 1036 | shadows are performed as a post-render darkening pass, and as such |
---|
| 1037 | fragment programs are generally not required per-object. Additive |
---|
| 1038 | texture shadows, however, are applied by accumulating light masked |
---|
| 1039 | out using a texture shadow (black & white by default, unless you |
---|
| 1040 | customise this using SceneManager::setCustomShadowCasterMaterial). |
---|
| 1041 | OGRE can do this for you for most materials, but if you use a custom |
---|
| 1042 | lighting program (e.g. per pixel lighting) then you'll need to provide |
---|
| 1043 | a custom version for receiving shadows. You don't need to provide |
---|
| 1044 | this for shadow casters if you don't use self-shadowing since they |
---|
| 1045 | will never be shadow receivers too. |
---|
| 1046 | @par |
---|
| 1047 | The shadow texture is always bound to texture unit 0 when rendering |
---|
| 1048 | texture shadow passes. Therefore your custom shadow receiver program |
---|
| 1049 | may well just need to shift it's texture unit usage up by one unit, |
---|
| 1050 | and take the shadow texture into account in its calculations. |
---|
| 1051 | */ |
---|
| 1052 | void setShadowReceiverFragmentProgram(const String& name); |
---|
| 1053 | /** Sets the fragment program parameters for rendering as a shadow receiver. |
---|
| 1054 | @remarks |
---|
| 1055 | Only applicable to programmable passes, and this particular call is |
---|
| 1056 | designed for low-level programs; use the named parameter methods |
---|
| 1057 | for setting high-level program parameters. |
---|
| 1058 | */ |
---|
| 1059 | void setShadowReceiverFragmentProgramParameters(GpuProgramParametersSharedPtr params); |
---|
| 1060 | |
---|
| 1061 | /** Gets the name of the vertex program used by this pass when rendering shadow receivers. */ |
---|
| 1062 | const String& getShadowReceiverVertexProgramName(void) const; |
---|
| 1063 | /** Gets the vertex program parameters used by this pass when rendering shadow receivers. */ |
---|
| 1064 | GpuProgramParametersSharedPtr getShadowReceiverVertexProgramParameters(void) const; |
---|
| 1065 | /** Gets the vertex program used by this pass when rendering shadow receivers, |
---|
| 1066 | only available after _load(). */ |
---|
| 1067 | const GpuProgramPtr& getShadowReceiverVertexProgram(void) const; |
---|
| 1068 | |
---|
| 1069 | /** Gets the name of the fragment program used by this pass when rendering shadow receivers. */ |
---|
| 1070 | const String& getShadowReceiverFragmentProgramName(void) const; |
---|
| 1071 | /** Gets the fragment program parameters used by this pass when rendering shadow receivers. */ |
---|
| 1072 | GpuProgramParametersSharedPtr getShadowReceiverFragmentProgramParameters(void) const; |
---|
| 1073 | /** Gets the fragment program used by this pass when rendering shadow receivers, |
---|
| 1074 | only available after _load(). */ |
---|
| 1075 | const GpuProgramPtr& getShadowReceiverFragmentProgram(void) const; |
---|
| 1076 | |
---|
| 1077 | /** Sets the details of the fragment program to use. |
---|
| 1078 | @remarks |
---|
| 1079 | Only applicable to programmable passes, this sets the details of |
---|
| 1080 | the fragment program to use in this pass. The program will not be |
---|
| 1081 | loaded until the parent Material is loaded. |
---|
| 1082 | @param name The name of the program - this must have been |
---|
| 1083 | created using GpuProgramManager by the time that this Pass |
---|
| 1084 | is loaded. If this parameter is blank, any fragment program in this pass is disabled. |
---|
| 1085 | @param resetParams |
---|
| 1086 | If true, this will create a fresh set of parameters from the |
---|
| 1087 | new program being linked, so if you had previously set parameters |
---|
| 1088 | you will have to set them again. If you set this to false, you must |
---|
| 1089 | be absolutely sure that the parameters match perfectly, and in the |
---|
| 1090 | case of named parameters refers to the indexes underlying them, |
---|
| 1091 | not just the names. |
---|
| 1092 | */ |
---|
| 1093 | void setFragmentProgram(const String& name, bool resetParams = true); |
---|
| 1094 | /** Sets the fragment program parameters. |
---|
| 1095 | @remarks |
---|
| 1096 | Only applicable to programmable passes. |
---|
| 1097 | */ |
---|
| 1098 | void setFragmentProgramParameters(GpuProgramParametersSharedPtr params); |
---|
| 1099 | /** Gets the name of the fragment program used by this pass. */ |
---|
| 1100 | const String& getFragmentProgramName(void) const; |
---|
| 1101 | /** Gets the fragment program parameters used by this pass. */ |
---|
| 1102 | GpuProgramParametersSharedPtr getFragmentProgramParameters(void) const; |
---|
| 1103 | /** Gets the fragment program used by this pass, only available after _load(). */ |
---|
| 1104 | const GpuProgramPtr& getFragmentProgram(void) const; |
---|
| 1105 | |
---|
| 1106 | /** Splits this Pass to one which can be handled in the number of |
---|
| 1107 | texture units specified. |
---|
| 1108 | @remarks |
---|
| 1109 | Only works on non-programmable passes, programmable passes cannot be |
---|
| 1110 | split, it's up to the author to ensure that there is a fallback Technique |
---|
| 1111 | for less capable cards. |
---|
| 1112 | @param numUnits The target number of texture units |
---|
| 1113 | @returns A new Pass which contains the remaining units, and a scene_blend |
---|
| 1114 | setting appropriate to approximate the multitexture. This Pass will be |
---|
| 1115 | attached to the parent Technique of this Pass. |
---|
| 1116 | */ |
---|
| 1117 | Pass* _split(unsigned short numUnits); |
---|
| 1118 | |
---|
| 1119 | /** Internal method to adjust pass index. */ |
---|
| 1120 | void _notifyIndex(unsigned short index); |
---|
| 1121 | |
---|
| 1122 | /** Internal method for loading this pass. */ |
---|
| 1123 | void _load(void); |
---|
| 1124 | /** Internal method for unloading this pass. */ |
---|
| 1125 | void _unload(void); |
---|
| 1126 | // Is this loaded? |
---|
| 1127 | bool isLoaded(void) const; |
---|
| 1128 | |
---|
| 1129 | /** Gets the 'hash' of this pass, ie a precomputed number to use for sorting |
---|
| 1130 | @remarks |
---|
| 1131 | This hash is used to sort passes, and for this reason the pass is hashed |
---|
| 1132 | using firstly its index (so that all passes are rendered in order), then |
---|
| 1133 | by the textures which it's TextureUnitState instances are using. |
---|
| 1134 | */ |
---|
| 1135 | uint32 getHash(void) const { return mHash; } |
---|
| 1136 | /// Mark the hash as dirty |
---|
| 1137 | void _dirtyHash(void); |
---|
| 1138 | /** Internal method for recalculating the hash. |
---|
| 1139 | @remarks |
---|
| 1140 | Do not call this unless you are sure the old hash is not still being |
---|
| 1141 | used by anything. If in doubt, call _dirtyHash if you want to force |
---|
| 1142 | recalculation of the has next time. |
---|
| 1143 | */ |
---|
| 1144 | void _recalculateHash(void); |
---|
| 1145 | /** Tells the pass that it needs recompilation. */ |
---|
| 1146 | void _notifyNeedsRecompile(void); |
---|
| 1147 | |
---|
| 1148 | /** Update any automatic parameters (except lights) on this pass */ |
---|
| 1149 | void _updateAutoParamsNoLights(const AutoParamDataSource& source) const; |
---|
| 1150 | /** Update any automatic light parameters on this pass */ |
---|
| 1151 | void _updateAutoParamsLightsOnly(const AutoParamDataSource& source) const; |
---|
| 1152 | |
---|
| 1153 | /** Gets the 'nth' texture which references the given content type. |
---|
| 1154 | @remarks |
---|
| 1155 | If the 'nth' texture unit which references the content type doesn't |
---|
| 1156 | exist, then this method returns an arbitrary high-value outside the |
---|
| 1157 | valid range to index texture units. |
---|
| 1158 | */ |
---|
| 1159 | unsigned short _getTextureUnitWithContentTypeIndex( |
---|
| 1160 | TextureUnitState::ContentType contentType, unsigned short index) const; |
---|
| 1161 | |
---|
| 1162 | /** Set texture filtering for every texture unit |
---|
| 1163 | @note |
---|
| 1164 | This property actually exists on the TextureUnitState class |
---|
| 1165 | For simplicity, this method allows you to set these properties for |
---|
| 1166 | every current TeextureUnitState, If you need more precision, retrieve the |
---|
| 1167 | TextureUnitState instance and set the property there. |
---|
| 1168 | @see TextureUnitState::setTextureFiltering |
---|
| 1169 | */ |
---|
| 1170 | void setTextureFiltering(TextureFilterOptions filterType); |
---|
| 1171 | /** Sets the anisotropy level to be used for all textures. |
---|
| 1172 | @note |
---|
| 1173 | This property has been moved to the TextureUnitState class, which is accessible via the |
---|
| 1174 | Technique and Pass. For simplicity, this method allows you to set these properties for |
---|
| 1175 | every current TeextureUnitState, If you need more precision, retrieve the Technique, |
---|
| 1176 | Pass and TextureUnitState instances and set the property there. |
---|
| 1177 | @see TextureUnitState::setTextureAnisotropy |
---|
| 1178 | */ |
---|
| 1179 | void setTextureAnisotropy(unsigned int maxAniso); |
---|
| 1180 | /** Static method to retrieve all the Passes which need their |
---|
| 1181 | hash values recalculated. |
---|
| 1182 | */ |
---|
| 1183 | static const PassSet& getDirtyHashList(void) |
---|
| 1184 | { return msDirtyHashList; } |
---|
| 1185 | /** Static method to retrieve all the Passes which are pending deletion. |
---|
| 1186 | */ |
---|
| 1187 | static const PassSet& getPassGraveyard(void) |
---|
| 1188 | { return msPassGraveyard; } |
---|
| 1189 | /** Static method to reset the list of passes which need their hash |
---|
| 1190 | values recalculated. |
---|
| 1191 | @remarks |
---|
| 1192 | For performance, the dirty list is not updated progressively as |
---|
| 1193 | the hashes are recalculated, instead we expect the processor of the |
---|
| 1194 | dirty hash list to clear the list when they are done. |
---|
| 1195 | */ |
---|
| 1196 | static void clearDirtyHashList(void); |
---|
| 1197 | |
---|
| 1198 | /** Process all dirty and pending deletion passes. */ |
---|
| 1199 | static void processPendingPassUpdates(void); |
---|
| 1200 | |
---|
| 1201 | /** Queue this pass for deletion when appropriate. */ |
---|
| 1202 | void queueForDeletion(void); |
---|
| 1203 | |
---|
| 1204 | /** Returns whether this pass is ambient only. |
---|
| 1205 | */ |
---|
| 1206 | bool isAmbientOnly(void) const; |
---|
| 1207 | |
---|
| 1208 | /** set the number of iterations that this pass |
---|
| 1209 | should perform when doing fast multi pass operation. |
---|
| 1210 | @remarks |
---|
| 1211 | Only applicable for programmable passes. |
---|
| 1212 | @param count number of iterations to perform fast multi pass operations. |
---|
| 1213 | A value greater than 1 will cause the pass to be executed count number of |
---|
| 1214 | times without changing the render state. This is very usefull for passes |
---|
| 1215 | that use programmable shaders that have to iterate more than once but don't |
---|
| 1216 | need a render state change. Using multi pass can dramatically speed up rendering |
---|
| 1217 | for materials that do things like fur, blur. |
---|
| 1218 | A value of 1 turns off multi pass operation and the pass does |
---|
| 1219 | the normal pass operation. |
---|
| 1220 | */ |
---|
| 1221 | void setPassIterationCount(const size_t count) { mPassIterationCount = count; } |
---|
| 1222 | |
---|
| 1223 | /** Gets the pass iteration count value. |
---|
| 1224 | */ |
---|
| 1225 | size_t getPassIterationCount(void) const { return mPassIterationCount; } |
---|
| 1226 | |
---|
| 1227 | /** Applies texture names to Texture Unit State with matching texture name aliases. |
---|
| 1228 | All Texture Unit States within the pass are checked. |
---|
| 1229 | If matching texture aliases are found then true is returned. |
---|
| 1230 | |
---|
| 1231 | @param |
---|
| 1232 | aliasList is a map container of texture alias, texture name pairs |
---|
| 1233 | @param |
---|
| 1234 | apply set true to apply the texture aliases else just test to see if texture alias matches are found. |
---|
| 1235 | @return |
---|
| 1236 | True if matching texture aliases were found in the pass. |
---|
| 1237 | */ |
---|
| 1238 | bool applyTextureAliases(const AliasTextureNamePairList& aliasList, const bool apply = true) const; |
---|
| 1239 | |
---|
| 1240 | |
---|
| 1241 | /** There are some default hash functions used to order passes so that |
---|
| 1242 | render state changes are minimised, this enumerates them. |
---|
| 1243 | */ |
---|
| 1244 | enum BuiltinHashFunction |
---|
| 1245 | { |
---|
| 1246 | /** Try to minimise the number of texture changes. */ |
---|
| 1247 | MIN_TEXTURE_CHANGE, |
---|
| 1248 | /** Try to minimise the number of GPU program changes. |
---|
| 1249 | @note Only really useful if you use GPU programs for all of your |
---|
| 1250 | materials. |
---|
| 1251 | */ |
---|
| 1252 | MIN_GPU_PROGRAM_CHANGE |
---|
| 1253 | }; |
---|
| 1254 | /** Sets one of the default hash functions to be used. |
---|
| 1255 | @remarks |
---|
| 1256 | You absolutely must not change the hash function whilst any Pass instances |
---|
| 1257 | exist in the render queue. The only time you can do this is either |
---|
| 1258 | before you render anything, or directly after you manuall call |
---|
| 1259 | RenderQueue::clear(true) to completely destroy the queue structures. |
---|
| 1260 | The default is MIN_TEXTURE_CHANGE. |
---|
| 1261 | @note |
---|
| 1262 | You can also implement your own hash function, see the alternate version |
---|
| 1263 | of this method. |
---|
| 1264 | @see HashFunc |
---|
| 1265 | */ |
---|
| 1266 | static void setHashFunction(BuiltinHashFunction builtin); |
---|
| 1267 | |
---|
| 1268 | /** Set the hash function used for all passes. |
---|
| 1269 | @remarks |
---|
| 1270 | You absolutely must not change the hash function whilst any Pass instances |
---|
| 1271 | exist in the render queue. The only time you can do this is either |
---|
| 1272 | before you render anything, or directly after you manuall call |
---|
| 1273 | RenderQueue::clear(true) to completely destroy the queue structures. |
---|
| 1274 | @note |
---|
| 1275 | You can also use one of the built-in hash functions, see the alternate version |
---|
| 1276 | of this method. The default is MIN_TEXTURE_CHANGE. |
---|
| 1277 | @see HashFunc |
---|
| 1278 | */ |
---|
| 1279 | static void setHashFunction(HashFunc* hashFunc) { msHashFunc = hashFunc; } |
---|
| 1280 | |
---|
| 1281 | /** Get the hash function used for all passes. |
---|
| 1282 | */ |
---|
| 1283 | static HashFunc* getHashFunction(void) { return msHashFunc; } |
---|
| 1284 | |
---|
| 1285 | }; |
---|
| 1286 | |
---|
| 1287 | enum IlluminationStage |
---|
| 1288 | { |
---|
| 1289 | /// Part of the rendering which occurs without any kind of direct lighting |
---|
| 1290 | IS_AMBIENT, |
---|
| 1291 | /// Part of the rendering which occurs per light |
---|
| 1292 | IS_PER_LIGHT, |
---|
| 1293 | /// Post-lighting rendering |
---|
| 1294 | IS_DECAL |
---|
| 1295 | }; |
---|
| 1296 | /** Struct recording a pass which can be used for a specific illumination stage. |
---|
| 1297 | @remarks |
---|
| 1298 | This structure is used to record categorised passes which fit into a |
---|
| 1299 | number of distinct illumination phases - ambient, diffuse / specular |
---|
| 1300 | (per-light) and decal (post-lighting texturing). |
---|
| 1301 | An original pass may fit into one of these categories already, or it |
---|
| 1302 | may require splitting into its component parts in order to be categorised |
---|
| 1303 | properly. |
---|
| 1304 | */ |
---|
| 1305 | struct IlluminationPass |
---|
| 1306 | { |
---|
| 1307 | IlluminationStage stage; |
---|
| 1308 | /// The pass to use in this stage |
---|
| 1309 | Pass* pass; |
---|
| 1310 | /// Whether this pass is one which should be deleted itself |
---|
| 1311 | bool destroyOnShutdown; |
---|
| 1312 | /// The original pass which spawned this one |
---|
| 1313 | Pass* originalPass; |
---|
| 1314 | }; |
---|
| 1315 | |
---|
| 1316 | typedef std::vector<IlluminationPass*> IlluminationPassList; |
---|
| 1317 | |
---|
| 1318 | |
---|
| 1319 | } |
---|
| 1320 | |
---|
| 1321 | #endif |
---|