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

Copyright © 2012 Torus Knot Software Ltd
Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
Last modified Fri May 25 23:36:28 2012