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 __GpuProgramManager_H_ 00026 #define __GpuProgramManager_H_ 00027 00028 // Precompiler options 00029 #include "OgrePrerequisites.h" 00030 #include "OgreResourceManager.h" 00031 #include "OgreException.h" 00032 #include "OgreGpuProgram.h" 00033 #include "OgreSingleton.h" 00034 00035 namespace Ogre { 00036 00037 class _OgreExport GpuProgramManager : public ResourceManager, public Singleton<GpuProgramManager> 00038 { 00039 public: 00040 typedef std::set<String> SyntaxCodes; 00041 00042 protected: 00044 SyntaxCodes mSyntaxCodes; 00046 virtual Resource* createImpl(const String& name, ResourceHandle handle, 00047 const String& group, bool isManual, ManualResourceLoader* loader, 00048 GpuProgramType gptype, const String& syntaxCode) = 0; 00049 public: 00050 GpuProgramManager(); 00051 virtual ~GpuProgramManager(); 00052 00064 virtual GpuProgramPtr load(const String& name, const String& groupName, 00065 const String& filename, GpuProgramType gptype, 00066 const String& syntaxCode); 00067 00079 virtual GpuProgramPtr loadFromString(const String& name, const String& groupName, 00080 const String& code, GpuProgramType gptype, 00081 const String& syntaxCode); 00082 00084 virtual const SyntaxCodes& getSupportedSyntax(void) const { return mSyntaxCodes; }; 00085 00087 virtual bool isSyntaxSupported(const String& syntaxCode) const; 00088 00094 virtual GpuProgramParametersSharedPtr createParameters(void) = 0; 00095 00110 virtual GpuProgramPtr createProgram(const String& name, 00111 const String& groupName, const String& filename, 00112 GpuProgramType gptype, const String& syntaxCode); 00113 00128 virtual GpuProgramPtr createProgramFromString(const String& name, 00129 const String& groupName, const String& code, 00130 GpuProgramType gptype, const String& syntaxCode); 00131 00135 virtual ResourcePtr create(const String& name, const String& group, 00136 GpuProgramType gptype, const String& syntaxCode, bool isManual = false, 00137 ManualResourceLoader* loader = 0); 00138 00140 virtual void _pushSyntaxCode(const String& syntaxCode) { mSyntaxCodes.insert(syntaxCode); } 00146 ResourcePtr getByName(const String& name, bool preferHighLevelPrograms = true); 00162 static GpuProgramManager& getSingleton(void); 00178 static GpuProgramManager* getSingletonPtr(void); 00179 00180 00181 00182 }; 00183 00184 } 00185 00186 #endif
Copyright © 2000-2005 by The OGRE Team
This work is licensed under a Creative Commons Attribution-ShareAlike 2.5 License.
Last modified Sun Mar 12 14:37:42 2006