]> de.git.xonotic.org Git - xonotic/netradiant.git/blobdiff - include/ishaders.h
macos: ignore warnings about OpenGL being deprecated
[xonotic/netradiant.git] / include / ishaders.h
index 17cafc36626db7f882a8ba80a636a3a450466f98..e1ce6261fbcf92da9c55d9e26bbf5e96bb6ff5f5 100644 (file)
-/*\r
-Copyright (C) 1999-2007 id Software, Inc. and contributors.\r
-For a list of contributors, see the accompanying CONTRIBUTORS file.\r
-\r
-This file is part of GtkRadiant.\r
-\r
-GtkRadiant is free software; you can redistribute it and/or modify\r
-it under the terms of the GNU General Public License as published by\r
-the Free Software Foundation; either version 2 of the License, or\r
-(at your option) any later version.\r
-\r
-GtkRadiant is distributed in the hope that it will be useful,\r
-but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-GNU General Public License for more details.\r
-\r
-You should have received a copy of the GNU General Public License\r
-along with GtkRadiant; if not, write to the Free Software\r
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA\r
-*/\r
-\r
-//-----------------------------------------------------------------------------\r
-//\r
-//\r
-// DESCRIPTION:\r
-// a set of functions to manipulate textures in Radiant\r
-// \r
-\r
-#ifndef __ISHADERS_H_\r
-#define __ISHADERS_H_\r
-\r
-#define SHADERS_MAJOR "shaders"\r
-// define a GUID for this interface so plugins can access and reference it\r
-// {D42F798A-DF57-11d3-A3EE-0004AC96D4C3}\r
-static const GUID QERShadersTable_GUID = \r
-{ 0xd42f798a, 0xdf57, 0x11d3, { 0xa3, 0xee, 0x0, 0x4, 0xac, 0x96, 0xd4, 0xc3 } };\r
-\r
-// NOTES ABOUT SYNTAX:\r
-// if a function starts by 'Try' it means that if the requested thing could not be found / loaded it will return nothing / NULL\r
-// otherwise a default object will be created\r
-// the _QERShadersTable is also used by shader code inside Radiant. but for speed and "keep it simple" consideration you\r
-// can get the static equivalent of the func pointers by adding 'QERApp_' (access to _QERShadersTable is better thought ..\r
-// see the note to move all the shader language out of Radiant below)\r
-\r
-/*!\r
-\todo FIXME TTimo\r
-fix the reference count strategy\r
-- define the policy. It seems the initial policy of doing an inc ref when you create the shader is not good\r
-(it doesn't work, and it's not being used right)\r
-so, when you request an IShader and store it, incref it yourself\r
-as a debugging safe check: push the created increfed objects into a list, and scan them at next idle loop\r
-to make sure they have been decref'ed ? (sounds easy, may not be that much).\r
-*/\r
-\r
-class IShader\r
-{\r
-public:\r
-  // Increment the number of references to this object\r
-  virtual void IncRef () = 0;\r
-  // Decrement the reference count\r
-  virtual void DecRef () = 0;\r
-  // get/set the qtexture_t* Radiant uses to represent this shader object\r
-  virtual qtexture_t* getTexture() const = 0;\r
-  virtual void setTexture(qtexture_t *pTex) = 0;\r
-  // get shader name\r
-  virtual const char* getName() const = 0;\r
-  // is this shader in use?\r
-  // NOTE: this flag can mean this shader has been in use at least once since the last rescan of in-use stuff\r
-  // (rescan of in-use happens in several cases, user command or during a texture directory load)\r
-  // NOTE: this is used to draw the green outline in the texture window\r
-  // NOTE: when does Radiant set the InUse flag? Whenever Select_SetTexture is called (well that doesn't necessarily means the texture actually gets in use, but that's close enough)\r
-  virtual bool IsInUse() const = 0;\r
-  virtual void SetInUse(bool) = 0;\r
-  // is this shader displayed in the texture browser?\r
-  // NOTE: if IsInUse() == true, the shader will always be displayed in the texture window and this flag ingored\r
-  virtual bool IsDisplayed() const = 0;\r
-  virtual void SetDisplayed(bool) = 0;\r
-  // get the editor flags (QER_NOCARVE QER_TRANS)\r
-  virtual int getFlags() = 0;\r
-  // get the transparency value\r
-  virtual float getTrans() = 0;\r
-  // test if it's a true shader, or a default shader created to wrap around a texture\r
-  virtual bool IsDefault() = 0;\r
-  // test if it's a plain color shader, i.e. a shader we use on plain color stuff (like info_playerstart)\r
-  virtual bool IsColor() = 0;\r
-  // get the related color then!\r
-  virtual void getColor(vec3_t v) = 0;\r
-  // get the alphaFunc\r
-  virtual void getAlphaFunc(int *func, float *ref) = 0;\r
-  // get the cull type\r
-  virtual int getCull() = 0;\r
-  // get shader file name (ie the file where this one is defined)\r
-  virtual const char* getShaderFileName() const = 0;\r
-};\r
-\r
-// NOTE: how to move all the shader language out of Radiant in a plugin?\r
-// -> change this _QERShadersTable into an IShadersManager\r
-// -> let the plugin create an instance of IShadersManager\r
-// -> make sure Radiant uses this IShadersManager to load / query the shaders\r
-\r
-// NOTE: shader and texture names used must be full path, ie. most often with "textures/" prefix\r
-// (since shaders are defined in .shader files with textures/)\r
-\r
-// free all shaders\r
-// free the shaders, will not free the qtexture_t*\r
-typedef void           (WINAPI* PFN_FREESHADERS)               ();\r
-// reload all the shaders\r
-// this will free everything (shaders and their textures), then reload all in use stuff\r
-typedef void           (WINAPI* PFN_RELOADSHADERS)             ();\r
-// load all shaders in a given directory\r
-// this will scan the list of in-memory shaders, and load the related qtexture_t if needed\r
-typedef int            (WINAPI* PFN_LOADSHADERSFROMDIR)(const char* path);\r
-// load a shader file (ie a set of shaders)\r
-// after LoadShaderFile shaders will be in memory, next step is to load the qtexture_t Radiant uses to represent them\r
-// if a shader with the same name exists, new one will not be loaded - don't use this to refresh the shaders!\r
-typedef void           (WINAPI* PFN_LOADSHADERFILE)    (const char* filename);\r
-// tell if a given shader exists in our shader table\r
-// NOTE: this doesn't tell wether it's corresponding qtexture is loaded \r
-typedef int                    (WINAPI* PFN_HASSHADER)                 (const char* name);\r
-// return the shader for a given name\r
-// if the qtexture is not already in memory, will try loading it\r
-// if the qtexture could not be found, will use default\r
-// will return NULL on shader not found\r
-typedef IShader*       (WINAPI* PFN_TRYSHADERFORNAME)  (const char* name);\r
-// return the shader for a given name\r
-// if the qtexture is not already in memory, will try loading it\r
-// will create a default shader if not found (will use a default texture)\r
-typedef IShader*       (WINAPI* PFN_SHADERFORNAME)             (const char* name);\r
-// query / load a texture\r
-// will not try loading a shader, will look for the actual image file ..\r
-// returns NULL on file not found\r
-// NOTE: strategy for file lookup:\r
-//   paths must be relative, ie. textures/me/myfile\r
-//   if a 3-letters filename extension (such as .jpg or .tga) is provided, it will get loaded first\r
-//   if not found or no extension, will try loading after adding .tga and .jpg (in this order)\r
-typedef qtexture_t* (WINAPI* PFN_TRYTEXTUREFORNAME) (const char* filename);\r
-// query / load a texture\r
-// will not try loading a shader, will look for the actual image file ..\r
-// on file not found will use the "texture not found"\r
-typedef qtexture_t* (WINAPI* PFN_TEXTUREFORNAME)       (const char* filename);\r
-// get the number of active shaders\r
-// these are the shaders currently loaded, that have an associated qtexture_t*\r
-typedef int                    (WINAPI* PFN_GETACTIVESHADERCOUNT)      ();\r
-// for stuff that needs to be represented by a plain texture\r
-// the shader will get a "color" name, use GetColor to get the actual color\r
-typedef IShader*       (WINAPI* PFN_COLORSHADERFORNAME)        (const char* name);\r
-// reload a shaderfile - update shaders and their display properties/qtexture_t if needed\r
-// will not reload the texture files\r
-// will switch to "show in use" atfer use\r
-// filename must be reletive path of the shader, ex. scripts/gothic_wall.shader\r
-typedef void           (WINAPI* PFN_RELOADSHADERFILE)(const char* filename);\r
-// retrieve a shader if exists, without loading the textures for it etc.\r
-// use this function if you want special info on a shader\r
-typedef IShader* (WINAPI* PFN_SHADERFORNAMENOLOAD) (const char* name);\r
-// force the "in use" flag on all active shaders\r
-typedef void (WINAPI* PFN_ACTIVESHADERSSETINUSE) (bool b);\r
-// sort the shaders in alphabetical order, we use the order in the texture inspector\r
-typedef void (WINAPI* PFN_SORTACTIVESHADERS) ();\r
-// check if there exists an active shader with the given texture name (loaded or not, doesn't matter)\r
-// (used to detect the textures we need to create a default shader for .. while scanning a directory)\r
-typedef IShader* (WINAPI* PFN_ACTIVESHADERFORTEXTURENAME) (char *);\r
-// create a shader to wrap around a texture name, we use this when loading a texture directory and some textures\r
-// are not present as shaders\r
-typedef IShader* (WINAPI* PFN_CREATESHADERFORTEXTURENAME) (const char* name);\r
-// switch the IsDisplayed flag on all the active shaders\r
-typedef void (WINAPI* PFN_ACTIVESHADERSSETDISPLAYED) (bool b);\r
-// retrieve an active shader based on index\r
-typedef IShader* (WINAPI* PFN_ACTIVESHADERFORINDEX) (int i);\r
-// will cleanup a texture name and force it to the right format\r
-// the debug version is painfully slow, but will detect more problems\r
-// the idea being to avoid loading the same file several time because of uppercase/lowercase etc.\r
-typedef const char* (WINAPI* PFN_CLEANTEXTURENAME) (const char* name, bool bAddTexture);\r
-\r
-struct _QERShadersTable\r
-{\r
-  int          m_nSize;\r
-  PFN_FREESHADERS                                    m_pfnFreeShaders;\r
-  PFN_RELOADSHADERS                          m_pfnReloadShaders;\r
-  PFN_LOADSHADERSFROMDIR            m_pfnLoadShadersFromDir;\r
-  PFN_LOADSHADERFILE                       m_pfnLoadShaderFile;\r
-  PFN_RELOADSHADERFILE              m_pfnReloadShaderFile;\r
-  PFN_HASSHADER                                        m_pfnHasShader;\r
-  PFN_TRYSHADERFORNAME             m_pfnTry_Shader_ForName;\r
-  PFN_SHADERFORNAME                          m_pfnShader_ForName;\r
-  PFN_TRYTEXTUREFORNAME                    m_pfnTry_Texture_ForName;\r
-  PFN_TEXTUREFORNAME                       m_pfnTexture_ForName;\r
-  PFN_GETACTIVESHADERCOUNT                         m_pfnGetActiveShaderCount;\r
-  PFN_COLORSHADERFORNAME                                               m_pfnColorShader_ForName;\r
-  PFN_SHADERFORNAMENOLOAD                                              m_pfnShader_ForName_NoLoad;\r
-  PFN_ACTIVESHADERSSETINUSE         m_pfnActiveShaders_SetInUse;\r
-  PFN_SORTACTIVESHADERS             m_pfnSortActiveShaders;\r
-  PFN_ACTIVESHADERFORTEXTURENAME    m_pfnActiveShader_ForTextureName;\r
-  PFN_CREATESHADERFORTEXTURENAME    m_pfnCreateShader_ForTextureName;\r
-  PFN_ACTIVESHADERSSETDISPLAYED     m_pfnActiveShaders_SetDisplayed;\r
-  PFN_ACTIVESHADERFORINDEX          m_pfnActiveShader_ForIndex;\r
-  PFN_CLEANTEXTURENAME              m_pfnCleanTextureName;\r
-};\r
-\r
-/*!\r
-\todo FIXME fix the QERApp_ prototyping on shaders module\r
-make it homogeneous with other modules, should be straight calls\r
-*/\r
-\r
-#ifdef USE_SHADERSTABLE_DEFINE\r
-  #ifndef __SHADERSTABLENAME\r
-    #define __SHADERSTABLENAME g_ShadersTable\r
-  #endif\r
-#define QERApp_Shader_ForName __SHADERSTABLENAME.m_pfnShader_ForName\r
-#define QERApp_Texture_ForName2 __SHADERSTABLENAME.m_pfnTexture_ForName\r
-#define QERApp_FreeShaders __SHADERSTABLENAME.m_pfnFreeShaders\r
-#define QERApp_ReloadShaders __SHADERSTABLENAME.m_pfnReloadShaders\r
-#define QERApp_SortActiveShaders __SHADERSTABLENAME.m_pfnSortActiveShaders\r
-#define QERApp_ReloadShaderFile __SHADERSTABLENAME.m_pfnReloadShaderFile\r
-#define QERApp_LoadShaderFile __SHADERSTABLENAME.m_pfnLoadShaderFile\r
-#define QERApp_HasShader __SHADERSTABLENAME.m_pfnHasShader\r
-#define QERApp_Try_Shader_ForName __SHADERSTABLENAME.m_pfnTry_Shader_ForName\r
-#define QERApp_Try_Texture_ForName __SHADERSTABLENAME.m_pfnTry_Texture_ForName\r
-#define QERApp_ColorShader_ForName __SHADERSTABLENAME.m_pfnColorShader_ForName\r
-#define QERApp_Shader_ForName_NoLoad __SHADERSTABLENAME.m_pfnShader_ForName_NoLoad\r
-#define QERApp_LoadShadersFromDir __SHADERSTABLENAME.m_pfnLoadShadersFromDir\r
-#define QERApp_LoadShadersFromDir __SHADERSTABLENAME.m_pfnLoadShadersFromDir\r
-#define QERApp_CreateShader_ForTextureName __SHADERSTABLENAME.m_pfnCreateShader_ForTextureName\r
-#define QERApp_GetActiveShaderCount __SHADERSTABLENAME.m_pfnGetActiveShaderCount\r
-#define QERApp_ActiveShaders_SetDisplayed __SHADERSTABLENAME.m_pfnActiveShaders_SetDisplayed\r
-#define QERApp_ActiveShader_ForIndex __SHADERSTABLENAME.m_pfnActiveShader_ForIndex\r
-#define QERApp_ActiveShaders_SetInUse __SHADERSTABLENAME.m_pfnActiveShaders_SetInUse\r
-#define QERApp_ActiveShader_ForTextureName __SHADERSTABLENAME.m_pfnActiveShader_ForTextureName\r
-#define QERApp_ActiveShader_ForIndex __SHADERSTABLENAME.m_pfnActiveShader_ForIndex\r
-#define QERApp_CleanTextureName __SHADERSTABLENAME.m_pfnCleanTextureName\r
-#endif\r
-\r
-#define APPSHADERS_MAJOR "appshaders"\r
-// FIXME: remove\r
-static const GUID QERAppShadersTable_GUID = \r
-{ 0xec3008a8, 0xbd0b, 0x11d4, { 0x82, 0x51, 0x20, 0x4c, 0x4f, 0x4f, 0x50, 0x20 } };\r
-\r
-// g_qeglobals.d_qtextures is used internally by the editor for actual camera drawing\r
-typedef qtexture_t** (WINAPI* PFN_QTEXTURES)();\r
-// g_qeglobals.d_qtexmap is a map for fast access\r
-typedef GHashTable* (WINAPI* PFN_QTEXMAP)();\r
-// d_texturewin\r
-//++timo NOTE: this same function is also in isurface.h table, we would eventually have to merge some stuff\r
-typedef texturewin_t* (* PFN_QEGLOBALSTEXTUREWIN)();\r
-// Texture_SetTexture\r
-//++timo NOTE: this one may have to be reorganized too .. putting it here is a bit clumsy\r
-// NOTE: the C++ function used internally has a lot of default values\r
-typedef void (WINAPI* PFN_TEXTURESETTEXTURE)(texdef_t *texdef, brushprimit_texdef_t *brushprimit_texdef);\r
-// Texture_ShowInuse\r
-typedef void (WINAPI* PFN_TEXTURESHOWINUSE)();\r
-// BuildShaderList\r
-typedef void (* PFN_BUILDSHADERLIST)();\r
-// PreloadShaders\r
-typedef void (* PFN_PRELOADSHADERS)();\r
-\r
-// a table that Radiant makes available to the shader module in return\r
-struct _QERAppShadersTable\r
-{\r
-  int m_nSize;\r
-  PFN_QTEXTURES           m_pfnQTextures;\r
-  PFN_QTEXMAP             m_pfnQTexmap;\r
-       PFN_QEGLOBALSTEXTUREWIN m_pfnQeglobalsTexturewin;\r
-       PFN_TEXTURESETTEXTURE   m_pfnTexture_SetTexture;\r
-       PFN_TEXTURESHOWINUSE    m_pfnTexture_ShowInuse;\r
-  PFN_BUILDSHADERLIST     m_pfnBuildShaderList;\r
-  PFN_PRELOADSHADERS      m_pfnPreloadShaders;\r
-};\r
-\r
-#ifdef USE_APPSHADERSTABLE_DEFINE\r
-  #ifndef __APPSHADERTABLENAME\r
-    #define __APPSHADERTABLENAME g_AppShadersTable\r
-  #endif\r
-#define Texture_ShowInuse __APPSHADERTABLENAME.m_pfnTexture_ShowInuse\r
-#endif\r
-\r
-/*!\r
-NOTE TTimo: there is an important distinction between SHADER_NOT_FOUND and SHADER_NOTEX:\r
-SHADER_NOT_FOUND means we didn't find the raw texture or the shader for this\r
-SHADER_NOTEX means we recognize this as a shader script, but we are missing the texture to represent it\r
-this was in the initial design of the shader code since early GtkRadiant alpha, and got sort of foxed in 1.2 and put back in\r
-*/\r
-#define SHADER_NOT_FOUND "textures/radiant/notex"\r
-#define SHADER_NOTEX "textures/radiant/shadernotex" ///< Q3 tech specific\r
-\r
-#endif\r
+/*
+   Copyright (C) 1999-2006 Id Software, Inc. and contributors.
+   For a list of contributors, see the accompanying CONTRIBUTORS file.
+
+   This file is part of GtkRadiant.
+
+   GtkRadiant is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   GtkRadiant is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with GtkRadiant; if not, write to the Free Software
+   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+#if !defined( INCLUDED_ISHADERS_H )
+#define INCLUDED_ISHADERS_H
+
+#include "generic/constant.h"
+#include "generic/callback.h"
+
+enum
+{
+       QER_TRANS = 1 << 0,
+       QER_NOCARVE = 1 << 1,
+       QER_NODRAW = 1 << 2,
+       QER_NONSOLID = 1 << 3,
+       QER_WATER = 1 << 4,
+       QER_LAVA = 1 << 5,
+       QER_FOG = 1 << 6,
+       QER_ALPHATEST = 1 << 7,
+       QER_CULL = 1 << 8,
+       QER_AREAPORTAL = 1 << 9,
+       QER_CLIP = 1 << 10,
+       QER_BOTCLIP = 1 << 11,
+};
+
+struct qtexture_t;
+
+template<typename Element> class BasicVector3;
+typedef BasicVector3<float> Vector3;
+typedef Vector3 Colour3;
+
+typedef unsigned char BlendFactor;
+const BlendFactor BLEND_ZERO = 0;
+const BlendFactor BLEND_ONE = 1;
+const BlendFactor BLEND_SRC_COLOUR = 2;
+const BlendFactor BLEND_ONE_MINUS_SRC_COLOUR = 3;
+const BlendFactor BLEND_SRC_ALPHA = 4;
+const BlendFactor BLEND_ONE_MINUS_SRC_ALPHA = 5;
+const BlendFactor BLEND_DST_COLOUR = 6;
+const BlendFactor BLEND_ONE_MINUS_DST_COLOUR = 7;
+const BlendFactor BLEND_DST_ALPHA = 8;
+const BlendFactor BLEND_ONE_MINUS_DST_ALPHA = 9;
+const BlendFactor BLEND_SRC_ALPHA_SATURATE = 10;
+
+class BlendFunc
+{
+public:
+BlendFunc( BlendFactor src, BlendFactor dst ) : m_src( src ), m_dst( dst ){
+}
+BlendFactor m_src;
+BlendFactor m_dst;
+};
+
+class ShaderLayer
+{
+public:
+virtual qtexture_t* texture() const = 0;
+virtual BlendFunc blendFunc() const = 0;
+virtual bool clampToBorder() const = 0;
+virtual float alphaTest() const = 0;
+};
+
+typedef Callback<void(const ShaderLayer&)> ShaderLayerCallback;
+
+class IShader
+{
+public:
+enum EAlphaFunc
+{
+       eAlways,
+       eEqual,
+       eLess,
+       eGreater,
+       eLEqual,
+       eGEqual,
+};
+enum ECull
+{
+       eCullNone,
+       eCullBack,
+};
+// Increment the number of references to this object
+virtual void IncRef() = 0;
+// Decrement the reference count
+virtual void DecRef() = 0;
+// get/set the qtexture_t* Radiant uses to represent this shader object
+virtual qtexture_t* getTexture() const = 0;
+virtual qtexture_t* getDiffuse() const = 0;
+virtual qtexture_t* getBump() const = 0;
+virtual qtexture_t* getSpecular() const = 0;
+// get shader name
+virtual const char* getName() const = 0;
+virtual const char* getWadName() const = 0;
+virtual void setWadName( const char* name ) = 0;
+virtual bool IsInUse() const = 0;
+virtual void SetInUse( bool bInUse ) = 0;
+// get the editor flags (QER_NOCARVE QER_TRANS)
+virtual int getFlags() const = 0;
+// get the transparency value
+virtual float getTrans() const = 0;
+// test if it's a true shader, or a default shader created to wrap around a texture
+virtual bool IsDefault() const = 0;
+// get the alphaFunc
+virtual void getAlphaFunc( EAlphaFunc *func, float *ref ) = 0;
+virtual BlendFunc getBlendFunc() const = 0;
+// get the cull type
+virtual ECull getCull() = 0;
+// get shader file name (ie the file where this one is defined)
+virtual const char* getShaderFileName() const = 0;
+
+virtual const ShaderLayer* firstLayer() const = 0;
+virtual void forEachLayer( const ShaderLayerCallback& layer ) const = 0;
+
+virtual qtexture_t* lightFalloffImage() const = 0;
+};
+
+typedef struct _GSList GSList;
+typedef Callback<void(const char*)> ShaderNameCallback;
+
+class ModuleObserver;
+
+class ShaderSystem
+{
+public:
+INTEGER_CONSTANT( Version, 1 );
+STRING_CONSTANT( Name, "shaders" );
+// NOTE: shader and texture names used must be full path.
+// Shaders usable as textures have prefix equal to getTexturePrefix()
+
+virtual void realise() = 0;
+virtual void unrealise() = 0;
+virtual void refresh() = 0;
+// activate the shader for a given name and return it
+// will return the default shader if name is not found
+virtual IShader* getShaderForName( const char* name ) = 0;
+
+virtual void foreachShaderName( const ShaderNameCallback& callback ) = 0;
+
+// iterate over the list of active shaders
+virtual void beginActiveShadersIterator() = 0;
+virtual bool endActiveShadersIterator() = 0;
+virtual IShader* dereferenceActiveShadersIterator() = 0;
+virtual void incrementActiveShadersIterator() = 0;
+
+virtual void setActiveShadersChangedNotify( const Callback<void()>& notify ) = 0;
+
+virtual void attach( ModuleObserver& observer ) = 0;
+virtual void detach( ModuleObserver& observer ) = 0;
+
+virtual void setLightingEnabled( bool enabled ) = 0;
+
+virtual const char* getTexturePrefix() const = 0;
+};
+
+#include "modulesystem.h"
+
+template<typename Type>
+class GlobalModule;
+typedef GlobalModule<ShaderSystem> GlobalShadersModule;
+
+template<typename Type>
+class GlobalModuleRef;
+typedef GlobalModuleRef<ShaderSystem> GlobalShadersModuleRef;
+
+inline ShaderSystem& GlobalShaderSystem(){
+       return GlobalShadersModule::getTable();
+}
+
+#define QERApp_Shader_ForName GlobalShaderSystem().getShaderForName
+#define QERApp_ActiveShaders_IteratorBegin GlobalShaderSystem().beginActiveShadersIterator
+#define QERApp_ActiveShaders_IteratorAtEnd GlobalShaderSystem().endActiveShadersIterator
+#define QERApp_ActiveShaders_IteratorCurrent GlobalShaderSystem().dereferenceActiveShadersIterator
+#define QERApp_ActiveShaders_IteratorIncrement GlobalShaderSystem().incrementActiveShadersIterator
+
+#endif