From 61ffd280022e1261e84d558dda35da65ed73d7fe Mon Sep 17 00:00:00 2001 From: K4RP4T Date: Sat, 27 Jan 2024 20:39:27 +0100 Subject: [PATCH] =?UTF-8?q?da=20si=C4=99=20odpali=C4=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- grk/cw 6/grk-cw6.vcxproj | 6 ++++-- grk/cw 6/src/Planet.hpp | 19 +++++-------------- 2 files changed, 9 insertions(+), 16 deletions(-) diff --git a/grk/cw 6/grk-cw6.vcxproj b/grk/cw 6/grk-cw6.vcxproj index 98c4fe8..64b1ad9 100644 --- a/grk/cw 6/grk-cw6.vcxproj +++ b/grk/cw 6/grk-cw6.vcxproj @@ -36,12 +36,14 @@ + + + + - - diff --git a/grk/cw 6/src/Planet.hpp b/grk/cw 6/src/Planet.hpp index 0672567..fdce6c9 100644 --- a/grk/cw 6/src/Planet.hpp +++ b/grk/cw 6/src/Planet.hpp @@ -57,7 +57,6 @@ namespace textureMaterials { GLuint clouds; } */ -GLuint programDepth; GLuint programTex; GLuint programPbr; GLuint programSun; @@ -209,11 +208,7 @@ void drawPlanet(Core::RenderContext& context, glm::mat4 modelMatrix, GLuint text glUniformMatrix4fv(glGetUniformLocation(programTex, "modelMatrix"), 1, GL_FALSE, (float*)&modelMatrix); glUniform3f(glGetUniformLocation(programTex, "lightPos"), sunPos.x, sunPos.y, sunPos.z); glUniform3f(glGetUniformLocation(programTex, "lightColor"), lightColor.x, lightColor.y, lightColor.z); - - - Core::DrawContext(context); - glUseProgram(0); } @@ -231,8 +226,6 @@ void drawSun(Core::RenderContext& context, glm::mat4 modelMatrix, GLuint texture } void drawObjectBloom(Core::RenderContext& context, glm::mat4 modelMatrix, GLuint texture, int amount, bool horizontal, bool first_iteration) { - - glUseProgram(programBlur); glUniform1i(glGetUniformLocation(programBlur, "screenTexture"), 0); glm::mat4 viewProjectionMatrix = createPerspectiveMatrix() * createCameraMatrix(); @@ -324,7 +317,7 @@ void renderScene(GLFWwindow* window) glm::mat4 planetTranslate = glm::translate(planetPos); //drawPlanet(sphereContext, planetTranslate * planetRotate * planetScale, planetTex); - drawObjectPBR(sphereContext, planetTranslate * planetRotate * planetScale, planetTex, planetRough, planetMetal); + //drawObjectPBR(sphereContext, planetTranslate * planetRotate * planetScale, planetTex, planetRough, planetMetal); //rysowanie słońca glm::mat4 sunScale = glm::scale(glm::vec3(sunSize)); @@ -340,8 +333,7 @@ void renderScene(GLFWwindow* window) drawSkyBox(cubeContext, skyBoxTranslate * skyBoxScale, skyBoxTex); glBindFramebuffer(hdrFBO, 0); - glUseProgram(programBlur); - drawObjectBloom(sphereContext, planetTranslate * planetRotate * planetScale, texture::earth, 10, true, true); + drawObjectBloom(sphereContext, planetTranslate * planetRotate * planetScale, planetTex, 10, true, true); glfwSwapBuffers(window); } @@ -372,10 +364,8 @@ void init(GLFWwindow* window) { initHDR(); initBlurFBO(); - programDepth = shaderLoader.CreateProgram("shaders/shader_smap.vert", "shaders/shader_smap.frag"); - programBlur = shaderLoader.CreateProgram("shaders/shader_FBO.vert", "shaders/shader_bloom.frag"); + programBlur = shaderLoader.CreateProgram("shaders/shader_bloom.vert", "shaders/shader_bloom.frag"); programFramebuffer = shaderLoader.CreateProgram("shaders/shader_FBO.vert", "shaders/shader_FBO.frag"); - program = shaderLoader.CreateProgram("shaders/shader.vert", "shaders/shader.frag"); programTex = shaderLoader.CreateProgram("shaders/shader_tex.vert", "shaders/shader_tex.frag"); programPbr = shaderLoader.CreateProgram("shaders/shader_pbr.vert", "shaders/shader_pbr.frag"); programSun = shaderLoader.CreateProgram("shaders/shader_sun.vert", "shaders/shader_sun.frag"); @@ -391,7 +381,8 @@ void init(GLFWwindow* window) { } void shutdown(GLFWwindow* window) { - shaderLoader.DeleteProgram(programDepth); + shaderLoader.DeleteProgram(programBlur); + shaderLoader.DeleteProgram(programFramebuffer); shaderLoader.DeleteProgram(programTex); shaderLoader.DeleteProgram(programPbr); shaderLoader.DeleteProgram(programSun);