- Main Page
- Namespaces
- Classes
- Files
- Directories
- Related Pages

# OgreCompositorChain.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 __CompositorChain_H__
    00030 #define __CompositorChain_H__
    00031
    00032 #include "OgrePrerequisites.h"
    00033 #include "OgreRenderTargetListener.h"
    00034 #include "OgreRenderQueueListener.h"
    00035 #include "OgreCompositorInstance.h"
    00036 #include "OgreCompositor.h"
    00037 namespace Ogre {
    00038
    00041     class _OgreExport CompositorChain: public RenderTargetListener
    00042     {
    00043     public:
    00044         CompositorChain(Viewport *vp);
    00049         virtual ~CompositorChain();
    00050
    00052         typedef std::vector<CompositorInstance*> Instances;
    00053         typedef VectorIterator<Instances> InstanceIterator;
    00054
    00056         static const size_t LAST = (size_t)-1;
    00058         static const size_t BEST = 0;
    00059
    00066         CompositorInstance* addCompositor(CompositorPtr filter, size_t addPosition=LAST, size_t technique=BEST);
    00067
    00071         void removeCompositor(size_t position=LAST);
    00072
    00075         size_t getNumCompositors();
    00076
    00079         void removeAllCompositors();
    00080
    00083         CompositorInstance *getCompositor(size_t index);
    00084
    00087         CompositorInstance* _getOriginalSceneCompositor(void) { return mOriginalScene; }
    00088
    00091         InstanceIterator getCompositors();
    00092
    00098         void setCompositorEnabled(size_t position, bool state);
    00099
    00101         virtual void preRenderTargetUpdate(const RenderTargetEvent& evt);
    00103         virtual void preViewportUpdate(const RenderTargetViewportEvent& evt);
    00105         virtual void postViewportUpdate(const RenderTargetViewportEvent& evt);
    00107         virtual void viewportRemoved(const RenderTargetViewportEvent& evt);
    00108
    00111         void _markDirty();
    00112
    00115         Viewport *getViewport();
    00116
    00118         void _notifyViewport(Viewport* vp);
    00119
    00123         void _removeInstance(CompositorInstance *i);
    00124
    00126         void _queuedOperation(CompositorInstance::RenderSystemOperation* op);
    00127
    00130         void _compile();
    00131     protected:
    00133         Viewport *mViewport;
    00134
    00137         CompositorInstance *mOriginalScene;
    00138
    00140         Instances mInstances;
    00141
    00143         bool mDirty;
    00145         bool mAnyCompositorsEnabled;
    00146
    00148         CompositorInstance::CompiledState mCompiledState;
    00149         CompositorInstance::TargetOperation mOutputOperation;
    00153         typedef std::vector<CompositorInstance::RenderSystemOperation*> RenderSystemOperations;
    00154         RenderSystemOperations mRenderSystemOperations;
    00155
    00156
    00158         void clearCompiledState();
    00159
    00162         void preTargetOperation(CompositorInstance::TargetOperation &op, Viewport *vp, Camera *cam);
    00163
    00166         void postTargetOperation(CompositorInstance::TargetOperation &op, Viewport *vp, Camera *cam);
    00167
    00169         void destroyResources(void);
    00170
    00172         class _OgreExport RQListener: public RenderQueueListener
    00173         {
    00174         public:
    00177             virtual void renderQueueStarted(uint8 id, const String& invocation, bool& skipThisQueue);
    00180             virtual void renderQueueEnded(uint8 id, const String& invocation, bool& repeatThisQueue);
    00181
    00183             void setOperation(CompositorInstance::TargetOperation *op,SceneManager *sm,RenderSystem *rs);
    00184
    00186             void notifyViewport(Viewport* vp) { mViewport = vp; }
    00187
    00189             void flushUpTo(uint8 id);
    00190         private:
    00191             CompositorInstance::TargetOperation *mOperation;
    00192             SceneManager *mSceneManager;
    00193             RenderSystem *mRenderSystem;
    00194             Viewport* mViewport;
    00195             CompositorInstance::RenderSystemOpPairs::iterator currentOp, lastOp;
    00196         };
    00197         RQListener mOurListener;
    00199         unsigned int mOldClearEveryFrameBuffers;
    00201         uint32 mOldVisibilityMask;
    00203         bool mOldFindVisibleObjects;
    00205         float mOldLodBias;
    00207         String mOldMaterialScheme;
    00209         bool mOldShadowsEnabled;
    00210
    00211     };
    00212 }
    00213
    00214 #endif

Copyright © 2000-2005 by The OGRE Team
This work is licensed under a Creative Commons Attribution-ShareAlike 2.5 License.
Last modified Mon Jun 16 12:48:50 2008