Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/ogre_src_v1-9-0/OgreMain/include/OgreRenderQueueSortingGrouping.h @ 148

Last change on this file since 148 was 148, checked in by patricwi, 6 years ago

Added new dependencies for ogre1.9 and cegui0.8

File size: 24.8 KB
Line 
1/*
2-----------------------------------------------------------------------------
3This source file is part of OGRE
4    (Object-oriented Graphics Rendering Engine)
5For the latest info, see http://www.ogre3d.org/
6
7Copyright (c) 2000-2013 Torus Knot Software Ltd
8
9Permission is hereby granted, free of charge, to any person obtaining a copy
10of this software and associated documentation files (the "Software"), to deal
11in the Software without restriction, including without limitation the rights
12to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13copies of the Software, and to permit persons to whom the Software is
14furnished to do so, subject to the following conditions:
15
16The above copyright notice and this permission notice shall be included in
17all copies or substantial portions of the Software.
18
19THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25THE SOFTWARE.
26-----------------------------------------------------------------------------
27*/
28#ifndef __RenderQueueSortingGrouping_H__
29#define __RenderQueueSortingGrouping_H__
30
31// Precompiler options
32#include "OgrePrerequisites.h"
33#include "OgreIteratorWrappers.h"
34#include "OgreMaterial.h"
35#include "OgreTechnique.h"
36#include "OgrePass.h"
37#include "OgreRadixSort.h"
38
39namespace Ogre {
40
41        /** \addtogroup Core
42        *  @{
43        */
44        /** \addtogroup RenderSystem
45        *  @{
46        */
47        /** Struct associating a single Pass with a single Renderable.
48                This is used to for objects sorted by depth and thus not
49                grouped by pass.
50        */
51        struct RenderablePass
52        {
53                /// Pointer to the Renderable details
54                Renderable* renderable;
55                /// Pointer to the Pass
56                Pass* pass;
57
58                RenderablePass(Renderable* rend, Pass* p) :renderable(rend), pass(p) {}
59        };
60
61
62        /** Visitor interface for items in a QueuedRenderableCollection.
63        @remarks
64                Those wishing to iterate over the items in a
65                QueuedRenderableCollection should implement this visitor pattern,
66                since internal organisation of the collection depends on the
67                sorting method in use.
68        */
69        class _OgreExport QueuedRenderableVisitor
70        {
71        public:
72                QueuedRenderableVisitor() {}
73                virtual ~QueuedRenderableVisitor() {}
74               
75                /** Called when visiting a RenderablePass, i.e. items in a
76                        sorted collection where items are not grouped by pass.
77                @remarks
78                        If this is called, neither of the other 2 visit methods
79                        will be called.
80                */
81                virtual void visit(RenderablePass* rp) = 0;
82
83                /* When visiting a collection grouped by pass, this is
84                        called when the grouping pass changes.
85                @remarks
86                        If this method is called, the RenderablePass visit
87                        method will not be called for this collection. The
88                        Renderable visit method will be called for each item
89                        underneath the pass grouping level.
90                @return True to continue, false to skip the Renderables underneath
91                */
92                virtual bool visit(const Pass* p) = 0;
93                /** Visit method called once per Renderable on a grouped
94                        collection.
95                @remarks
96                        If this method is called, the RenderablePass visit
97                        method will not be called for this collection.
98                */
99                virtual void visit(Renderable* r) = 0;
100               
101               
102        };
103
104        /** Lowest level collection of renderables.
105        @remarks
106                To iterate over items in this collection, you must call
107                the accept method and supply a QueuedRenderableVisitor.
108                The order of the iteration, and whether that iteration is
109                over a RenderablePass list or a 2-level grouped list which
110                causes a visit call at the Pass level, and a call for each
111                Renderable underneath.
112        */
113        class _OgreExport QueuedRenderableCollection : public RenderQueueAlloc
114        {
115        public:
116                /** Organisation modes required for this collection.
117                @remarks
118                        This affects the internal placement of the items added to this collection;
119                        if only one type of sorting / grouping is to be required, then renderables
120                        can be stored only once, whilst if multiple types are going to be needed
121                        then internally there will be multiple organisations. Changing the organisation
122                        needs to be done when the collection is empty.
123                */             
124                enum OrganisationMode
125                {
126                        /// Group by pass
127                        OM_PASS_GROUP = 1,
128                        /// Sort descending camera distance
129                        OM_SORT_DESCENDING = 2,
130                        /** Sort ascending camera distance
131                                Note value overlaps with descending since both use same sort
132                        */
133                        OM_SORT_ASCENDING = 6
134                };
135
136        protected:
137        /// Comparator to order pass groups
138        struct PassGroupLess
139        {
140            bool _OgreExport operator()(const Pass* a, const Pass* b) const
141            {
142                // Sort by passHash, which is pass, then texture unit changes
143                uint32 hasha = a->getHash();
144                uint32 hashb = b->getHash();
145                if (hasha == hashb)
146                {
147                    // Must differentTransparentQueueItemLessiate by pointer incase 2 passes end up with the same hash
148                    return a < b;
149                }
150                else
151                {
152                    return hasha < hashb;
153                }
154            }
155        };
156        /// Comparator to order objects by descending camera distance
157                struct DepthSortDescendingLess
158        {
159            const Camera* camera;
160
161            DepthSortDescendingLess(const Camera* cam)
162                : camera(cam)
163            {
164            }
165
166            bool _OgreExport operator()(const RenderablePass& a, const RenderablePass& b) const
167            {
168                if (a.renderable == b.renderable)
169                {
170                    // Same renderable, sort by pass hash
171                    return a.pass->getHash() < b.pass->getHash();
172                }
173                else
174                {
175                    // Different renderables, sort by depth
176                    Real adepth = a.renderable->getSquaredViewDepth(camera);
177                    Real bdepth = b.renderable->getSquaredViewDepth(camera);
178                                        if (Math::RealEqual(adepth, bdepth))
179                                    {
180                        // Must return deterministic result, doesn't matter what
181                        return a.pass < b.pass;
182                                    }
183                                    else
184                                    {
185                                        // Sort DESCENDING by depth (i.e. far objects first)
186                                            return (adepth > bdepth);
187                                    }
188                }
189
190            }
191        };
192
193        /** Vector of RenderablePass objects, this is built on the assumption that
194         vectors only ever increase in size, so even if we do clear() the memory stays
195         allocated, ie fast */
196        typedef vector<RenderablePass>::type RenderablePassList;
197        typedef vector<Renderable*>::type RenderableList;
198        /** Map of pass to renderable lists, this is a grouping by pass. */
199        typedef map<Pass*, RenderableList*, PassGroupLess>::type PassGroupRenderableMap;
200
201                /// Functor for accessing sort value 1 for radix sort (Pass)
202                struct RadixSortFunctorPass
203                {
204                        uint32 operator()(const RenderablePass& p) const
205            {
206                return p.pass->getHash();
207            }
208                };
209
210        /// Radix sorter for accessing sort value 1 (Pass)
211                static RadixSort<RenderablePassList, RenderablePass, uint32> msRadixSorter1;
212
213                /// Functor for descending sort value 2 for radix sort (distance)
214                struct RadixSortFunctorDistance
215                {
216                        const Camera* camera;
217
218            RadixSortFunctorDistance(const Camera* cam)
219                : camera(cam)
220            {
221            }
222
223                        float operator()(const RenderablePass& p) const
224            {
225                // Sort DESCENDING by depth (ie far objects first), use negative distance
226                // here because radix sorter always dealing with accessing sort
227                return static_cast<float>(- p.renderable->getSquaredViewDepth(camera));
228            }
229                };
230
231        /// Radix sorter for sort value 2 (distance)
232                static RadixSort<RenderablePassList, RenderablePass, float> msRadixSorter2;
233
234                /// Bitmask of the organisation modes requested
235                uint8 mOrganisationMode;
236
237                /// Grouped
238                PassGroupRenderableMap mGrouped;
239                /// Sorted descending (can iterate backwards to get ascending)
240                RenderablePassList mSortedDescending;
241
242                /// Internal visitor implementation
243                void acceptVisitorGrouped(QueuedRenderableVisitor* visitor) const;
244                /// Internal visitor implementation
245                void acceptVisitorDescending(QueuedRenderableVisitor* visitor) const;
246                /// Internal visitor implementation
247                void acceptVisitorAscending(QueuedRenderableVisitor* visitor) const;
248
249        public:
250                QueuedRenderableCollection();
251                ~QueuedRenderableCollection();
252
253                /// Empty the collection
254                void clear(void);
255
256                /** Remove the group entry (if any) for a given Pass.
257                @remarks
258                        To be used when a pass is destroyed, such that any
259                        grouping level for it becomes useless.
260                */     
261                void removePassGroup(Pass* p);
262               
263                /** Reset the organisation modes required for this collection.
264                @remarks
265                        You can only do this when the collection is empty.
266                @see OrganisationMode
267                */
268                void resetOrganisationModes(void) 
269                { 
270                        mOrganisationMode = 0; 
271                }
272               
273                /** Add a required sorting / grouping mode to this collection when next used.
274                @remarks
275                        You can only do this when the collection is empty.
276                @see OrganisationMode
277                */
278                void addOrganisationMode(OrganisationMode om) 
279                { 
280                        mOrganisationMode |= om; 
281                }
282
283        /// Add a renderable to the collection using a given pass
284        void addRenderable(Pass* pass, Renderable* rend);
285               
286                /** Perform any sorting that is required on this collection.
287                @param cam The camera
288                */
289                void sort(const Camera* cam);
290
291                /** Accept a visitor over the collection contents.
292                @param visitor Visitor class which should be called back
293                @param om The organisation mode which you want to iterate over.
294                        Note that this must have been included in an addOrganisationMode
295                        call before any renderables were added.
296                */
297                void acceptVisitor(QueuedRenderableVisitor* visitor, OrganisationMode om) const;
298
299                /** Merge renderable collection.
300                */
301                void merge( const QueuedRenderableCollection& rhs );
302        };
303
304        /** Collection of renderables by priority.
305    @remarks
306        This class simply groups renderables for rendering. All the
307        renderables contained in this class are destined for the same
308        RenderQueueGroup (coarse groupings like those between the main
309        scene and overlays) and have the same priority (fine groupings
310        for detailed overlap control).
311    @par
312        This class can order solid renderables by a number of criteria;
313                it can optimise them into groups based on pass to reduce render
314                state changes, or can sort them by ascending or descending view
315                depth. Transparent objects are always ordered by descending depth.
316        @par
317                To iterate over items in the collections held by this object
318                you should retrieve the collection in use (e.g. solids, solids with
319                no shadows, transparents) and use the accept() method, providing
320                a class implementing QueuedRenderableVisitor.
321       
322    */
323    class _OgreExport RenderPriorityGroup : public RenderQueueAlloc
324    {
325        protected:
326
327                /// Parent queue group
328        RenderQueueGroup* mParent;
329        bool mSplitPassesByLightingType;
330        bool mSplitNoShadowPasses;
331                bool mShadowCastersNotReceivers;
332        /// Solid pass list, used when no shadows, modulative shadows, or ambient passes for additive
333                QueuedRenderableCollection mSolidsBasic;
334        /// Solid per-light pass list, used with additive shadows
335        QueuedRenderableCollection mSolidsDiffuseSpecular;
336        /// Solid decal (texture) pass list, used with additive shadows
337        QueuedRenderableCollection mSolidsDecal;
338        /// Solid pass list, used when shadows are enabled but shadow receive is turned off for these passes
339        QueuedRenderableCollection mSolidsNoShadowReceive;
340                /// Unsorted transparent list
341                QueuedRenderableCollection mTransparentsUnsorted;
342                /// Transparent list
343                QueuedRenderableCollection mTransparents;
344
345        /// remove a pass entry from all collections
346        void removePassEntry(Pass* p);
347
348        /// Internal method for adding a solid renderable
349        void addSolidRenderable(Technique* pTech, Renderable* rend, bool toNoShadowMap);
350        /// Internal method for adding a solid renderable
351        void addSolidRenderableSplitByLightType(Technique* pTech, Renderable* rend);
352        /// Internal method for adding an unsorted transparent renderable
353        void addUnsortedTransparentRenderable(Technique* pTech, Renderable* rend);
354        /// Internal method for adding a transparent renderable
355        void addTransparentRenderable(Technique* pTech, Renderable* rend);
356
357    public:
358        RenderPriorityGroup(RenderQueueGroup* parent, 
359            bool splitPassesByLightingType,
360            bool splitNoShadowPasses, 
361                        bool shadowCastersNotReceivers); 
362           
363        ~RenderPriorityGroup() { }
364
365        /** Get the collection of basic solids currently queued, this includes
366                        all solids when there are no shadows, or all solids which have shadow
367                        receiving enabled when using modulative shadows, or all ambient passes
368                        of solids which have shadow receive enabled for additive shadows. */
369        const QueuedRenderableCollection& getSolidsBasic(void) const
370        { return mSolidsBasic; }
371        /** Get the collection of solids currently queued per light (only applicable in
372                        additive shadow modes). */
373        const QueuedRenderableCollection& getSolidsDiffuseSpecular(void) const
374        { return mSolidsDiffuseSpecular; }
375        /** Get the collection of solids currently queued for decal passes (only
376                        applicable in additive shadow modes). */
377        const QueuedRenderableCollection& getSolidsDecal(void) const
378        { return mSolidsDecal; }
379        /** Get the collection of solids for which shadow receipt is disabled (only
380                        applicable when shadows are enabled). */
381        const QueuedRenderableCollection& getSolidsNoShadowReceive(void) const
382        { return mSolidsNoShadowReceive; }
383        /** Get the collection of transparent objects currently queued */
384        const QueuedRenderableCollection& getTransparentsUnsorted(void) const
385        { return mTransparentsUnsorted; }
386        /** Get the collection of transparent objects currently queued */
387        const QueuedRenderableCollection& getTransparents(void) const
388        { return mTransparents; }
389
390
391                /** Reset the organisation modes required for the solids in this group.
392                @remarks
393                        You can only do this when the group is empty, i.e. after clearing the
394                        queue.
395                @see QueuedRenderableCollection::OrganisationMode
396                */
397                void resetOrganisationModes(void);
398               
399                /** Add a required sorting / grouping mode for the solids in this group.
400                @remarks
401                        You can only do this when the group is empty, i.e. after clearing the
402                        queue.
403                @see QueuedRenderableCollection::OrganisationMode
404                */
405                void addOrganisationMode(QueuedRenderableCollection::OrganisationMode om); 
406
407                /** Set the sorting / grouping mode for the solids in this group to the default.
408                @remarks
409                        You can only do this when the group is empty, i.e. after clearing the
410                        queue.
411                @see QueuedRenderableCollection::OrganisationMode
412                */
413                void defaultOrganisationMode(void); 
414
415                /** Add a renderable to this group. */
416        void addRenderable(Renderable* pRend, Technique* pTech);
417
418                /** Sorts the objects which have been added to the queue; transparent objects by their
419            depth in relation to the passed in Camera. */
420                void sort(const Camera* cam);
421
422        /** Clears this group of renderables.
423        */
424        void clear(void);
425
426        /** Sets whether or not the queue will split passes by their lighting type,
427        ie ambient, per-light and decal.
428        */
429        void setSplitPassesByLightingType(bool split)
430        {
431            mSplitPassesByLightingType = split;
432        }
433
434        /** Sets whether or not passes which have shadow receive disabled should
435            be separated.
436        */
437        void setSplitNoShadowPasses(bool split)
438        {
439            mSplitNoShadowPasses = split;
440        }
441
442                /** Sets whether or not objects which cast shadows should be treated as
443                        never receiving shadows.
444                */
445                void setShadowCastersCannotBeReceivers(bool ind)
446                {
447                        mShadowCastersNotReceivers = ind;
448                }
449
450                /** Merge group of renderables.
451                */
452                void merge( const RenderPriorityGroup* rhs );
453
454
455    };
456
457
458    /** A grouping level underneath RenderQueue which groups renderables
459    to be issued at coarsely the same time to the renderer.
460    @remarks
461        Each instance of this class itself hold RenderPriorityGroup instances,
462        which are the groupings of renderables by priority for fine control
463        of ordering (not required for most instances).
464    */
465    class _OgreExport RenderQueueGroup : public RenderQueueAlloc
466    {
467    public:
468        typedef map<ushort, RenderPriorityGroup*, std::less<ushort> >::type PriorityMap;
469        typedef MapIterator<PriorityMap> PriorityMapIterator;
470        typedef ConstMapIterator<PriorityMap> ConstPriorityMapIterator;
471    protected:
472        RenderQueue* mParent;
473        bool mSplitPassesByLightingType;
474        bool mSplitNoShadowPasses;
475                bool mShadowCastersNotReceivers;
476        /// Map of RenderPriorityGroup objects
477        PriorityMap mPriorityGroups;
478                /// Whether shadows are enabled for this queue
479                bool mShadowsEnabled;
480                /// Bitmask of the organisation modes requested (for new priority groups)
481                uint8 mOrganisationMode;
482
483
484    public:
485                RenderQueueGroup(RenderQueue* parent,
486            bool splitPassesByLightingType,
487            bool splitNoShadowPasses,
488            bool shadowCastersNotReceivers) 
489            : mParent(parent)
490            , mSplitPassesByLightingType(splitPassesByLightingType)
491            , mSplitNoShadowPasses(splitNoShadowPasses)
492            , mShadowCastersNotReceivers(shadowCastersNotReceivers)
493            , mShadowsEnabled(true)
494                        , mOrganisationMode(0)
495        {
496        }
497
498        ~RenderQueueGroup() {
499            // destroy contents now
500            PriorityMap::iterator i;
501            for (i = mPriorityGroups.begin(); i != mPriorityGroups.end(); ++i)
502            {
503                OGRE_DELETE i->second;
504            }
505        }
506
507        /** Get an iterator for browsing through child contents. */
508        PriorityMapIterator getIterator(void)
509        {
510            return PriorityMapIterator(mPriorityGroups.begin(), mPriorityGroups.end());
511        }
512
513        /** Get a const iterator for browsing through child contents. */
514        ConstPriorityMapIterator getIterator(void) const
515        {
516            return ConstPriorityMapIterator(mPriorityGroups.begin(), mPriorityGroups.end());
517        }
518
519        /** Add a renderable to this group, with the given priority. */
520        void addRenderable(Renderable* pRend, Technique* pTech, ushort priority)
521        {
522            // Check if priority group is there
523            PriorityMap::iterator i = mPriorityGroups.find(priority);
524            RenderPriorityGroup* pPriorityGrp;
525            if (i == mPriorityGroups.end())
526            {
527                // Missing, create
528                pPriorityGrp = OGRE_NEW RenderPriorityGroup(this, 
529                    mSplitPassesByLightingType,
530                    mSplitNoShadowPasses, 
531                                        mShadowCastersNotReceivers);
532                                if (mOrganisationMode)
533                                {
534                                        pPriorityGrp->resetOrganisationModes();
535                                        pPriorityGrp->addOrganisationMode((QueuedRenderableCollection::OrganisationMode)mOrganisationMode);
536                                }
537
538                mPriorityGroups.insert(PriorityMap::value_type(priority, pPriorityGrp));
539            }
540            else
541            {
542                pPriorityGrp = i->second;
543            }
544
545            // Add
546            pPriorityGrp->addRenderable(pRend, pTech);
547
548        }
549
550        /** Clears this group of renderables.
551        @param destroy
552            If false, doesn't delete any priority groups, just empties them. Saves on
553            memory deallocations since the chances are roughly the same kinds of
554            renderables are going to be sent to the queue again next time. If
555                        true, completely destroys.
556        */
557        void clear(bool destroy = false)
558        {
559            PriorityMap::iterator i, iend;
560            iend = mPriorityGroups.end();
561            for (i = mPriorityGroups.begin(); i != iend; ++i)
562            {
563                                if (destroy)
564                                        OGRE_DELETE i->second;
565                                else
566                                        i->second->clear();
567            }
568
569                        if (destroy)
570                                mPriorityGroups.clear();
571
572        }
573
574                /** Indicate whether a given queue group will be doing any
575                shadow setup.
576                @remarks
577                This method allows you to inform the queue about a queue group, and to
578                indicate whether this group will require shadow processing of any sort.
579                In order to preserve rendering order, OGRE has to treat queue groups
580                as very separate elements of the scene, and this can result in it
581                having to duplicate shadow setup for each group. Therefore, if you
582                know that a group which you are using will never need shadows, you
583                should preregister the group using this method in order to improve
584                the performance.
585                */
586                void setShadowsEnabled(bool enabled) { mShadowsEnabled = enabled; }
587
588                /** Are shadows enabled for this queue? */
589                bool getShadowsEnabled(void) const { return mShadowsEnabled; }
590
591        /** Sets whether or not the queue will split passes by their lighting type,
592        ie ambient, per-light and decal.
593        */
594        void setSplitPassesByLightingType(bool split)
595        {
596            mSplitPassesByLightingType = split;
597            PriorityMap::iterator i, iend;
598            iend = mPriorityGroups.end();
599            for (i = mPriorityGroups.begin(); i != iend; ++i)
600            {
601                i->second->setSplitPassesByLightingType(split);
602            }
603        }
604        /** Sets whether or not the queue will split passes which have shadow receive
605        turned off (in their parent material), which is needed when certain shadow
606        techniques are used.
607        */
608        void setSplitNoShadowPasses(bool split)
609        {
610            mSplitNoShadowPasses = split;
611            PriorityMap::iterator i, iend;
612            iend = mPriorityGroups.end();
613            for (i = mPriorityGroups.begin(); i != iend; ++i)
614            {
615                i->second->setSplitNoShadowPasses(split);
616            }
617        }
618                /** Sets whether or not objects which cast shadows should be treated as
619                never receiving shadows.
620                */
621                void setShadowCastersCannotBeReceivers(bool ind)
622                {
623                        mShadowCastersNotReceivers = ind;
624                        PriorityMap::iterator i, iend;
625                        iend = mPriorityGroups.end();
626                        for (i = mPriorityGroups.begin(); i != iend; ++i)
627                        {
628                                i->second->setShadowCastersCannotBeReceivers(ind);
629                        }
630                }
631                /** Reset the organisation modes required for the solids in this group.
632                @remarks
633                        You can only do this when the group is empty, ie after clearing the
634                        queue.
635                @see QueuedRenderableCollection::OrganisationMode
636                */
637                void resetOrganisationModes(void)
638                {
639                        mOrganisationMode = 0;
640
641                        PriorityMap::iterator i, iend;
642                        iend = mPriorityGroups.end();
643                        for (i = mPriorityGroups.begin(); i != iend; ++i)
644                        {
645                                i->second->resetOrganisationModes();
646                        }
647                }
648               
649                /** Add a required sorting / grouping mode for the solids in this group.
650                @remarks
651                        You can only do this when the group is empty, ie after clearing the
652                        queue.
653                @see QueuedRenderableCollection::OrganisationMode
654                */
655                void addOrganisationMode(QueuedRenderableCollection::OrganisationMode om)
656                {
657                        mOrganisationMode |= om;
658
659                        PriorityMap::iterator i, iend;
660                        iend = mPriorityGroups.end();
661                        for (i = mPriorityGroups.begin(); i != iend; ++i)
662                        {
663                                i->second->addOrganisationMode(om);
664                        }
665                }
666
667                /** Setthe  sorting / grouping mode for the solids in this group to the default.
668                @remarks
669                        You can only do this when the group is empty, ie after clearing the
670                        queue.
671                @see QueuedRenderableCollection::OrganisationMode
672                */
673                void defaultOrganisationMode(void)
674                {
675                        mOrganisationMode = 0;
676
677                        PriorityMap::iterator i, iend;
678                        iend = mPriorityGroups.end();
679                        for (i = mPriorityGroups.begin(); i != iend; ++i)
680                        {
681                                i->second->defaultOrganisationMode();
682                        }
683                }
684
685                /** Merge group of renderables.
686                */
687                void merge( const RenderQueueGroup* rhs )
688                {
689                        ConstPriorityMapIterator it = rhs->getIterator();
690
691                        while( it.hasMoreElements() )
692                        {
693                                ushort priority = it.peekNextKey();
694                                RenderPriorityGroup* pSrcPriorityGrp = it.getNext();
695                                RenderPriorityGroup* pDstPriorityGrp;
696
697                                // Check if priority group is there
698                                PriorityMap::iterator i = mPriorityGroups.find(priority);
699                                if (i == mPriorityGroups.end())
700                                {
701                                        // Missing, create
702                                        pDstPriorityGrp = OGRE_NEW RenderPriorityGroup(this, 
703                                                mSplitPassesByLightingType,
704                                                mSplitNoShadowPasses, 
705                                                mShadowCastersNotReceivers);
706                                        if (mOrganisationMode)
707                                        {
708                                                pDstPriorityGrp->resetOrganisationModes();
709                                                pDstPriorityGrp->addOrganisationMode((QueuedRenderableCollection::OrganisationMode)mOrganisationMode);
710                                        }
711
712                                        mPriorityGroups.insert(PriorityMap::value_type(priority, pDstPriorityGrp));
713                                }
714                                else
715                                {
716                                        pDstPriorityGrp = i->second;
717                                }
718
719                                // merge
720                                pDstPriorityGrp->merge( pSrcPriorityGrp );
721                        }
722                }
723    };
724
725        /** @} */
726        /** @} */
727
728
729}
730
731#endif
732
733
Note: See TracBrowser for help on using the repository browser.