OgreCompositionTechnique.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-2013 Torus Knot Software Ltd
00008 
00009 Permission is hereby granted, free of charge, to any person obtaining a copy
00010 of this software and associated documentation files (the "Software"), to deal
00011 in the Software without restriction, including without limitation the rights
00012 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
00013 copies of the Software, and to permit persons to whom the Software is
00014 furnished to do so, subject to the following conditions:
00015 
00016 The above copyright notice and this permission notice shall be included in
00017 all copies or substantial portions of the Software.
00018 
00019 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
00020 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00021 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
00022 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
00023 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
00024 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
00025 THE SOFTWARE.
00026 -----------------------------------------------------------------------------
00027 */
00028 #ifndef __CompositionTechnique_H__
00029 #define __CompositionTechnique_H__
00030 
00031 #include "OgrePrerequisites.h"
00032 #include "OgrePixelFormat.h"
00033 #include "OgreIteratorWrappers.h"
00034 #include "OgreHeaderPrefix.h"
00035 
00036 namespace Ogre {
00045     class _OgreExport CompositionTechnique : public CompositorInstAlloc
00046     {
00047     public:
00048         CompositionTechnique(Compositor *parent);
00049         virtual ~CompositionTechnique();
00050     
00051         //The scope of a texture defined by the compositor
00052         enum TextureScope { 
00053             //Local texture - only available to the compositor passes in this technique
00054             TS_LOCAL, 
00055             //Chain texture - available to the other compositors in the chain
00056             TS_CHAIN, 
00057             //Global texture - available to everyone in every scope
00058             TS_GLOBAL 
00059         };
00060 
00062         class TextureDefinition : public CompositorInstAlloc
00063         {
00064         public:
00065             String name;
00066             //Texture definition being a reference is determined by these two fields not being empty.
00067             String refCompName; //If a reference, the name of the compositor being referenced
00068             String refTexName;  //If a reference, the name of the texture in the compositor being referenced
00069             size_t width;       // 0 means adapt to target width
00070             size_t height;      // 0 means adapt to target height
00071             float widthFactor;  // multiple of target width to use (if width = 0)
00072             float heightFactor; // multiple of target height to use (if height = 0)
00073             PixelFormatList formatList; // more than one means MRT
00074             bool fsaa;          // FSAA enabled; true = determine from main target (if render_scene), false = disable
00075             bool hwGammaWrite;  // Do sRGB gamma correction on write (only 8-bit per channel formats) 
00076             uint16 depthBufferId;//Depth Buffer's pool ID. (unrelated to "pool" variable below)
00077             bool pooled;        // whether to use pooled textures for this one
00078             TextureScope scope; // Which scope has access to this texture
00079 
00080             TextureDefinition() :width(0), height(0), widthFactor(1.0f), heightFactor(1.0f), 
00081                 fsaa(true), hwGammaWrite(false), depthBufferId(1), pooled(false), scope(TS_LOCAL) {}
00082         };
00084         typedef vector<CompositionTargetPass *>::type TargetPasses;
00085         typedef VectorIterator<TargetPasses> TargetPassIterator;
00086         typedef vector<TextureDefinition*>::type TextureDefinitions;
00087         typedef VectorIterator<TextureDefinitions> TextureDefinitionIterator;
00088         
00092         TextureDefinition *createTextureDefinition(const String &name);
00093         
00096         void removeTextureDefinition(size_t idx);
00097         
00100         TextureDefinition *getTextureDefinition(size_t idx);
00101         
00104         TextureDefinition *getTextureDefinition(const String& name);
00105 
00108         size_t getNumTextureDefinitions();
00109         
00112         void removeAllTextureDefinitions();
00113         
00115         TextureDefinitionIterator getTextureDefinitionIterator(void);
00116         
00119         CompositionTargetPass *createTargetPass();
00120         
00123         void removeTargetPass(size_t idx);
00124         
00127         CompositionTargetPass *getTargetPass(size_t idx);
00128         
00131         size_t getNumTargetPasses();
00132         
00135         void removeAllTargetPasses();
00136         
00138         TargetPassIterator getTargetPassIterator(void);
00139         
00142         CompositionTargetPass *getOutputTargetPass();
00143         
00147         virtual bool isSupported(bool allowTextureDegradation);
00148         
00152         virtual void setSchemeName(const String& schemeName);
00154         const String& getSchemeName() const { return mSchemeName; }
00155         
00159         void setCompositorLogicName(const String& compositorLogicName) 
00160             { mCompositorLogicName = compositorLogicName; }
00162         const String& getCompositorLogicName() const { return mCompositorLogicName; }
00163 
00165         Compositor *getParent();
00166     private:
00168         Compositor *mParent;
00170         TextureDefinitions mTextureDefinitions;
00171         
00173         TargetPasses mTargetPasses;
00175         CompositionTargetPass *mOutputTarget;  
00176 
00178         String mSchemeName;
00179         
00181         String mCompositorLogicName;
00182 
00183     };
00187 }
00188 
00189 #include "OgreHeaderSuffix.h"
00190 
00191 #endif

Copyright © 2012 Torus Knot Software Ltd
Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
Last modified Mon Jul 27 2020 13:40:41