TDME2 1.9.121
LightingShaderDefaultImplementation.cpp
Go to the documentation of this file.
2
3#include <string>
4
5#include <tdme/tdme.h>
10
11using std::string;
12using std::to_string;
13
20
21bool LightingShaderDefaultImplementation::isSupported(Renderer* renderer) {
22 return true;
23}
24
26{
27}
28
30 return "default";
31}
32
34{
35 auto shaderVersion = renderer->getShaderVersion();
36
37 // lighting
38 // vertex shader
41 "shader/" + shaderVersion + "/lighting/specular",
42 "render_vertexshader.vert",
43 "#define LIGHT_COUNT " + to_string(Engine::LIGHTS_MAX) + "\n#define HAVE_DEPTH_FOG"
44 );
45 if (vertexShaderId == 0) return;
46
47 // fragment shader
50 "shader/" + shaderVersion + "/lighting/specular",
51 "render_fragmentshader.frag",
52 "#define LIGHT_COUNT " + to_string(Engine::LIGHTS_MAX) + "\n#define HAVE_DEPTH_FOG",
53 FileSystem::getInstance()->getContentAsString(
54 "shader/" + shaderVersion + "/functions/specular",
55 "specular_lighting.inc.glsl"
56 )
57 );
58 if (fragmentShaderId == 0) return;
59
60 // create, attach and link program
64
65 //
67}
68
70 Engine::registerShader(Engine::ShaderType::SHADERTYPE_OBJECT3D, getId());
71}
72
74}
Engine main class.
Definition: Engine.h:122
static void registerShader(ShaderType type, const string &shaderId, const map< string, ShaderParameter > &parameterDefaults={})
Register shader.
Definition: Engine.cpp:2122
static constexpr int LIGHTS_MAX
Definition: Engine.h:173
virtual void updateShaderParameters(Renderer *renderer, int contextIdx) override
Update shader parameters.
virtual int32_t loadShader(int32_t type, const string &pathName, const string &fileName, const string &definitions=string(), const string &functions=string())=0
Loads a shader.
virtual int32_t createProgram(int type)=0
Creates a shader program.
virtual void attachShaderToProgram(int32_t programId, int32_t shaderId)=0
Attaches a shader to a program.
File system singleton class.
Definition: FileSystem.h:14