Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

OgreGpuProgramManager.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 © 2000-2003 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;
00045     public:
00046         GpuProgramManager() {}
00047         virtual ~GpuProgramManager() {}
00048 
00057         virtual Resource* create( const String& name ) 
00058         {
00059             // N/A, we need to know the type
00060             Except(Exception::ERR_INTERNAL_ERROR, "You should call load "
00061                 "with a specific type", "GpuProgramManager::create");
00062         }
00063 
00064 
00075         virtual GpuProgram* load(const String& name, const String& filename, GpuProgramType gptype, 
00076             const String& syntaxCode, int priority = 1);
00077 
00088         virtual GpuProgram* loadFromString(const String& name, const String& code, GpuProgramType gptype,
00089             const String& syntaxCode, int priority = 1);
00090 
00092         virtual const SyntaxCodes& getSupportedSyntax(void) const { return mSyntaxCodes; };
00093 
00095         virtual bool isSyntaxSupported(const String& syntaxCode) const;
00096         
00102         virtual GpuProgramParametersSharedPtr createParameters(void) = 0;
00103         
00115         static GpuProgramManager& getSingleton(void);
00116 
00130         virtual GpuProgram* createProgram(const String& name, const String& filename, 
00131             GpuProgramType gptype, const String& syntaxCode, int priority = 1);
00132 
00146         virtual GpuProgram* createProgramFromString(const String& name, const String& code, 
00147             GpuProgramType gptype, const String& syntaxCode, int priority = 1);
00148 
00150         virtual void _pushSyntaxCode(const String& syntaxCode) { mSyntaxCodes.insert(syntaxCode); }
00156         Resource* getByName(const String& name, bool preferHighLevelPrograms = true);
00157     protected:
00159         virtual GpuProgram* create(const String& name, GpuProgramType gptype, const String& syntaxCode) = 0;
00160 
00161 
00162     };
00163 
00164 }
00165 
00166 #endif

Copyright © 2002-2003 by The OGRE Team
Last modified Wed Jan 21 00:10:12 2004