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-2011 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 
00035 namespace Ogre {
00044     class _OgreExport CompositionTechnique : public CompositorInstAlloc
00045     {
00046     public:
00047         CompositionTechnique(Compositor *parent);
00048         virtual ~CompositionTechnique();
00049     
00050         //The scope of a texture defined by the compositor
00051         enum TextureScope { 
00052             //Local texture - only available to the compositor passes in this technique
00053             TS_LOCAL, 
00054             //Chain texture - available to the other compositors in the chain
00055             TS_CHAIN, 
00056             //Global texture - available to everyone in every scope
00057             TS_GLOBAL 
00058         };
00059 
00061         class TextureDefinition : public CompositorInstAlloc
00062         {
00063         public:
00064             String name;
00065             //Texture definition being a reference is determined by these two fields not being empty.
00066             String refCompName; //If a reference, the name of the compositor being referenced
00067             String refTexName;  //If a reference, the name of the texture in the compositor being referenced
00068             size_t width;       // 0 means adapt to target width
00069             size_t height;      // 0 means adapt to target height
00070             float widthFactor;  // multiple of target width to use (if width = 0)
00071             float heightFactor; // multiple of target height to use (if height = 0)
00072             PixelFormatList formatList; // more than one means MRT
00073             bool fsaa;          // FSAA enabled; true = determine from main target (if render_scene), false = disable
00074             bool hwGammaWrite;  // Do sRGB gamma correction on write (only 8-bit per channel formats) 
00075             bool pooled;        // whether to use pooled textures for this one
00076             TextureScope scope; // Which scope has access to this texture
00077 
00078             TextureDefinition() :width(0), height(0), widthFactor(1.0f), heightFactor(1.0f), 
00079                 fsaa(true), hwGammaWrite(false), pooled(false), scope(TS_LOCAL) {}
00080         };
00082         typedef vector<CompositionTargetPass *>::type TargetPasses;
00083         typedef VectorIterator<TargetPasses> TargetPassIterator;
00084         typedef vector<TextureDefinition*>::type TextureDefinitions;
00085         typedef VectorIterator<TextureDefinitions> TextureDefinitionIterator;
00086         
00090         TextureDefinition *createTextureDefinition(const String &name);
00091         
00094         void removeTextureDefinition(size_t idx);
00095         
00098         TextureDefinition *getTextureDefinition(size_t idx);
00099         
00102         TextureDefinition *getTextureDefinition(const String& name);
00103 
00106         size_t getNumTextureDefinitions();
00107         
00110         void removeAllTextureDefinitions();
00111         
00113         TextureDefinitionIterator getTextureDefinitionIterator(void);
00114         
00117         CompositionTargetPass *createTargetPass();
00118         
00121         void removeTargetPass(size_t idx);
00122         
00125         CompositionTargetPass *getTargetPass(size_t idx);
00126         
00129         size_t getNumTargetPasses();
00130         
00133         void removeAllTargetPasses();
00134         
00136         TargetPassIterator getTargetPassIterator(void);
00137         
00140         CompositionTargetPass *getOutputTargetPass();
00141         
00145         virtual bool isSupported(bool allowTextureDegradation);
00146         
00150         virtual void setSchemeName(const String& schemeName);
00152         const String& getSchemeName() const { return mSchemeName; }
00153         
00157         void setCompositorLogicName(const String& compositorLogicName) 
00158             { mCompositorLogicName = compositorLogicName; }
00160         const String& getCompositorLogicName() const { return mCompositorLogicName; }
00161 
00163         Compositor *getParent();
00164     private:
00166         Compositor *mParent;
00168         TextureDefinitions mTextureDefinitions;
00169         
00171         TargetPasses mTargetPasses;
00173         CompositionTargetPass *mOutputTarget;  
00174 
00176         String mSchemeName;
00177         
00179         String mCompositorLogicName;
00180 
00181     };
00185 }
00186 
00187 #endif

Copyright © 2008 Torus Knot Software Ltd
Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
Last modified Sat Jan 14 2012 18:40:43