# OgreCompositor.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-2006 Torus Knot Software Ltd
    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 You may alternatively use this source under the terms of a specific version of
    00025 the OGRE Unrestricted License provided you have obtained such a license from
    00026 Torus Knot Software Ltd.
    00027 -----------------------------------------------------------------------------
    00028 */
    00029 #ifndef __Compositor_H__
    00030 #define __Compositor_H__
    00031
    00032 #include "OgrePrerequisites.h"
    00033 #include "OgreIteratorWrappers.h"
    00034 #include "OgreResource.h"
    00035
    00036 namespace Ogre {
    00043     class _OgreExport Compositor: public Resource
    00044     {
    00045     public:
    00046         Compositor(ResourceManager* creator, const String& name, ResourceHandle handle,
    00047             const String& group, bool isManual = false, ManualResourceLoader* loader = 0);
    00048         ~Compositor();
    00049
    00051         typedef std::vector<CompositionTechnique *> Techniques;
    00052         typedef VectorIterator<Techniques> TechniqueIterator;
    00053
    00056         CompositionTechnique *createTechnique();
    00057
    00060         void removeTechnique(size_t idx);
    00061
    00064         CompositionTechnique *getTechnique(size_t idx);
    00065
    00068         size_t getNumTechniques();
    00069
    00072         void removeAllTechniques();
    00073
    00075         TechniqueIterator getTechniqueIterator(void);
    00076
    00083         CompositionTechnique *getSupportedTechnique(size_t idx);
    00084
    00091         size_t getNumSupportedTechniques();
    00092
    00099         TechniqueIterator getSupportedTechniqueIterator(void);
    00100     protected:
    00102         void loadImpl(void);
    00103
    00105         void unloadImpl(void);
    00107         size_t calculateSize(void) const;
    00108
    00111         void compile();
    00112     private:
    00113         Techniques mTechniques;
    00114         Techniques mSupportedTechniques;
    00115
    00119         bool mCompilationRequired;
    00120     };
    00121
    00128     class _OgreExport CompositorPtr : public SharedPtr<Compositor>
    00129     {
    00130     public:
    00131         CompositorPtr() : SharedPtr<Compositor>() {}
    00132         explicit CompositorPtr(Compositor* rep) : SharedPtr<Compositor>(rep) {}
    00133         CompositorPtr(const CompositorPtr& r) : SharedPtr<Compositor>(r) {}
    00134         CompositorPtr(const ResourcePtr& r) : SharedPtr<Compositor>()
    00135         {
    00136             // lock & copy other mutex pointer
    00137             OGRE_MUTEX_CONDITIONAL(r.OGRE_AUTO_MUTEX_NAME)
    00138             {
    00139                 OGRE_LOCK_MUTEX(*r.OGRE_AUTO_MUTEX_NAME)
    00140                 OGRE_COPY_AUTO_SHARED_MUTEX(r.OGRE_AUTO_MUTEX_NAME)
    00141                 pRep = static_cast<Compositor*>(r.getPointer());
    00142                 pUseCount = r.useCountPointer();
    00143                 if (pUseCount)
    00144                 {
    00145                     ++(*pUseCount);
    00146                 }
    00147             }
    00148         }
    00149
    00151         CompositorPtr& operator=(const ResourcePtr& r)
    00152         {
    00153             if (pRep == static_cast<Compositor*>(r.getPointer()))
    00154                 return *this;
    00155             release();
    00156             // lock & copy other mutex pointer
    00157             OGRE_MUTEX_CONDITIONAL(r.OGRE_AUTO_MUTEX_NAME)
    00158             {
    00159                 OGRE_LOCK_MUTEX(*r.OGRE_AUTO_MUTEX_NAME)
    00160                 OGRE_COPY_AUTO_SHARED_MUTEX(r.OGRE_AUTO_MUTEX_NAME)
    00161                 pRep = static_cast<Compositor*>(r.getPointer());
    00162                 pUseCount = r.useCountPointer();
    00163                 if (pUseCount)
    00164                 {
    00165                     ++(*pUseCount);
    00166                 }
    00167             }
    00168             else
    00169             {
    00170                 // RHS must be a null pointer
    00171                 assert(r.isNull() && "RHS must be null if it has no mutex!");
    00172                 setNull();
    00173             }
    00174             return *this;
    00175         }
    00176     };
    00177 }
    00178
    00179 #endif

Copyright © 2008 Torus Knot Software Ltd
This work is licensed under a Creative Commons Attribution-ShareAlike 2.5 License.
Last modified Sat Apr 11 13:46:39 2009