3 Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
4 Copyright (C) 2013 Kahrl <kahrl@gmx.net>
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU Lesser General Public License as published by
8 the Free Software Foundation; either version 2.1 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU Lesser General Public License for more details.
16 You should have received a copy of the GNU Lesser General Public License along
17 with this program; if not, write to the Free Software Foundation, Inc.,
18 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24 #include "irrlichttypes_extrabloated.h"
31 shader.{h,cpp}: Shader handling stuff.
35 Gets the path to a shader by first checking if the file
36 name_of_shader/filename
37 exists in shader_path and if not, using the data path.
39 If not found, returns "".
41 Utilizes a thread-safe cache.
43 std::string getShaderPath(const std::string &name_of_shader,
44 const std::string &filename);
49 video::E_MATERIAL_TYPE material;
51 ShaderInfo(): name(""), material(video::EMT_SOLID) {}
52 virtual ~ShaderInfo() {}
56 Setter of constants for shaders
59 namespace irr { namespace video {
60 class IMaterialRendererServices;
63 class IShaderConstantSetter
66 virtual ~IShaderConstantSetter(){};
67 virtual void onSetConstants(video::IMaterialRendererServices *services,
68 bool is_highlevel) = 0;
72 ShaderSource creates and caches shaders.
79 virtual ~IShaderSource(){}
80 virtual u32 getShaderId(const std::string &name){return 0;}
81 virtual u32 getShaderIdDirect(const std::string &name){return 0;}
82 virtual std::string getShaderName(u32 id){return "";}
83 virtual ShaderInfo getShader(u32 id){return ShaderInfo();}
84 virtual ShaderInfo getShader(const std::string &name){return ShaderInfo();}
87 class IWritableShaderSource : public IShaderSource
90 IWritableShaderSource(){}
91 virtual ~IWritableShaderSource(){}
92 virtual u32 getShaderId(const std::string &name){return 0;}
93 virtual u32 getShaderIdDirect(const std::string &name){return 0;}
94 virtual std::string getShaderName(u32 id){return "";}
95 virtual ShaderInfo getShader(u32 id){return ShaderInfo();}
96 virtual ShaderInfo getShader(const std::string &name){return ShaderInfo();}
98 virtual void processQueue()=0;
99 virtual void insertSourceShader(const std::string &name_of_shader,
100 const std::string &filename, const std::string &program)=0;
101 virtual void rebuildShaders()=0;
102 virtual void addGlobalConstantSetter(IShaderConstantSetter *setter)=0;
105 IWritableShaderSource* createShaderSource(IrrlichtDevice *device);