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

Revision 692, 5.0 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 __CompositionTechnique_H__
26#define __CompositionTechnique_H__
27
28#include "OgrePrerequisites.h"
29#include "OgrePixelFormat.h"
30#include "OgreIteratorWrappers.h"
31
32namespace Ogre {
33    /** Base composition technique, can be subclassed in plugins.
34     */
35    class _OgreExport CompositionTechnique
36    {
37    public:
38        CompositionTechnique(Compositor *parent);
39        virtual ~CompositionTechnique();
40   
41        /// Local texture definition
42        class TextureDefinition
43        {
44        public:
45            String name;
46            size_t width;       // 0 means adapt to target width
47            size_t height;      // 0 means adapt to target height
48            PixelFormat format;
49
50                        TextureDefinition() :width(0), height(0), format(PF_R8G8B8A8){}
51        };
52        /// Typedefs for several iterators
53        typedef std::vector<CompositionTargetPass *> TargetPasses;
54        typedef VectorIterator<TargetPasses> TargetPassIterator;
55        typedef std::vector<TextureDefinition*> TextureDefinitions;
56        typedef VectorIterator<TextureDefinitions> TextureDefinitionIterator;
57       
58        /** Create a new local texture definition, and return a pointer to it.
59            @param name     Name of the local texture
60        */
61        TextureDefinition *createTextureDefinition(const String &name);
62       
63        /** Remove and destroy a local texture definition.
64        */
65        void removeTextureDefinition(size_t idx);
66       
67        /** Get a local texture definition.
68        */
69        TextureDefinition *getTextureDefinition(size_t idx);
70       
71        /** Get the number of local texture definitions.
72        */
73        size_t getNumTextureDefinitions();
74       
75        /** Remove all Texture Definitions
76        */
77        void removeAllTextureDefinitions();
78       
79        /** Get an iterator over the TextureDefinitions in this Technique. */
80        TextureDefinitionIterator getTextureDefinitionIterator(void);
81       
82        /** Create a new target pass, and return a pointer to it.
83        */
84        CompositionTargetPass *createTargetPass();
85       
86        /** Remove a target pass. It will also be destroyed.
87        */
88        void removeTargetPass(size_t idx);
89       
90        /** Get a target pass.
91        */
92        CompositionTargetPass *getTargetPass(size_t idx);
93       
94        /** Get the number of target passes.
95        */
96        size_t getNumTargetPasses();
97       
98        /** Remove all target passes.
99        */
100        void removeAllTargetPasses();
101       
102        /** Get an iterator over the TargetPasses in this Technique. */
103        TargetPassIterator getTargetPassIterator(void);
104       
105        /** Get output (final) target pass
106         */
107        CompositionTargetPass *getOutputTargetPass();
108       
109        /** Determine if this technique is supported on the current rendering device.
110                @param allowTextureDegradation True to accept a reduction in texture depth
111         */
112        virtual bool isSupported(bool allowTextureDegradation);
113       
114        /** Create an instance of this technique.
115         */
116        virtual CompositorInstance *createInstance(CompositorChain *chain);
117       
118        /** Destroy an instance of this technique.
119         */
120        virtual void destroyInstance(CompositorInstance *instance);
121       
122        /** Get parent object */
123        Compositor *getParent();
124    private:
125        /// Parent compositor
126        Compositor *mParent;
127        /// Local texture definitions
128        TextureDefinitions mTextureDefinitions;
129       
130        /// Intermediate target passes
131        TargetPasses mTargetPasses;
132        /// Output target pass (can be only one)
133        CompositionTargetPass *mOutputTarget;   
134
135                /// List of instances
136                typedef std::vector<CompositorInstance *> Instances;
137                Instances mInstances;
138    };
139
140}
141
142#endif
Note: See TracBrowser for help on using the repository browser.