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-2012 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             uint16 depthBufferId;//Depth Buffer's pool ID. (unrelated to "pool" variable below)
    00076             bool pooled;        // whether to use pooled textures for this one
    00077             TextureScope scope; // Which scope has access to this texture
    00078
    00079             TextureDefinition() :width(0), height(0), widthFactor(1.0f), heightFactor(1.0f),
    00080                 fsaa(true), hwGammaWrite(false), depthBufferId(1), pooled(false), scope(TS_LOCAL) {}
    00081         };
    00083         typedef vector<CompositionTargetPass *>::type TargetPasses;
    00084         typedef VectorIterator<TargetPasses> TargetPassIterator;
    00085         typedef vector<TextureDefinition*>::type TextureDefinitions;
    00086         typedef VectorIterator<TextureDefinitions> TextureDefinitionIterator;
    00087
    00091         TextureDefinition *createTextureDefinition(const String &name);
    00092
    00095         void removeTextureDefinition(size_t idx);
    00096
    00099         TextureDefinition *getTextureDefinition(size_t idx);
    00100
    00103         TextureDefinition *getTextureDefinition(const String& name);
    00104
    00107         size_t getNumTextureDefinitions();
    00108
    00111         void removeAllTextureDefinitions();
    00112
    00114         TextureDefinitionIterator getTextureDefinitionIterator(void);
    00115
    00118         CompositionTargetPass *createTargetPass();
    00119
    00122         void removeTargetPass(size_t idx);
    00123
    00126         CompositionTargetPass *getTargetPass(size_t idx);
    00127
    00130         size_t getNumTargetPasses();
    00131
    00134         void removeAllTargetPasses();
    00135
    00137         TargetPassIterator getTargetPassIterator(void);
    00138
    00141         CompositionTargetPass *getOutputTargetPass();
    00142
    00146         virtual bool isSupported(bool allowTextureDegradation);
    00147
    00151         virtual void setSchemeName(const String& schemeName);
    00153         const String& getSchemeName() const { return mSchemeName; }
    00154
    00158         void setCompositorLogicName(const String& compositorLogicName)
    00159             { mCompositorLogicName = compositorLogicName; }
    00161         const String& getCompositorLogicName() const { return mCompositorLogicName; }
    00162
    00164         Compositor *getParent();
    00165     private:
    00167         Compositor *mParent;
    00169         TextureDefinitions mTextureDefinitions;
    00170
    00172         TargetPasses mTargetPasses;
    00174         CompositionTargetPass *mOutputTarget;
    00175
    00177         String mSchemeName;
    00178
    00180         String mCompositorLogicName;
    00181
    00182     };
    00186 }
    00187
    00188 #endif

Copyright © 2012 Torus Knot Software Ltd
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
Last modified Sun Sep 2 2012 07:27:21