Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/ogre_src_v1-9-0/OgreMain/include/OgreRenderQueueInvocation.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: 8.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
7 Copyright (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 __RenderQueueInvocation_H__
29#define __RenderQueueInvocation_H__
30
31#include "OgrePrerequisites.h"
32#include "OgreRenderQueueSortingGrouping.h"
33#include "OgreIteratorWrappers.h"
34
35namespace Ogre {
36
37        /** \addtogroup Core
38        *  @{
39        */
40        /** \addtogroup RenderSystem
41        *  @{
42        */
43        /** Class representing the invocation of queue groups in a RenderQueue.
44        @remarks
45                The default behaviour for OGRE's render queue is to render each queue
46                group in turn, dealing with shadows automatically, and rendering solids
47                in grouped passes, followed by transparent objects in descending order.
48                This class, together with RenderQueueInvocationSequence and the ability
49                to associate one with a Viewport, allows you to change that behaviour
50                and render queue groups in arbitrary sequence, repeatedly, and to skip
51                shadows, change the ordering of solids, or even prevent OGRE controlling
52                the render state during a particular invocation for special effects.
53        @par
54                Note that whilst you can change the ordering of rendering solids, you
55                can't change the ordering on transparent objects, since to do this would
56                cause them to render incorrectly.
57        @par
58                As well as using this class directly and using the options it provides you
59                with, you can also provide subclasses of it to a
60                RenderQueueInvocationSequence instance if you want to gain ultimate control.
61        @note
62                Invocations will be skipped if there are scene-level options preventing
63                them being rendered - for example special-case render queues and
64                render queue listeners that dictate this.
65        */
66        class _OgreExport RenderQueueInvocation : public RenderQueueAlloc
67        {
68        protected:
69                /// Target queue group
70                uint8 mRenderQueueGroupID;
71                /// Invocation identifier - used in listeners
72                String mInvocationName;
73                /// Solids ordering mode
74                QueuedRenderableCollection::OrganisationMode mSolidsOrganisation;
75                /// Suppress shadows processing in this invocation?
76                bool mSuppressShadows;
77                /// Suppress OGRE's render state management?
78                bool mSuppressRenderStateChanges;
79        public:
80                /** Constructor
81                @param renderQueueGroupID ID of the queue this will target
82                @param invocationName Optional name to uniquely identify this
83                        invocation from others in a RenderQueueListener
84                */
85                RenderQueueInvocation(uint8 renderQueueGroupID, 
86                        const String& invocationName = StringUtil::BLANK);
87                virtual ~RenderQueueInvocation();
88
89                /// Get the render queue group id
90                virtual uint8 getRenderQueueGroupID(void) const { return mRenderQueueGroupID; }
91
92                /// Get the invocation name (may be blank if not set by creator)
93                virtual const String& getInvocationName(void) const { return mInvocationName; }
94
95                /** Set the organisation mode being used for solids in this queue group
96                invocation.
97                */
98                virtual void setSolidsOrganisation(
99                        QueuedRenderableCollection::OrganisationMode org) 
100                { mSolidsOrganisation = org; }
101
102                /** Get the organisation mode being used for solids in this queue group
103                        invocation.
104                */
105                virtual QueuedRenderableCollection::OrganisationMode
106                        getSolidsOrganisation(void) const { return mSolidsOrganisation; }
107
108                /** Sets whether shadows are suppressed when invoking this queue.
109                @remarks
110                        When doing effects you often will want to suppress shadow processing
111                        if shadows will already have been done by a previous render.
112                */
113                virtual void setSuppressShadows(bool suppress) 
114                { mSuppressShadows =  suppress; }
115
116                /** Gets whether shadows are suppressed when invoking this queue.
117                */
118                virtual bool getSuppressShadows(void) const { return mSuppressShadows; }
119
120                /** Sets whether render state changes are suppressed when invoking this queue.
121                @remarks
122                        When doing special effects you may want to set up render state yourself
123                        and have it apply for the entire rendering of a queue. In that case,
124                        you should call this method with a parameter of 'true', and use a
125                        RenderQueueListener to set the render state directly on RenderSystem
126                        yourself before the invocation.
127                @par
128                        Suppressing render state changes is only intended for advanced use,
129                        don't use it if you're unsure of the effect. The only RenderSystem
130                        calls made are to set the world matrix for each object (note -
131                        view an projection matrices are NOT SET - they are under your control)
132                        and to render the object; it is up to the caller to do everything else,
133                        including enabling any vertex / fragment programs and updating their
134                        parameter state, and binding parameters to the RenderSystem.
135                        We advise you use a RenderQueueListener in order to get a notification
136                        when this invocation is going to happen (use an invocation name to
137                        identify it if you like), at which point you can set the state you
138                        need to apply before the objects are rendered.
139                */
140                virtual void setSuppressRenderStateChanges(bool suppress) 
141                { mSuppressRenderStateChanges =  suppress; }
142
143                /** Gets whether shadows are suppressed when invoking this queue.
144                */
145                virtual bool getSuppressRenderStateChanges(void) const { return mSuppressRenderStateChanges; }
146
147                /** Invoke this class on a concrete queue group.
148                @remarks
149                        Implementation will send the queue group to the target scene manager
150                        after doing what it needs to do.
151                */
152                virtual void invoke(RenderQueueGroup* group, SceneManager* targetSceneManager);
153
154                /// Invocation identifier for shadows
155                static String RENDER_QUEUE_INVOCATION_SHADOWS;
156        };
157
158
159        /// List of RenderQueueInvocations
160        typedef vector<RenderQueueInvocation*>::type RenderQueueInvocationList;
161        typedef VectorIterator<RenderQueueInvocationList> RenderQueueInvocationIterator;
162
163        /** Class to hold a linear sequence of RenderQueueInvocation objects.
164        @remarks
165                This is just a simple data holder class which contains a list of
166                RenderQueueInvocation objects representing the sequence of invocations
167                made for a viewport. It's only real purpose is to ensure that
168                RenderQueueInvocation instances are deleted on shutdown, since you can
169                provide your own subclass instances on RenderQueueInvocation. Remember
170                that any invocation instances you give to this class will be deleted
171                by it when it is cleared / destroyed.
172        */
173        class _OgreExport RenderQueueInvocationSequence : public RenderQueueAlloc
174        {
175        protected:
176                String mName;
177                RenderQueueInvocationList mInvocations;
178        public:
179                RenderQueueInvocationSequence(const String& name);
180                virtual ~RenderQueueInvocationSequence();
181
182                /** Get the name of this sequence. */
183                const String& getName(void) const { return mName; }
184
185                /** Add a standard invocation to the sequence.
186                @param renderQueueGroupID The ID of the render queue group
187                @param invocationName Optional name to identify the invocation, useful
188                        for listeners if a single queue group is invoked more than once
189                @return A new RenderQueueInvocatin instance which you may customise
190                */
191                RenderQueueInvocation* add(uint8 renderQueueGroupID, 
192                        const String& invocationName);
193
194                /** Add a custom invocation to the sequence.
195                @remarks
196                        Use this to add your own custom subclasses of RenderQueueInvocation
197                        to the sequence; just remember that this class takes ownership of
198                        deleting this pointer when it is cleared / destroyed.
199                */
200                void add(RenderQueueInvocation* i);
201
202                /** Get the number of invocations in this sequence. */
203                size_t size(void) const { return mInvocations.size(); }
204
205                /** Clear and delete all invocations in this sequence. */
206                void clear(void);
207
208                /** Gets the details of an invocation at a given index. */
209                RenderQueueInvocation* get(size_t index);
210
211                /** Removes (and deletes) an invocation by index. */
212                void remove(size_t index);
213
214                /** Get an iterator over the invocations. */
215                RenderQueueInvocationIterator iterator(void);
216
217
218        };
219        /** @} */
220        /** @} */
221
222}
223
224#endif
225
Note: See TracBrowser for help on using the repository browser.