# OgreUnifiedHighLevelGpuProgram.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 __UnifiedHighLevelGpuProgram_H__
    00030 #define __UnifiedHighLevelGpuProgram_H__
    00031
    00032 #include "OgrePrerequisites.h"
    00033 #include "OgreHighLevelGpuProgram.h"
    00034 #include "OgreHighLevelGpuProgramManager.h"
    00035
    00036 namespace Ogre {
    00037
    00055     class _OgreExport UnifiedHighLevelGpuProgram : public HighLevelGpuProgram
    00056     {
    00057     public:
    00059         class CmdDelegate : public ParamCommand
    00060         {
    00061         public:
    00062             String doGet(const void* target) const;
    00063             void doSet(void* target, const String& val);
    00064         };
    00065
    00066     protected:
    00067         static CmdDelegate msCmdDelegate;
    00068
    00070         StringVector mDelegateNames;
    00072         mutable HighLevelGpuProgramPtr mChosenDelegate;
    00073
    00075         void chooseDelegate() const;
    00076
    00077         void createLowLevelImpl(void);
    00078         void unloadHighLevelImpl(void);
    00079         void buildConstantDefinitions() const;
    00080         void loadFromSource(void);
    00081
    00082     public:
    00084         UnifiedHighLevelGpuProgram(ResourceManager* creator, const String& name, ResourceHandle handle,
    00085             const String& group, bool isManual = false, ManualResourceLoader* loader = 0);
    00086         ~UnifiedHighLevelGpuProgram();
    00087
    00088
    00093         void addDelegateProgram(const String& name);
    00094
    00096         void clearDelegatePrograms();
    00097
    00099         const HighLevelGpuProgramPtr& _getDelegate() const;
    00100
    00102         const String& getLanguage(void) const;
    00103
    00111         GpuProgramParametersSharedPtr createParameters(void);
    00113         GpuProgram* _getBindingDelegate(void);
    00114
    00115         // All the following methods must delegate to the implementation
    00116
    00118         bool isSupported(void) const;
    00119
    00121         bool isSkeletalAnimationIncluded(void) const;
    00122
    00123         bool isMorphAnimationIncluded(void) const;
    00124
    00125         bool isPoseAnimationIncluded(void) const;
    00126
    00127         bool isVertexTextureFetchRequired(void) const;
    00128         GpuProgramParametersSharedPtr getDefaultParameters(void);
    00129         bool hasDefaultParameters(void) const;
    00130         bool getPassSurfaceAndLightStates(void) const;
    00131         bool hasCompileError(void) const;
    00132         void resetCompileError(void);
    00133
    00134         void load(bool backgroundThread = false);
    00135         void reload(void);
    00136         bool isReloadable(void) const;
    00137         bool isLoaded(void) const;
    00138         LoadingState isLoading() const;
    00139         LoadingState getLoadingState() const;
    00140         void unload(void);
    00141         size_t getSize(void) const;
    00142         void touch(void);
    00143         bool isBackgroundLoaded(void) const;
    00144         void setBackgroundLoaded(bool bl);
    00145         void escalateLoading();
    00146         void addListener(Listener* lis);
    00147         void removeListener(Listener* lis);
    00148
    00149     };
    00150
    00152     class UnifiedHighLevelGpuProgramFactory : public HighLevelGpuProgramFactory
    00153     {
    00154     public:
    00155         UnifiedHighLevelGpuProgramFactory();
    00156         ~UnifiedHighLevelGpuProgramFactory();
    00158         const String& getLanguage(void) const;
    00159         HighLevelGpuProgram* create(ResourceManager* creator,
    00160             const String& name, ResourceHandle handle,
    00161             const String& group, bool isManual, ManualResourceLoader* loader);
    00162         void destroy(HighLevelGpuProgram* prog);
    00163
    00164     };
    00165
    00166
    00167 }
    00168 #endif

Copyright © 2000-2005 by The OGRE Team
This work is licensed under a Creative Commons Attribution-ShareAlike 2.5 License.
Last modified Sat May 10 16:25:04 2008