TDME2  1.9.200
DeferredLightingShaderPBRDefaultImplementation.cpp
Go to the documentation of this file.
2 
3 #include <string>
4 
5 #include <tdme/tdme.h>
8 #include <tdme/engine/Engine.h>
11 
12 using std::string;
13 using std::to_string;
14 
21 
22 bool DeferredLightingShaderPBRDefaultImplementation::isSupported(Renderer* renderer) {
23  return renderer->isPBRAvailable() == true && renderer->isDeferredShadingAvailable() == true;
24 }
25 
27 {
28 }
29 
31  return "defer_pbr-default";
32 }
33 
35 {
36  auto shaderVersion = renderer->getShaderVersion();
37 
38  // lighting
39  // vertex shader
42  "shader/" + shaderVersion + "/lighting/pbr",
43  "render_vertexshader.vert",
44  "#define LIGHT_COUNT " + to_string(Engine::LIGHTS_MAX) + "\n#define USE_PUNCTUAL\n#define MATERIAL_METALLICROUGHNESS\n#define USE_IBL\n"
45  );
46  if (vertexShaderId == 0) return;
47 
48  // fragment shader
51  "shader/" + shaderVersion + "/lighting/pbr",
52  "defer_fragmentshader.frag",
53  "#define LIGHT_COUNT " + to_string(Engine::LIGHTS_MAX) + "\n#define USE_PUNCTUAL\n#define MATERIAL_METALLICROUGHNESS\n#define USE_IBL\n",
54  FileSystem::getInstance()->getContentAsString(
55  "shader/" + shaderVersion + "/functions/pbr",
56  "tonemapping.inc.glsl"
57  ) +
58  "\n\n" +
59  FileSystem::getInstance()->getContentAsString(
60  "shader/" + shaderVersion + "/functions/pbr",
61  "textures.inc.glsl"
62  ) +
63  "\n\n" +
64  FileSystem::getInstance()->getContentAsString(
65  "shader/" + shaderVersion + "/functions/pbr",
66  "functions.inc.glsl"
67  ) +
68  "\n\n" +
69  FileSystem::getInstance()->getContentAsString(
70  "shader/" + shaderVersion + "/functions/pbr",
71  "pbr_lighting.inc.glsl"
72  ) +
73  "\n\n"
74  );
75  if (fragmentShaderId == 0) return;
76 
77  // create, attach and link program
81 
82  //
84 }
85 
87 }
88 
90 }
Engine main class.
Definition: Engine.h:131
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:17