Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/OgreMain/include/OgreCompositionPass.h @ 1

Last change on this file since 1 was 1, checked in by landauf, 17 years ago
File size: 9.4 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-2006 Torus Knot Software Ltd
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#ifndef __CompositionPass_H__
30#define __CompositionPass_H__
31
32#include "OgrePrerequisites.h"
33#include "OgreMaterial.h"
34#include "OgreRenderSystem.h"
35#include "OgreRenderQueue.h"
36
37namespace Ogre {
38        /** Object representing one pass or operation in a composition sequence. This provides a
39                method to conviently interleave RenderSystem commands between Render Queues.
40         */
41    class _OgreExport CompositionPass
42    {
43    public:
44        CompositionPass(CompositionTargetPass *parent);
45        ~CompositionPass();
46       
47        /** Enumeration that enumerates the various composition pass types.
48        */
49        enum PassType
50        {
51            PT_CLEAR,           // Clear target to one colour
52                        PT_STENCIL,                     // Set stencil operation
53            PT_RENDERSCENE,     // Render the scene or part of it
54            PT_RENDERQUAD       // Render a full screen quad
55        };
56       
57        /** Set the type of composition pass */
58        void setType(PassType type);
59        /** Get the type of composition pass */
60        PassType getType() const;
61       
62                /** Set an identifier for this pass. This identifier can be used to
63                        "listen in" on this pass with an CompositorInstance::Listener.
64                */
65                void setIdentifier(uint32 id);
66                /** Get the identifier for this pass */
67                uint32 getIdentifier() const;
68
69        /** Set the material used by this pass
70                        @note applies when PassType is RENDERQUAD
71                */
72        void setMaterial(const MaterialPtr& mat);
73        /** Set the material used by this pass
74                        @note applies when PassType is RENDERQUAD
75                */
76        void setMaterialName(const String &name);
77        /** Get the material used by this pass
78                        @note applies when PassType is RENDERQUAD
79                */
80        const MaterialPtr& getMaterial() const;
81                /** Set the first render queue to be rendered in this pass (inclusive)
82                        @note applies when PassType is RENDERSCENE
83                */
84        void setFirstRenderQueue(uint8 id);
85                /** Get the first render queue to be rendered in this pass (inclusive)
86                        @note applies when PassType is RENDERSCENE
87                */
88                uint8 getFirstRenderQueue();
89                /** Set the last render queue to be rendered in this pass (inclusive)
90                        @note applies when PassType is RENDERSCENE
91                */
92        void setLastRenderQueue(uint8 id);
93                /** Get the last render queue to be rendered in this pass (inclusive)
94                        @note applies when PassType is RENDERSCENE
95                */
96                uint8 getLastRenderQueue();
97
98                /** Would be nice to have for RENDERSCENE:
99                        flags to:
100                                exclude transparents
101                                override material (at least -- color)
102                */
103
104        /** Set the viewport clear buffers  (defaults to FBT_COLOUR|FBT_DEPTH)
105            @param val is a combination of FBT_COLOUR, FBT_DEPTH, FBT_STENCIL.
106                        @note applies when PassType is CLEAR
107        */
108        void setClearBuffers(uint32 val);
109        /** Get the viewport clear buffers.
110                        @note applies when PassType is CLEAR
111        */
112        uint32 getClearBuffers();
113        /** Set the viewport clear colour (defaults to 0,0,0,0)
114                        @note applies when PassType is CLEAR
115                 */
116        void setClearColour(ColourValue val);
117        /** Get the viewport clear colour (defaults to 0,0,0,0)
118                        @note applies when PassType is CLEAR
119                 */
120        const ColourValue &getClearColour();
121        /** Set the viewport clear depth (defaults to 1.0)
122                        @note applies when PassType is CLEAR
123                */
124        void setClearDepth(Real depth);
125        /** Get the viewport clear depth (defaults to 1.0)
126                        @note applies when PassType is CLEAR
127                */
128        Real getClearDepth();
129                /** Set the viewport clear stencil value (defaults to 0)
130                        @note applies when PassType is CLEAR
131                */
132        void setClearStencil(uint32 value);
133        /** Get the viewport clear stencil value (defaults to 0)
134                        @note applies when PassType is CLEAR
135                */
136        uint32 getClearStencil();
137
138                /** Set stencil check on or off.
139                        @note applies when PassType is STENCIL
140                */
141                void setStencilCheck(bool value);
142                /** Get stencil check enable.
143                        @note applies when PassType is STENCIL
144                */
145                bool getStencilCheck();
146                /** Set stencil compare function.
147                        @note applies when PassType is STENCIL
148                */
149                void setStencilFunc(CompareFunction value); 
150                /** Get stencil compare function.
151                        @note applies when PassType is STENCIL
152                */
153                CompareFunction getStencilFunc(); 
154                /** Set stencil reference value.
155                        @note applies when PassType is STENCIL
156                */
157                void setStencilRefValue(uint32 value);
158                /** Get stencil reference value.
159                        @note applies when PassType is STENCIL
160                */
161                uint32 getStencilRefValue();
162                /** Set stencil mask.
163                        @note applies when PassType is STENCIL
164                */
165                void setStencilMask(uint32 value);
166                /** Get stencil mask.
167                        @note applies when PassType is STENCIL
168                */
169                uint32 getStencilMask();
170                /** Set stencil fail operation.
171                        @note applies when PassType is STENCIL
172                */
173                void setStencilFailOp(StencilOperation value);
174                /** Get stencil fail operation.
175                        @note applies when PassType is STENCIL
176                */
177                StencilOperation getStencilFailOp();
178                /** Set stencil depth fail operation.
179                        @note applies when PassType is STENCIL
180                */
181                void setStencilDepthFailOp(StencilOperation value);
182                /** Get stencil depth fail operation.
183                        @note applies when PassType is STENCIL
184                */
185                StencilOperation getStencilDepthFailOp();
186                /** Set stencil pass operation.
187                        @note applies when PassType is STENCIL
188                */
189                void setStencilPassOp(StencilOperation value);
190                /** Get stencil pass operation.
191                        @note applies when PassType is STENCIL
192                */
193                StencilOperation getStencilPassOp();
194                /** Set two sided stencil operation.
195                        @note applies when PassType is STENCIL
196                */
197                void setStencilTwoSidedOperation(bool value);
198                /** Get two sided stencil operation.
199                        @note applies when PassType is STENCIL
200                */
201                bool getStencilTwoSidedOperation();
202
203        /** Set an input local texture. An empty string clears the input.
204            @param id    Input to set. Must be in 0..OGRE_MAX_TEXTURE_LAYERS-1
205            @param input Which texture to bind to this input. An empty string clears the input.
206                        @note applies when PassType is RENDERQUAD
207        */
208        void setInput(size_t id, const String &input="");
209       
210        /** Get the value of an input.
211            @param id    Input to get. Must be in 0..OGRE_MAX_TEXTURE_LAYERS-1.
212                        @note applies when PassType is RENDERQUAD
213        */
214        const String &getInput(size_t id);
215       
216        /** Get the number of inputs used.
217                        @note applies when PassType is RENDERQUAD
218        */
219        size_t getNumInputs();
220       
221        /** Clear all inputs.
222                        @note applies when PassType is RENDERQUAD
223        */
224        void clearAllInputs();
225       
226        /** Get parent object
227                        @note applies when PassType is RENDERQUAD
228                */
229        CompositionTargetPass *getParent();
230
231        /** Determine if this target pass is supported on the current rendering device.
232         */
233        bool _isSupported(void);
234
235    private:
236        /// Parent technique
237        CompositionTargetPass *mParent;
238        /// Type of composition pass
239        PassType mType;
240                /// Identifier for this pass
241                uint32 mIdentifier;
242        /// Material used for rendering
243        MaterialPtr mMaterial;
244        /// [first,last] render queue to render this pass (in case of PT_RENDERSCENE)
245                uint8 mFirstRenderQueue;
246                uint8 mLastRenderQueue;
247        /// Clear buffers (in case of PT_CLEAR)
248        uint32 mClearBuffers;
249        /// Clear colour (in case of PT_CLEAR)
250        ColourValue mClearColour;
251                /// Clear depth (in case of PT_CLEAR)
252                Real mClearDepth;
253                /// Clear stencil value (in case of PT_CLEAR)
254                uint32 mClearStencil;
255        /// Inputs (for material used for rendering the quad)
256        /// An empty string signifies that no input is used
257        String mInputs[OGRE_MAX_TEXTURE_LAYERS];
258                /// Stencil operation parameters
259                bool mStencilCheck;
260                CompareFunction mStencilFunc; 
261                uint32 mStencilRefValue;
262                uint32 mStencilMask;
263                StencilOperation mStencilFailOp;
264                StencilOperation mStencilDepthFailOp;
265                StencilOperation mStencilPassOp;
266                bool mStencilTwoSidedOperation;
267    };
268
269}
270
271#endif
Note: See TracBrowser for help on using the repository browser.