source: OGRE/trunk/ogrenew/OgreMain/include/OgreCompositionPass.h @ 692

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