source: OGRE/trunk/ogrenew/OgreMain/include/OgreCompositorManager.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 __CompositorManager_H__
26#define __CompositorManager_H__
27
28#include "OgrePrerequisites.h"
29#include "OgreResourceManager.h"
30#include "OgreCompositor.h"
31#include "OgreRectangle2D.h"
32#include "OgreCompositorSerializer.h"
33
34namespace Ogre {
35    /** Class for managing Compositor settings for Ogre. Compositors provide the means
36        to flexibly "composite" the final rendering result from multiple scene renders
37        and intermediate operations like rendering fullscreen quads. This makes
38        it possible to apply postfilter effects, HDRI postprocessing, and shadow
39        effects to a Viewport.
40        @par
41            When loaded from a script, a Compositor is in an 'unloaded' state and only stores the settings
42            required. It does not at that stage load any textures. This is because the material settings may be
43            loaded 'en masse' from bulk material script files, but only a subset will actually be required.
44        @par
45            Because this is a subclass of ResourceManager, any files loaded will be searched for in any path or
46            archive added to the resource paths/archives. See ResourceManager for details.
47    */
48    class _OgreExport CompositorManager : public ResourceManager, public Singleton<CompositorManager>
49    {
50    public:
51        CompositorManager();
52        virtual ~CompositorManager();
53
54        /// Overridden from ResourceManager
55        Resource* createImpl(const String& name, ResourceHandle handle,
56            const String& group, bool isManual, ManualResourceLoader* loader,
57            const NameValuePairList* params);
58
59        /** Intialises the Compositor manager, which also triggers it to
60            parse all available .compositor scripts. */
61        void initialise(void);
62
63        /** @see ScriptLoader::parseScript
64        */
65        void parseScript(DataStreamPtr& stream, const String& groupName);
66
67        /** Get the compositor chain for a Viewport. If there is none yet, a new
68                        compositor chain is registered.
69                        XXX We need a _notifyViewportRemoved to find out when this viewport disappears,
70                        so we can destroy its chain as well.
71        */
72        CompositorChain *getCompositorChain(Viewport *vp);
73
74                /** Returns whether exists compositor chain for a viewport.
75        */
76                bool hasCompositorChain(Viewport *vp) const;
77
78                /** Remove the compositor chain from a viewport if exists.
79                */
80        void removeCompositorChain(Viewport *vp);
81
82                /** Add a compositor to a viewport. By default, it is added to end of the chain,
83                        after the other compositors.
84                        @param vp                       Viewport to modify
85                        @param compositor       The name of the compositor to apply
86                        @param addPosition      At which position to add, defaults to the end (-1).
87                        @returns pointer to instance, or 0 if it failed.
88                */
89                CompositorInstance *addCompositor(Viewport *vp, const String &compositor, int addPosition=-1);
90
91                /** Remove a compositor from a viewport
92                */
93                void removeCompositor(Viewport *vp, const String &compositor);
94
95                /** Set the state of a compositor on a viewport to enabled or disabled.
96                        Disabling a compositor stops it from rendering but does not free any resources.
97                        This can be more efficient than using removeCompositor and addCompositor in cases
98                        the filter is switched on and off a lot.
99                */
100                void setCompositorEnabled(Viewport *vp, const String &compositor, bool value);
101
102                /** Get a textured fullscreen 2D rectangle, for internal use.
103                */
104                Renderable *_getTexturedRectangle2D();
105
106                /** Overridden from ResourceManager since we have to clean up chains too. */
107                void removeAll(void);
108
109    private:
110        typedef std::map<Viewport*, CompositorChain*> Chains;
111        Chains mChains;
112
113        /// Serializer
114        CompositorSerializer mSerializer;
115
116        /** Clear composition chains for all viewports
117         */
118        void freeChains();
119
120                Rectangle2D *mRectangle;
121    };
122}
123
124#endif
Note: See TracBrowser for help on using the repository browser.