some textures/skybox changes and turned off flashlight
@ -133,12 +133,12 @@ void main()
|
|||||||
|
|
||||||
//flashlight
|
//flashlight
|
||||||
//vec3 spotlightDir= normalize(spotlightDirTS);
|
//vec3 spotlightDir= normalize(spotlightDirTS);
|
||||||
vec3 spotlightDir= normalize(spotlightPos-worldPos);
|
//vec3 spotlightDir= normalize(spotlightPos-worldPos);
|
||||||
|
|
||||||
|
|
||||||
float angle_atenuation = clamp((dot(-normalize(spotlightPos-worldPos),spotlightConeDir)-0.5)*3,0,1);
|
//float angle_atenuation = clamp((dot(-normalize(spotlightPos-worldPos),spotlightConeDir)-0.5)*3,0,1);
|
||||||
attenuatedlightColor = angle_atenuation*spotlightColor/pow(length(spotlightPos-worldPos),2);
|
//attenuatedlightColor = angle_atenuation*spotlightColor/pow(length(spotlightPos-worldPos),2);
|
||||||
ilumination=ilumination+PBRLight(spotlightDir,attenuatedlightColor,normal,viewDir);
|
//ilumination=ilumination+PBRLight(spotlightDir,attenuatedlightColor,normal,viewDir);
|
||||||
|
|
||||||
//sun
|
//sun
|
||||||
ilumination=ilumination+PBRLight(sunDir,sunColor,normal,viewDir);
|
ilumination=ilumination+PBRLight(sunDir,sunColor,normal,viewDir);
|
||||||
|
@ -135,12 +135,12 @@ void main()
|
|||||||
|
|
||||||
//flashlight
|
//flashlight
|
||||||
//vec3 spotlightDir= normalize(spotlightDirTS);
|
//vec3 spotlightDir= normalize(spotlightDirTS);
|
||||||
vec3 spotlightDir= normalize(spotlightPos-worldPos);
|
//vec3 spotlightDir= normalize(spotlightPos-worldPos);
|
||||||
|
|
||||||
|
|
||||||
float angle_atenuation = clamp((dot(-normalize(spotlightPos-worldPos),spotlightConeDir)-0.5)*3,0,1);
|
//float angle_atenuation = clamp((dot(-normalize(spotlightPos-worldPos),spotlightConeDir)-0.5)*3,0,1);
|
||||||
attenuatedlightColor = angle_atenuation*spotlightColor/pow(length(spotlightPos-worldPos),2);
|
//attenuatedlightColor = angle_atenuation*spotlightColor/pow(length(spotlightPos-worldPos),2);
|
||||||
ilumination=ilumination+PBRLight(spotlightDir,attenuatedlightColor,normal,viewDir);
|
//ilumination=ilumination+PBRLight(spotlightDir,attenuatedlightColor,normal,viewDir);
|
||||||
|
|
||||||
//sun
|
//sun
|
||||||
ilumination=ilumination+PBRLight(sunDir,sunColor,normal,viewDir);
|
ilumination=ilumination+PBRLight(sunDir,sunColor,normal,viewDir);
|
||||||
|
@ -89,12 +89,9 @@ Core::Shader_Loader shaderLoader;
|
|||||||
Core::RenderContext shipContext;
|
Core::RenderContext shipContext;
|
||||||
Core::RenderContext sphereContext;
|
Core::RenderContext sphereContext;
|
||||||
|
|
||||||
glm::vec3 sunPos = glm::vec3(-0.028716f, 2.06441f, 3.84067f);
|
glm::vec3 sunPos = glm::vec3(0.f, 0.f, 0.f);
|
||||||
glm::vec3 sunDir = glm::vec3(-0.93633f, 0.351106f, 0.003226f);
|
glm::vec3 sunDir = glm::vec3(0.f, 4.f, 0.f);
|
||||||
glm::vec3 sunColor = glm::vec3(0.9f, 0.6f, 0.7f) * 5;
|
glm::vec3 sunColor = glm::vec3(0.9f, 0.6f, 0.7f) * 0.15;
|
||||||
glm::vec3 sunColor1 = glm::vec3(0.9f, 0.6f, 0.7f) * 5;
|
|
||||||
glm::vec3 sunColor2 = glm::vec3(1.0f, 0.2f, 0.2f) * 5;
|
|
||||||
glm::vec3 sunColor3 = glm::vec3(1.0f, 0.2f, 0.2f) * 5;
|
|
||||||
|
|
||||||
glm::vec3 cameraPos = glm::vec3(0.479490f, 1.250000f, -2.124680f);
|
glm::vec3 cameraPos = glm::vec3(0.479490f, 1.250000f, -2.124680f);
|
||||||
glm::vec3 cameraDir = glm::vec3(-0.354510f, 0.000000f, 0.935054f);
|
glm::vec3 cameraDir = glm::vec3(-0.354510f, 0.000000f, 0.935054f);
|
||||||
@ -108,12 +105,17 @@ float aspectRatio = 1.f;
|
|||||||
|
|
||||||
float exposition = 1.f;
|
float exposition = 1.f;
|
||||||
|
|
||||||
|
glm::vec3 lampColor = glm::vec3(0.9f, 0.6f, 0.7f) * 5;
|
||||||
|
glm::vec3 lampColor2 = glm::vec3(1.0f, 0.2f, 0.2f) * 5;
|
||||||
|
glm::vec3 lampColor3 = glm::vec3(1.0f, 0.2f, 0.2f) * 5;
|
||||||
|
|
||||||
glm::vec3 pointlightPos = glm::vec3(-3.5, 2.8, 0);
|
glm::vec3 pointlightPos = glm::vec3(-3.5, 2.8, 0);
|
||||||
glm::vec3 pointlightPos2 = glm::vec3(4.5, 2.8, 3);
|
glm::vec3 pointlightPos2 = glm::vec3(4.5, 2.8, 3);
|
||||||
glm::vec3 pointlightPos3 = glm::vec3(4.5, 2.8, -2.99);
|
glm::vec3 pointlightPos3 = glm::vec3(4.5, 2.8, -2.99);
|
||||||
glm::vec3 pointlightColor = glm::vec3(0.9, 0.6, 0.6) * 20;
|
|
||||||
glm::vec3 pointlightColor2 = glm::vec3(1, 0.2, 0.2) * 10;
|
glm::vec3 pointlightColor = glm::vec3(0.9, 0.6, 0.6) * 30;
|
||||||
glm::vec3 pointlightColor3 = glm::vec3(1, 0.2, 0.2) * 10;
|
glm::vec3 pointlightColor2 = glm::vec3(1, 0.2, 0.2) * 20;
|
||||||
|
glm::vec3 pointlightColor3 = glm::vec3(1, 0.2, 0.2) * 20;
|
||||||
|
|
||||||
|
|
||||||
glm::vec3 spotlightPos = glm::vec3(0, 0, 0);
|
glm::vec3 spotlightPos = glm::vec3(0, 0, 0);
|
||||||
@ -150,6 +152,7 @@ unsigned int skyboxIndices[] =
|
|||||||
6, 2, 3
|
6, 2, 3
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
std::string facesCubemap[6] =
|
std::string facesCubemap[6] =
|
||||||
{
|
{
|
||||||
"./textures/skybox/rt.png",
|
"./textures/skybox/rt.png",
|
||||||
@ -159,6 +162,18 @@ std::string facesCubemap[6] =
|
|||||||
"./textures/skybox/ft.png",
|
"./textures/skybox/ft.png",
|
||||||
"./textures/skybox/bk.png"
|
"./textures/skybox/bk.png"
|
||||||
};
|
};
|
||||||
|
*/
|
||||||
|
std::string facesCubemap[6] =
|
||||||
|
{
|
||||||
|
"./textures/skybox/space_lf.png",
|
||||||
|
"./textures/skybox/space_rt.png",
|
||||||
|
"./textures/skybox/space_up.png",
|
||||||
|
"./textures/skybox/space_dn.png",
|
||||||
|
"./textures/skybox/space_ft.png",
|
||||||
|
"./textures/skybox/space_bk.png"
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
unsigned int cubemapTexture;
|
unsigned int cubemapTexture;
|
||||||
|
|
||||||
@ -387,19 +402,19 @@ void renderScene(GLFWwindow* window)
|
|||||||
//glm::mat4 viewProjectionMatrix = createPerspectiveMatrix() * createCameraMatrix();
|
//glm::mat4 viewProjectionMatrix = createPerspectiveMatrix() * createCameraMatrix();
|
||||||
glm::mat4 transformation = viewProjectionMatrix * glm::translate(pointlightPos) * glm::scale(glm::vec3(0.1));
|
glm::mat4 transformation = viewProjectionMatrix * glm::translate(pointlightPos) * glm::scale(glm::vec3(0.1));
|
||||||
glUniformMatrix4fv(glGetUniformLocation(programSun, "transformation"), 1, GL_FALSE, (float*)&transformation);
|
glUniformMatrix4fv(glGetUniformLocation(programSun, "transformation"), 1, GL_FALSE, (float*)&transformation);
|
||||||
glUniform3f(glGetUniformLocation(programSun, "color"), sunColor1.x / 2, sunColor1.y / 2, sunColor1.z / 2);
|
glUniform3f(glGetUniformLocation(programSun, "color"), lampColor.x / 2, lampColor.y / 2, lampColor.z / 2);
|
||||||
glUniform1f(glGetUniformLocation(programSun, "exposition"), exposition);
|
glUniform1f(glGetUniformLocation(programSun, "exposition"), exposition);
|
||||||
Core::DrawContext(sphereContext);
|
Core::DrawContext(sphereContext);
|
||||||
|
|
||||||
glm::mat4 transformation2 = viewProjectionMatrix * glm::translate(pointlightPos2) * glm::scale(glm::vec3(0.1));
|
glm::mat4 transformation2 = viewProjectionMatrix * glm::translate(pointlightPos2) * glm::scale(glm::vec3(0.1));
|
||||||
glUniformMatrix4fv(glGetUniformLocation(programSun, "transformation"), 1, GL_FALSE, (float*)&transformation2);
|
glUniformMatrix4fv(glGetUniformLocation(programSun, "transformation"), 1, GL_FALSE, (float*)&transformation2);
|
||||||
glUniform3f(glGetUniformLocation(programSun, "color"), sunColor2.x / 2, sunColor2.y / 2, sunColor2.z / 2);
|
glUniform3f(glGetUniformLocation(programSun, "color"), lampColor2.x / 2, lampColor2.y / 2, lampColor2.z / 2);
|
||||||
glUniform1f(glGetUniformLocation(programSun, "exposition"), exposition);
|
glUniform1f(glGetUniformLocation(programSun, "exposition"), exposition);
|
||||||
Core::DrawContext(sphereContext);
|
Core::DrawContext(sphereContext);
|
||||||
|
|
||||||
glm::mat4 transformation3 = viewProjectionMatrix * glm::translate(pointlightPos3) * glm::scale(glm::vec3(0.1));
|
glm::mat4 transformation3 = viewProjectionMatrix * glm::translate(pointlightPos3) * glm::scale(glm::vec3(0.1));
|
||||||
glUniformMatrix4fv(glGetUniformLocation(programSun, "transformation"), 1, GL_FALSE, (float*)&transformation3);
|
glUniformMatrix4fv(glGetUniformLocation(programSun, "transformation"), 1, GL_FALSE, (float*)&transformation3);
|
||||||
glUniform3f(glGetUniformLocation(programSun, "color"), sunColor3.x / 2, sunColor3.y / 2, sunColor3.z / 2);
|
glUniform3f(glGetUniformLocation(programSun, "color"), lampColor3.x / 2, lampColor3.y / 2, lampColor3.z / 2);
|
||||||
glUniform1f(glGetUniformLocation(programSun, "exposition"), exposition);
|
glUniform1f(glGetUniformLocation(programSun, "exposition"), exposition);
|
||||||
Core::DrawContext(sphereContext);
|
Core::DrawContext(sphereContext);
|
||||||
|
|
||||||
@ -505,6 +520,9 @@ void renderScene(GLFWwindow* window)
|
|||||||
drawObjectPBRWithTexture(models::door_next_toContext, glm::mat4(), texture::door_next_toTexture, 0.5f, 0.0f);
|
drawObjectPBRWithTexture(models::door_next_toContext, glm::mat4(), texture::door_next_toTexture, 0.5f, 0.0f);
|
||||||
drawObjectPBRWithTexture(models::door_next_to_doorhandleContext, glm::mat4(), texture::door_next_to_doorhandleTexture, 0.5f, 0.0f);
|
drawObjectPBRWithTexture(models::door_next_to_doorhandleContext, glm::mat4(), texture::door_next_to_doorhandleTexture, 0.5f, 0.0f);
|
||||||
|
|
||||||
|
//objects with textures that contain transparency should be drawn here (last)
|
||||||
|
drawObjectPBRWithTexture(models::glassWallContext, glm::mat4(), texture::glassWallTexture, 0.8f, 0.0f);
|
||||||
|
|
||||||
//test depth buffer
|
//test depth buffer
|
||||||
//glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
//glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||||
//glUseProgram(programTest);
|
//glUseProgram(programTest);
|
||||||
@ -512,9 +530,6 @@ void renderScene(GLFWwindow* window)
|
|||||||
//glBindTexture(GL_TEXTURE_2D, depthMap);
|
//glBindTexture(GL_TEXTURE_2D, depthMap);
|
||||||
//Core::DrawContext(models::testContext);
|
//Core::DrawContext(models::testContext);
|
||||||
|
|
||||||
//objects with textures that contain transparency should be drawn here (last)
|
|
||||||
drawObjectPBRWithTexture(models::glassWallContext, glm::mat4(), texture::glassWallTexture, 0.8f, 0.0f);
|
|
||||||
|
|
||||||
glUseProgram(0);
|
glUseProgram(0);
|
||||||
glfwSwapBuffers(window);
|
glfwSwapBuffers(window);
|
||||||
}
|
}
|
||||||
@ -586,11 +601,11 @@ void init(GLFWwindow* window)
|
|||||||
glDisable(GL_BLEND);
|
glDisable(GL_BLEND);
|
||||||
programTex = shaderLoader.CreateProgram("shaders/shader_texture.vert", "shaders/shader_texture.frag");
|
programTex = shaderLoader.CreateProgram("shaders/shader_texture.vert", "shaders/shader_texture.frag");
|
||||||
texture::fishTexture = Core::LoadTexture("textures/fish.png");
|
texture::fishTexture = Core::LoadTexture("textures/fish.png");
|
||||||
texture::roomTexture = Core::LoadTexture("textures/wall.jpg");
|
texture::roomTexture = Core::LoadTexture("textures/roof.jpg");
|
||||||
texture::sofaBaseTexture = Core::LoadTexture("textures/sofa.jpg");
|
texture::sofaBaseTexture = Core::LoadTexture("textures/sofa.jpg");
|
||||||
texture::sofaTexture = Core::LoadTexture("textures/sofa.jpg");
|
texture::sofaTexture = Core::LoadTexture("textures/sofa.jpg");
|
||||||
texture::landTexture = Core::LoadTexture("textures/land.jpg");
|
texture::landTexture = Core::LoadTexture("textures/grass.jpg");
|
||||||
texture::floorTexture = Core::LoadTexture("textures/floor3.png");
|
texture::floorTexture = Core::LoadTexture("textures/floor.png");
|
||||||
texture::roofTexture = Core::LoadTexture("textures/roof.jpg");
|
texture::roofTexture = Core::LoadTexture("textures/roof.jpg");
|
||||||
texture::door1Texture = Core::LoadTexture("textures/Door.jpg");
|
texture::door1Texture = Core::LoadTexture("textures/Door.jpg");
|
||||||
texture::door2Texture = Core::LoadTexture("textures/Door.jpg");
|
texture::door2Texture = Core::LoadTexture("textures/Door.jpg");
|
||||||
|
BIN
cw 9/textures/floor.png
Normal file
After Width: | Height: | Size: 88 KiB |
BIN
cw 9/textures/grass.jpg
Normal file
After Width: | Height: | Size: 270 KiB |
BIN
cw 9/textures/skybox/alt_bk.jpg
Normal file
After Width: | Height: | Size: 118 KiB |
BIN
cw 9/textures/skybox/alt_dn.jpg
Normal file
After Width: | Height: | Size: 17 KiB |
BIN
cw 9/textures/skybox/alt_ft.jpg
Normal file
After Width: | Height: | Size: 125 KiB |
BIN
cw 9/textures/skybox/alt_lf.jpg
Normal file
After Width: | Height: | Size: 100 KiB |
BIN
cw 9/textures/skybox/alt_rt.jpg
Normal file
After Width: | Height: | Size: 134 KiB |
BIN
cw 9/textures/skybox/alt_up.jpg
Normal file
After Width: | Height: | Size: 160 KiB |
BIN
cw 9/textures/skybox/space_bk.png
Normal file
After Width: | Height: | Size: 508 KiB |
BIN
cw 9/textures/skybox/space_dn.png
Normal file
After Width: | Height: | Size: 636 KiB |
BIN
cw 9/textures/skybox/space_ft.png
Normal file
After Width: | Height: | Size: 326 KiB |
BIN
cw 9/textures/skybox/space_lf.png
Normal file
After Width: | Height: | Size: 545 KiB |
BIN
cw 9/textures/skybox/space_rt.png
Normal file
After Width: | Height: | Size: 299 KiB |
BIN
cw 9/textures/skybox/space_up.png
Normal file
After Width: | Height: | Size: 507 KiB |