source: OGRE/trunk/ogrenew/OgreMain/src/OgreRenderQueueInvocation.cpp @ 692

Revision 692, 4.9 KB checked in by mattausch, 19 years ago (diff)

adding ogre 1.2 and dependencies

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 © 2000-2005 The OGRE Team
8Also see acknowledgements in Readme.html
9
10This program is free software; you can redistribute it and/or modify it under
11the terms of the GNU Lesser General Public License as published by the Free Software
12Foundation; either version 2 of the License, or (at your option) any later
13version.
14
15This program is distributed in the hope that it will be useful, but WITHOUT
16ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
18
19You should have received a copy of the GNU Lesser General Public License along with
20this program; if not, write to the Free Software Foundation, Inc., 59 Temple
21Place - Suite 330, Boston, MA 02111-1307, USA, or go to
22http://www.gnu.org/copyleft/lesser.txt.
23-----------------------------------------------------------------------------
24*/
25#include "OgreStableHeaders.h"
26
27#include "OgreRenderQueueInvocation.h"
28#include "OgreSceneManager.h"
29#include "OgreException.h"
30
31namespace Ogre
32{
33        String RenderQueueInvocation::RENDER_QUEUE_INVOCATION_SHADOWS = "SHADOWS";
34        //-----------------------------------------------------------------------------
35        RenderQueueInvocation::RenderQueueInvocation(uint8 renderQueueGroupID,
36                const String& invocationName)
37                : mRenderQueueGroupID(renderQueueGroupID), mInvocationName(invocationName),
38                mSolidsOrganisation(QueuedRenderableCollection::OM_PASS_GROUP),
39                mSuppressShadows(false), mSuppressRenderStateChanges(false)
40        {
41
42        }
43        //-----------------------------------------------------------------------------
44        RenderQueueInvocation::~RenderQueueInvocation()
45        {
46
47        }
48        //-----------------------------------------------------------------------------
49        void RenderQueueInvocation::invoke(RenderQueueGroup* group, SceneManager* targetSceneManager)
50        {
51                bool oldShadows = targetSceneManager->_areShadowsSuppressed();
52                bool oldRSChanges = targetSceneManager->_areRenderStateChangesSuppressed();
53
54                targetSceneManager->_suppressShadows(mSuppressShadows);
55                targetSceneManager->_suppressRenderStateChanges(mSuppressRenderStateChanges);
56
57                targetSceneManager->_renderQueueGroupObjects(group, mSolidsOrganisation);
58
59                targetSceneManager->_suppressShadows(oldShadows);
60                targetSceneManager->_suppressRenderStateChanges(oldRSChanges);
61
62        }
63        //-----------------------------------------------------------------------------
64        //-----------------------------------------------------------------------------
65        RenderQueueInvocationSequence::RenderQueueInvocationSequence(const String& name)
66                :mName(name)
67        {
68        }
69        //-----------------------------------------------------------------------------
70        RenderQueueInvocationSequence::~RenderQueueInvocationSequence()
71        {
72                clear();
73        }
74        //-----------------------------------------------------------------------------
75        RenderQueueInvocation* RenderQueueInvocationSequence::add(uint8 renderQueueGroupID,
76                const String& invocationName)
77        {
78                RenderQueueInvocation* ret =
79                        new RenderQueueInvocation(renderQueueGroupID, invocationName);
80
81                mInvocations.push_back(ret);
82
83                return ret;
84
85        }
86        //-----------------------------------------------------------------------------
87        void RenderQueueInvocationSequence::add(RenderQueueInvocation* i)
88        {
89                mInvocations.push_back(i);
90        }
91        //-----------------------------------------------------------------------------
92        void RenderQueueInvocationSequence::clear(void)
93        {
94                for (RenderQueueInvocationList::iterator i = mInvocations.begin();
95                        i != mInvocations.end(); ++i)
96                {
97                        delete *i;
98                }
99                mInvocations.clear();
100        }
101        //-----------------------------------------------------------------------------
102        RenderQueueInvocation* RenderQueueInvocationSequence::get(size_t index)
103        {
104                if (index >= size())
105                        OGRE_EXCEPT(Exception::ERR_ITEM_NOT_FOUND,
106                                "Index out of bounds",
107                                "RenderQueueInvocationSequence::get");
108
109                return mInvocations[index];
110        }
111        //-----------------------------------------------------------------------------
112        void RenderQueueInvocationSequence::remove(size_t index)
113        {
114                if (index >= size())
115                        OGRE_EXCEPT(Exception::ERR_ITEM_NOT_FOUND,
116                        "Index out of bounds",
117                        "RenderQueueInvocationSequence::remove");
118               
119                RenderQueueInvocationList::iterator i = mInvocations.begin();
120                std::advance(i, index);
121                delete *i;
122                mInvocations.erase(i);
123               
124        }
125        //-----------------------------------------------------------------------------
126        RenderQueueInvocationIterator RenderQueueInvocationSequence::iterator(void)
127        {
128                return RenderQueueInvocationIterator(mInvocations.begin(), mInvocations.end());
129        }
130        //-----------------------------------------------------------------------------
131
132
133}
Note: See TracBrowser for help on using the repository browser.