TDME2  1.9.200
LightingShaderLightScatteringTreeImplementation.cpp
Go to the documentation of this file.
2 
3 #include <string>
4 
5 #include <tdme/tdme.h>
7 
8 #include <tdme/engine/Engine.h>
11 
12 using std::string;
13 using std::to_string;
14 
21 
22 bool LightingShaderLightScatteringTreeImplementation::isSupported(Renderer* renderer) {
23  return renderer->getShaderVersion() == "gl3";
24 }
25 
27 {
28 }
29 
31  return "ls_tree";
32 }
33 
35 {
36  auto shaderVersion = renderer->getShaderVersion();
37 
38  // lighting
39  // fragment shader
42  "shader/" + shaderVersion + "/lighting/light_scattering",
43  "render_fragmentshader.frag",
44  "#define LIGHT_COUNT " + to_string(Engine::LIGHTS_MAX) + "\n"
45  );
46  if (fragmentShaderId == 0) return;
47 
48  // vertex shader
51  "shader/" + shaderVersion + "/lighting/light_scattering",
52  "render_vertexshader.vert",
53  "#define LIGHT_COUNT " + to_string(Engine::LIGHTS_MAX) + "\n#define HAVE_TREE",
54  FileSystem::getInstance()->getContentAsString(
55  "shader/" + shaderVersion + "/functions",
56  "create_rotation_matrix.inc.glsl"
57  ) +
58  "\n\n" +
59  FileSystem::getInstance()->getContentAsString(
60  "shader/" + shaderVersion + "/functions",
61  "create_translation_matrix.inc.glsl"
62  ) +
63  "\n\n" +
64  FileSystem::getInstance()->getContentAsString(
65  "shader/" + shaderVersion + "/functions",
66  "create_tree_transform_matrix.inc.glsl"
67  )
68  );
69  if (vertexShaderId == 0) return;
70 
71  // create, attach and link program
75 
76  //
78 }
79 
81 }
82 
84 }
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