# OgreHighLevelGpuProgram.h Source File - OGRE Documentation

# OgreHighLevelGpuProgram.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-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 __HighLevelGpuProgram_H__
    00026 #define __HighLevelGpuProgram_H__
    00027
    00028 #include "OgrePrerequisites.h"
    00029 #include "OgreGpuProgram.h"
    00030
    00031 namespace Ogre {
    00032
    00054     class _OgreExport HighLevelGpuProgram : public GpuProgram
    00055     {
    00056     protected:
    00058         bool mHighLevelLoaded;
    00060         GpuProgramPtr mAssemblerProgram;
    00061
    00065         virtual void loadHighLevelImpl(void);
    00068         virtual void createLowLevelImpl(void) = 0;
    00070         virtual void unloadHighLevelImpl(void) = 0;
    00072         virtual void populateParameterNames(GpuProgramParametersSharedPtr params) = 0;
    00074         void loadImpl();
    00076         void unloadImpl();
    00077     public:
    00079         HighLevelGpuProgram(ResourceManager* creator, const String& name, ResourceHandle handle,
    00080             const String& group, bool isManual = false, ManualResourceLoader* loader = 0);
    00081         ~HighLevelGpuProgram();
    00082
    00083
    00091         GpuProgramParametersSharedPtr createParameters(void);
    00093         GpuProgram* _getBindingDelegate(void) { return mAssemblerProgram.getPointer(); }
    00094
    00095
    00096
    00097     };
    00098
    00105     class _OgreExport HighLevelGpuProgramPtr : public SharedPtr<HighLevelGpuProgram>
    00106     {
    00107     public:
    00108         HighLevelGpuProgramPtr() : SharedPtr<HighLevelGpuProgram>() {}
    00109         explicit HighLevelGpuProgramPtr(HighLevelGpuProgram* rep) : SharedPtr<HighLevelGpuProgram>(rep) {}
    00110         HighLevelGpuProgramPtr(const HighLevelGpuProgramPtr& r) : SharedPtr<HighLevelGpuProgram>(r) {}
    00111         HighLevelGpuProgramPtr(const ResourcePtr& r) : SharedPtr<HighLevelGpuProgram>()
    00112         {
    00113             // lock & copy other mutex pointer
    00114             OGRE_LOCK_MUTEX(*r.OGRE_AUTO_MUTEX_NAME)
    00115             OGRE_COPY_AUTO_SHARED_MUTEX(r.OGRE_AUTO_MUTEX_NAME)
    00116             pRep = static_cast<HighLevelGpuProgram*>(r.getPointer());
    00117             pUseCount = r.useCountPointer();
    00118             if (pUseCount)
    00119             {
    00120                 ++(*pUseCount);
    00121             }
    00122         }
    00123
    00125         HighLevelGpuProgramPtr& operator=(const ResourcePtr& r)
    00126         {
    00127             if (pRep == static_cast<HighLevelGpuProgram*>(r.getPointer()))
    00128                 return *this;
    00129             release();
    00130             // lock & copy other mutex pointer
    00131             OGRE_LOCK_MUTEX(*r.OGRE_AUTO_MUTEX_NAME)
    00132             OGRE_COPY_AUTO_SHARED_MUTEX(r.OGRE_AUTO_MUTEX_NAME)
    00133             pRep = static_cast<HighLevelGpuProgram*>(r.getPointer());
    00134             pUseCount = r.useCountPointer();
    00135             if (pUseCount)
    00136             {
    00137                 ++(*pUseCount);
    00138             }
    00139             return *this;
    00140         }
    00142         HighLevelGpuProgramPtr& operator=(const GpuProgramPtr& r);
    00143     };
    00144
    00145 }
    00146 #endif

Copyright © 2000-2005 by The OGRE Team
Last modified Sun Sep 25 17:35:55 2005