Browse Source

added skybox stuff on editor and refactoring

meemknight 2 years ago
parent
commit
aa5b88bc8c

+ 8 - 0
Pika/core/pikaRuntime/pikaMain.cpp

@@ -50,6 +50,14 @@ BOOL WINAPI customConsoleHandlerRoutine(
 
 #endif
 
+#pragma region gpu
+extern "C"
+{
+	__declspec(dllexport) unsigned long NvOptimusEnablement = 1;
+	__declspec(dllexport) int AmdPowerXpressRequestHighPerformance = 1;
+}
+#pragma endregion
+
 int main()
 {
 

+ 207 - 1
Pika/core/pikaSTD/engineLibraresSupport/engineGL3DSupport.cpp

@@ -1,6 +1,8 @@
 #include "engineGL3DSupport.h"
+#include <stringManipulation/stringManipulation.h>
 
-
+#undef min
+#undef max
 
 void errorCallbackCustom(std::string err, void *userData)
 {
@@ -410,3 +412,207 @@ void pika::gl3d::lightEditorSettingsWindow(int imguiId, ::gl3d::Renderer3D &rend
 
 	ImGui::PopID();
 }
+
+
+void pika::gl3d::fpsInput(::gl3d::Renderer3D &renderer, pika::Input &input, float speed, glm::dvec2 &lastMousePos)
+{
+	glm::vec3 dir = {};
+	if (input.buttons[pika::Button::W].held())
+	{
+		dir.z -= speed * input.deltaTime;
+	}
+	if (input.buttons[pika::Button::S].held())
+	{
+		dir.z += speed * input.deltaTime;
+	}
+
+	if (input.buttons[pika::Button::A].held())
+	{
+		dir.x -= speed * input.deltaTime;
+	}
+	if (input.buttons[pika::Button::D].held())
+	{
+		dir.x += speed * input.deltaTime;
+	}
+
+	if (input.buttons[pika::Button::Q].held())
+	{
+		dir.y -= speed * input.deltaTime;
+	}
+	if (input.buttons[pika::Button::E].held())
+	{
+		dir.y += speed * input.deltaTime;
+	}
+
+	renderer.camera.moveFPS(dir);
+
+	{
+		if (input.rMouse.held())
+		{
+			glm::dvec2 currentMousePos = {input.mouseX, input.mouseY};
+
+			float speed = 0.8f;
+
+			glm::vec2 delta = lastMousePos - currentMousePos;
+			delta *= speed * input.deltaTime;
+
+			renderer.camera.rotateCamera(delta);
+
+			lastMousePos = currentMousePos;
+		}
+		else
+		{
+			lastMousePos = {input.mouseX, input.mouseY};
+		}
+
+	}
+}
+
+
+void pika::gl3d::General3DEditor::loadFromFile(::gl3d::Renderer3D &renderer, std::string file, RequestedContainerInfo &info)
+{
+	std::string data;
+
+	if (info.readEntireFile(file.c_str(), data))
+	{
+		if (data.size() > 0)
+		{
+			renderer.loadSettingsFromJson(data.c_str(), 1, 0, 0);
+		}
+		pika::strlcpy(currentFile, file, sizeof(currentFile));
+	}
+}
+
+void pika::gl3d::General3DEditor::update(int imguiId, ::gl3d::Renderer3D &renderer,
+	pika::Input &input, float moveSpeed, RequestedContainerInfo &info)
+{
+
+	if (ImGui::Begin("Settings"))
+	{
+
+		if (ImGui::CollapsingHeader("Basic settings", ImGuiTreeNodeFlags_Framed | ImGuiTreeNodeFlags_FramePadding))
+		{
+			pika::gl3d::generalSettingsWindow(imguiId, renderer);
+		}
+
+		if (ImGui::CollapsingHeader("fxaa settings", ImGuiTreeNodeFlags_Framed | ImGuiTreeNodeFlags_FramePadding))
+		{
+			pika::gl3d::fxaaSettingsWindow(imguiId, renderer);
+		}
+
+		if (ImGui::CollapsingHeader("ssao settings", ImGuiTreeNodeFlags_Framed | ImGuiTreeNodeFlags_FramePadding))
+		{
+			pika::gl3d::ssaoSettingsWindow(imguiId, renderer);
+		}
+
+		if (ImGui::CollapsingHeader("ssr settings", ImGuiTreeNodeFlags_Framed | ImGuiTreeNodeFlags_FramePadding))
+		{
+			pika::gl3d::ssrSettingsWindow(imguiId, renderer);
+		}
+
+		if (ImGui::CollapsingHeader("bloom settings", ImGuiTreeNodeFlags_Framed | ImGuiTreeNodeFlags_FramePadding))
+		{
+			pika::gl3d::bloomSettingsWindow(imguiId, renderer);
+		}
+
+		if (ImGui::CollapsingHeader("chromatic aberation settings", ImGuiTreeNodeFlags_Framed | ImGuiTreeNodeFlags_FramePadding))
+		{
+			pika::gl3d::chromaticAberationSettingsWindow(imguiId, renderer);
+		}
+
+		if (ImGui::CollapsingHeader("lights settings", ImGuiTreeNodeFlags_Framed | ImGuiTreeNodeFlags_FramePadding))
+		{
+			pika::gl3d::lightEditorSettingsWindow(imguiId, renderer);
+		}
+
+		if (ImGui::CollapsingHeader("Sky box", ImGuiTreeNodeFlags_Framed | ImGuiTreeNodeFlags_FramePadding))
+		{
+
+			if (ImGui::Button("delete skybox"))
+			{
+				renderer.skyBox.clearTextures();
+			}
+
+			if (ImGui::Button("select new skybox"))
+			{
+				fileBrowserSkyBox.SetTitle("Sellect map");
+				fileBrowserSkyBox.SetPwd(PIKA_RESOURCES_PATH);
+				fileBrowserSkyBox.SetTypeFilters({".hdr", ".png"});
+				fileBrowserSkyBox.Open();
+			}
+
+			ImGui::ColorEdit3("Global Ambient color", &renderer.skyBox.color[0]);
+
+			ImGui::Separator();
+
+			if (ImGui::Button("atmospheric scattering"))
+			{
+				renderer.skyBox.clearTextures();
+				renderer.skyBox = renderer.atmosfericScattering(atmosphericScattering);
+			}
+
+			ImGui::DragFloat3("sun pos", &atmosphericScattering.sun[0], 0.1, -1, 1);
+			ImGui::ColorEdit3("sky color", &atmosphericScattering.color1[0]);
+			ImGui::ColorEdit3("sun color", &atmosphericScattering.color2[0]);
+			ImGui::ColorEdit3("ground", &atmosphericScattering.ground[0]);
+			ImGui::Checkbox("use ground", &atmosphericScattering.useGroundColor);
+			ImGui::DragFloat("g", &atmosphericScattering.g, 0.1, 0, 50);
+
+			float s = glm::length(atmosphericScattering.sun);
+			if (s == 0)
+			{
+				atmosphericScattering.sun = {0,1,0};
+			}
+			else
+			{
+				atmosphericScattering.sun /= s;
+			}
+
+		}
+
+		fileBrowserSkyBox.Display();
+
+		if (fileBrowserSkyBox.HasSelected())
+		{
+			if (fileBrowserSkyBox.GetSelected().extension() == ".hdr")
+			{
+				//todo api to log errors
+				renderer.skyBox.clearTextures();
+				renderer.skyBox = renderer.loadHDRSkyBox(fileBrowserSkyBox.GetSelected().string().c_str());
+			}
+			else if (fileBrowserSkyBox.GetSelected().extension() == ".png")
+			{
+				renderer.skyBox.clearTextures();
+				renderer.skyBox = renderer.loadSkyBox(fileBrowserSkyBox.GetSelected().string().c_str());
+			}
+
+			fileBrowserSkyBox.ClearSelected();
+			fileBrowserSkyBox.Close();
+		}
+
+		ImGui::InputText("current file", currentFile, sizeof(currentFile));
+		if (ImGui::Button("save"))
+		{
+			saveToFile(renderer, info);
+		}
+		if (ImGui::Button("load"))
+		{
+			loadFromFile(renderer, currentFile, info);
+		}
+
+
+	}
+	ImGui::End();
+
+
+	pika::gl3d::fpsInput(renderer, input, 4, lastMousePos);
+
+
+}
+
+void pika::gl3d::General3DEditor::saveToFile(::gl3d::Renderer3D &renderer, RequestedContainerInfo &info)
+{
+	auto rez = renderer.saveSettingsToJson(true);
+
+	info.writeEntireFile(currentFile, rez);
+};

+ 20 - 0
Pika/core/pikaSTD/engineLibraresSupport/engineGL3DSupport.h

@@ -16,6 +16,10 @@ bool defaultFileExistsCustom(const char *fileName, void *userData);
 #endif
 
 #include <pikaImgui/pikaImgui.h>
+#include <imfilebrowser.h>
+#include <windowSystemm/input.h>
+#include <baseContainer.h>
+
 
 namespace pika
 {
@@ -35,7 +39,23 @@ namespace pika
 
 		void lightEditorSettingsWindow(int imguiId, ::gl3d::Renderer3D &renderer);
 
+		void fpsInput(::gl3d::Renderer3D &renderer, pika::Input &input, float moveSpeed, glm::dvec2 &lastMousePos);
+
+		struct General3DEditor
+		{
+			void loadFromFile(::gl3d::Renderer3D &renderer, std::string file, RequestedContainerInfo &info);
+
+			void update(int imguiId, ::gl3d::Renderer3D &renderer, pika::Input &input, float moveSpeed
+				,RequestedContainerInfo &info);
+			ImGui::FileBrowser fileBrowserSkyBox;
+			glm::dvec2 lastMousePos = {};
+			::gl3d::AtmosfericScatteringSettings atmosphericScattering;
+			
+			std::string currentSkyBox;
+			char currentFile[257] = {};
 
+			void saveToFile(::gl3d::Renderer3D &renderer, RequestedContainerInfo &info);
+		};
 	};
 };
 

+ 38 - 1
Pika/core/sharedRuntime/baseContainer.h

@@ -10,6 +10,7 @@
 #include <globalAllocator/globalAllocator.h>
 #include <fstream>
 #include <staticString.h>
+#include <vector>
 
 
 #define READENTIREFILE(x) bool x(const char* name, void* buffer, size_t size)
@@ -54,6 +55,42 @@ struct RequestedContainerInfo
 		return true;
 	}
 
+	bool writeEntireFile(const char *name, const std::string &content)
+	{
+		std::ofstream f(name);
+
+		if (!f.is_open()) { return 0; }
+
+		f.write(content.c_str(), content.size());
+		
+		f.close();
+		return 1;
+	}
+
+	bool readEntireFileBinary(const char *name, std::vector<char> &data)
+	{
+		size_t s = 0;
+		data.clear();
+
+		if (!getFileSizeBinary(name, s)) { return 0; }
+
+		data.reserve(s);
+
+		return readEntireFileBinary(name, data.data(), s);
+	}
+
+	bool readEntireFile(const char *name, std::string &data)
+	{
+		size_t s = 0;
+		data.clear();
+
+		if (!getFileSize(name, s)) { return 0; }
+
+		data.resize(s);
+
+		return readEntireFile(name, data.data(), s);
+	}
+
 	bool readEntireFileBinary(const char *name, void *buffer, size_t size)
 	{
 		//PIKA_DEVELOPMENT_ONLY_ASSERT(readEntireFilePointer, "read entire file pointer not assigned");
@@ -147,7 +184,7 @@ struct RequestedContainerInfo
 		}
 		pika::memory::setGlobalAllocator(mainAllocator);
 
-		return size;
+		return success;
 	}
 };
 

+ 1 - 0
Pika/core/sharedRuntime/pikaImgui/pikaImgui.h

@@ -3,6 +3,7 @@
 
 
 #include "imgui.h"
+
 #include "backends/imgui_impl_glfw.h"
 #include "backends/imgui_impl_opengl3.h"
 #include "imguiThemes.h"

+ 18 - 150
Pika/pluggins/pluggins/threeDEditor.h

@@ -20,22 +20,25 @@ struct ThreeDEditor: public Container
 		ContainerStaticInfo info = {};
 		info.defaultHeapMemorySize = pika::MB(1000); //todo option to use global allocator
 
+		info.extensionsSuported = {".gl3d"};
+
 		info.requestImguiFbo = true;
 		info.requestImguiIds = 1;
 
 		return info;
 	}
 
-	ImGui::FileBrowser fileBrowserSkyBox;
 
 	gl3d::Renderer3D renderer;
 	gl3d::Model model;
 	gl3d::Entity entity;
+	bool first = 1;
+
+	pika::gl3d::General3DEditor editor;
 
 	bool create(RequestedContainerInfo &requestedInfo, pika::StaticString<256> commandLineArgument)
 	{
 
-
 		renderer.setErrorCallback(&errorCallbackCustom, &requestedInfo);
 		renderer.fileOpener.userData = &requestedInfo;
 		renderer.fileOpener.readEntireFileBinaryCallback = readEntireFileBinaryCustom;
@@ -44,10 +47,6 @@ struct ThreeDEditor: public Container
 		
 		renderer.init(1, 1, PIKA_RESOURCES_PATH "BRDFintegrationMap.png", requestedInfo.requestedFBO.fbo);
 		
-		//renderer.skyBox = renderer.atmosfericScattering({0.2,1,0.3}, {0.9,0.1,0.1}, {0.4, 0.4, 0.8}, 0.8f); //todo a documentation
-		//todo api for skybox stuff
-		//renderer.skyBox.color = {0.2,0.3,0.9};
-		
 		const char *names[6] =
 		{PIKA_RESOURCES_PATH "/skyBoxes/ocean/right.jpg",
 			PIKA_RESOURCES_PATH "/skyBoxes/ocean/left.jpg",
@@ -56,9 +55,11 @@ struct ThreeDEditor: public Container
 			PIKA_RESOURCES_PATH "/skyBoxes/ocean/front.jpg",
 			PIKA_RESOURCES_PATH "/skyBoxes/ocean/back.jpg"};
 		
-		renderer.skyBox = renderer.loadSkyBox(names);
+		//renderer.skyBox = renderer.loadSkyBox(names);
 		//renderer.skyBox.color = {0.2,0.3,0.8};
-		
+		renderer.skyBox = renderer.atmosfericScattering({0,1,0}, {0.2,0.2,0.5}, {0.6,0.2,0.1}, {},
+			false, 10);
+
 		//helmetModel = renderer.loadModel(PIKA_RESOURCES_PATH "helmet/helmet.obj");
 		model = renderer.loadModel(PIKA_RESOURCES_PATH "rave.glb", 0.5);
 		
@@ -68,6 +69,12 @@ struct ThreeDEditor: public Container
 		
 		entity = renderer.createEntity(model, t);
 
+		if (commandLineArgument.size() > 0)
+		{
+			editor.loadFromFile(renderer, commandLineArgument.to_string(), requestedInfo);
+		}
+
+
 		return true;
 	}
 
@@ -85,154 +92,15 @@ struct ThreeDEditor: public Container
 		glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
 		glEnable(GL_DEPTH_TEST);
 
+		
+
 		renderer.updateWindowMetrics(windowState.w, windowState.h);
 		renderer.camera.aspectRatio = (float)windowState.w / windowState.h; //todo do this in update
 
-		if(ImGui::Begin("Settings"))
-		{
-		
-			if (ImGui::CollapsingHeader("Basic settings", ImGuiTreeNodeFlags_Framed | ImGuiTreeNodeFlags_FramePadding))
-			{
-				pika::gl3d::generalSettingsWindow(requestedInfo.requestedImguiIds, renderer);
-			}
-
-			if (ImGui::CollapsingHeader("fxaa settings", ImGuiTreeNodeFlags_Framed | ImGuiTreeNodeFlags_FramePadding))
-			{
-				pika::gl3d::fxaaSettingsWindow(requestedInfo.requestedImguiIds, renderer);
-			}
-
-			if (ImGui::CollapsingHeader("ssao settings", ImGuiTreeNodeFlags_Framed | ImGuiTreeNodeFlags_FramePadding))
-			{
-				pika::gl3d::ssaoSettingsWindow(requestedInfo.requestedImguiIds, renderer);
-			}
-
-			if (ImGui::CollapsingHeader("ssr settings", ImGuiTreeNodeFlags_Framed | ImGuiTreeNodeFlags_FramePadding))
-			{
-				pika::gl3d::ssrSettingsWindow(requestedInfo.requestedImguiIds, renderer);
-			}
-
-			if (ImGui::CollapsingHeader("bloom settings", ImGuiTreeNodeFlags_Framed | ImGuiTreeNodeFlags_FramePadding))
-			{
-				pika::gl3d::bloomSettingsWindow(requestedInfo.requestedImguiIds, renderer);
-			}
-
-			if (ImGui::CollapsingHeader("chromatic aberation settings", ImGuiTreeNodeFlags_Framed | ImGuiTreeNodeFlags_FramePadding))
-			{
-				pika::gl3d::chromaticAberationSettingsWindow(requestedInfo.requestedImguiIds, renderer);
-			}
-			
-			if (ImGui::CollapsingHeader("lights settings", ImGuiTreeNodeFlags_Framed | ImGuiTreeNodeFlags_FramePadding))
-			{
-				pika::gl3d::lightEditorSettingsWindow(requestedInfo.requestedImguiIds, renderer);
-			}
-
-			if (ImGui::CollapsingHeader("Sky box", ImGuiTreeNodeFlags_Framed | ImGuiTreeNodeFlags_FramePadding))
-			{
-
-				if (ImGui::Button("delete skybox"))
-				{
-					renderer.skyBox.clearTextures();
-				}
-
-				if (ImGui::Button("select new skybox"))
-				{
-					fileBrowserSkyBox.SetTitle("Sellect map");
-					fileBrowserSkyBox.SetPwd(PIKA_RESOURCES_PATH);
-					fileBrowserSkyBox.SetTypeFilters({".hdr", ".png"});
-					fileBrowserSkyBox.Open();
-				}
-
-				ImGui::ColorEdit3("Global Ambient color", &renderer.skyBox.color[0]);
-
-			}
 			
-			fileBrowserSkyBox.Display();
-
-			if (fileBrowserSkyBox.HasSelected())
-			{
-				if (fileBrowserSkyBox.GetSelected().extension() == ".hdr")
-				{
-					//todo api to log errors
-					renderer.skyBox.clearTextures();
-					renderer.skyBox = renderer.loadHDRSkyBox(fileBrowserSkyBox.GetSelected().string().c_str());
-				}
-				else if (fileBrowserSkyBox.GetSelected().extension() == ".png")
-				{
-					renderer.skyBox.clearTextures();
-					renderer.skyBox = renderer.loadSkyBox(fileBrowserSkyBox.GetSelected().string().c_str());
-				}
-
-				fileBrowserSkyBox.ClearSelected();
-				fileBrowserSkyBox.Close();
-			}
-
-		}
-		ImGui::End();
+		editor.update(requestedInfo.requestedImguiIds, renderer, input, 4, requestedInfo);
 
 
-	#pragma region input
-
-	{
-		float speed = 4;
-		glm::vec3 dir = {};
-		if (GetAsyncKeyState('W'))
-		{
-			dir.z -= speed * input.deltaTime;
-		}
-		if (GetAsyncKeyState('S'))
-		{
-			dir.z += speed * input.deltaTime;
-		}
-
-		if (GetAsyncKeyState('A'))
-		{
-			dir.x -= speed * input.deltaTime;
-		}
-		if (GetAsyncKeyState('D'))
-		{
-			dir.x += speed * input.deltaTime;
-		}
-
-		if (GetAsyncKeyState('Q'))
-		{
-			dir.y -= speed * input.deltaTime;
-		}
-		if (GetAsyncKeyState('E'))
-		{
-			dir.y += speed * input.deltaTime;
-		}
-
-		renderer.camera.moveFPS(dir);
-	}
-
-	{
-		static glm::dvec2 lastMousePos = {};
-		if (input.rMouse.held())
-		{
-			glm::dvec2 currentMousePos = {input.mouseX, input.mouseY};
-
-			float speed = 0.8f;
-
-			glm::vec2 delta = lastMousePos - currentMousePos;
-			delta *= speed * input.deltaTime;
-
-			renderer.camera.rotateCamera(delta);
-
-			lastMousePos = currentMousePos;
-		}
-		else
-		{
-			lastMousePos = {input.mouseX, input.mouseY};
-		}
-	}
-
-	#pragma endregion
-
-		if (input.buttons[pika::Button::P].pressed())
-		{
-			renderer.setEntityAnimate(entity, true);
-		}
-
 		renderer.render(input.deltaTime);
 		glDisable(GL_DEPTH_TEST);
 

+ 1 - 0
Pika/resources/3d/default.gl3d

@@ -0,0 +1 @@
+{"SSR":false,"SSRdata":{"maxRayDelta":0.6000000238418579,"maxRayStep":1.75,"maxSteps":20,"minRayStep":0.4000000059604645,"numBinarySearchSteps":7},"adaptiveResolution":true,"chromaticAberation":false,"chromaticAberationData":{"strength":20.0,"unfocusDistance":5.0},"exposure":1.7000000476837158,"frustumCulling":true,"fxaa":true,"fxaaData":{"edgeDarkTreshold":0.125,"edgeMinTreshold":0.02800000086426735,"iterations":12,"qualityMultiplyer":0.800000011920929,"subPixelQuality":0.949999988079071},"light subscatter":true,"normal mapping":true,"ssao":true,"ssaoData":{"bias":0.02500000037252903,"exponent":5.0,"radius":0.20000000298023224,"sampleCount":16}}

+ 4 - 2
Pika/resources/logs.txt

@@ -1,2 +1,4 @@
-#2023-02-13 19:38:43: Created container: Gameplay
-#2023-02-13 19:43:58: Created container: ThreeDEditor
+#2023-02-14 21:33:18: Created container: Gameplay
+#2023-02-14 21:33:21: Created container: ThreeDEditor
+#2023-02-14 21:33:35: Destroyed continer: Gameplay #1
+#2023-02-14 21:33:35: Destroyed continer: ThreeDEditor #2

+ 280 - 80
Pika/thirdparty/gl3d/gl3d.cpp

@@ -1,6 +1,6 @@
 ////////////////////////////////////////////////
 //gl32 --Vlad Luta -- 
-//built on 2023-02-13
+//built on 2023-02-14
 ////////////////////////////////////////////////
 
 #include "gl3d.h"
@@ -32294,7 +32294,9 @@ namespace gl3d
 "uniform vec3 u_lightPos;\n"
 "uniform vec3 u_color1;\n"
 "uniform vec3 u_color2;\n"
+"uniform vec3 u_groundColor;\n"
 "uniform float u_g;\n"
+"uniform int u_useGround;\n"
 "in vec3 v_localPos;\n"
 "out vec3 fragColor;\n"
 "void main ()\n"
@@ -32327,10 +32329,10 @@ namespace gl3d
 "* \n"
 "pow (tmpvar_4, 16.0)\n"
 ")) + (pow (tmpvar_4, 16.0) * u_color2));\n"
-"if ((tmpvar_3 < 0.02)) {\n"
+"if (((tmpvar_3 < 0.02) && (u_useGround != 0))) {\n"
 "float tmpvar_8;\n"
 "tmpvar_8 = min (max ((tmpvar_3 / 0.02), 0.0), 1.0);\n"
-"fragColor = mix (vec3(0.1, 0.2, 0.1), tmpvar_7, vec3((tmpvar_8 * (tmpvar_8 * tmpvar_8))));\n"
+"fragColor = mix (u_groundColor, tmpvar_7, vec3((tmpvar_8 * (tmpvar_8 * tmpvar_8))));\n"
 "} else {\n"
 "fragColor = tmpvar_7;\n"
 "};\n"
@@ -34371,6 +34373,14 @@ namespace gl3d
 "{\n"
 "v_texCoords = a_TexCoords;\n"
 "gl_Position = vec4(a_Pos, 1.0);\n"
+"}\n"},
+
+      std::pair<std::string, const char*>{"copyDepth.frag", "#version 330 core\n"
+"noperspective in vec2 v_texCoords;\n"
+"uniform sampler2D u_depth;\n"
+"void main()\n"
+"{\n"
+"gl_FragDepth = texture(u_depth, v_texCoords).r;\n"
 "}\n"},
 
       std::pair<std::string, const char*>{"color.vert", "#version 330\n"
@@ -35588,6 +35598,9 @@ namespace gl3d
 		atmosphericScatteringShader.u_g = getUniform(atmosphericScatteringShader.shader.id, "u_g", errorReporter);
 		atmosphericScatteringShader.u_color1 = getUniform(atmosphericScatteringShader.shader.id, "u_color1", errorReporter);
 		atmosphericScatteringShader.u_color2 = getUniform(atmosphericScatteringShader.shader.id, "u_color2", errorReporter);
+		atmosphericScatteringShader.u_groundColor = getUniform(atmosphericScatteringShader.shader.id, "u_groundColor", errorReporter);
+		atmosphericScatteringShader.u_useGround = getUniform(atmosphericScatteringShader.shader.id, "u_useGround", errorReporter);
+
 		atmosphericScatteringShader.modelViewUniformLocation 
 			= getUniform(atmosphericScatteringShader.shader.id, "u_viewProjection", errorReporter);
 
@@ -35939,7 +35952,8 @@ namespace gl3d
 		createConvolutedAndPrefilteredTextureData(skyBox, frameBuffer);
 	}
 
-	void SkyBoxLoaderAndDrawer::atmosphericScattering(glm::vec3 sun, glm::vec3 color1, glm::vec3 color2, float g,
+	void SkyBoxLoaderAndDrawer::atmosphericScattering(glm::vec3 sun, glm::vec3 color1, glm::vec3 color2,
+		glm::vec3 groundColor, bool useGroundColor, float g,
 		SkyBox& skyBox, GLuint frameBuffer)
 	{
 		skyBox = {};
@@ -35972,6 +35986,8 @@ namespace gl3d
 				glUniform1f(atmosphericScatteringShader.u_g, g);
 				glUniform3fv(atmosphericScatteringShader.u_color1, 1, &color1[0]);
 				glUniform3fv(atmosphericScatteringShader.u_color2, 1, &color2[0]);
+				glUniform3fv(atmosphericScatteringShader.u_groundColor, 1, &groundColor[0]);
+				glUniform1i(atmosphericScatteringShader.u_useGround, (int)useGroundColor);
 
 				glViewport(0, 0, skyBoxSize, skyBoxSize);
 
@@ -35998,7 +36014,7 @@ namespace gl3d
 
 		}
 
-		createConvolutedAndPrefilteredTextureData(skyBox, 0.02, 64u);
+		createConvolutedAndPrefilteredTextureData(skyBox, frameBuffer, 0.02, 64u);
 
 	}
 
@@ -36298,13 +36314,14 @@ namespace gl3d
 
 		internal.gBuffer.create(x, y, errorReporter, frameBuffer);
 		internal.ssao.create(x, y, errorReporter, fileOpener, frameBuffer);
-		internal.hbao.create(errorReporter, fileOpener, frameBuffer);
+		internal.hbao.create(errorReporter, fileOpener);
 		postProcess.create(x, y, errorReporter, fileOpener, frameBuffer);
 		directionalShadows.create(frameBuffer);
 		spotShadows.create(frameBuffer);
 		pointShadows.create(frameBuffer);
 		antiAlias.create(x, y, errorReporter, fileOpener);
 		adaptiveResolution.create(x, y);
+		copyDepth.create(errorReporter, fileOpener);
 
 		internal.pBRtextureMaker.init(errorReporter, fileOpener);
 	}
@@ -38629,16 +38646,16 @@ namespace gl3d
 
 		internal.lightShader.lightPassUniformBlockCpuData.SSR = data;
 
-
 	}
 
-	void Renderer3D::ebableSSR(bool enable)
+	void Renderer3D::enableSSR(bool enable)
 	{
+		internal.hasLastFrameTexture = enable;
 	}
 
 	bool Renderer3D::isSSRenabeled()
 	{
-		return false;
+		return internal.hasLastFrameTexture;
 	}
 
 	float stub = 0;
@@ -38696,85 +38713,134 @@ namespace gl3d
 	}
 
 	//todo flags
-	std::string Renderer3D::saveSettingsToJson()
+	std::string Renderer3D::saveSettingsToJson(bool includeRenderingSettings, std::string skyBoxName,
+		gl3d::AtmosfericScatteringSettings *atmosphericScattering)
 	{
 		using Json = nlohmann::json;
 
 		Json j;
 
-		j["exposure"] = getExposure();
-		j["normal mapping"] = isNormalMappingEnabeled();
-		j["light subscatter"] = isLightSubScatteringEnabeled();
+		if (!skyBoxName.empty())
+		{
+			j["sky box"] = skyBoxName;
+		}
 
-		//fxaa
+		if (atmosphericScattering != nullptr)
 		{
-			j["fxaa"] = isFXAAenabeled();
-			Json fxaaData;
-			auto data = getFxaaSettings();
+			Json a;
+			a["sunx"] = atmosphericScattering->sun.x;
+			a["suny"] = atmosphericScattering->sun.y;
+			a["sunz"] = atmosphericScattering->sun.z;
 
-			fxaaData["edgeDarkTreshold"] = data.edgeDarkTreshold;
-			fxaaData["edgeMinTreshold"] = data.edgeMinTreshold;
-			fxaaData["qualityMultiplyer"] = data.quaityMultiplier;
-			fxaaData["iterations"] = data.ITERATIONS;
-			fxaaData["subPixelQuality"] = data.SUBPIXEL_QUALITY;
+			a["color1x"] = atmosphericScattering->color1.x;
+			a["color1y"] = atmosphericScattering->color1.y;
+			a["color1z"] = atmosphericScattering->color1.z;
 
-			j["fxaaData"] = fxaaData;
-		}
-		
-		//todo separate thing
-		j["adaptiveResolution"] = adaptiveResolution.useAdaptiveResolution; //todo setter getter
-		//j["zprePass"] = zPrePass; //todo setter getter //todo add back if will be used
-		j["frustumCulling"] = frustumCulling; 
+			a["color2x"] = atmosphericScattering->color2.x;
+			a["color2y"] = atmosphericScattering->color2.y;
+			a["color2z"] = atmosphericScattering->color2.z;
 
+			a["groundx"] = atmosphericScattering->ground.x;
+			a["groundy"] = atmosphericScattering->ground.y;
+			a["groundz"] = atmosphericScattering->ground.z;
 
-		//ssao
-		{
-			j["ssao"] = isSSAOenabeled();
-			Json ssaoData;
-			ssaoData["bias"] = getSSAOBias();
-			ssaoData["radius"] = getSSAORadius();
-			ssaoData["sampleCount"] = getSSAOSampleCount();
-			ssaoData["exponent"] = getSSAOExponent();
-			
-			j["ssaoData"] = ssaoData;
+			a["g"] = atmosphericScattering->g;
+			a["useGround"] = atmosphericScattering->useGroundColor;
+
+			j["atmosphericScattering"] = a;
 		}
 
-		//chromatic aberation
+		if (!skyBoxName.empty() || atmosphericScattering != nullptr)
 		{
-			j["chromaticAberation"] = chromaticAberationEnabeled();
-			
-			Json chromaticAberationData;
-			chromaticAberationData["strength"] = getChromaticAberationStrength();
-			chromaticAberationData["unfocusDistance"] = getChromaticAberationUnfocusDistance();
-
-			j["chromaticAberationData"] = chromaticAberationData;
+			j["ambientr"] = skyBox.color.r;
+			j["ambientg"] = skyBox.color.g;
+			j["ambientb"] = skyBox.color.b;
 		}
 
+		if (includeRenderingSettings)
 		{
-			j["SSR"] = isSSRenabeled();
 
-			Json SSR;
+			j["exposure"] = getExposure();
+			j["normal mapping"] = isNormalMappingEnabeled();
+			j["light subscatter"] = isLightSubScatteringEnabeled();
 
-			auto d = getSSRdata();
-			SSR["maxRayDelta"] = d.maxRayDelta;
-			SSR["maxRayStep"] = d.maxRayStep;
-			SSR["maxSteps"] = d.maxSteps;
-			SSR["minRayStep"] = d.minRayStep;
-			SSR["numBinarySearchSteps"] = d.numBinarySearchSteps;
+			//fxaa
+			{
+				j["fxaa"] = isFXAAenabeled();
+				Json fxaaData;
+				auto data = getFxaaSettings();
 
-			j["SSRdata"] = SSR;
-		}
+				fxaaData["edgeDarkTreshold"] = data.edgeDarkTreshold;
+				fxaaData["edgeMinTreshold"] = data.edgeMinTreshold;
+				fxaaData["qualityMultiplyer"] = data.quaityMultiplier;
+				fxaaData["iterations"] = data.ITERATIONS;
+				fxaaData["subPixelQuality"] = data.SUBPIXEL_QUALITY;
+
+				j["fxaaData"] = fxaaData;
+			}
+
+			//todo separate thing
+			j["adaptiveResolution"] = adaptiveResolution.useAdaptiveResolution; //todo setter getter
+			//j["zprePass"] = zPrePass; //todo setter getter //todo add back if will be used
+			j["frustumCulling"] = frustumCulling;
+
+			//ssao
+			{
+				j["ssao"] = isSSAOenabeled();
+				Json ssaoData;
+				ssaoData["bias"] = getSSAOBias();
+				ssaoData["radius"] = getSSAORadius();
+				ssaoData["sampleCount"] = getSSAOSampleCount();
+				ssaoData["exponent"] = getSSAOExponent();
+
+				j["ssaoData"] = ssaoData;
+			}
+
+			//chromatic aberation
+			{
+				j["chromaticAberation"] = chromaticAberationEnabeled();
+
+				Json chromaticAberationData;
+				chromaticAberationData["strength"] = getChromaticAberationStrength();
+				chromaticAberationData["unfocusDistance"] = getChromaticAberationUnfocusDistance();
 
+				j["chromaticAberationData"] = chromaticAberationData;
+			}
+
+			{
+				j["SSR"] = isSSRenabeled();
+
+				Json SSR;
+
+				auto d = getSSRdata();
+				SSR["maxRayDelta"] = d.maxRayDelta;
+				SSR["maxRayStep"] = d.maxRayStep;
+				SSR["maxSteps"] = d.maxSteps;
+				SSR["minRayStep"] = d.minRayStep;
+				SSR["numBinarySearchSteps"] = d.numBinarySearchSteps;
+
+				j["SSRdata"] = SSR;
+			}
+
+		}
 
 		return j.dump();
 	}
 
-	void Renderer3D::loadSettingsFromJson(const char *data)
+	//https://stackoverflow.com/questions/874134/find-out-if-string-ends-with-another-string-in-c
+	inline bool endsWith(std::string const &value, std::string const &ending)
+	{
+		if (ending.size() > value.size()) return false;
+		return std::equal(ending.rbegin(), ending.rend(), value.rbegin());
+	}
+
+	void Renderer3D::loadSettingsFromJson(const char *data, bool includeRenderingSettings, bool loadSkyBox, bool loadAtmosphericScattering)
 	{
 		using Json = nlohmann::json;
 
 		auto rez = Json::parse(data);
 
+		if(includeRenderingSettings)
 		{
 			auto exposure = rez["exposure"];
 			if (exposure.is_number())
@@ -38805,10 +38871,9 @@ namespace gl3d
 			{
 				this->frustumCulling = frustumCulling;
 			}
-		}
 
-		//SSAO
-		{
+			//SSAO
+			{
 			auto ssao = rez["ssao"];
 			if(ssao.is_boolean())
 			{
@@ -38830,8 +38895,8 @@ namespace gl3d
 			}
 		}
 
-		//FXAA
-		{
+			//FXAA
+			{
 			auto fxaaEnabeled = rez["fxaa"];
 			if (fxaaEnabeled.is_boolean()) { enableFXAA(fxaaEnabeled); }
 
@@ -38875,8 +38940,8 @@ namespace gl3d
 			}
 		}
 
-		//Chromatic Aberation
-		{
+			//Chromatic Aberation
+			{
 			auto chromaticAberationEnabeled = rez["chromaticAberation"];
 			if (chromaticAberationEnabeled.is_boolean()) { this->chromaticAberationEnabeled() = chromaticAberationEnabeled; }
 
@@ -38893,10 +38958,10 @@ namespace gl3d
 			}
 		}
 
-		//SSR
-		{
+			//SSR
+			{
 			auto ssrEnabeled = rez["SSR"];
-			if (ssrEnabeled.is_boolean()) { ebableSSR(ssrEnabeled); }
+			if (ssrEnabeled.is_boolean()) { enableSSR(ssrEnabeled); }
 			
 			auto ssrData = rez["SSRdata"];
 
@@ -38915,7 +38980,100 @@ namespace gl3d
 				#undef ADD_ENTRY
 			}
 		}
+		}
 
+		bool loadSkyBoxFailed = 1;
+		if (loadSkyBox)
+		{
+			auto s = rez["sky box"];
+
+			if (s.is_string())
+			{
+				std::string str = s;
+
+				if (endsWith(str, ".hdr") || endsWith(str, ".HDR"))
+				{
+					skyBox.clearTextures();
+					skyBox = loadHDRSkyBox(str.c_str());
+					if (skyBox.texture != 0) { loadSkyBoxFailed = 0; }
+				}else
+				if (endsWith(str, ".png") || endsWith(str, ".PNG"))
+				{
+					skyBox.clearTextures();
+					skyBox = this->loadSkyBox(str.c_str(), 0);
+					if (skyBox.texture != 0) { loadSkyBoxFailed = 0; }
+				}
+			}
+		}
+
+		if (loadAtmosphericScattering && loadSkyBoxFailed)
+		{
+			auto a = rez["atmosphericScattering"];
+
+			if (a.is_object())
+			{
+				auto sunx = a["sunx"];
+				auto suny = a["suny"];
+				auto sunz = a["sunz"];
+
+				auto color1x = a["color1x"];
+				auto color1y = a["color1y"];
+				auto color1z = a["color1z"];
+
+				auto color2x = a["color2x"];
+				auto color2y = a["color2y"];
+				auto color2z = a["color2z"];
+
+				auto groundx = a["groundx"];
+				auto groundy = a["groundy"];
+				auto groundz = a["groundz"];
+
+				auto g = a["g"];
+				auto useGround = a["useGround"];
+
+				gl3d::AtmosfericScatteringSettings s;
+
+				if (
+					sunx.is_number() &&
+					suny.is_number() &&
+					sunz.is_number() &&
+					color1x.is_number() &&
+					color1y.is_number() &&
+					color1z.is_number() &&
+					color2x.is_number() &&
+					color2y.is_number() &&
+					color2z.is_number() &&
+					groundx.is_number() &&
+					groundy.is_number() &&
+					groundz.is_number() &&
+					useGround.is_boolean() &&
+					g.is_number()
+					)
+				{
+					skyBox.clearTextures();
+					s.sun = glm::normalize(glm::vec3{sunx, suny, sunz});
+					s.color1 = {color1x, color1y, color1z};
+					s.color2 = {color2x, color2y, color2z};
+					s.ground = {groundx,groundy,groundz};
+					s.useGroundColor = useGround;
+					s.g = g;
+					skyBox = this->atmosfericScattering(s);
+				}
+			}
+
+		}
+
+		if (loadSkyBox || loadAtmosphericScattering)
+		{
+			auto r = rez["ambientr"];
+			auto g = rez["ambientg"];
+			auto b = rez["ambientb"];
+			
+			if (r.is_number() && g.is_number() && b.is_number())
+			{
+				skyBox.color = glm::vec3{r,g,b};
+			}
+		}
 
 	}
 
@@ -41446,7 +41604,8 @@ namespace gl3d
 
 	#pragma endregion
 
-	#pragma region draw to screen and fxaa and chromatic aberation
+
+	#pragma region chromatic aberation
 
 		GLuint currentTexture = adaptiveResolution.texture;
 
@@ -41475,10 +41634,13 @@ namespace gl3d
 			currentTexture = adaptiveResolution.texture2;
 		}
 
+	#pragma endregion
+
+
+	#pragma region draw to screen and fxaa 
 
 		glViewport(0, 0, internal.w, internal.h);
 		glBindFramebuffer(GL_FRAMEBUFFER, frameBuffer);
-		
 
 		if (antiAlias.usingFXAA || adaptiveResolution.useAdaptiveResolution)
 		{
@@ -41516,18 +41678,36 @@ namespace gl3d
 
 
 	#pragma region copy depth buffer for later forward rendering
-		glBindVertexArray(0);
 
-		//glBindFramebuffer(GL_READ_FRAMEBUFFER, gBuffer.gBuffer);
-		//glBindFramebuffer(GL_DRAW_FRAMEBUFFER, frameBuffer); // write to default framebuffer
-		//glBlitFramebuffer(
-		//  0, 0, adaptiveW, adaptiveH, 0, 0, w, h, GL_DEPTH_BUFFER_BIT, GL_NEAREST
-		//);
+		glBindFramebuffer(GL_FRAMEBUFFER, frameBuffer);
 
+		if (copyDepthForLaterForwardRendering)
+		{
+
+			if ((internal.adaptiveW == internal.w &&
+				internal.adaptiveH == internal.h) || !adaptiveResolution.useAdaptiveResolution
+				)
+			{
+				glBindFramebuffer(GL_READ_FRAMEBUFFER, internal.gBuffer.gBuffer);
+				glBindFramebuffer(GL_DRAW_FRAMEBUFFER, frameBuffer); // write to default framebuffer
+				glBlitFramebuffer(
+					0, 0, internal.adaptiveW, internal.adaptiveH, 0, 0, internal.w, internal.h, GL_DEPTH_BUFFER_BIT, GL_NEAREST
+				);
+			}
+			else
+			{
+				copyDepth.shader.bind();
+				glUniform1i(copyDepth.u_depth, 0);
+				glActiveTexture(GL_TEXTURE0);
+				glBindTexture(GL_TEXTURE_2D, internal.gBuffer.depthBuffer);
+				glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
+			}
 		
-		glBindFramebuffer(GL_FRAMEBUFFER, frameBuffer);
+		}
+
 	#pragma endregion
 
+		glBindVertexArray(0);
 
 		//reset per frame flags
 		internal.perFrameFlags = {};
@@ -41656,6 +41836,7 @@ namespace gl3d
 		antiAlias.clear();
 		adaptiveResolution.clear();
 		internal.pBRtextureMaker.clear();
+		copyDepth.clear();
 	}
 
 	SkyBox Renderer3D::loadSkyBox(const char *names[6])
@@ -41684,13 +41865,21 @@ namespace gl3d
 		skyBox.clearTextures();
 	}
 
-	SkyBox Renderer3D::atmosfericScattering(glm::vec3 sun, glm::vec3 color1, glm::vec3 color2, float g)
+	SkyBox Renderer3D::atmosfericScattering(glm::vec3 sun, glm::vec3 color1, glm::vec3 color2,
+		glm::vec3 groundColor, bool useGroundColor, float g)
 	{
 		SkyBox skyBox = {};
-		internal.skyBoxLoaderAndDrawer.atmosphericScattering(sun, color1, color2, g, skyBox, frameBuffer);
+		internal.skyBoxLoaderAndDrawer.atmosphericScattering(sun, color1, color2, groundColor,
+			useGroundColor, g, skyBox, frameBuffer);
 		return skyBox;
 	}
 
+	SkyBox Renderer3D::atmosfericScattering(AtmosfericScatteringSettings settings)
+	{
+		return atmosfericScattering(settings.sun, settings.color1, settings.color2, settings.ground,
+			settings.useGroundColor, settings.g);
+	}
+
 	float lerp(float a, float b, float f)
 	{
 		return a + f * (b - a);
@@ -42556,7 +42745,7 @@ namespace gl3d
 		glDeleteTextures(1, &depthBuffer);
 	}
 
-	void Renderer3D::InternalStruct::HBAO::create(ErrorReporter &errorReporter, FileOpener &fileOpener, GLuint frameBuffer)
+	void Renderer3D::InternalStruct::HBAO::create(ErrorReporter &errorReporter, FileOpener &fileOpener)
 	{
 
 		shader.loadShaderProgramFromFile("shaders/drawQuads.vert", "shaders/hbao/hbao.frag", errorReporter, fileOpener);
@@ -42575,6 +42764,17 @@ namespace gl3d
 	}
 
 
+	void Renderer3D::CopyDepth::create(ErrorReporter &errorReporter, FileOpener &fileOpener)
+	{
+		shader.loadShaderProgramFromFile("shaders/drawQuads.vert", "shaders/copyDepth.frag", errorReporter, fileOpener);
+		u_depth = getUniform(shader.id, "u_depth", errorReporter);
+	}
+
+	void Renderer3D::CopyDepth::clear()
+	{
+		shader.clear();
+	}
+
 };
 #pragma endregion
 

+ 35 - 8
Pika/thirdparty/gl3d/gl3d.h

@@ -1,6 +1,6 @@
 ////////////////////////////////////////////////
 //gl32 --Vlad Luta -- 
-//built on 2023-02-13
+//built on 2023-02-14
 ////////////////////////////////////////////////
 
 
@@ -34439,6 +34439,8 @@ namespace gl3d
 			GLuint u_g;
 			GLuint u_color1;
 			GLuint u_color2;
+			GLuint u_groundColor;
+			GLuint u_useGround;
 			GLuint modelViewUniformLocation;
 
 		}atmosphericScatteringShader;
@@ -34453,7 +34455,8 @@ namespace gl3d
 		void loadTexture(const char *names[6], SkyBox &skyBox, ErrorReporter &errorReporter, FileOpener &fileOpener, GLuint frameBuffer);
 		void loadTexture(const char *name, SkyBox &skyBox, ErrorReporter &errorReporter, FileOpener &fileOpener, GLuint frameBuffer, int format = 0);
 		void loadHDRtexture(const char *name, ErrorReporter &errorReporter, FileOpener &fileOpener, SkyBox &skyBox, GLuint frameBuffer);
-		void atmosphericScattering(glm::vec3 sun, glm::vec3 color1, glm::vec3 color2, float g, SkyBox& skyBox,
+		void atmosphericScattering(glm::vec3 sun, glm::vec3 color1, glm::vec3 color2,
+			glm::vec3 groundColor, bool useGroundColor, float g, SkyBox& skyBox,
 			GLuint frameBuffer);
 
 		//, GLuint frameBuffer is the default fbo
@@ -34545,7 +34548,17 @@ namespace gl3d
 
 	};
 
-	
+	struct AtmosfericScatteringSettings
+	{
+		glm::vec3 sun = {0,1,0};
+		//sky
+		glm::vec3 color1 = {0,0,0};
+		//sun
+		glm::vec3 color2 = {0,0,0};
+		glm::vec3 ground = {0,0,0};
+		float g = 0;
+		bool useGroundColor = 0;
+	};
 
 	struct Renderer3D
 
@@ -34620,7 +34633,9 @@ namespace gl3d
 		SkyBox loadHDRSkyBox(const char* name);
 		void deleteSkyBoxTextures(SkyBox& skyBox);
 
-		SkyBox atmosfericScattering(glm::vec3 sun, glm::vec3 color1, glm::vec3 color2, float g);
+		SkyBox atmosfericScattering(glm::vec3 sun, glm::vec3 color1, glm::vec3 color2,
+			glm::vec3 groundColor, bool useGroundColor, float g);
+		SkyBox atmosfericScattering(AtmosfericScatteringSettings settings);
 
 	#pragma endregion
 
@@ -34817,7 +34832,7 @@ namespace gl3d
 		//SSR
 		LightShader::LightPassData::SSRdata &getSSRdata();
 		void setSSRdata(LightShader::LightPassData::SSRdata data);
-		void ebableSSR(bool enable = true);
+		void enableSSR(bool enable = true);
 		bool isSSRenabeled();
 
 		//
@@ -34853,10 +34868,11 @@ namespace gl3d
 		#pragma endregion
 		
 		//saves the current settings to a string;
-		std::string saveSettingsToJson();
+		std::string saveSettingsToJson(bool includeRenderingSettings, std::string skyBoxName = "", 
+			gl3d::AtmosfericScatteringSettings *atmosphericScattering = nullptr);
 
 		//this will terminate if data is not a valid json
-		void loadSettingsFromJson(const char *data);
+		void loadSettingsFromJson(const char *data, bool includeRenderingSettings, bool loadSkyBox, bool loadAtmosphericScattering);
 
 
 	#pragma endregion
@@ -35019,7 +35035,7 @@ namespace gl3d
 			{
 				//https://developer.download.nvidia.com/presentations/2008/SIGGRAPH/HBAO_SIG08b.pdf
 
-				void create(ErrorReporter &errorReporter, FileOpener &fileOpener, GLuint frameBuffer);
+				void create(ErrorReporter &errorReporter, FileOpener &fileOpener);
 				void clear();
 				Shader shader;
 
@@ -35197,6 +35213,15 @@ namespace gl3d
 			bool usingFXAA = true;
 		}antiAlias;
 
+		struct CopyDepth
+		{
+			gl3d::Shader shader;
+			GLint u_depth = -1;
+
+			void create(ErrorReporter &errorReporter, FileOpener &fileOpener);
+			void clear();
+		}copyDepth;
+
 		struct DirectionalShadows
 		{
 			void create(GLuint frameBuffer);
@@ -35255,6 +35280,7 @@ namespace gl3d
 		}pointShadows;
 
 		void render(float deltaTime);
+
 		void updateWindowMetrics(int x, int y);
 
 		void clearAllLoadedResource();
@@ -35264,6 +35290,7 @@ namespace gl3d
 
 		bool frustumCulling = 1;
 		bool zPrePass = 0;
+		bool copyDepthForLaterForwardRendering = 0;
 
 	};
 

+ 3 - 2
Pika/thirdparty/imgui-docking/imgui/imfilebrowser.h

@@ -178,7 +178,7 @@ namespace ImGui
         uint32_t drives_;
 #endif
     };
-} // namespace ImGui
+}; // namespace ImGui
 
 inline ImGui::FileBrowser::FileBrowser(ImGuiFileBrowserFlags flags)
     : width_(700), height_(450), posX_(0), posY_(0), flags_(flags),
@@ -946,10 +946,11 @@ inline std::string ImGui::FileBrowser::u8StrToStr(std::string s)
 #ifndef WIN32_LEAN_AND_MEAN
 
 #define IMGUI_FILEBROWSER_UNDEF_WIN32_LEAN_AND_MEAN
-#define WIN32_LEAN_AND_MEAN
+//#define WIN32_LEAN_AND_MEAN
 
 #endif // #ifndef WIN32_LEAN_AND_MEAN
 
+#define NOMINMAX
 #include <windows.h>
 
 #ifdef IMGUI_FILEBROWSER_UNDEF_WIN32_LEAN_AND_MEAN