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-2013 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 virtual size_t calculateSize(void) const; 00094 00099 void addDelegateProgram(const String& name); 00100 00102 void clearDelegatePrograms(); 00103 00105 const HighLevelGpuProgramPtr& _getDelegate() const; 00106 00108 const String& getLanguage(void) const; 00109 00117 GpuProgramParametersSharedPtr createParameters(void); 00119 GpuProgram* _getBindingDelegate(void); 00120 00121 // All the following methods must delegate to the implementation 00122 00124 bool isSupported(void) const; 00125 00127 bool isSkeletalAnimationIncluded(void) const; 00128 00129 bool isMorphAnimationIncluded(void) const; 00130 00131 bool isPoseAnimationIncluded(void) const; 00132 00133 bool isVertexTextureFetchRequired(void) const; 00134 GpuProgramParametersSharedPtr getDefaultParameters(void); 00135 bool hasDefaultParameters(void) const; 00136 bool getPassSurfaceAndLightStates(void) const; 00137 bool getPassFogStates(void) const; 00138 bool getPassTransformStates(void) const; 00139 bool hasCompileError(void) const; 00140 void resetCompileError(void); 00141 00142 void load(bool backgroundThread = false); 00143 void reload(void); 00144 bool isReloadable(void) const; 00145 bool isLoaded(void) const; 00146 bool isLoading() const; 00147 LoadingState getLoadingState() const; 00148 void unload(void); 00149 size_t getSize(void) const; 00150 void touch(void); 00151 bool isBackgroundLoaded(void) const; 00152 void setBackgroundLoaded(bool bl); 00153 void escalateLoading(); 00154 void addListener(Listener* lis); 00155 void removeListener(Listener* lis); 00156 00157 }; 00158 00160 class UnifiedHighLevelGpuProgramFactory : public HighLevelGpuProgramFactory 00161 { 00162 public: 00163 UnifiedHighLevelGpuProgramFactory(); 00164 ~UnifiedHighLevelGpuProgramFactory(); 00166 const String& getLanguage(void) const; 00167 HighLevelGpuProgram* create(ResourceManager* creator, 00168 const String& name, ResourceHandle handle, 00169 const String& group, bool isManual, ManualResourceLoader* loader); 00170 void destroy(HighLevelGpuProgram* prog); 00171 00172 }; 00173 00177 } 00178 #endif
Copyright © 2012 Torus Knot Software Ltd

This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
Last modified Mon Jul 27 2020 13:40:48