OGRE: OgreCompositorInstance.h Source File - OGRE Documentation

Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

# OgreCompositorInstance.h

Go to the documentation of this file.

    00001 /*
    00002 -----------------------------------------------------------------------------
    00003 This source file is part of OGRE
    00004     (Object-oriented Graphics Rendering Engine)
    00005 For the latest info, see http://www.ogre3d.org/
    00006
    00007 Copyright (c) 2000-2006 Torus Knot Software Ltd
    00008 Also see acknowledgements in Readme.html
    00009
    00010 This program is free software; you can redistribute it and/or modify it under
    00011 the terms of the GNU Lesser General Public License as published by the Free Software
    00012 Foundation; either version 2 of the License, or (at your option) any later
    00013 version.
    00014
    00015 This program is distributed in the hope that it will be useful, but WITHOUT
    00016 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
    00017 FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
    00018
    00019 You should have received a copy of the GNU Lesser General Public License along with
    00020 this program; if not, write to the Free Software Foundation, Inc., 59 Temple
    00021 Place - Suite 330, Boston, MA 02111-1307, USA, or go to
    00022 http://www.gnu.org/copyleft/lesser.txt.
    00023
    00024 You may alternatively use this source under the terms of a specific version of
    00025 the OGRE Unrestricted License provided you have obtained such a license from
    00026 Torus Knot Software Ltd.
    00027 -----------------------------------------------------------------------------
    00028 */
    00029 #ifndef __CompositorInstance_H__
    00030 #define __CompositorInstance_H__
    00031
    00032 #include "OgrePrerequisites.h"
    00033 #include "OgreMaterial.h"
    00034 #include "OgreTexture.h"
    00035 #include "OgreRenderQueue.h"
    00036 namespace Ogre {
    00037     const size_t RENDER_QUEUE_COUNT = RENDER_QUEUE_MAX+1;
    00038
    00042     class _OgreExport CompositorInstance
    00043     {
    00044     public:
    00045         CompositorInstance(Compositor *filter, CompositionTechnique *technique, CompositorChain *chain);
    00046         virtual ~CompositorInstance();
    00050         class _OgreExport Listener
    00051         {
    00052         public:
    00053             virtual ~Listener();
    00054
    00064             virtual void notifyMaterialSetup(uint32 pass_id, MaterialPtr &mat);
    00065
    00074             virtual void notifyMaterialRender(uint32 pass_id, MaterialPtr &mat);
    00075         };
    00080         class RenderSystemOperation
    00081         {
    00082         public:
    00083             virtual ~RenderSystemOperation();
    00085             virtual void execute(SceneManager *sm, RenderSystem *rs) = 0;
    00086         };
    00087         typedef std::map<int, MaterialPtr> QuadMaterialMap;
    00088         typedef std::pair<int, RenderSystemOperation*> RenderSystemOpPair;
    00089         typedef std::vector<RenderSystemOpPair> RenderSystemOpPairs;
    00092         class TargetOperation
    00093         {
    00094         public:
    00095             TargetOperation()
    00096             {
    00097             }
    00098             TargetOperation(RenderTarget *target):
    00099                 target(target), currentQueueGroupID(0), visibilityMask(0xFFFFFFFF),
    00100                 lodBias(1.0f),
    00101                 onlyInitial(false), hasBeenRendered(false), findVisibleObjects(false),
    00102                 shadowsEnabled(true)
    00103             {
    00104             }
    00106             RenderTarget *target;
    00107
    00109             int currentQueueGroupID;
    00110
    00113             RenderSystemOpPairs renderSystemOperations;
    00114
    00117             uint32 visibilityMask;
    00118
    00121             float lodBias;
    00122
    00125             typedef std::bitset<RENDER_QUEUE_COUNT> RenderQueueBitSet;
    00126
    00128             RenderQueueBitSet renderQueues;
    00129
    00132             bool onlyInitial;
    00136             bool hasBeenRendered;
    00139             bool findVisibleObjects;
    00141             String materialScheme;
    00143             bool shadowsEnabled;
    00144         };
    00145         typedef std::vector<TargetOperation> CompiledState;
    00146
    00150         void setEnabled(bool value);
    00151
    00154         bool getEnabled();
    00155
    00165         const String& getTextureInstanceName(const String& name);
    00166
    00167
    00171         virtual void _compileTargetOperations(CompiledState &compiledState);
    00172
    00176         virtual void _compileOutputOperation(TargetOperation &finalState);
    00177
    00180         Compositor *getCompositor();
    00181
    00184         CompositionTechnique *getTechnique();
    00185
    00188         CompositorChain *getChain();
    00189
    00195         void addListener(Listener *l);
    00196
    00200         void removeListener(Listener *l);
    00201
    00204         void _fireNotifyMaterialSetup(uint32 pass_id, MaterialPtr &mat);
    00205
    00208         void _fireNotifyMaterialRender(uint32 pass_id, MaterialPtr &mat);
    00209     private:
    00211         Compositor *mCompositor;
    00213         CompositionTechnique *mTechnique;
    00215         CompositorChain *mChain;
    00217         bool mEnabled;
    00219         typedef std::map<String,TexturePtr> LocalTextureMap;
    00220         LocalTextureMap mLocalTextures;
    00221
    00223         typedef std::vector<Listener*> Listeners;
    00224         Listeners mListeners;
    00225
    00227         CompositorInstance *mPreviousInstance;
    00228
    00232         virtual void collectPasses(TargetOperation &finalState, CompositionTargetPass *target);
    00233
    00238         MaterialPtr createLocalMaterial();
    00239
    00242         void createResources();
    00243
    00246         void freeResources();
    00247
    00250         RenderTarget *getTargetForTex(const String &name);
    00251
    00254         const String &getSourceForTex(const String &name);
    00255
    00259         void queueRenderSystemOp(TargetOperation &finalState, RenderSystemOperation *op);
    00260
    00261         friend class CompositorChain;
    00262     };
    00263 }
    00264
    00265 #endif

Copyright © 2000-2005 by The OGRE Team
This work is licensed under a Creative Commons Attribution-ShareAlike 2.5 License.
Last modified Thu Mar 6 09:46:25 2008