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