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-2005 The OGRE Team 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 */ 00025 #ifndef __CompositorChain_H__ 00026 #define __CompositorChain_H__ 00027 00028 #include "OgrePrerequisites.h" 00029 #include "OgreRenderTargetListener.h" 00030 #include "OgreRenderQueueListener.h" 00031 #include "OgreCompositorInstance.h" 00032 #include "OgreCompositor.h" 00033 namespace Ogre { 00034 00037 class _OgreExport CompositorChain: public RenderTargetListener 00038 { 00039 public: 00040 CompositorChain(Viewport *vp); 00045 virtual ~CompositorChain(); 00046 00048 typedef std::vector<CompositorInstance*> Instances; 00049 typedef VectorIterator<Instances> InstanceIterator; 00050 00052 static const size_t LAST = (size_t)-1; 00054 static const size_t BEST = 0; 00055 00062 CompositorInstance* addCompositor(CompositorPtr filter, size_t addPosition=LAST, size_t technique=BEST); 00063 00067 void removeCompositor(size_t position=LAST); 00068 00071 size_t getNumCompositors(); 00072 00075 void removeAllCompositors(); 00076 00079 CompositorInstance *getCompositor(size_t index); 00080 00083 CompositorInstance* _getOriginalSceneCompositor(void) { return mOriginalScene; } 00084 00087 InstanceIterator getCompositors(); 00088 00094 void setCompositorEnabled(size_t position, bool state); 00095 00097 virtual void preRenderTargetUpdate(const RenderTargetEvent& evt); 00099 virtual void preViewportUpdate(const RenderTargetViewportEvent& evt); 00101 virtual void postViewportUpdate(const RenderTargetViewportEvent& evt); 00103 virtual void viewportRemoved(const RenderTargetViewportEvent& evt); 00104 00107 void _markDirty(); 00108 00111 Viewport *getViewport(); 00112 00116 void _removeInstance(CompositorInstance *i); 00117 00119 void _queuedOperation(CompositorInstance::RenderSystemOperation* op); 00120 00123 void _compile(); 00124 protected: 00126 Viewport *mViewport; 00127 00130 CompositorInstance *mOriginalScene; 00131 00133 Instances mInstances; 00134 00136 bool mDirty; 00138 bool mAnyCompositorsEnabled; 00139 00141 CompositorInstance::CompiledState mCompiledState; 00142 CompositorInstance::TargetOperation mOutputOperation; 00146 typedef std::vector<CompositorInstance::RenderSystemOperation*> RenderSystemOperations; 00147 RenderSystemOperations mRenderSystemOperations; 00148 00149 00151 void clearCompiledState(); 00152 00155 void preTargetOperation(CompositorInstance::TargetOperation &op, Viewport *vp, Camera *cam); 00156 00159 void postTargetOperation(CompositorInstance::TargetOperation &op, Viewport *vp, Camera *cam); 00160 00162 void destroyResources(void); 00163 00165 class RQListener: public RenderQueueListener 00166 { 00167 public: 00170 virtual void renderQueueStarted(uint8 id, const String& invocation, bool& skipThisQueue); 00173 virtual void renderQueueEnded(uint8 id, const String& invocation, bool& repeatThisQueue); 00174 00176 void setOperation(CompositorInstance::TargetOperation *op,SceneManager *sm,RenderSystem *rs); 00177 00179 void notifyViewport(Viewport* vp) { mViewport = vp; } 00180 00182 void flushUpTo(uint8 id); 00183 private: 00184 CompositorInstance::TargetOperation *mOperation; 00185 SceneManager *mSceneManager; 00186 RenderSystem *mRenderSystem; 00187 Viewport* mViewport; 00188 CompositorInstance::RenderSystemOpPairs::iterator currentOp, lastOp; 00189 }; 00190 RQListener mOurListener; 00192 unsigned int mOldClearEveryFrameBuffers; 00194 uint32 mOldVisibilityMask; 00196 bool mOldFindVisibleObjects; 00198 float mOldLodBias; 00200 String mOldMaterialScheme; 00201 }; 00202 } 00203 00204 #endif
Copyright © 2000-2005 by The OGRE Team
This work is licensed under a Creative Commons Attribution-ShareAlike 2.5 License.
Last modified Sun Jan 21 10:01:35 2007