some textures/skybox changes and turned off flashlight

This commit is contained in:
Maks Kulikowski 2023-02-10 13:29:12 +01:00
parent 155c33cfd5
commit 5ed94d4af3
17 changed files with 41 additions and 26 deletions

View File

@ -133,12 +133,12 @@ void main()
//flashlight
//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);
attenuatedlightColor = angle_atenuation*spotlightColor/pow(length(spotlightPos-worldPos),2);
ilumination=ilumination+PBRLight(spotlightDir,attenuatedlightColor,normal,viewDir);
//float angle_atenuation = clamp((dot(-normalize(spotlightPos-worldPos),spotlightConeDir)-0.5)*3,0,1);
//attenuatedlightColor = angle_atenuation*spotlightColor/pow(length(spotlightPos-worldPos),2);
//ilumination=ilumination+PBRLight(spotlightDir,attenuatedlightColor,normal,viewDir);
//sun
ilumination=ilumination+PBRLight(sunDir,sunColor,normal,viewDir);

View File

@ -135,12 +135,12 @@ void main()
//flashlight
//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);
attenuatedlightColor = angle_atenuation*spotlightColor/pow(length(spotlightPos-worldPos),2);
ilumination=ilumination+PBRLight(spotlightDir,attenuatedlightColor,normal,viewDir);
//float angle_atenuation = clamp((dot(-normalize(spotlightPos-worldPos),spotlightConeDir)-0.5)*3,0,1);
//attenuatedlightColor = angle_atenuation*spotlightColor/pow(length(spotlightPos-worldPos),2);
//ilumination=ilumination+PBRLight(spotlightDir,attenuatedlightColor,normal,viewDir);
//sun
ilumination=ilumination+PBRLight(sunDir,sunColor,normal,viewDir);

View File

@ -89,12 +89,9 @@ Core::Shader_Loader shaderLoader;
Core::RenderContext shipContext;
Core::RenderContext sphereContext;
glm::vec3 sunPos = glm::vec3(-0.028716f, 2.06441f, 3.84067f);
glm::vec3 sunDir = glm::vec3(-0.93633f, 0.351106f, 0.003226f);
glm::vec3 sunColor = glm::vec3(0.9f, 0.6f, 0.7f) * 5;
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 sunPos = glm::vec3(0.f, 0.f, 0.f);
glm::vec3 sunDir = glm::vec3(0.f, 4.f, 0.f);
glm::vec3 sunColor = glm::vec3(0.9f, 0.6f, 0.7f) * 0.15;
glm::vec3 cameraPos = glm::vec3(0.479490f, 1.250000f, -2.124680f);
glm::vec3 cameraDir = glm::vec3(-0.354510f, 0.000000f, 0.935054f);
@ -108,12 +105,17 @@ float aspectRatio = 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 pointlightPos2 = glm::vec3(4.5, 2.8, 3);
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 pointlightColor3 = glm::vec3(1, 0.2, 0.2) * 10;
glm::vec3 pointlightColor = glm::vec3(0.9, 0.6, 0.6) * 30;
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);
@ -150,6 +152,7 @@ unsigned int skyboxIndices[] =
6, 2, 3
};
/*
std::string facesCubemap[6] =
{
"./textures/skybox/rt.png",
@ -159,6 +162,18 @@ std::string facesCubemap[6] =
"./textures/skybox/ft.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;
@ -387,19 +402,19 @@ void renderScene(GLFWwindow* window)
//glm::mat4 viewProjectionMatrix = createPerspectiveMatrix() * createCameraMatrix();
glm::mat4 transformation = viewProjectionMatrix * glm::translate(pointlightPos) * glm::scale(glm::vec3(0.1));
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);
Core::DrawContext(sphereContext);
glm::mat4 transformation2 = viewProjectionMatrix * glm::translate(pointlightPos2) * glm::scale(glm::vec3(0.1));
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);
Core::DrawContext(sphereContext);
glm::mat4 transformation3 = viewProjectionMatrix * glm::translate(pointlightPos3) * glm::scale(glm::vec3(0.1));
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);
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_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
//glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
//glUseProgram(programTest);
@ -512,9 +530,6 @@ void renderScene(GLFWwindow* window)
//glBindTexture(GL_TEXTURE_2D, depthMap);
//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);
glfwSwapBuffers(window);
}
@ -586,11 +601,11 @@ void init(GLFWwindow* window)
glDisable(GL_BLEND);
programTex = shaderLoader.CreateProgram("shaders/shader_texture.vert", "shaders/shader_texture.frag");
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::sofaTexture = Core::LoadTexture("textures/sofa.jpg");
texture::landTexture = Core::LoadTexture("textures/land.jpg");
texture::floorTexture = Core::LoadTexture("textures/floor3.png");
texture::landTexture = Core::LoadTexture("textures/grass.jpg");
texture::floorTexture = Core::LoadTexture("textures/floor.png");
texture::roofTexture = Core::LoadTexture("textures/roof.jpg");
texture::door1Texture = Core::LoadTexture("textures/Door.jpg");
texture::door2Texture = Core::LoadTexture("textures/Door.jpg");

BIN
cw 9/textures/floor.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 88 KiB

BIN
cw 9/textures/grass.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 270 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 118 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 125 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 100 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 134 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 160 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 508 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 636 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 326 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 545 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 299 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 507 KiB