da się odpalić
This commit is contained in:
parent
cfc84de744
commit
61ffd28002
@ -36,12 +36,14 @@
|
|||||||
<ClInclude Include="src\Texture.h" />
|
<ClInclude Include="src\Texture.h" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<None Include="shaders\shader_bloom.frag" />
|
||||||
|
<None Include="shaders\shader_bloom.vert" />
|
||||||
|
<None Include="shaders\shader_FBO.frag" />
|
||||||
|
<None Include="shaders\shader_FBO.vert" />
|
||||||
<None Include="shaders\shader_pbr.frag" />
|
<None Include="shaders\shader_pbr.frag" />
|
||||||
<None Include="shaders\shader_pbr.vert" />
|
<None Include="shaders\shader_pbr.vert" />
|
||||||
<None Include="shaders\shader_skybox.frag" />
|
<None Include="shaders\shader_skybox.frag" />
|
||||||
<None Include="shaders\shader_skybox.vert" />
|
<None Include="shaders\shader_skybox.vert" />
|
||||||
<None Include="shaders\shader_smap.frag" />
|
|
||||||
<None Include="shaders\shader_smap.vert" />
|
|
||||||
<None Include="shaders\shader_tex.frag" />
|
<None Include="shaders\shader_tex.frag" />
|
||||||
<None Include="shaders\shader_tex.vert" />
|
<None Include="shaders\shader_tex.vert" />
|
||||||
<None Include="shaders\shader_sun.frag" />
|
<None Include="shaders\shader_sun.frag" />
|
||||||
|
@ -57,7 +57,6 @@ namespace textureMaterials {
|
|||||||
GLuint clouds;
|
GLuint clouds;
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
GLuint programDepth;
|
|
||||||
GLuint programTex;
|
GLuint programTex;
|
||||||
GLuint programPbr;
|
GLuint programPbr;
|
||||||
GLuint programSun;
|
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);
|
glUniformMatrix4fv(glGetUniformLocation(programTex, "modelMatrix"), 1, GL_FALSE, (float*)&modelMatrix);
|
||||||
glUniform3f(glGetUniformLocation(programTex, "lightPos"), sunPos.x, sunPos.y, sunPos.z);
|
glUniform3f(glGetUniformLocation(programTex, "lightPos"), sunPos.x, sunPos.y, sunPos.z);
|
||||||
glUniform3f(glGetUniformLocation(programTex, "lightColor"), lightColor.x, lightColor.y, lightColor.z);
|
glUniform3f(glGetUniformLocation(programTex, "lightColor"), lightColor.x, lightColor.y, lightColor.z);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Core::DrawContext(context);
|
Core::DrawContext(context);
|
||||||
|
|
||||||
glUseProgram(0);
|
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) {
|
void drawObjectBloom(Core::RenderContext& context, glm::mat4 modelMatrix, GLuint texture, int amount, bool horizontal, bool first_iteration) {
|
||||||
|
|
||||||
|
|
||||||
glUseProgram(programBlur);
|
glUseProgram(programBlur);
|
||||||
glUniform1i(glGetUniformLocation(programBlur, "screenTexture"), 0);
|
glUniform1i(glGetUniformLocation(programBlur, "screenTexture"), 0);
|
||||||
glm::mat4 viewProjectionMatrix = createPerspectiveMatrix() * createCameraMatrix();
|
glm::mat4 viewProjectionMatrix = createPerspectiveMatrix() * createCameraMatrix();
|
||||||
@ -324,7 +317,7 @@ void renderScene(GLFWwindow* window)
|
|||||||
glm::mat4 planetTranslate = glm::translate(planetPos);
|
glm::mat4 planetTranslate = glm::translate(planetPos);
|
||||||
|
|
||||||
//drawPlanet(sphereContext, planetTranslate * planetRotate * planetScale, planetTex);
|
//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
|
//rysowanie słońca
|
||||||
glm::mat4 sunScale = glm::scale(glm::vec3(sunSize));
|
glm::mat4 sunScale = glm::scale(glm::vec3(sunSize));
|
||||||
@ -340,8 +333,7 @@ void renderScene(GLFWwindow* window)
|
|||||||
drawSkyBox(cubeContext, skyBoxTranslate * skyBoxScale, skyBoxTex);
|
drawSkyBox(cubeContext, skyBoxTranslate * skyBoxScale, skyBoxTex);
|
||||||
|
|
||||||
glBindFramebuffer(hdrFBO, 0);
|
glBindFramebuffer(hdrFBO, 0);
|
||||||
glUseProgram(programBlur);
|
drawObjectBloom(sphereContext, planetTranslate * planetRotate * planetScale, planetTex, 10, true, true);
|
||||||
drawObjectBloom(sphereContext, planetTranslate * planetRotate * planetScale, texture::earth, 10, true, true);
|
|
||||||
|
|
||||||
glfwSwapBuffers(window);
|
glfwSwapBuffers(window);
|
||||||
}
|
}
|
||||||
@ -372,10 +364,8 @@ void init(GLFWwindow* window) {
|
|||||||
initHDR();
|
initHDR();
|
||||||
initBlurFBO();
|
initBlurFBO();
|
||||||
|
|
||||||
programDepth = shaderLoader.CreateProgram("shaders/shader_smap.vert", "shaders/shader_smap.frag");
|
programBlur = shaderLoader.CreateProgram("shaders/shader_bloom.vert", "shaders/shader_bloom.frag");
|
||||||
programBlur = shaderLoader.CreateProgram("shaders/shader_FBO.vert", "shaders/shader_bloom.frag");
|
|
||||||
programFramebuffer = shaderLoader.CreateProgram("shaders/shader_FBO.vert", "shaders/shader_FBO.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");
|
programTex = shaderLoader.CreateProgram("shaders/shader_tex.vert", "shaders/shader_tex.frag");
|
||||||
programPbr = shaderLoader.CreateProgram("shaders/shader_pbr.vert", "shaders/shader_pbr.frag");
|
programPbr = shaderLoader.CreateProgram("shaders/shader_pbr.vert", "shaders/shader_pbr.frag");
|
||||||
programSun = shaderLoader.CreateProgram("shaders/shader_sun.vert", "shaders/shader_sun.frag");
|
programSun = shaderLoader.CreateProgram("shaders/shader_sun.vert", "shaders/shader_sun.frag");
|
||||||
@ -391,7 +381,8 @@ void init(GLFWwindow* window) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void shutdown(GLFWwindow* window) {
|
void shutdown(GLFWwindow* window) {
|
||||||
shaderLoader.DeleteProgram(programDepth);
|
shaderLoader.DeleteProgram(programBlur);
|
||||||
|
shaderLoader.DeleteProgram(programFramebuffer);
|
||||||
shaderLoader.DeleteProgram(programTex);
|
shaderLoader.DeleteProgram(programTex);
|
||||||
shaderLoader.DeleteProgram(programPbr);
|
shaderLoader.DeleteProgram(programPbr);
|
||||||
shaderLoader.DeleteProgram(programSun);
|
shaderLoader.DeleteProgram(programSun);
|
||||||
|
Loading…
Reference in New Issue
Block a user