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 protected: 00119 Viewport *mViewport; 00120 00123 CompositorInstance *mOriginalScene; 00124 00126 Instances mInstances; 00127 00129 bool mDirty; 00131 bool mAnyCompositorsEnabled; 00132 00134 CompositorInstance::CompiledState mCompiledState; 00135 CompositorInstance::TargetOperation mOutputOperation; 00136 00139 void _compile(); 00140 00143 void preTargetOperation(CompositorInstance::TargetOperation &op, Viewport *vp, Camera *cam); 00144 00147 void postTargetOperation(CompositorInstance::TargetOperation &op, Viewport *vp, Camera *cam); 00148 00150 void destroyResources(void); 00151 00153 class RQListener: public RenderQueueListener 00154 { 00155 public: 00158 virtual void renderQueueStarted(uint8 id, const String& invocation, bool& skipThisQueue); 00161 virtual void renderQueueEnded(uint8 id, const String& invocation, bool& repeatThisQueue); 00162 00164 void setOperation(CompositorInstance::TargetOperation *op,SceneManager *sm,RenderSystem *rs); 00165 00167 void flushUpTo(uint8 id); 00168 private: 00169 CompositorInstance::TargetOperation *mOperation; 00170 SceneManager *mSceneManager; 00171 RenderSystem *mRenderSystem; 00172 CompositorInstance::RenderSystemOpPairs::iterator currentOp, lastOp; 00173 }; 00174 RQListener mOurListener; 00176 unsigned int mOldClearEveryFrameBuffers; 00178 uint32 mOldVisibilityMask; 00180 bool mOldFindVisibleObjects; 00182 float mOldLodBias; 00184 String mOldMaterialScheme; 00185 }; 00186 } 00187 00188 #endif
Copyright © 2000-2005 by The OGRE Team
This work is licensed under a Creative Commons Attribution-ShareAlike 2.5 License.
Last modified Sun Mar 12 14:37:39 2006