2 Copyright (C) 1999-2007 id Software, Inc. and contributors.
\r
3 For a list of contributors, see the accompanying CONTRIBUTORS file.
\r
5 This file is part of GtkRadiant.
\r
7 GtkRadiant is free software; you can redistribute it and/or modify
\r
8 it under the terms of the GNU General Public License as published by
\r
9 the Free Software Foundation; either version 2 of the License, or
\r
10 (at your option) any later version.
\r
12 GtkRadiant is distributed in the hope that it will be useful,
\r
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
15 GNU General Public License for more details.
\r
17 You should have received a copy of the GNU General Public License
\r
18 along with GtkRadiant; if not, write to the Free Software
\r
19 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\r
22 #ifndef _ISHADERSMANAGER_H_
\r
23 #define _ISHADERSMANAGER_H_
\r
25 class IShadersManager
\r
29 virtual ~IShadersManager ();
\r
31 // Increment the number of references to this object
\r
32 virtual void IncRef () = 0;
\r
33 // Decrement the reference count
\r
34 virtual void DecRef () = 0;
\r
37 // free the shaders, will not free the qtexture_t*
\r
38 virtual void FreeShaders () = 0;
\r
40 // reload all the shaders
\r
41 // this will free everything (shaders and their textures), then reload all in use stuff
\r
42 virtual void ReloadShaders () = 0;
\r
44 // load all shaders in a given directory
\r
45 // this will scan the list of in-memory shaders, and load the related qtexture_t if needed
\r
46 virtual void LoadShadersFromDir (const char* path) = 0;
\r
48 // load a shader file (ie a set of shaders)
\r
49 // after LoadShaderFile shaders will be in memory, next step is to load the qtexture_t Radiant uses
\r
50 // to represent them if a shader with the same name exists, new one will not be loaded
\r
51 // don't use this to refresh the shaders!
\r
52 virtual void LoadShaderFile (const char* filename) = 0;
\r
54 // tell if a given shader exists in our shader table
\r
55 // NOTE: this doesn't tell wether it's corresponding qtexture is loaded
\r
56 virtual int HasShader (const char* name) = 0;
\r
58 // return the shader for a given name
\r
59 // if the qtexture is not already in memory, will try loading it
\r
60 // if the qtexture could not be found, will use default
\r
61 // will return NULL on shader not found
\r
62 virtual IShader* Try_Shader_ForName (const char* name) = 0;
\r
64 // return the shader for a given name
\r
65 // if the qtexture is not already in memory, will try loading it
\r
66 // will create a default shader if not found (will use a default texture)
\r
67 virtual IShader* Shader_ForName (const char* name) = 0;
\r
69 // query / load a texture
\r
70 // will not try loading a shader, will look for the actual image file ..
\r
71 // returns NULL on file not found
\r
72 // NOTE: strategy for file lookup:
\r
73 // paths must be relative, ie. textures/me/myfile
\r
74 // if a 3-letters filename extension (such as .jpg or .tga) is provided, it will get loaded first
\r
75 // if not found or no extension, will try loading after adding .tga and .jpg (in this order)
\r
76 virtual qtexture_t* Try_Texture_ForName (const char* filename) = 0;
\r
78 // query / load a texture
\r
79 // will not try loading a shader, will look for the actual image file ..
\r
80 // on file not found will use the "texture not found"
\r
81 virtual qtexture_t* Texture_ForName (const char* filename) = 0;
\r
83 // get the number of active shaders
\r
84 // these are the shaders currently loaded, that have an associated qtexture_t*
\r
85 virtual int GetActiveShaderCount () = 0;
\r
87 // for stuff that needs to be represented by a plain texture
\r
88 // the shader will get a "color" name, use GetColor to get the actual color
\r
89 virtual IShader* ColorShader_ForName (const char* name) = 0;
\r
91 // reload a shaderfile - update shaders and their display properties/qtexture_t if needed
\r
92 // will not reload the texture files
\r
93 // will switch to "show in use" atfer use
\r
94 // filename must be reletive path of the shader, ex. scripts/gothic_wall.shader
\r
95 virtual void ReloadShaderFile (const char* filename) = 0;
\r
97 // retrieve a shader if exists, without loading the textures for it etc.
\r
98 // use this function if you want special info on a shader
\r
99 virtual IShader* Shader_ForName_NoLoad (const char* name) = 0;
\r
102 #endif // _ISHADERSMANAGER_H_
\r