Coverage Report

Created: 2025-10-10 06:46

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/ogre/OgreMain/include/OgreMaterial.h
Line
Count
Source
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-2014 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 _Material_H__
29
#define _Material_H__
30
31
#include "OgrePrerequisites.h"
32
33
#include "OgreResource.h"
34
#include "OgreCommon.h"
35
#include "OgreColourValue.h"
36
#include "OgreBlendMode.h"
37
#include "OgreHeaderPrefix.h"
38
#include "OgreSharedPtr.h"
39
40
namespace Ogre {
41
42
    // Forward declaration
43
    class LodStrategy;
44
    template <typename T> class ConstVectorIterator;
45
    template <typename T> class VectorIterator;
46
47
    /** \addtogroup Core
48
    *  @{
49
    */
50
    /** \addtogroup Materials
51
    *  @{
52
    */
53
    /** Class encapsulates rendering properties of an object.
54
55
    %Ogre's material class encapsulates *all* aspects of the visual appearance,
56
    of an object. It also includes other flags which 
57
    might not be traditionally thought of as material properties such as 
58
    culling modes and depth buffer settings, but these affect the 
59
    appearance of the rendered object and are convenient to attach to the 
60
    material since it keeps all the settings in one place. This is 
61
    different to Direct3D which treats a material as just the colour 
62
    components (diffuse, specular) and not texture maps etc. An Ogre 
63
    Material can be thought of as equivalent to a 'Shader'.
64
65
    A Material can be rendered in multiple different ways depending on the
66
    hardware available. You may configure a Material to use high-complexity
67
    fragment shaders, but these won't work on every card; therefore a Technique
68
    is an approach to creating the visual effect you are looking for. You are advised
69
    to create fallback techniques with lower hardware requirements if you decide to
70
    use advanced features. In addition, you also might want lower-detail techniques
71
    for distant geometry.
72
73
    Each Technique can be made up of multiple passes. A fixed-function Pass
74
    may combine multiple texture layers using multitexturing, but Ogre can 
75
    break that into multiple passes automatically if the active card cannot
76
    handle that many simultaneous textures. Programmable passes, however, cannot
77
    be split down automatically, so if the active graphics card cannot handle the
78
    technique which contains these passes, OGRE will try to find another technique
79
    which the card can do. If, at the end of the day, the card cannot handle any of the
80
    techniques which are listed for the material, the engine will render the 
81
    geometry plain white, which should alert you to the problem.
82
83
    %Ogre comes configured with a number of default settings for a newly 
84
    created material. These can be changed if you wish by retrieving the 
85
    default material settings through 
86
    MaterialManager::getDefaultSettings. Any changes you make to the
87
    Material returned from this method will apply to any materials created 
88
    from this point onward.
89
    */
90
    class _OgreExport Material final : public Resource
91
    {
92
        friend class SceneManager;
93
        friend class MaterialManager;
94
95
    public:
96
        /// distance list used to specify LOD
97
        typedef std::vector<Real> LodValueList;
98
        typedef ConstVectorIterator<LodValueList> LodValueIterator;
99
        typedef std::vector<Technique*> Techniques;
100
    private:
101
102
103
        /** Internal method which sets the material up from the default settings.
104
        */
105
        void applyDefaults(void);
106
107
        /// All techniques, supported and unsupported
108
        Techniques mTechniques;
109
        /// Supported techniques of any sort
110
        Techniques mSupportedTechniques;
111
        typedef std::map<unsigned short, Technique*> LodTechniques;
112
        typedef std::map<unsigned short, LodTechniques> BestTechniquesBySchemeList;
113
        /** Map of scheme -> list of LOD techniques. 
114
            Current scheme is set on MaterialManager,
115
            and can be set per Viewport for auto activation.
116
        */
117
        BestTechniquesBySchemeList mBestTechniquesBySchemeList;
118
119
        LodValueList mUserLodValues;
120
        LodValueList mLodValues;
121
        const LodStrategy *mLodStrategy;
122
        /// Text description of why any techniques are not supported
123
        String mUnsupportedReasons;
124
        bool mReceiveShadows;
125
        bool mTransparencyCastsShadows;
126
        /// Does this material require compilation?
127
        bool mCompilationRequired;
128
129
        /** Insert a supported technique into the local collections. */
130
        void insertSupportedTechnique(Technique* t);
131
132
        /** Clear the best technique list.
133
        */
134
        void clearBestTechniqueList(void);
135
136
        void prepareImpl(void) override;
137
        void unprepareImpl(void) override;
138
        void loadImpl(void) override;
139
140
        /** Unloads the material, frees resources etc.
141
        @see
142
        Resource
143
        */
144
        void unloadImpl(void) override;
145
        /// @copydoc Resource::calculateSize
146
        size_t calculateSize(void) const override;
147
    public:
148
149
        /** Constructor - use resource manager's create method rather than this.
150
        */
151
        Material(ResourceManager* creator, const String& name, ResourceHandle handle,
152
            const String& group, bool isManual = false, ManualResourceLoader* loader = 0);
153
154
        ~Material();
155
        /** Assignment operator to allow easy copying between materials.
156
        */
157
        Material& operator=( const Material& rhs );
158
159
        /** Determines if the material has any transparency with the rest of the scene (derived from 
160
            whether any Techniques say they involve transparency).
161
        */
162
        bool isTransparent(void) const;
163
164
        /** Sets whether objects using this material will receive shadows.
165
166
            This method allows a material to opt out of receiving shadows, if
167
            it would otherwise do so. Shadows will not be cast on any objects
168
            unless the scene is set up to support shadows 
169
            (@see SceneManager::setShadowTechnique), and not all techniques cast
170
            shadows on all objects. In any case, if you have a need to prevent
171
            shadows being received by material, this is the method you call to
172
            do it.
173
        @note 
174
            Transparent materials never receive shadows despite this setting. 
175
            The default is to receive shadows.
176
        */
177
0
        void setReceiveShadows(bool enabled) { mReceiveShadows = enabled; }
178
        /** Returns whether or not objects using this material will receive shadows. */
179
0
        bool getReceiveShadows(void) const { return mReceiveShadows; }
180
181
        /** Sets whether objects using this material be classified as opaque to the shadow caster system.
182
183
        This method allows a material to cast a shadow, even if it is transparent.
184
        By default, transparent materials neither cast nor receive shadows. Shadows
185
        will not be cast on any objects unless the scene is set up to support shadows 
186
        (@see SceneManager::setShadowTechnique), and not all techniques cast
187
        shadows on all objects.
188
        */
189
0
        void setTransparencyCastsShadows(bool enabled) { mTransparencyCastsShadows = enabled; }
190
        /** Returns whether or not objects using this material be classified as opaque to the shadow caster system. */
191
0
        bool getTransparencyCastsShadows(void) const { return mTransparencyCastsShadows; }
192
193
        typedef VectorIterator<Techniques> TechniqueIterator;
194
        /// @name Techniques
195
        /// @{
196
        /** Creates a new Technique for this Material.
197
198
            A Technique is a single way of rendering geometry in order to achieve the effect
199
            you are intending in a material. There are many reason why you would want more than
200
            one - the main one being to handle variable graphics card abilities; you might have
201
            one technique which is impressive but only runs on 4th-generation graphics cards, 
202
            for example. In this case you will want to create at least one fallback Technique.
203
            OGRE will work out which Techniques a card can support and pick the best one.
204
        @par
205
            If multiple Techniques are available, the order in which they are created is 
206
            important - the engine will consider lower-indexed Techniques to be preferable
207
            to higher-indexed Techniques, ie when asked for the 'best' technique it will
208
            return the first one in the technique list which is supported by the hardware.
209
        */
210
        Technique* createTechnique(void);
211
        /** Gets the indexed technique. */
212
0
        Technique* getTechnique(size_t index) const { return mTechniques.at(index); }
213
        /** searches for the named technique.
214
            Return 0 if technique with name is not found
215
        */
216
        Technique* getTechnique(const String& name) const;
217
        /** Retrieves the number of techniques.  */
218
0
        size_t getNumTechniques(void) const { return mTechniques.size(); }
219
        /** Removes the technique at the given index. */        
220
        void removeTechnique(unsigned short index);     
221
        /** Removes all the techniques in this Material. */
222
        void removeAllTechniques(void);
223
        /** Get an iterator over the Techniques in this Material.
224
         * @deprecated use getTechniques() */
225
        OGRE_DEPRECATED TechniqueIterator getTechniqueIterator(void);
226
227
        /** Get the Techniques in this Material. */
228
0
        const Techniques& getTechniques(void) const {
229
0
            return mTechniques;
230
0
        }
231
232
        /** Gets all the Techniques which are supported by the current card.
233
234
            The supported technique list is only available after this material has been compiled,
235
            which typically happens on loading the material. Therefore, if this method returns
236
            an empty list, try calling Material::load.
237
        */
238
0
        const Techniques& getSupportedTechniques(void) const {
239
0
            return mSupportedTechniques;
240
0
        }
241
242
        /// @deprecated use getSupportedTechniques()
243
        OGRE_DEPRECATED TechniqueIterator getSupportedTechniqueIterator(void);
244
        
245
        /** Gets the indexed supported technique. */
246
0
        Technique* getSupportedTechnique(size_t index) const { return mSupportedTechniques.at(index); }
247
        /** Retrieves the number of supported techniques. */
248
0
        size_t getNumSupportedTechniques(void) const { return mSupportedTechniques.size(); }
249
        /** Gets a string explaining why any techniques are not supported. */
250
0
        const String& getUnsupportedTechniquesExplanation() const { return mUnsupportedReasons; }
251
252
        /** Gets the best supported technique. 
253
254
            This method returns the lowest-index supported Technique in this material
255
            (since lower-indexed Techniques are considered to be better than higher-indexed
256
            ones).
257
        @par
258
            The best supported technique is only available after this material has been compiled,
259
            which typically happens on loading the material. Therefore, if this method returns
260
            NULL, try calling Material::load.
261
        @param lodIndex The material LOD index to use
262
        @param rend Optional parameter specifying the Renderable that is requesting
263
            this technique. Only used if no valid technique for the active material 
264
            scheme is found, at which point it is passed to 
265
            MaterialManager::Listener::handleSchemeNotFound as information.
266
        */
267
        Technique* getBestTechnique(unsigned short lodIndex = 0, const Renderable* rend = 0);
268
        /// @}
269
270
        /** Creates a new copy of this material with the same settings but a new name.
271
        @param newName The name for the cloned material
272
        @param newGroup
273
            Optional name of the new group to assign the clone to;
274
            if you leave this blank, the clone will be assigned to the same
275
            group as this Material.
276
        */
277
        MaterialPtr clone(const String& newName, const String& newGroup = BLANKSTRING) const;
278
279
        // needed because of deprecated variant below
280
0
        MaterialPtr clone(const String& newName, const char* newGroup) const { return clone(newName, String(newGroup)); }
281
282
        /// @deprecated use clone(const String&, const String&)
283
        OGRE_DEPRECATED MaterialPtr clone(const String& newName, bool changeGroup,
284
                                          const String& newGroup = BLANKSTRING) const
285
0
        {
286
0
            return clone(newName, newGroup);
287
0
        }
288
289
        /** Copies the details of this material into another, preserving the target's handle and name
290
        (unlike operator=) but copying everything else.
291
        @param mat Weak reference to material which will receive this material's settings.
292
        */
293
        void copyDetailsTo(MaterialPtr& mat) const;
294
295
        /** 'Compiles' this Material.
296
297
            Compiling a material involves determining which Techniques are supported on the
298
            card on which OGRE is currently running, and for fixed-function Passes within those
299
            Techniques, splitting the passes down where they contain more TextureUnitState 
300
            instances than the current card has texture units.
301
        @par
302
            This process is automatically done when the Material is loaded, but may be
303
            repeated if you make some procedural changes.
304
        @param
305
            autoManageTextureUnits If true, when a fixed function pass has too many TextureUnitState
306
                entries than the card has texture units, the Pass in question will be split into
307
                more than one Pass in order to emulate the Pass. If you set this to false and
308
                this situation arises, an Exception will be thrown.
309
        */
310
        void compile(bool autoManageTextureUnits = true);
311
312
        /** @name Forwarded Pass Properties
313
314
            The following methods are to make migration from previous versions simpler
315
            and to make code easier to write when dealing with simple materials
316
            They set the properties which have been moved to Pass for all Techniques and all Passes
317
        */
318
319
        /// @{
320
        /** Sets the point size properties for every Pass in every Technique.
321
        @note
322
            This property has been moved to the Pass class, which is accessible via the 
323
            Technique. For simplicity, this method allows you to set these properties for 
324
            every current Technique, and for every current Pass within those Techniques. If 
325
            you need more precision, retrieve the Technique and Pass instances and set the
326
            property there.
327
        @see Pass::setPointSize
328
        */
329
        void setPointSize(Real ps);
330
331
        /** Sets the ambient colour reflectance properties for every Pass in every Technique.
332
        @note
333
            This property has been moved to the Pass class, which is accessible via the 
334
            Technique. For simplicity, this method allows you to set these properties for 
335
            every current Technique, and for every current Pass within those Techniques. If 
336
            you need more precision, retrieve the Technique and Pass instances and set the
337
            property there.
338
        @see Pass::setAmbient
339
        */
340
        void setAmbient(float red, float green, float blue);
341
342
        /// @overload
343
        void setAmbient(const ColourValue& ambient);
344
345
        /** Sets the diffuse colour reflectance properties of every Pass in every Technique.
346
        @note
347
            This property has been moved to the Pass class, which is accessible via the 
348
            Technique. For simplicity, this method allows you to set these properties for 
349
            every current Technique, and for every current Pass within those Techniques. If 
350
            you need more precision, retrieve the Technique and Pass instances and set the
351
            property there.
352
        @see Pass::setDiffuse
353
        */
354
        void setDiffuse(float red, float green, float blue, float alpha);
355
356
        /// @overload
357
        void setDiffuse(const ColourValue& diffuse);
358
359
        /** Sets the specular colour reflectance properties of every Pass in every Technique.
360
        @note
361
            This property has been moved to the Pass class, which is accessible via the 
362
            Technique. For simplicity, this method allows you to set these properties for 
363
            every current Technique, and for every current Pass within those Techniques. If 
364
            you need more precision, retrieve the Technique and Pass instances and set the
365
            property there.
366
        @see Pass::setSpecular
367
        */
368
        void setSpecular(float red, float green, float blue, float alpha);
369
370
        /// @overload
371
        void setSpecular(const ColourValue& specular);
372
373
        /** Sets the shininess properties of every Pass in every Technique.
374
        @note
375
            This property has been moved to the Pass class, which is accessible via the 
376
            Technique. For simplicity, this method allows you to set these properties for 
377
            every current Technique, and for every current Pass within those Techniques. If 
378
            you need more precision, retrieve the Technique and Pass instances and set the
379
            property there.
380
        @see Pass::setShininess
381
        */
382
        void setShininess(Real val);
383
384
        /** Sets the amount of self-illumination of every Pass in every Technique.
385
        @note
386
            This property has been moved to the Pass class, which is accessible via the 
387
            Technique. For simplicity, this method allows you to set these properties for 
388
            every current Technique, and for every current Pass within those Techniques. If 
389
            you need more precision, retrieve the Technique and Pass instances and set the
390
            property there.
391
        @see Pass::setSelfIllumination
392
        */
393
        void setSelfIllumination(float red, float green, float blue);
394
395
        /// @overload
396
        void setSelfIllumination(const ColourValue& selfIllum);
397
398
        /** Sets whether or not each Pass renders with depth-buffer checking on or not.
399
        @note
400
            This property has been moved to the Pass class, which is accessible via the 
401
            Technique. For simplicity, this method allows you to set these properties for 
402
            every current Technique, and for every current Pass within those Techniques. If 
403
            you need more precision, retrieve the Technique and Pass instances and set the
404
            property there.
405
        @see Pass::setDepthCheckEnabled
406
        */
407
        void setDepthCheckEnabled(bool enabled);
408
409
        /** Sets whether or not each Pass renders with depth-buffer writing on or not.
410
        @note
411
            This property has been moved to the Pass class, which is accessible via the 
412
            Technique. For simplicity, this method allows you to set these properties for 
413
            every current Technique, and for every current Pass within those Techniques. If 
414
            you need more precision, retrieve the Technique and Pass instances and set the
415
            property there.
416
        @see Pass::setDepthWriteEnabled
417
        */
418
        void setDepthWriteEnabled(bool enabled);
419
420
        /** Sets the function used to compare depth values when depth checking is on.
421
        @note
422
            This property has been moved to the Pass class, which is accessible via the 
423
            Technique. For simplicity, this method allows you to set these properties for 
424
            every current Technique, and for every current Pass within those Techniques. If 
425
            you need more precision, retrieve the Technique and Pass instances and set the
426
            property there.
427
        @see Pass::setDepthFunction
428
        */
429
        void setDepthFunction( CompareFunction func );
430
431
        /** Sets whether or not colour buffer writing is enabled for each Pass.
432
        @note
433
            This property has been moved to the Pass class, which is accessible via the 
434
            Technique. For simplicity, this method allows you to set these properties for 
435
            every current Technique, and for every current Pass within those Techniques. If 
436
            you need more precision, retrieve the Technique and Pass instances and set the
437
            property there.
438
        @see Pass::setColourWriteEnabled
439
        */
440
        void setColourWriteEnabled(bool enabled);
441
442
        /** Sets which colour buffer channels are enabled for writing for each Pass.
443
         @see Pass::setColourWriteEnabled
444
         */
445
        void setColourWriteEnabled(bool red, bool green, bool blue, bool alpha);
446
447
        /** Sets the culling mode for each pass  based on the 'vertex winding'.
448
        @note
449
            This property has been moved to the Pass class, which is accessible via the 
450
            Technique. For simplicity, this method allows you to set these properties for 
451
            every current Technique, and for every current Pass within those Techniques. If 
452
            you need more precision, retrieve the Technique and Pass instances and set the
453
            property there.
454
        @see Pass::setCullingMode
455
        */
456
        void setCullingMode( CullingMode mode );
457
458
        /** Sets the manual culling mode, performed by CPU rather than hardware.
459
        @note
460
            This property has been moved to the Pass class, which is accessible via the 
461
            Technique. For simplicity, this method allows you to set these properties for 
462
            every current Technique, and for every current Pass within those Techniques. If 
463
            you need more precision, retrieve the Technique and Pass instances and set the
464
            property there.
465
        @see Pass::setManualCullingMode
466
        */
467
        void setManualCullingMode( ManualCullingMode mode );
468
469
        /** Sets whether or not dynamic lighting is enabled for every Pass.
470
        @note
471
            This property has been moved to the Pass class, which is accessible via the 
472
            Technique. For simplicity, this method allows you to set these properties for 
473
            every current Technique, and for every current Pass within those Techniques. If 
474
            you need more precision, retrieve the Technique and Pass instances and set the
475
            property there.
476
        @see Pass::setLightingEnabled
477
        */
478
        void setLightingEnabled(bool enabled);
479
480
        /** Sets the type of light shading required
481
        @note
482
            This property has been moved to the Pass class, which is accessible via the 
483
            Technique. For simplicity, this method allows you to set these properties for 
484
            every current Technique, and for every current Pass within those Techniques. If 
485
            you need more precision, retrieve the Technique and Pass instances and set the
486
            property there.
487
        @see Pass::setShadingMode
488
        */
489
        void setShadingMode( ShadeOptions mode );
490
491
        /** Sets the fogging mode applied to each pass.
492
        @note
493
            This property has been moved to the Pass class, which is accessible via the 
494
            Technique. For simplicity, this method allows you to set these properties for 
495
            every current Technique, and for every current Pass within those Techniques. If 
496
            you need more precision, retrieve the Technique and Pass instances and set the
497
            property there.
498
        @see Pass::setFog
499
        */
500
        void setFog(
501
            bool overrideScene,
502
            FogMode mode = FOG_NONE,
503
            const ColourValue& colour = ColourValue::White,
504
            Real expDensity = 0.001f, Real linearStart = 0.0f, Real linearEnd = 1.0f );
505
506
        /** Sets the depth bias to be used for each Pass.
507
        @note
508
            This property has been moved to the Pass class, which is accessible via the 
509
            Technique. For simplicity, this method allows you to set these properties for 
510
            every current Technique, and for every current Pass within those Techniques. If 
511
            you need more precision, retrieve the Technique and Pass instances and set the
512
            property there.
513
        @see Pass::setDepthBias
514
        */
515
        void setDepthBias(float constantBias, float slopeScaleBias);
516
517
        /** Set texture filtering for every texture unit in every Technique and Pass
518
        @note
519
            This property has been moved to the TextureUnitState class, which is accessible via the 
520
            Technique and Pass. For simplicity, this method allows you to set these properties for 
521
            every current TeextureUnitState, If you need more precision, retrieve the Technique, 
522
            Pass and TextureUnitState instances and set the property there.
523
        @see TextureUnitState::setTextureFiltering
524
        */
525
        void setTextureFiltering(TextureFilterOptions filterType);
526
        /** Sets the anisotropy level to be used for all textures.
527
        @note
528
            This property has been moved to the TextureUnitState class, which is accessible via the 
529
            Technique and Pass. For simplicity, this method allows you to set these properties for 
530
            every current TeextureUnitState, If you need more precision, retrieve the Technique, 
531
            Pass and TextureUnitState instances and set the property there.
532
        @see TextureUnitState::setTextureAnisotropy
533
        */
534
        void setTextureAnisotropy(int maxAniso);
535
536
        /** Sets the kind of blending every pass has with the existing contents of the scene.
537
        @note
538
            This property has been moved to the Pass class, which is accessible via the 
539
            Technique. For simplicity, this method allows you to set these properties for 
540
            every current Technique, and for every current Pass within those Techniques. If 
541
            you need more precision, retrieve the Technique and Pass instances and set the
542
            property there.
543
        @see Pass::setSceneBlending
544
        */
545
        void setSceneBlending( const SceneBlendType sbt );
546
547
        /** Sets the kind of blending every pass has with the existing contents of the scene, using individual factors for color and alpha channels
548
        @note
549
            This property has been moved to the Pass class, which is accessible via the 
550
            Technique. For simplicity, this method allows you to set these properties for 
551
            every current Technique, and for every current Pass within those Techniques. If 
552
            you need more precision, retrieve the Technique and Pass instances and set the
553
            property there.
554
        @see Pass::setSeparateSceneBlending
555
        */
556
        void setSeparateSceneBlending( const SceneBlendType sbt, const SceneBlendType sbta );
557
558
        /** Allows very fine control of blending every Pass with the existing contents of the scene.
559
        @note
560
            This property has been moved to the Pass class, which is accessible via the 
561
            Technique. For simplicity, this method allows you to set these properties for 
562
            every current Technique, and for every current Pass within those Techniques. If 
563
            you need more precision, retrieve the Technique and Pass instances and set the
564
            property there.
565
        @see Pass::setSceneBlending
566
        */
567
        void setSceneBlending( const SceneBlendFactor sourceFactor, const SceneBlendFactor destFactor);
568
569
        /** Allows very fine control of blending every Pass with the existing contents of the scene, using individual factors for color and alpha channels
570
        @note
571
            This property has been moved to the Pass class, which is accessible via the 
572
            Technique. For simplicity, this method allows you to set these properties for 
573
            every current Technique, and for every current Pass within those Techniques. If 
574
            you need more precision, retrieve the Technique and Pass instances and set the
575
            property there.
576
        @see Pass::setSeparateSceneBlending
577
        */
578
        void setSeparateSceneBlending( const SceneBlendFactor sourceFactor, const SceneBlendFactor destFactor, const SceneBlendFactor sourceFactorAlpha, const SceneBlendFactor destFactorAlpha);
579
        /// @}
580
581
        /** Tells the material that it needs recompilation. */
582
        void _notifyNeedsRecompile(void);
583
584
        /// @name Level of Detail
585
        /// @{
586
        /** Gets the number of levels-of-detail this material has in the
587
            given scheme, based on Technique::setLodIndex.
588
589
            Note that this will not be up to date until the material has been compiled.
590
        */
591
        unsigned short getNumLodLevels(unsigned short schemeIndex) const;
592
        /** Gets the number of levels-of-detail this material has in the
593
            given scheme, based on Technique::setLodIndex.
594
595
            Note that this will not be up to date until the material has been compiled.
596
        */
597
        unsigned short getNumLodLevels(const String& schemeName) const;
598
        /** Sets the distance at which level-of-detail (LOD) levels come into effect.
599
600
            You should only use this if you have assigned LOD indexes to the Technique
601
            instances attached to this Material. If you have done so, you should call this
602
            method to determine the distance at which the lowe levels of detail kick in.
603
            The decision about what distance is actually used is a combination of this
604
            and the LOD bias applied to both the current Camera and the current Entity.
605
        @param lodValues A vector of Reals which indicate the LOD value at which to 
606
            switch to lower details. They are listed in LOD index order, starting at index
607
            1 (ie the first level down from the highest level 0, which automatically applies
608
            from a value of 0). These are 'user values', before being potentially 
609
            transformed by the strategy, so for the distance strategy this is an
610
            unsquared distance for example.
611
        */
612
        void setLodLevels(const LodValueList& lodValues);
613
614
        /** Gets the list of values transformed by the LodStrategy at which each LOD comes into effect.
615
616
            Note that the iterator returned from this method is not totally analogous to 
617
            the one passed in by calling setLodLevels - the list includes a zero
618
            entry at the start (since the highest LOD starts at value 0). Also, the
619
            values returned are after being transformed by LodStrategy::transformUserValue.
620
        */
621
0
        const LodValueList& getLodValues(void) const {
622
0
            return mLodValues;
623
0
        }
624
625
        /// @deprecated use getLodValues()
626
        OGRE_DEPRECATED LodValueIterator getLodValueIterator(void) const;
627
628
        /** Gets the user-defined list of values which are internally transformed by the LodStrategy.
629
630
            Note that the iterator returned from this method is not totally analogous to 
631
            the one passed in by calling setLodLevels - the list includes a zero
632
            entry at the start (since the highest LOD starts at value 0). Also, the
633
            values returned are after being transformed by LodStrategy::transformUserValue.
634
        */
635
0
        const LodValueList& getUserLodValues(void) const {
636
0
            return mUserLodValues;
637
0
        }
638
639
        /// @deprecated use getUserLodValues()
640
        OGRE_DEPRECATED LodValueIterator getUserLodValueIterator(void) const;
641
642
        /** Gets the LOD index to use at the given value. 
643
        @note The value passed in is the 'transformed' value. If you are dealing with
644
        an original source value (e.g. distance), use LodStrategy::transformUserValue
645
        to turn this into a lookup value.
646
        */
647
        ushort getLodIndex(Real value) const;
648
649
        /** Get LOD strategy used by this material. */
650
        const LodStrategy *getLodStrategy() const;
651
        /** Set the LOD strategy used by this material. */
652
        void setLodStrategy(LodStrategy *lodStrategy);
653
        /// @}
654
655
        void touch(void) override
656
0
        { 
657
0
            if (mCompilationRequired) 
658
0
                compile();
659
            // call superclass
660
0
            Resource::touch();
661
0
        }
662
663
        /** Gets the compilation status of the material.
664
        @return True if the material needs recompilation.
665
        */
666
        bool getCompilationRequired() const
667
0
        {
668
0
            return mCompilationRequired;
669
0
        }
670
671
672
    };
673
    /** @} */
674
    /** @} */
675
676
} //namespace 
677
678
#include "OgreHeaderSuffix.h"
679
680
#endif