fixed models; cut the plane #13

Merged
s464961 merged 1 commits from code_cleanup into master 2023-02-07 20:10:31 +01:00
8 changed files with 25114 additions and 144927 deletions
Showing only changes of commit 4e64a7e1b1 - Show all commits

View File

@ -0,0 +1,15 @@
# Blender MTL File: 'ceramic_vase_02_4k.blend'
# Material Count: 1
newmtl ceramic_vase_02
Ns 225.000000
Ka 1.000000 1.000000 1.000000
Kd 0.800000 0.800000 0.800000
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.450000
d 1.000000
illum 2
map_Bump textures\\ceramic_vase_02_nor_gl_4k.exr
map_Kd textures\\ceramic_vase_02_diff_4k.jpg
map_Ns textures\\ceramic_vase_02_rough_4k.jpg

File diff suppressed because it is too large Load Diff

16
cw 9/models/chair.mtl Normal file
View File

@ -0,0 +1,16 @@
# Blender MTL File: 'painted_wooden_chair_01_4k.blend'
# Material Count: 1
newmtl painted_wooden_chair_01
Ns 225.000000
Ka 1.000000 1.000000 1.000000
Kd 0.800000 0.800000 0.800000
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.450000
d 1.000000
illum 2
map_Bump textures\\painted_wooden_chair_01_nor_gl_4k.exr
map_Kd textures\\painted_wooden_chair_01_diff_4k.jpg
map_Ns textures\\painted_wooden_chair_01_rough_4k.jpg
refl textures\\painted_wooden_chair_01_metal_4k.exr

File diff suppressed because it is too large Load Diff

View File

@ -1,12 +1,16 @@
# Blender MTL File: 'desk.blend'
# Blender MTL File: 'wooden_table_02_4k.blend'
# Material Count: 1
newmtl Material.009
Ns 96.078431
newmtl wooden_table_02
Ns 225.000000
Ka 1.000000 1.000000 1.000000
Kd 0.640000 0.640000 0.640000
Kd 0.800000 0.800000 0.800000
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.000000
Ni 1.450000
d 1.000000
illum 2
map_Bump textures\\wooden_table_02_nor_gl_4k.exr
map_Kd textures\\wooden_table_02_diff_4k.jpg
map_Ns textures\\wooden_table_02_rough_4k.jpg
refl textures\\wooden_table_02_metal_4k.exr

File diff suppressed because it is too large Load Diff

View File

@ -2,10 +2,10 @@
# www.blender.org
mtllib plane.mtl
o Plane
v -5.190380 -0.000000 2.500000
v 5.190380 -0.000000 2.500000
v 5.190380 0.000000 -2.500000
v -5.190380 0.000000 -2.500000
v -4.901168 -0.000000 2.500000
v 4.901168 -0.000000 2.500000
v 4.901168 0.000000 -2.500000
v -4.901168 0.000000 -2.500000
vt 0.000000 0.000000
vt 1.000000 0.000000
vt 1.000000 1.000000

View File

@ -49,6 +49,7 @@ namespace models {
Core::RenderContext easelContext;
Core::RenderContext carContext;
Core::RenderContext flowerContext;
Core::RenderContext vaseContext;
}
namespace texture {
@ -84,7 +85,6 @@ GLuint programSkybox;
Core::Shader_Loader shaderLoader;
Core::RenderContext shipContext;
Core::RenderContext sphereContext;
glm::vec3 sunPos = glm::vec3(-4.740971f, 2.149999f, 0.369280f);
@ -268,20 +268,13 @@ void drawObjectPBR(Core::RenderContext& context, glm::mat4 modelMatrix, glm::vec
glUniform3f(glGetUniformLocation(program, "spotlightColor"), spotlightColor.x, spotlightColor.y, spotlightColor.z);
glUniform1f(glGetUniformLocation(program, "spotlightPhi"), spotlightPhi);
//Core::SetActiveTexture(texture::earth, "colorTexture", program, 2);
//Core::SetActiveTexture(texture::earthNormal, "normalSampler", program, 3);
Core::DrawContext(context);
}
void renderShadowapSun(GLuint depthFBO, glm::mat4 light) {
float time = glfwGetTime();
//uzupelnij o renderowanie glebokosci do tekstury
//ustawianie przestrzeni rysowania
glViewport(0, 0, SHADOW_WIDTH, SHADOW_HEIGHT);
//bindowanie FBO
glBindFramebuffer(GL_FRAMEBUFFER, depthFBO);
//czyszczenie mapy głębokości
glClear(GL_DEPTH_BUFFER_BIT);
//ustawianie programu
glUseProgram(programDepth);
drawObjectDepth(sphereContext, light, glm::translate(pointlightPos) * glm::scale(glm::vec3(0.1)) * glm::eulerAngleY(time / 3) * glm::translate(glm::vec3(4.f, 0, 0)) * glm::scale(glm::vec3(0.3f)));
@ -290,20 +283,14 @@ void renderShadowapSun(GLuint depthFBO, glm::mat4 light) {
light,
glm::translate(pointlightPos) * glm::scale(glm::vec3(0.1)) * glm::eulerAngleY(time / 3) * glm::translate(glm::vec3(4.f, 0, 0)) * glm::eulerAngleY(time) * glm::translate(glm::vec3(1.f, 0, 0)) * glm::scale(glm::vec3(0.1f)));
// draw furniture
drawObjectDepth(models::couchContext, light, glm::scale(glm::vec3(0.5f)) * glm::translate(glm::vec3(8.4f, 0, -0.4f)) * glm::eulerAngleY(3.15f));
//drawObjectPBR(models::couchContext, glm::scale(glm::vec3(0.5f)) * glm::translate(glm::vec3(8.4f, 0, -0.4f)) * glm::eulerAngleY(3.15f), glm::vec3(0.03f, 0.03f, 0.03f), 0.2f, 0.0f);
drawObjectDepth(models::coffeeTableContext, light, glm::translate(glm::vec3(2.8f, 0, 0.5f)));
//drawObjectPBR(models::coffeeTableContext, glm::translate(glm::vec3(2.8f, 0, 0.5f)), glm::vec3(1.f, 1.f, 1.f), 0.4f, 0.0f);
drawObjectDepth(models::doorContext, light, glm::mat4());
//drawObjectPBR(models::doorContext, glm::mat4(), glm::vec3(0.402978f, 0.120509f, 0.057729f), 0.2f, 0.0f);
drawObjectDepth(models::planeContext, light, glm::mat4());
//drawObjectPBR(models::planeContext, glm::mat4(), glm::vec3(0.402978f, 0.120509f, 0.057729f), 0.2f, 0.0f);
drawObjectDepth(models::roomContext, light, glm::mat4());
//drawObjectPBR(models::roomContext, glm::scale(glm::vec3(2.5f, 1.0f, 1.f)), glm::vec3(1.0f, 1.0f, 1.0f), 0.8f, 0.0f);
drawObjectDepth(models::deskContext, light, glm::eulerAngleY(1.57f) * glm::scale(glm::vec3(0.2, 0.2, 0.2)) * glm::translate(glm::vec3(7.5f, 0.0f, -15.0f)));
drawObjectDepth(models::deskContext, light,glm::eulerAngleY(3.14f) * glm::translate(glm::vec3(2.8f, 0.0f, 1.9f)));
drawObjectDepth(models::displayScreenContext, light, glm::scale(glm::vec3(0.1, 0.1, 0.1)) * glm::translate(glm::vec3(-28.5f, 9.0f, -20.0f)));
drawObjectDepth(models::chairContext, light, glm::scale(glm::vec3(0.03, 0.03, 0.03)) * glm::translate(glm::vec3(-100.5f, 0.0f, -35.0f)));
drawObjectDepth(models::chairContext, light, glm::scale(glm::vec3(1.0f, 1.2f, 1.0f)) * glm::eulerAngleY(3.14f) * glm::translate(glm::vec3(2.8f, 0.0f, 1.5f)));
drawObjectDepth(models::ps5Context, light, glm::mat4());
drawObjectDepth(models::tvStandContext, light, glm::mat4());
drawObjectDepth(models::carpetContext, light, glm::mat4());
@ -314,8 +301,8 @@ void renderShadowapSun(GLuint depthFBO, glm::mat4 light) {
drawObjectDepth(models::easelContext, light, glm::mat4());
drawObjectDepth(models::carContext, light, glm::translate(carPosTranform));
drawObjectDepth(models::flowerContext, light, glm::mat4());
drawObjectDepth(models::vaseContext, light, glm::translate(glm::vec3(1.1f, 1.41f, -2.2f)));
// draw windows
drawObjectDepth(models::windowContext, light, glm::scale(glm::vec3(1.0f, 1.0f, 2.3f)) * glm::translate(glm::vec3(-2.9f, 0, -0.2f)));
drawObjectDepth(models::windowContext, light, glm::eulerAngleY(3.14f) * glm::scale(glm::vec3(1.0f, 1.0f, 2.3f)) * glm::translate(glm::vec3(-2.9f, 0, -0.3f)));
drawObjectDepth(models::windowContext, light, glm::eulerAngleY(1.57f) * glm::scale(glm::vec3(1.0f, 1.0f, 2.45f)) * glm::translate(glm::vec3(-0.6f, 0, -0.25f)));
@ -329,11 +316,7 @@ void renderShadowapSun(GLuint depthFBO, glm::mat4 light) {
0.,0.,0.,1.,
});
//drawObjectColor(shipContext,
// glm::translate(cameraPos + 1.5 * cameraDir + cameraUp * -0.5f) * inveseCameraRotrationMatrix * glm::eulerAngleY(glm::pi<float>()),
// glm::vec3(0.3, 0.3, 0.5)
// );
drawObjectDepth(shipContext,
drawObjectDepth(models::spaceshipContext,
light,
glm::translate(spaceshipPos) * specshipCameraRotrationMatrix * glm::eulerAngleY(glm::pi<float>()) * glm::scale(glm::vec3(0.03f))
);
@ -405,7 +388,6 @@ void renderScene(GLFWwindow* window)
drawSkyBox(cubeContext, glm::translate(cameraPos));
//space lamp
if (lightOn) {
glUseProgram(programSun);
glm::mat4 viewProjectionMatrix = createPerspectiveMatrix() * createCameraMatrix();
@ -424,15 +406,14 @@ void renderScene(GLFWwindow* window)
glm::translate(pointlightPos) * glm::scale(glm::vec3(0.1)) * glm::eulerAngleY(time / 3) * glm::translate(glm::vec3(4.f, 0, 0)) * glm::eulerAngleY(time) * glm::translate(glm::vec3(1.f, 0, 0)) * glm::scale(glm::vec3(0.1f)),
glm::vec3(0.5, 0.5, 0.5), 0.7, 0.0);
// draw furniture
drawObjectPBR(models::couchContext, glm::scale(glm::vec3(0.5f)) * glm::translate(glm::vec3(8.4f, 0, -0.4f)) * glm::eulerAngleY(3.15f), glm::vec3(0.03f, 0.03f, 0.03f), 0.2f, 0.0f);
drawObjectPBR(models::coffeeTableContext, glm::translate(glm::vec3(2.8f, 0, 0.5f)), glm::vec3(1.f, 1.f, 1.f), 0.4f, 0.0f);
drawObjectPBR(models::doorContext, glm::mat4(), glm::vec3(0.402978f, 0.120509f, 0.057729f), 0.2f, 0.0f);
drawObjectPBR(models::planeContext, glm::mat4(), glm::vec3(0.402978f, 0.120509f, 0.057729f), 0.2f, 0.0f);
drawObjectPBR(models::roomContext, glm::mat4(), glm::vec3(1.0f, 1.0f, 1.0f), 0.8f, 0.0f);
drawObjectPBR(models::deskContext, glm::eulerAngleY(1.57f) * glm::scale(glm::vec3(0.2, 0.2, 0.2)) * glm::translate(glm::vec3(7.5f, 0.0f, -15.0f)), glm::vec3(1.0f, 1.0f, 1.0f), 0.0f, 0.0f);
drawObjectPBR(models::deskContext, glm::eulerAngleY(3.14f) * glm::translate(glm::vec3(2.8f, 0.0f, 1.9f)), glm::vec3(1.0f, 1.0f, 1.0f), 0.0f, 0.0f);
drawObjectPBR(models::displayScreenContext, glm::scale(glm::vec3(0.1, 0.1, 0.1)) * glm::translate(glm::vec3(-28.5f, 9.0f, -20.0f)), glm::vec3(0.0f, 0.0f, 0.0f), 0.0f, 0.3f);
drawObjectPBR(models::chairContext, glm::scale(glm::vec3(0.03, 0.03, 0.03)) * glm::translate(glm::vec3(-100.5f, 0.0f, -35.0f)), glm::vec3(0.0f, 0.0f, 0.0f), 0.0f, 0.2f);
drawObjectPBR(models::chairContext, glm::scale(glm::vec3(1.0f, 1.2f, 1.0f)) * glm::eulerAngleY(3.14f) * glm::translate(glm::vec3(2.8f, 0.0f, 1.5f)), glm::vec3(0.402978f, 0.120509f, 0.057729f), 0.0f, 0.2f);
drawObjectPBR(models::tvContext, glm::mat4(), glm::vec3(0.0f, 0.0f, 0.0f), 0.0f, 0.2f);
drawObjectPBR(models::ps5Context, glm::mat4(), glm::vec3(0.0f, 0.0f, 0.0f), 0.0f, 0.2f);
drawObjectPBR(models::tvStandContext, glm::mat4(), glm::vec3(1.0f, 1.0f, 1.0f), 0.0f, 0.2f);
@ -445,29 +426,18 @@ void renderScene(GLFWwindow* window)
drawObjectPBR(models::easelContext, glm::mat4(), glm::vec3(0.6745098039215686f, 0.6352941176470588f, 0.6235294117647059f), 0.0f, 0.2f);
drawObjectPBR(models::carContext, glm::translate(carPosTranform), glm::vec3(1.0f, 0.0f, 0.0f), 0.0f, 0.2f);
drawObjectPBR(models::flowerContext, glm::mat4(), glm::vec3(1.0f, 1.0f, 1.0f), 0.0f, 0.2f);
drawObjectPBR(models::vaseContext, glm::translate(glm::vec3(1.1f, 1.41f, -2.2f)), glm::vec3(244.0f/255.0f, 245.0f/255.0f, 220.0f/255.0f), 0.0f, 0.2f);
// draw windows
drawObjectPBR(models::windowContext, glm::scale(glm::vec3(1.0f, 1.0f, 2.3f)) * glm::translate(glm::vec3(-2.9f, 0, -0.2f)), glm::vec3(0.402978f, 0.120509f, 0.057729f), 0.2f, 0.0f);
drawObjectPBR(models::windowContext, glm::eulerAngleY(3.14f) * glm::scale(glm::vec3(1.0f, 1.0f, 2.3f)) * glm::translate(glm::vec3(-2.9f, 0, -0.3f)), glm::vec3(0.402978f, 0.120509f, 0.057729f), 0.2f, 0.0f);
drawObjectPBR(models::windowContext, glm::eulerAngleY(1.57f) * glm::scale(glm::vec3(1.0f, 1.0f, 2.45f)) * glm::translate(glm::vec3(-0.6f, 0, -0.25f)), glm::vec3(0.402978f, 0.120509f, 0.057729f), 0.2f, 0.0f);
//drawObjectColor(shipContext,
// glm::translate(cameraPos + 1.5 * cameraDir + cameraUp * -0.5f) * inveseCameraRotrationMatrix * glm::eulerAngleY(glm::pi<float>()),
// glm::vec3(0.3, 0.3, 0.5)
// );
drawObjectPBR(shipContext,
drawObjectPBR(models::spaceshipContext,
glm::translate(spaceshipPos) * specshipCameraRotrationMatrix * glm::eulerAngleY(glm::pi<float>()) * glm::scale(glm::vec3(0.03f)),
glm::vec3(0.3, 0.3, 0.5),
0.2,1.0
);
//test depth buffer
//glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
//glUseProgram(programTest);
//glActiveTexture(GL_TEXTURE0);
//glBindTexture(GL_TEXTURE_2D, depthMap);
//Core::DrawContext(models::testContext);
glUseProgram(0);
glfwSwapBuffers(window);
}
@ -491,11 +461,6 @@ void loadModelToContext(std::string path, Core::RenderContext& context)
}
std::cout << scene->mNumMeshes << std::endl;
//for (unsigned int i = 0; i < scene->mNumMeshes; i++)
//{
// context.initFromAssimpMesh(scene->mMeshes[i]);
//}
context.initFromAssimpMesh(scene->mMeshes[0]);
}
@ -517,10 +482,10 @@ void init(GLFWwindow* window)
texture::earthNormal = Core::LoadTexture("textures/room/earth_normalmap.png");
loadModelToContext("./models/sphere.obj", sphereContext);
loadModelToContext("./models/spaceship.obj", shipContext);
loadModelToContext("./models/cube.obj", cubeContext);
loadModelToContext("./models/couch.obj", models::couchContext);
loadModelToContext("./models/coffeeTable.obj", models::coffeeTableContext);
loadModelToContext("./models/ceramic_vase_02_4k.obj", models::vaseContext);
loadModelToContext("./models/door.obj", models::doorContext);
loadModelToContext("./models/drawer.obj", models::drawerContext);
loadModelToContext("./models/plane.obj", models::planeContext);
@ -531,7 +496,7 @@ void init(GLFWwindow* window)
loadModelToContext("./models/test.obj", models::testContext);
loadModelToContext("./models/desk.obj", models::deskContext);
loadModelToContext("./models/monitor.obj", models::displayScreenContext);
loadModelToContext("./models/Chair.obj", models::chairContext);
loadModelToContext("./models/chair.obj", models::chairContext);
loadModelToContext("./models/tv/tv.obj", models::tvContext);
loadModelToContext("./models/tv_stand/tv_stand.obj", models::tvStandContext);
loadModelToContext("./models/ps5/ps5.obj", models::ps5Context);
@ -555,7 +520,6 @@ void shutdown(GLFWwindow* window)
shaderLoader.DeleteProgram(program);
}
//obsluga wejscia
void processInput(GLFWwindow* window)
{
glm::vec3 spaceshipSide = glm::normalize(glm::cross(spaceshipDir, glm::vec3(0.f,1.f,0.f)));
@ -603,7 +567,6 @@ void processInput(GLFWwindow* window)
if (glfwGetKey(window, GLFW_KEY_L) == GLFW_PRESS)
lightOn = !lightOn;
// if (glfwGetKey(window, GLFW_KEY_LEFT) == GLFW_PRESS)
if (glfwGetKey(window, GLFW_KEY_UP) == GLFW_PRESS)
carPosTranform += carUp * moveSpeed;
if (glfwGetKey(window, GLFW_KEY_DOWN) == GLFW_PRESS)
@ -612,12 +575,8 @@ void processInput(GLFWwindow* window)
carPosTranform -= carSide * moveSpeed;
if (glfwGetKey(window, GLFW_KEY_RIGHT) == GLFW_PRESS)
carPosTranform += carSide * moveSpeed;
//cameraDir = glm::normalize(-cameraPos);
}
// funkcja jest glowna petla
void renderLoop(GLFWwindow* window) {
while (!glfwWindowShouldClose(window))
{
@ -627,4 +586,3 @@ void renderLoop(GLFWwindow* window) {
glfwPollEvents();
}
}
//}