TerraForge3D  2.3.1
3D Terrain And Landscape Generator

◆ ShadingManager()

ShadingManager::ShadingManager ( ApplicationState appState)

Definition at line 119 of file ShadingManager.cpp.

120{
121 appState = as;
122 vsh = new GLSLHandler("Primary Vertex Shader");
123 gsh = new GLSLHandler("Primary Geometry Shader");
124 fsh = new GLSLHandler("Primary Fragment Shader");
125 sharedMemoryManager = new SharedMemoryManager();
126 shaderTextureManager = new ShaderTextureManager();
127 NodeEditorConfig config;
128 config.makeNodeFunc = [&]()
129 {
130 ImGuiNodeEditor::Suspend();
131 ImGui::OpenPopup("NodeMakerDropped");
132 ImGuiNodeEditor::Resume();
133 };
134 config.insNodeFunc = [&](nlohmann::json data) -> NodeEditorNode*
135 {
136 SNENode *node = nullptr;
137
138 if(data["type"] == "ShaderOutput")
139 {
140 node = new ShaderOutputNode(fsh);
141 }
142
143 else if(data["type"] == "Float3")
144 {
145 node = new Float3Node(fsh);
146 }
147
148 else if(data["type"] == "Float")
149 {
150 node = new FloatNode(fsh);
151 }
152
153 else if(data["type"] == "ShaderTexture")
154 {
155 node = new ShaderTextureNode(fsh, shaderTextureManager);
156 }
157
158 else if(data["type"] == "PBRMaterial")
159 {
160 node = new PBRMaterialNode(fsh);
161 }
162
163 else if(data["type"] == "BakeToSlot")
164 {
165 node = new BakeToSlotNode(fsh);
166 }
167
168 else if(data["type"] == "CustomShader")
169 {
170 node = new CustomShaderNode(fsh, data["shader"]);
171 }
172
173 return node;
174 };
175 config.saveFile = GetExecutableDir() + PATH_SEPARATOR "Data" PATH_SEPARATOR "configs" PATH_SEPARATOR "ShaderNodes.json";
176 shaderNodeEditor = new NodeEditor(config);
177 shaderNodeEditor->name = "Shader Nodes";
178 shaderNodeEditor->SetOutputNode(new ShaderOutputNode(fsh));
179 LoadDefaultCustomNodes();
180 ReCompileShaders();
181}
a class to store JSON values
Definition: json.hpp:17860