TerraForge3D  2.3.1
3D Terrain And Landscape Generator
GLSLHandler.h
1#pragma once
2
3#include <string>
4#include <vector>
5#include <unordered_map>
6
8{
9 GLSLUniform(std::string name, std::string type, std::string value = "");
11
12 std::string GenerateGLSL();
13
14 std::string name = "";
15 std::string type = "";
16 std::string value = "";
17 std::string comment = "";
18};
19
21{
22 GLSLMacro(std::string name, std::string value, std::string comment = "");
23 ~GLSLMacro();
24
25 std::string GenerateGLSL();
26
27 std::string name = "";
28 std::string value = "";
29 std::string comment = "";
30};
31
33{
34 GLSLLine(std::string line, std::string comment = "");
35 ~GLSLLine();
36
37 std::string GenerateGLSL();
38
39 std::string line = "";
40 std::string comment = "";
41};
42
44{
45 GLSLSSBO(std::string name, std::string binding = "1", std::string comment = "");
46 ~GLSLSSBO();
47
48 std::string GenerateGLSL();
49
50 void AddLine(GLSLLine line);
51
52 std::vector<GLSLLine> lines;
53 std::string name = "";
54 std::string binding = "";
55 std::string comment = "";
56};
57
59{
60 GLSLFunction(std::string name, std::string params = "", std::string returnType = "void");
62
63 std::string GenerateGLSL();
64
65 void AddLine(GLSLLine line);
66
67 std::string name = "";
68 std::string returnType = "";
69 std::string params = "";
70 std::string comment = "";
71 std::vector<GLSLLine> lines;
72};
73
75{
76public:
77 GLSLHandler(std::string name = "Shader");
79
80 std::string GenerateGLSL();
81
82 void AddTopLine(GLSLLine line);
83 void AddUniform(GLSLUniform uniform);
84 void AddMacro(GLSLMacro macro);
85 void AddSSBO(GLSLSSBO ssbo);
86 void AddFunction(GLSLFunction function);
87
88 bool HasFunction(std::string name);
89
90 void Clear();
91
92public:
93 std::string version = "430 core";
94 std::string code = "";
95 std::string name = "";
96 std::vector<GLSLUniform> uniforms;
97 std::vector<GLSLFunction> functions;
98 std::vector<std::string> functionNames;
99 std::vector<GLSLMacro> macros;
100 std::vector<GLSLSSBO> ssbos;
101 std::vector<GLSLLine> topLines;
102};