00001 /* 00002 Copyright (C) 1999-2006 Id Software, Inc. and contributors. 00003 For a list of contributors, see the accompanying CONTRIBUTORS file. 00004 00005 This file is part of GtkRadiant. 00006 00007 GtkRadiant is free software; you can redistribute it and/or modify 00008 it under the terms of the GNU General Public License as published by 00009 the Free Software Foundation; either version 2 of the License, or 00010 (at your option) any later version. 00011 00012 GtkRadiant is distributed in the hope that it will be useful, 00013 but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 GNU General Public License for more details. 00016 00017 You should have received a copy of the GNU General Public License 00018 along with GtkRadiant; if not, write to the Free Software 00019 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00020 */ 00021 00022 #if !defined(INCLUDED_ISHADERS_H) 00023 #define INCLUDED_ISHADERS_H 00024 00025 #include "generic/constant.h" 00026 #include "generic/callbackfwd.h" 00027 #include <string> 00028 #include "ishader.h" 00029 00030 enum 00031 { 00032 QER_TRANS = 1 << 0, QER_ALPHATEST = 1 << 1, QER_CLIP = 1 << 2, 00033 }; 00034 00035 template<typename Element> class BasicVector3; 00036 typedef BasicVector3<float> Vector3; 00037 typedef Vector3 Colour3; 00038 00039 typedef Callback1<const char*> ShaderNameCallback; 00040 00041 class ModuleObserver; 00042 00047 class ShaderSystem 00048 { 00049 public: 00050 INTEGER_CONSTANT(Version, 1); 00051 STRING_CONSTANT(Name, "shaders"); 00052 00053 virtual ~ShaderSystem () 00054 { 00055 } 00056 00057 virtual void realise () = 0; 00058 00059 virtual void unrealise () = 0; 00060 00061 virtual void refresh () = 0; 00062 00067 virtual IShader* getShaderForName (const std::string& name) = 0; 00068 00069 virtual void foreachShaderName (const ShaderNameCallback& callback) = 0; 00070 00074 virtual void beginActiveShadersIterator () = 0; 00075 00076 virtual bool endActiveShadersIterator () = 0; 00077 00078 virtual IShader* dereferenceActiveShadersIterator () = 0; 00079 00080 virtual void incrementActiveShadersIterator () = 0; 00081 00082 virtual void setActiveShadersChangedNotify (const Callback& notify) = 0; 00083 00084 virtual void attach (ModuleObserver& observer) = 0; 00085 00086 virtual void detach (ModuleObserver& observer) = 0; 00087 00088 virtual const std::string& getTexturePrefix () const = 0; 00089 }; 00090 00091 #include "modulesystem.h" 00092 00093 template<typename Type> 00094 class GlobalModule; 00095 typedef GlobalModule<ShaderSystem> GlobalShadersModule; 00096 00097 template<typename Type> 00098 class GlobalModuleRef; 00099 typedef GlobalModuleRef<ShaderSystem> GlobalShadersModuleRef; 00100 00101 inline ShaderSystem& GlobalShaderSystem () 00102 { 00103 return GlobalShadersModule::getTable(); 00104 } 00105 00106 #endif