Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/OgreMain/src/OgreRenderQueueInvocation.cpp @ 3

Last change on this file since 3 was 3, checked in by anonymous, 17 years ago

=update

File size: 4.9 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-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
24You may alternatively use this source under the terms of a specific version of
25the OGRE Unrestricted License provided you have obtained such a license from
26Torus Knot Software Ltd.
27-----------------------------------------------------------------------------
28*/
29#include "OgreStableHeaders.h"
30
31#include "OgreRenderQueueInvocation.h"
32#include "OgreSceneManager.h"
33#include "OgreException.h"
34
35namespace Ogre
36{
37        String RenderQueueInvocation::RENDER_QUEUE_INVOCATION_SHADOWS = "SHADOWS";
38        //-----------------------------------------------------------------------------
39        RenderQueueInvocation::RenderQueueInvocation(uint8 renderQueueGroupID, 
40                const String& invocationName)
41                : mRenderQueueGroupID(renderQueueGroupID), mInvocationName(invocationName), 
42                mSolidsOrganisation(QueuedRenderableCollection::OM_PASS_GROUP), 
43                mSuppressShadows(false), mSuppressRenderStateChanges(false)
44        {
45
46        }
47        //-----------------------------------------------------------------------------
48        RenderQueueInvocation::~RenderQueueInvocation()
49        {
50
51        }
52        //-----------------------------------------------------------------------------
53        void RenderQueueInvocation::invoke(RenderQueueGroup* group, SceneManager* targetSceneManager)
54        {
55                bool oldShadows = targetSceneManager->_areShadowsSuppressed();
56                bool oldRSChanges = targetSceneManager->_areRenderStateChangesSuppressed();
57
58                targetSceneManager->_suppressShadows(mSuppressShadows);
59                targetSceneManager->_suppressRenderStateChanges(mSuppressRenderStateChanges);
60
61                targetSceneManager->_renderQueueGroupObjects(group, mSolidsOrganisation);
62
63                targetSceneManager->_suppressShadows(oldShadows);
64                targetSceneManager->_suppressRenderStateChanges(oldRSChanges);
65
66        }
67        //-----------------------------------------------------------------------------
68        //-----------------------------------------------------------------------------
69        RenderQueueInvocationSequence::RenderQueueInvocationSequence(const String& name)
70                :mName(name)
71        {
72        }
73        //-----------------------------------------------------------------------------
74        RenderQueueInvocationSequence::~RenderQueueInvocationSequence()
75        {
76                clear();
77        }
78        //-----------------------------------------------------------------------------
79        RenderQueueInvocation* RenderQueueInvocationSequence::add(uint8 renderQueueGroupID, 
80                const String& invocationName)
81        {
82                RenderQueueInvocation* ret = 
83                        new RenderQueueInvocation(renderQueueGroupID, invocationName);
84
85                mInvocations.push_back(ret);
86
87                return ret;
88
89        }
90        //-----------------------------------------------------------------------------
91        void RenderQueueInvocationSequence::add(RenderQueueInvocation* i)
92        {
93                mInvocations.push_back(i);
94        }
95        //-----------------------------------------------------------------------------
96        void RenderQueueInvocationSequence::clear(void)
97        {
98                for (RenderQueueInvocationList::iterator i = mInvocations.begin();
99                        i != mInvocations.end(); ++i)
100                {
101                        delete *i;
102                }
103                mInvocations.clear();
104        }
105        //-----------------------------------------------------------------------------
106        RenderQueueInvocation* RenderQueueInvocationSequence::get(size_t index)
107        {
108                if (index >= size())
109                        OGRE_EXCEPT(Exception::ERR_ITEM_NOT_FOUND, 
110                                "Index out of bounds", 
111                                "RenderQueueInvocationSequence::get");
112
113                return mInvocations[index];
114        }
115        //-----------------------------------------------------------------------------
116        void RenderQueueInvocationSequence::remove(size_t index)
117        {
118                if (index >= size())
119                        OGRE_EXCEPT(Exception::ERR_ITEM_NOT_FOUND, 
120                        "Index out of bounds", 
121                        "RenderQueueInvocationSequence::remove");
122               
123                RenderQueueInvocationList::iterator i = mInvocations.begin();
124                std::advance(i, index);
125                delete *i;
126                mInvocations.erase(i);
127               
128        }
129        //-----------------------------------------------------------------------------
130        RenderQueueInvocationIterator RenderQueueInvocationSequence::iterator(void)
131        {
132                return RenderQueueInvocationIterator(mInvocations.begin(), mInvocations.end());
133        }
134        //-----------------------------------------------------------------------------
135
136
137}
Note: See TracBrowser for help on using the repository browser.