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-2013 Torus Knot Software Ltd |
---|
8 | |
---|
9 | Permission is hereby granted, free of charge, to any person obtaining a copy |
---|
10 | of this software and associated documentation files (the "Software"), to deal |
---|
11 | in the Software without restriction, including without limitation the rights |
---|
12 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
---|
13 | copies of the Software, and to permit persons to whom the Software is |
---|
14 | furnished to do so, subject to the following conditions: |
---|
15 | |
---|
16 | The above copyright notice and this permission notice shall be included in |
---|
17 | all copies or substantial portions of the Software. |
---|
18 | |
---|
19 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
---|
20 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
---|
21 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
---|
22 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
---|
23 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
---|
24 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
---|
25 | THE SOFTWARE. |
---|
26 | ----------------------------------------------------------------------------- |
---|
27 | */ |
---|
28 | #ifndef __Technique_H__ |
---|
29 | #define __Technique_H__ |
---|
30 | |
---|
31 | #include "OgrePrerequisites.h" |
---|
32 | #include "OgreIteratorWrappers.h" |
---|
33 | #include "OgreBlendMode.h" |
---|
34 | #include "OgreCommon.h" |
---|
35 | #include "OgrePass.h" |
---|
36 | #include "OgreIteratorWrappers.h" |
---|
37 | #include "OgreRenderSystemCapabilities.h" |
---|
38 | #include "OgreUserObjectBindings.h" |
---|
39 | |
---|
40 | namespace Ogre { |
---|
41 | /** \addtogroup Core |
---|
42 | * @{ |
---|
43 | */ |
---|
44 | /** \addtogroup Materials |
---|
45 | * @{ |
---|
46 | */ |
---|
47 | /** Class representing an approach to rendering this particular Material. |
---|
48 | @remarks |
---|
49 | Ogre will attempt to use the best technique supported by the active hardware, |
---|
50 | unless you specifically request a lower detail technique (say for distant |
---|
51 | rendering). |
---|
52 | */ |
---|
53 | class _OgreExport Technique : public TechniqueAlloc |
---|
54 | { |
---|
55 | protected: |
---|
56 | /// Illumination pass state type |
---|
57 | enum IlluminationPassesState |
---|
58 | { |
---|
59 | IPS_COMPILE_DISABLED = -1, |
---|
60 | IPS_NOT_COMPILED = 0, |
---|
61 | IPS_COMPILED = 1 |
---|
62 | }; |
---|
63 | |
---|
64 | typedef vector<Pass*>::type Passes; |
---|
65 | /// List of primary passes |
---|
66 | Passes mPasses; |
---|
67 | /// List of derived passes, categorised into IlluminationStage (ordered) |
---|
68 | IlluminationPassList mIlluminationPasses; |
---|
69 | // Raw pointer since we don't want child to stop parent's destruction |
---|
70 | Material* mParent; |
---|
71 | bool mIsSupported; |
---|
72 | IlluminationPassesState mIlluminationPassesCompilationPhase; |
---|
73 | /// LOD level |
---|
74 | unsigned short mLodIndex; |
---|
75 | /** Scheme index, derived from scheme name but the names are held on |
---|
76 | MaterialManager, for speed an index is used here. |
---|
77 | */ |
---|
78 | unsigned short mSchemeIndex; |
---|
79 | /// Optional name for the technique |
---|
80 | String mName; |
---|
81 | |
---|
82 | /// Internal method for clearing illumination pass list |
---|
83 | void clearIlluminationPasses(void); |
---|
84 | /// Internal method - check for manually assigned illumination passes |
---|
85 | bool checkManuallyOrganisedIlluminationPasses(); |
---|
86 | |
---|
87 | |
---|
88 | /** When casting shadow, if not using default Ogre shadow casting material, or |
---|
89 | * nor using fixed function casting, mShadowCasterMaterial let you customize per material |
---|
90 | * shadow caster behavior |
---|
91 | */ |
---|
92 | MaterialPtr mShadowCasterMaterial; |
---|
93 | /** When casting shadow, if not using default Ogre shadow casting material, or |
---|
94 | * nor using fixed function casting, mShadowCasterMaterial let you customize per material |
---|
95 | * shadow caster behavior.There only material name is stored so that it can be loaded once all file parsed in a resource group. |
---|
96 | */ |
---|
97 | String mShadowCasterMaterialName; |
---|
98 | /** When receiving shadow, if not using default Ogre shadow receiving material, or |
---|
99 | * nor using fixed function texture projection receiving, mShadowReceiverMaterial let you customize per material |
---|
100 | * shadow caster behavior |
---|
101 | */ |
---|
102 | MaterialPtr mShadowReceiverMaterial; |
---|
103 | /** When receiving shadow, if not using default Ogre shadow receiving material, or |
---|
104 | * nor using fixed function texture projection receiving, mShadowReceiverMaterial let you customize per material |
---|
105 | * shadow caster behavior. There only material name is stored so that it can be loaded once all file parsed in a resource group. |
---|
106 | */ |
---|
107 | String mShadowReceiverMaterialName; |
---|
108 | |
---|
109 | // User objects binding. |
---|
110 | UserObjectBindings mUserObjectBindings; |
---|
111 | |
---|
112 | public: |
---|
113 | /** Directive used to manually control technique support based on the |
---|
114 | inclusion or exclusion of some factor. |
---|
115 | */ |
---|
116 | enum IncludeOrExclude |
---|
117 | { |
---|
118 | /// Inclusive - only support if present |
---|
119 | INCLUDE = 0, |
---|
120 | /// Exclusive - do not support if present |
---|
121 | EXCLUDE = 1 |
---|
122 | }; |
---|
123 | /// Rule controlling whether technique is deemed supported based on GPU vendor |
---|
124 | struct GPUVendorRule |
---|
125 | { |
---|
126 | GPUVendor vendor; |
---|
127 | IncludeOrExclude includeOrExclude; |
---|
128 | GPUVendorRule() |
---|
129 | : vendor(GPU_UNKNOWN), includeOrExclude(EXCLUDE) {} |
---|
130 | GPUVendorRule(GPUVendor v, IncludeOrExclude ie) |
---|
131 | : vendor(v), includeOrExclude(ie) {} |
---|
132 | }; |
---|
133 | /// Rule controlling whether technique is deemed supported based on GPU device name |
---|
134 | struct GPUDeviceNameRule |
---|
135 | { |
---|
136 | String devicePattern; |
---|
137 | IncludeOrExclude includeOrExclude; |
---|
138 | bool caseSensitive; |
---|
139 | GPUDeviceNameRule() |
---|
140 | : includeOrExclude(EXCLUDE), caseSensitive(false) {} |
---|
141 | GPUDeviceNameRule(const String& pattern, IncludeOrExclude ie, bool caseSen) |
---|
142 | : devicePattern(pattern), includeOrExclude(ie), caseSensitive(caseSen) {} |
---|
143 | }; |
---|
144 | typedef vector<GPUVendorRule>::type GPUVendorRuleList; |
---|
145 | typedef vector<GPUDeviceNameRule>::type GPUDeviceNameRuleList; |
---|
146 | protected: |
---|
147 | GPUVendorRuleList mGPUVendorRules; |
---|
148 | GPUDeviceNameRuleList mGPUDeviceNameRules; |
---|
149 | public: |
---|
150 | /// Constructor |
---|
151 | Technique(Material* parent); |
---|
152 | /// Copy constructor |
---|
153 | Technique(Material* parent, const Technique& oth); |
---|
154 | ~Technique(); |
---|
155 | /** Indicates if this technique is supported by the current graphics card. |
---|
156 | @remarks |
---|
157 | This will only be correct after the Technique has been compiled, which is |
---|
158 | usually done from Material::compile. |
---|
159 | */ |
---|
160 | bool isSupported(void) const; |
---|
161 | /** Internal compilation method; see Material::compile. |
---|
162 | @return Any information explaining problems with the compile. |
---|
163 | */ |
---|
164 | String _compile(bool autoManageTextureUnits); |
---|
165 | /// Internal method for checking GPU vendor / device rules |
---|
166 | bool checkGPURules(StringUtil::StrStreamType& errors); |
---|
167 | /// Internal method for checking hardware support |
---|
168 | bool checkHardwareSupport(bool autoManageTextureUnits, StringUtil::StrStreamType& compileErrors); |
---|
169 | /** Internal method for splitting the passes into illumination passes. */ |
---|
170 | void _compileIlluminationPasses(void); |
---|
171 | size_t calculateSize(void) const; |
---|
172 | |
---|
173 | /** Creates a new Pass for this Technique. |
---|
174 | @remarks |
---|
175 | A Pass is a single rendering pass, i.e. a single draw of the given material. |
---|
176 | Note that if you create a pass without a fragment program, during compilation of the |
---|
177 | material the pass may be split into multiple passes if the graphics card cannot |
---|
178 | handle the number of texture units requested. For passes with fragment programs, however, |
---|
179 | the number of passes you create will never be altered, so you have to make sure |
---|
180 | that you create an alternative fallback Technique for if a card does not have |
---|
181 | enough facilities for what you're asking for. |
---|
182 | */ |
---|
183 | Pass* createPass(void); |
---|
184 | /** Retrieves the Pass with the given index. */ |
---|
185 | Pass* getPass(unsigned short index); |
---|
186 | /** Retrieves the Pass matching name. |
---|
187 | Returns 0 if name match is not found. |
---|
188 | */ |
---|
189 | Pass* getPass(const String& name); |
---|
190 | /** Retrieves the number of passes. */ |
---|
191 | unsigned short getNumPasses(void) const; |
---|
192 | /** Removes the Pass with the given index. */ |
---|
193 | void removePass(unsigned short index); |
---|
194 | /** Removes all Passes from this Technique. */ |
---|
195 | void removeAllPasses(void); |
---|
196 | /** Move a pass from source index to destination index. |
---|
197 | If successful then returns true. |
---|
198 | */ |
---|
199 | bool movePass(const unsigned short sourceIndex, const unsigned short destinationIndex); |
---|
200 | typedef VectorIterator<Passes> PassIterator; |
---|
201 | /** Gets an iterator over the passes in this Technique. */ |
---|
202 | const PassIterator getPassIterator(void); |
---|
203 | typedef VectorIterator<IlluminationPassList> IlluminationPassIterator; |
---|
204 | /** Gets an iterator over the illumination-stage categorised passes. */ |
---|
205 | const IlluminationPassIterator getIlluminationPassIterator(void); |
---|
206 | /// Gets the parent Material |
---|
207 | Material* getParent(void) const { return mParent; } |
---|
208 | |
---|
209 | /** Overloaded operator to copy on Technique to another. */ |
---|
210 | Technique& operator=(const Technique& rhs); |
---|
211 | |
---|
212 | /// Gets the resource group of the ultimate parent Material |
---|
213 | const String& getResourceGroup(void) const; |
---|
214 | |
---|
215 | /** Returns true if this Technique involves transparency. |
---|
216 | @remarks |
---|
217 | This basically boils down to whether the first pass |
---|
218 | has a scene blending factor. Even if the other passes |
---|
219 | do not, the base colour, including parts of the original |
---|
220 | scene, may be used for blending, therefore we have to treat |
---|
221 | the whole Technique as transparent. |
---|
222 | */ |
---|
223 | bool isTransparent(void) const; |
---|
224 | |
---|
225 | /** Returns true if this Technique has transparent sorting enabled. |
---|
226 | @remarks |
---|
227 | This basically boils down to whether the first pass |
---|
228 | has transparent sorting enabled or not |
---|
229 | */ |
---|
230 | bool isTransparentSortingEnabled(void) const; |
---|
231 | |
---|
232 | /** Returns true if this Technique has transparent sorting forced. |
---|
233 | @remarks |
---|
234 | This basically boils down to whether the first pass |
---|
235 | has transparent sorting forced or not |
---|
236 | */ |
---|
237 | bool isTransparentSortingForced(void) const; |
---|
238 | |
---|
239 | /** Internal prepare method, derived from call to Material::prepare. */ |
---|
240 | void _prepare(void); |
---|
241 | /** Internal unprepare method, derived from call to Material::unprepare. */ |
---|
242 | void _unprepare(void); |
---|
243 | /** Internal load method, derived from call to Material::load. */ |
---|
244 | void _load(void); |
---|
245 | /** Internal unload method, derived from call to Material::unload. */ |
---|
246 | void _unload(void); |
---|
247 | |
---|
248 | /// Is this loaded? |
---|
249 | bool isLoaded(void) const; |
---|
250 | |
---|
251 | /** Tells the technique that it needs recompilation. */ |
---|
252 | void _notifyNeedsRecompile(void); |
---|
253 | |
---|
254 | /** return this material specific shadow casting specific material |
---|
255 | */ |
---|
256 | Ogre::MaterialPtr getShadowCasterMaterial() const; |
---|
257 | /** set this material specific shadow casting specific material |
---|
258 | */ |
---|
259 | void setShadowCasterMaterial(Ogre::MaterialPtr val); |
---|
260 | /** set this material specific shadow casting specific material |
---|
261 | */ |
---|
262 | void setShadowCasterMaterial(const Ogre::String &name); |
---|
263 | /** return this material specific shadow receiving specific material |
---|
264 | */ |
---|
265 | Ogre::MaterialPtr getShadowReceiverMaterial() const; |
---|
266 | /** set this material specific shadow receiving specific material |
---|
267 | */ |
---|
268 | void setShadowReceiverMaterial(Ogre::MaterialPtr val); |
---|
269 | /** set this material specific shadow receiving specific material |
---|
270 | */ |
---|
271 | void setShadowReceiverMaterial(const Ogre::String &name); |
---|
272 | |
---|
273 | // ------------------------------------------------------------------------------- |
---|
274 | // The following methods are to make migration from previous versions simpler |
---|
275 | // and to make code easier to write when dealing with simple materials |
---|
276 | // They set the properties which have been moved to Pass for all Techniques and all Passes |
---|
277 | |
---|
278 | /** Sets the point size properties for every Pass in this Technique. |
---|
279 | @note |
---|
280 | This property actually exists on the Pass class. For simplicity, this method allows |
---|
281 | you to set these properties for every current Pass within this Technique. If |
---|
282 | you need more precision, retrieve the Pass instance and set the |
---|
283 | property there. |
---|
284 | @see Pass::setPointSize |
---|
285 | */ |
---|
286 | void setPointSize(Real ps); |
---|
287 | |
---|
288 | /** Sets the ambient colour reflectance properties for every Pass in every Technique. |
---|
289 | @note |
---|
290 | This property actually exists on the Pass class. For simplicity, this method allows |
---|
291 | you to set these properties for every current Pass within this Technique. If |
---|
292 | you need more precision, retrieve the Pass instance and set the |
---|
293 | property there. |
---|
294 | @see Pass::setAmbient |
---|
295 | */ |
---|
296 | void setAmbient(Real red, Real green, Real blue); |
---|
297 | |
---|
298 | /** Sets the ambient colour reflectance properties for every Pass in every Technique. |
---|
299 | @note |
---|
300 | This property actually exists on the Pass class. For simplicity, this method allows |
---|
301 | you to set these properties for every current Pass within this Technique. If |
---|
302 | you need more precision, retrieve the Pass instance and set the |
---|
303 | property there. |
---|
304 | @see Pass::setAmbient |
---|
305 | */ |
---|
306 | void setAmbient(const ColourValue& ambient); |
---|
307 | |
---|
308 | /** Sets the diffuse colour reflectance properties of every Pass in every Technique. |
---|
309 | @note |
---|
310 | This property actually exists on the Pass class. For simplicity, this method allows |
---|
311 | you to set these properties for every current Pass within this Technique. If |
---|
312 | you need more precision, retrieve the Pass instance and set the |
---|
313 | property there. |
---|
314 | @see Pass::setDiffuse |
---|
315 | */ |
---|
316 | void setDiffuse(Real red, Real green, Real blue, Real alpha); |
---|
317 | |
---|
318 | /** Sets the diffuse colour reflectance properties of every Pass in every Technique. |
---|
319 | @note |
---|
320 | This property actually exists on the Pass class. For simplicity, this method allows |
---|
321 | you to set these properties for every current Pass within this Technique. If |
---|
322 | you need more precision, retrieve the Pass instance and set the |
---|
323 | property there. |
---|
324 | @see Pass::setDiffuse |
---|
325 | */ |
---|
326 | void setDiffuse(const ColourValue& diffuse); |
---|
327 | |
---|
328 | /** Sets the specular colour reflectance properties of every Pass in every Technique. |
---|
329 | @note |
---|
330 | This property actually exists on the Pass class. For simplicity, this method allows |
---|
331 | you to set these properties for every current Pass within this Technique. If |
---|
332 | you need more precision, retrieve the Pass instance and set the |
---|
333 | property there. |
---|
334 | @see Pass::setSpecular |
---|
335 | */ |
---|
336 | void setSpecular(Real red, Real green, Real blue, Real alpha); |
---|
337 | |
---|
338 | /** Sets the specular colour reflectance properties of every Pass in every Technique. |
---|
339 | @note |
---|
340 | This property actually exists on the Pass class. For simplicity, this method allows |
---|
341 | you to set these properties for every current Pass within this Technique. If |
---|
342 | you need more precision, retrieve the Pass instance and set the |
---|
343 | property there. |
---|
344 | @see Pass::setSpecular |
---|
345 | */ |
---|
346 | void setSpecular(const ColourValue& specular); |
---|
347 | |
---|
348 | /** Sets the shininess properties of every Pass in every Technique. |
---|
349 | @note |
---|
350 | This property actually exists on the Pass class. For simplicity, this method allows |
---|
351 | you to set these properties for every current Pass within this Technique. If |
---|
352 | you need more precision, retrieve the Pass instance and set the |
---|
353 | property there. |
---|
354 | @see Pass::setShininess |
---|
355 | */ |
---|
356 | void setShininess(Real val); |
---|
357 | |
---|
358 | /** Sets the amount of self-illumination of every Pass in every Technique. |
---|
359 | @note |
---|
360 | This property actually exists on the Pass class. For simplicity, this method allows |
---|
361 | you to set these properties for every current Pass within this Technique. If |
---|
362 | you need more precision, retrieve the Pass instance and set the |
---|
363 | property there. |
---|
364 | @see Pass::setSelfIllumination |
---|
365 | */ |
---|
366 | void setSelfIllumination(Real red, Real green, Real blue); |
---|
367 | |
---|
368 | /** Sets the amount of self-illumination of every Pass in every Technique. |
---|
369 | @note |
---|
370 | This property actually exists on the Pass class. For simplicity, this method allows |
---|
371 | you to set these properties for every current Pass within this Technique. If |
---|
372 | you need more precision, retrieve the Pass instance and set the |
---|
373 | property there. |
---|
374 | @see Pass::setSelfIllumination |
---|
375 | */ |
---|
376 | void setSelfIllumination(const ColourValue& selfIllum); |
---|
377 | |
---|
378 | /** Sets whether or not each Pass renders with depth-buffer checking on or not. |
---|
379 | @note |
---|
380 | This property actually exists on the Pass class. For simplicity, this method allows |
---|
381 | you to set these properties for every current Pass within this Technique. If |
---|
382 | you need more precision, retrieve the Pass instance and set the |
---|
383 | property there. |
---|
384 | @see Pass::setDepthCheckEnabled |
---|
385 | */ |
---|
386 | void setDepthCheckEnabled(bool enabled); |
---|
387 | |
---|
388 | /** Sets whether or not each Pass renders with depth-buffer writing on or not. |
---|
389 | @note |
---|
390 | This property actually exists on the Pass class. For simplicity, this method allows |
---|
391 | you to set these properties for every current Pass within this Technique. If |
---|
392 | you need more precision, retrieve the Pass instance and set the |
---|
393 | property there. |
---|
394 | @see Pass::setDepthWriteEnabled |
---|
395 | */ |
---|
396 | void setDepthWriteEnabled(bool enabled); |
---|
397 | |
---|
398 | /** Sets the function used to compare depth values when depth checking is on. |
---|
399 | @note |
---|
400 | This property actually exists on the Pass class. For simplicity, this method allows |
---|
401 | you to set these properties for every current Pass within this Technique. If |
---|
402 | you need more precision, retrieve the Pass instance and set the |
---|
403 | property there. |
---|
404 | @see Pass::setDepthFunction |
---|
405 | */ |
---|
406 | void setDepthFunction( CompareFunction func ); |
---|
407 | |
---|
408 | /** Sets whether or not colour buffer writing is enabled for each Pass. |
---|
409 | @note |
---|
410 | This property actually exists on the Pass class. For simplicity, this method allows |
---|
411 | you to set these properties for every current Pass within this Technique. If |
---|
412 | you need more precision, retrieve the Pass instance and set the |
---|
413 | property there. |
---|
414 | @see Pass::setColourWriteEnabled |
---|
415 | */ |
---|
416 | void setColourWriteEnabled(bool enabled); |
---|
417 | |
---|
418 | /** Sets the culling mode for each pass based on the 'vertex winding'. |
---|
419 | @note |
---|
420 | This property actually exists on the Pass class. For simplicity, this method allows |
---|
421 | you to set these properties for every current Pass within this Technique. If |
---|
422 | you need more precision, retrieve the Pass instance and set the |
---|
423 | property there. |
---|
424 | @see Pass::setCullingMode |
---|
425 | */ |
---|
426 | void setCullingMode( CullingMode mode ); |
---|
427 | |
---|
428 | /** Sets the manual culling mode, performed by CPU rather than hardware. |
---|
429 | @note |
---|
430 | This property actually exists on the Pass class. For simplicity, this method allows |
---|
431 | you to set these properties for every current Pass within this Technique. If |
---|
432 | you need more precision, retrieve the Pass instance and set the |
---|
433 | property there. |
---|
434 | @see Pass::setManualCullingMode |
---|
435 | */ |
---|
436 | void setManualCullingMode( ManualCullingMode mode ); |
---|
437 | |
---|
438 | /** Sets whether or not dynamic lighting is enabled for every Pass. |
---|
439 | @note |
---|
440 | This property actually exists on the Pass class. For simplicity, this method allows |
---|
441 | you to set these properties for every current Pass within this Technique. If |
---|
442 | you need more precision, retrieve the Pass instance and set the |
---|
443 | property there. |
---|
444 | @see Pass::setLightingEnabled |
---|
445 | */ |
---|
446 | void setLightingEnabled(bool enabled); |
---|
447 | |
---|
448 | /** Sets the type of light shading required |
---|
449 | @note |
---|
450 | This property actually exists on the Pass class. For simplicity, this method allows |
---|
451 | you to set these properties for every current Pass within this Technique. If |
---|
452 | you need more precision, retrieve the Pass instance and set the |
---|
453 | property there. |
---|
454 | @see Pass::setShadingMode |
---|
455 | */ |
---|
456 | void setShadingMode( ShadeOptions mode ); |
---|
457 | |
---|
458 | /** Sets the fogging mode applied to each pass. |
---|
459 | @note |
---|
460 | This property actually exists on the Pass class. For simplicity, this method allows |
---|
461 | you to set these properties for every current Pass within this Technique. If |
---|
462 | you need more precision, retrieve the Pass instance and set the |
---|
463 | property there. |
---|
464 | @see Pass::setFog |
---|
465 | */ |
---|
466 | void setFog( |
---|
467 | bool overrideScene, |
---|
468 | FogMode mode = FOG_NONE, |
---|
469 | const ColourValue& colour = ColourValue::White, |
---|
470 | Real expDensity = 0.001, Real linearStart = 0.0, Real linearEnd = 1.0 ); |
---|
471 | |
---|
472 | /** Sets the depth bias to be used for each Pass. |
---|
473 | @note |
---|
474 | This property actually exists on the Pass class. For simplicity, this method allows |
---|
475 | you to set these properties for every current Pass within this Technique. If |
---|
476 | you need more precision, retrieve the Pass instance and set the |
---|
477 | property there. |
---|
478 | @see Pass::setDepthBias |
---|
479 | */ |
---|
480 | void setDepthBias(float constantBias, float slopeScaleBias); |
---|
481 | |
---|
482 | /** Set texture filtering for every texture unit in every Pass |
---|
483 | @note |
---|
484 | This property actually exists on the TextureUnitState class |
---|
485 | For simplicity, this method allows you to set these properties for |
---|
486 | every current TeextureUnitState, If you need more precision, retrieve the |
---|
487 | Pass and TextureUnitState instances and set the property there. |
---|
488 | @see TextureUnitState::setTextureFiltering |
---|
489 | */ |
---|
490 | void setTextureFiltering(TextureFilterOptions filterType); |
---|
491 | /** Sets the anisotropy level to be used for all textures. |
---|
492 | @note |
---|
493 | This property has been moved to the TextureUnitState class, which is accessible via the |
---|
494 | Technique and Pass. For simplicity, this method allows you to set these properties for |
---|
495 | every current TeextureUnitState, If you need more precision, retrieve the Technique, |
---|
496 | Pass and TextureUnitState instances and set the property there. |
---|
497 | @see TextureUnitState::setTextureAnisotropy |
---|
498 | */ |
---|
499 | void setTextureAnisotropy(unsigned int maxAniso); |
---|
500 | |
---|
501 | /** Sets the kind of blending every pass has with the existing contents of the scene. |
---|
502 | @note |
---|
503 | This property actually exists on the Pass class. For simplicity, this method allows |
---|
504 | you to set these properties for every current Pass within this Technique. If |
---|
505 | you need more precision, retrieve the Pass instance and set the |
---|
506 | property there. |
---|
507 | @see Pass::setSceneBlending |
---|
508 | */ |
---|
509 | void setSceneBlending( const SceneBlendType sbt ); |
---|
510 | |
---|
511 | /** Sets the kind of blending every pass has with the existing contents of the scene, using individual factors both color and alpha channels |
---|
512 | @note |
---|
513 | This property actually exists on the Pass class. For simplicity, this method allows |
---|
514 | you to set these properties for every current Pass within this Technique. If |
---|
515 | you need more precision, retrieve the Pass instance and set the |
---|
516 | property there. |
---|
517 | @see Pass::setSeparateSceneBlending |
---|
518 | */ |
---|
519 | void setSeparateSceneBlending( const SceneBlendType sbt, const SceneBlendType sbta ); |
---|
520 | |
---|
521 | /** Allows very fine control of blending every Pass with the existing contents of the scene. |
---|
522 | @note |
---|
523 | This property actually exists on the Pass class. For simplicity, this method allows |
---|
524 | you to set these properties for every current Pass within this Technique. If |
---|
525 | you need more precision, retrieve the Pass instance and set the |
---|
526 | property there. |
---|
527 | @see Pass::setSceneBlending |
---|
528 | */ |
---|
529 | void setSceneBlending( const SceneBlendFactor sourceFactor, const SceneBlendFactor destFactor); |
---|
530 | |
---|
531 | /** Allows very fine control of blending every Pass with the existing contents of the scene, using individual factors both color and alpha channels |
---|
532 | @note |
---|
533 | This property actually exists on the Pass class. For simplicity, this method allows |
---|
534 | you to set these properties for every current Pass within this Technique. If |
---|
535 | you need more precision, retrieve the Pass instance and set the |
---|
536 | property there. |
---|
537 | @see Pass::setSeparateSceneBlending |
---|
538 | */ |
---|
539 | void setSeparateSceneBlending( const SceneBlendFactor sourceFactor, const SceneBlendFactor destFactor, const SceneBlendFactor sourceFactorAlpha, const SceneBlendFactor destFactorAlpha); |
---|
540 | |
---|
541 | /** Assigns a level-of-detail (LOD) index to this Technique. |
---|
542 | @remarks |
---|
543 | As noted previously, as well as providing fallback support for various |
---|
544 | graphics cards, multiple Technique objects can also be used to implement |
---|
545 | material LOD, where the detail of the material diminishes with distance to |
---|
546 | save rendering power. |
---|
547 | @par |
---|
548 | By default, all Techniques have a LOD index of 0, which means they are the highest |
---|
549 | level of detail. Increasing LOD indexes are lower levels of detail. You can |
---|
550 | assign more than one Technique to the same LOD index, meaning that the best |
---|
551 | Technique that is supported at that LOD index is used. |
---|
552 | @par |
---|
553 | You should not leave gaps in the LOD sequence; Ogre will allow you to do this |
---|
554 | and will continue to function as if the LODs were sequential, but it will |
---|
555 | confuse matters. |
---|
556 | */ |
---|
557 | void setLodIndex(unsigned short index); |
---|
558 | /** Gets the level-of-detail index assigned to this Technique. */ |
---|
559 | unsigned short getLodIndex(void) const { return mLodIndex; } |
---|
560 | |
---|
561 | /** Set the 'scheme name' for this technique. |
---|
562 | @remarks |
---|
563 | Material schemes are used to control top-level switching from one |
---|
564 | set of techniques to another. For example, you might use this to |
---|
565 | define 'high', 'medium' and 'low' complexity levels on materials |
---|
566 | to allow a user to pick a performance / quality ratio. Another |
---|
567 | possibility is that you have a fully HDR-enabled pipeline for top |
---|
568 | machines, rendering all objects using unclamped shaders, and a |
---|
569 | simpler pipeline for others; this can be implemented using |
---|
570 | schemes. |
---|
571 | @par |
---|
572 | Every technique belongs to a scheme - if you don't specify one, the |
---|
573 | Technique belongs to the scheme called 'Default', which is also the |
---|
574 | scheme used to render by default. The active scheme is set one of |
---|
575 | two ways - either by calling Viewport::setMaterialScheme, or |
---|
576 | by manually calling MaterialManager::setActiveScheme. |
---|
577 | */ |
---|
578 | void setSchemeName(const String& schemeName); |
---|
579 | /** Returns the scheme to which this technique is assigned. |
---|
580 | @see Technique::setSchemeName |
---|
581 | */ |
---|
582 | const String& getSchemeName(void) const; |
---|
583 | |
---|
584 | /// Internal method for getting the scheme index |
---|
585 | unsigned short _getSchemeIndex(void) const; |
---|
586 | |
---|
587 | /** Is depth writing going to occur on this technique? */ |
---|
588 | bool isDepthWriteEnabled(void) const; |
---|
589 | |
---|
590 | /** Is depth checking going to occur on this technique? */ |
---|
591 | bool isDepthCheckEnabled(void) const; |
---|
592 | |
---|
593 | /** Exists colour writing disabled pass on this technique? */ |
---|
594 | bool hasColourWriteDisabled(void) const; |
---|
595 | |
---|
596 | /** Set the name of the technique. |
---|
597 | @remarks |
---|
598 | The use of technique name is optional. Its useful in material scripts where a material could inherit |
---|
599 | from another material and only want to modify a particular technique. |
---|
600 | */ |
---|
601 | void setName(const String& name); |
---|
602 | /// Gets the name of the technique |
---|
603 | const String& getName(void) const { return mName; } |
---|
604 | |
---|
605 | /** Applies texture names to Texture Unit State with matching texture name aliases. |
---|
606 | All passes, and Texture Unit States within the technique are checked. |
---|
607 | If matching texture aliases are found then true is returned. |
---|
608 | |
---|
609 | @param |
---|
610 | aliasList is a map container of texture alias, texture name pairs |
---|
611 | @param |
---|
612 | apply set true to apply the texture aliases else just test to see if texture alias matches are found. |
---|
613 | @return |
---|
614 | True if matching texture aliases were found in the Technique. |
---|
615 | */ |
---|
616 | bool applyTextureAliases(const AliasTextureNamePairList& aliasList, const bool apply = true) const; |
---|
617 | |
---|
618 | |
---|
619 | /** Add a rule which manually influences the support for this technique based |
---|
620 | on a GPU vendor. |
---|
621 | @remarks |
---|
622 | You can use this facility to manually control whether a technique is |
---|
623 | considered supported, based on a GPU vendor. You can add inclusive |
---|
624 | or exclusive rules, and you can add as many of each as you like. If |
---|
625 | at least one inclusive rule is added, a technique is considered |
---|
626 | unsupported if it does not match any of those inclusive rules. If exclusive rules are |
---|
627 | added, the technique is considered unsupported if it matches any of |
---|
628 | those inclusive rules. |
---|
629 | @note |
---|
630 | Any rule for the same vendor will be removed before adding this one. |
---|
631 | @param vendor The GPU vendor |
---|
632 | @param includeOrExclude Whether this is an inclusive or exclusive rule |
---|
633 | */ |
---|
634 | void addGPUVendorRule(GPUVendor vendor, IncludeOrExclude includeOrExclude); |
---|
635 | /** Add a rule which manually influences the support for this technique based |
---|
636 | on a GPU vendor. |
---|
637 | @remarks |
---|
638 | You can use this facility to manually control whether a technique is |
---|
639 | considered supported, based on a GPU vendor. You can add inclusive |
---|
640 | or exclusive rules, and you can add as many of each as you like. If |
---|
641 | at least one inclusive rule is added, a technique is considered |
---|
642 | unsupported if it does not match any of those inclusive rules. If exclusive rules are |
---|
643 | added, the technique is considered unsupported if it matches any of |
---|
644 | those inclusive rules. |
---|
645 | @note |
---|
646 | Any rule for the same vendor will be removed before adding this one. |
---|
647 | */ |
---|
648 | void addGPUVendorRule(const GPUVendorRule& rule); |
---|
649 | /** Removes a matching vendor rule. |
---|
650 | @see addGPUVendorRule |
---|
651 | */ |
---|
652 | void removeGPUVendorRule(GPUVendor vendor); |
---|
653 | typedef ConstVectorIterator<GPUVendorRuleList> GPUVendorRuleIterator; |
---|
654 | /// Get an iterator over the currently registered vendor rules. |
---|
655 | GPUVendorRuleIterator getGPUVendorRuleIterator() const; |
---|
656 | |
---|
657 | /** Add a rule which manually influences the support for this technique based |
---|
658 | on a pattern that matches a GPU device name (e.g. '*8800*'). |
---|
659 | @remarks |
---|
660 | You can use this facility to manually control whether a technique is |
---|
661 | considered supported, based on a GPU device name pattern. You can add inclusive |
---|
662 | or exclusive rules, and you can add as many of each as you like. If |
---|
663 | at least one inclusive rule is added, a technique is considered |
---|
664 | unsupported if it does not match any of those inclusive rules. If exclusive rules are |
---|
665 | added, the technique is considered unsupported if it matches any of |
---|
666 | those inclusive rules. The pattern you supply can include wildcard |
---|
667 | characters ('*') if you only want to match part of the device name. |
---|
668 | @note |
---|
669 | Any rule for the same device pattern will be removed before adding this one. |
---|
670 | @param devicePattern The GPU vendor |
---|
671 | @param includeOrExclude Whether this is an inclusive or exclusive rule |
---|
672 | @param caseSensitive Whether the match is case sensitive or not |
---|
673 | */ |
---|
674 | void addGPUDeviceNameRule(const String& devicePattern, IncludeOrExclude includeOrExclude, bool caseSensitive = false); |
---|
675 | /** Add a rule which manually influences the support for this technique based |
---|
676 | on a pattern that matches a GPU device name (e.g. '*8800*'). |
---|
677 | @remarks |
---|
678 | You can use this facility to manually control whether a technique is |
---|
679 | considered supported, based on a GPU device name pattern. You can add inclusive |
---|
680 | or exclusive rules, and you can add as many of each as you like. If |
---|
681 | at least one inclusive rule is added, a technique is considered |
---|
682 | unsupported if it does not match any of those inclusive rules. If exclusive rules are |
---|
683 | added, the technique is considered unsupported if it matches any of |
---|
684 | those inclusive rules. The pattern you supply can include wildcard |
---|
685 | characters ('*') if you only want to match part of the device name. |
---|
686 | @note |
---|
687 | Any rule for the same device pattern will be removed before adding this one. |
---|
688 | */ |
---|
689 | void addGPUDeviceNameRule(const GPUDeviceNameRule& rule); |
---|
690 | /** Removes a matching device name rule. |
---|
691 | @see addGPUDeviceNameRule |
---|
692 | */ |
---|
693 | void removeGPUDeviceNameRule(const String& devicePattern); |
---|
694 | typedef ConstVectorIterator<GPUDeviceNameRuleList> GPUDeviceNameRuleIterator; |
---|
695 | /// Get an iterator over the currently registered device name rules. |
---|
696 | GPUDeviceNameRuleIterator getGPUDeviceNameRuleIterator() const; |
---|
697 | |
---|
698 | /** Return an instance of user objects binding associated with this class. |
---|
699 | You can use it to associate one or more custom objects with this class instance. |
---|
700 | @see UserObjectBindings::setUserAny. |
---|
701 | */ |
---|
702 | UserObjectBindings& getUserObjectBindings() { return mUserObjectBindings; } |
---|
703 | |
---|
704 | /** Return an instance of user objects binding associated with this class. |
---|
705 | You can use it to associate one or more custom objects with this class instance. |
---|
706 | @see UserObjectBindings::setUserAny. |
---|
707 | */ |
---|
708 | const UserObjectBindings& getUserObjectBindings() const { return mUserObjectBindings; } |
---|
709 | |
---|
710 | }; |
---|
711 | |
---|
712 | /** @} */ |
---|
713 | /** @} */ |
---|
714 | |
---|
715 | } |
---|
716 | #endif |
---|