add interactive fan + shadows

This commit is contained in:
s464921 2023-02-11 19:00:49 +01:00
parent 4d3b1f67e4
commit 0a7eb60b12
32 changed files with 103 additions and 50 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -2,7 +2,7 @@
<Project> <Project>
<ProjectOutputs> <ProjectOutputs>
<ProjectOutput> <ProjectOutput>
<FullPath>C:\Users\jedrz\Desktop\graf\GRK_Project\Release\grk-cw9.exe</FullPath> <FullPath>C:\Users\jedrz\Desktop\g\GRK_Project\Release\grk-cw9.exe</FullPath>
</ProjectOutput> </ProjectOutput>
</ProjectOutputs> </ProjectOutputs>
<ContentFiles /> <ContentFiles />

Binary file not shown.

Binary file not shown.

View File

@ -1,69 +1,83 @@
 main.cpp  main.cpp
C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\shared\minwindef.h(130,1): warning C4005: "APIENTRY": ponowna definicja makra C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\shared\minwindef.h(130,1): warning C4005: "APIENTRY": ponowna definicja makra
C:\Users\jedrz\Desktop\graf\GRK_Project\dependencies\glfw-3.3.8.bin.WIN32\include\GLFW\glfw3.h(123): message : zobacz poprzednią definicję „APIENTRY” C:\Users\jedrz\Desktop\g\GRK_Project\dependencies\glfw-3.3.8.bin.WIN32\include\GLFW\glfw3.h(123): message : zobacz poprzednią definicję „APIENTRY”
C:\Users\jedrz\Desktop\graf\GRK_Project\cw 9\src\Collision_System.cpp(87,16): warning C4244: "inicjowanie": konwersja z "float" do "int", możliwa utrata danych C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\Collision_System.cpp(87,16): warning C4244: "inicjowanie": konwersja z "float" do "int", możliwa utrata danych
C:\Users\jedrz\Desktop\graf\GRK_Project\cw 9\src\Collision_System.cpp(88,14): warning C4244: "inicjowanie": konwersja z "float" do "int", możliwa utrata danych C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\Collision_System.cpp(88,14): warning C4244: "inicjowanie": konwersja z "float" do "int", możliwa utrata danych
C:\Users\jedrz\Desktop\graf\GRK_Project\cw 9\src\Collision_System.cpp(90,17): warning C4244: "inicjowanie": konwersja z "float" do "int", możliwa utrata danych C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\Collision_System.cpp(90,17): warning C4244: "inicjowanie": konwersja z "float" do "int", możliwa utrata danych
C:\Users\jedrz\Desktop\graf\GRK_Project\cw 9\src\Collision_System.cpp(91,15): warning C4244: "inicjowanie": konwersja z "float" do "int", możliwa utrata danych C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\Collision_System.cpp(91,15): warning C4244: "inicjowanie": konwersja z "float" do "int", możliwa utrata danych
C:\Users\jedrz\Desktop\graf\GRK_Project\cw 9\src\Collision_System.cpp(100,9): warning C4244: "inicjowanie": konwersja z "float" do "int", możliwa utrata danych C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\Collision_System.cpp(100,9): warning C4244: "inicjowanie": konwersja z "float" do "int", możliwa utrata danych
C:\Users\jedrz\Desktop\graf\GRK_Project\cw 9\src\Collision_System.cpp(101,9): warning C4244: "inicjowanie": konwersja z "float" do "int", możliwa utrata danych C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\Collision_System.cpp(101,9): warning C4244: "inicjowanie": konwersja z "float" do "int", możliwa utrata danych
C:\Users\jedrz\Desktop\graf\GRK_Project\cw 9\src\Collision_System.cpp(111,29): warning C4244: "return": konwersja z "int" do "float", możliwa utrata danych C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\Collision_System.cpp(111,29): warning C4244: "return": konwersja z "int" do "float", możliwa utrata danych
C:\Users\jedrz\Desktop\graf\GRK_Project\cw 9\src\Collision_System.cpp(115,29): warning C4244: "return": konwersja z "int" do "float", możliwa utrata danych C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\Collision_System.cpp(115,29): warning C4244: "return": konwersja z "int" do "float", możliwa utrata danych
C:\Users\jedrz\Desktop\graf\GRK_Project\cw 9\src\ex_9_1.hpp(270,30): warning C4305: "inicjowanie": obcięcie z "double" do "float" C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(302,30): warning C4305: "inicjowanie": obcięcie z "double" do "float"
C:\Users\jedrz\Desktop\graf\GRK_Project\cw 9\src\ex_9_1.hpp(284,17): warning C4101: "data": lokalna zmienna, do której nie istnieje odwołanie C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(319,17): warning C4101: "data": lokalna zmienna, do której nie istnieje odwołanie
C:\Users\jedrz\Desktop\graf\GRK_Project\cw 9\src\ex_9_1.hpp(309,38): warning C4305: "=": obcięcie z "double" do "float" C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(344,38): warning C4305: "=": obcięcie z "double" do "float"
C:\Users\jedrz\Desktop\graf\GRK_Project\cw 9\src\ex_9_1.hpp(338,16): warning C4305: "inicjowanie": obcięcie z "double" do "float" C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(373,16): warning C4305: "inicjowanie": obcięcie z "double" do "float"
C:\Users\jedrz\Desktop\graf\GRK_Project\cw 9\src\ex_9_1.hpp(527,13): warning C4244: "inicjowanie": konwersja z "double" do "float", możliwa utrata danych C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(578,13): warning C4244: "inicjowanie": konwersja z "double" do "float", możliwa utrata danych
C:\Users\jedrz\Desktop\graf\GRK_Project\cw 9\src\ex_9_1.hpp(541,98): warning C4305: "argument": obcięcie z "double" do "T" C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(586,73): warning C4244: "argument": konwersja z "int" do "GLfloat", możliwa utrata danych
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(586,66): warning C4244: "argument": konwersja z "int" do "GLfloat", możliwa utrata danych
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(601,13): warning C4244: "inicjowanie": konwersja z "double" do "float", możliwa utrata danych
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(619,98): warning C4305: "argument": obcięcie z "double" do "T"
with with
[ [
T=float T=float
] ]
C:\Users\jedrz\Desktop\graf\GRK_Project\cw 9\src\ex_9_1.hpp(544,68): warning C4305: "argument": obcięcie z "double" do "T" C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(622,68): warning C4305: "argument": obcięcie z "double" do "T"
with with
[ [
T=float T=float
] ]
C:\Users\jedrz\Desktop\graf\GRK_Project\cw 9\src\ex_9_1.hpp(576,13): warning C4244: "inicjowanie": konwersja z "double" do "float", możliwa utrata danych C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(657,13): warning C4244: "inicjowanie": konwersja z "double" do "float", możliwa utrata danych
C:\Users\jedrz\Desktop\graf\GRK_Project\cw 9\src\ex_9_1.hpp(590,99): warning C4305: "argument": obcięcie z "double" do "T" C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(671,99): warning C4305: "argument": obcięcie z "double" do "T"
with with
[ [
T=float T=float
] ]
C:\Users\jedrz\Desktop\graf\GRK_Project\cw 9\src\ex_9_1.hpp(593,69): warning C4305: "argument": obcięcie z "double" do "T" C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(674,69): warning C4305: "argument": obcięcie z "double" do "T"
with with
[ [
T=float T=float
] ]
C:\Users\jedrz\Desktop\graf\GRK_Project\cw 9\src\ex_9_1.hpp(685,13): warning C4244: "inicjowanie": konwersja z "double" do "float", możliwa utrata danych C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(770,8): warning C4244: "inicjowanie": konwersja z "float" do "int", możliwa utrata danych
C:\Users\jedrz\Desktop\graf\GRK_Project\cw 9\src\ex_9_1.hpp(694,108): warning C4305: "argument": obcięcie z "double" do "T" C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(771,8): warning C4244: "inicjowanie": konwersja z "float" do "int", możliwa utrata danych
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(772,8): warning C4244: "inicjowanie": konwersja z "float" do "int", możliwa utrata danych
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(775,31): warning C4305: "inicjowanie": obcięcie z "double" do "float"
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(776,25): warning C4305: "inicjowanie": obcięcie z "double" do "float"
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(832,8): warning C4244: "inicjowanie": konwersja z "float" do "int", możliwa utrata danych
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(833,8): warning C4244: "inicjowanie": konwersja z "float" do "int", możliwa utrata danych
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(834,8): warning C4244: "inicjowanie": konwersja z "float" do "int", możliwa utrata danych
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(837,31): warning C4305: "inicjowanie": obcięcie z "double" do "float"
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(838,25): warning C4305: "inicjowanie": obcięcie z "double" do "float"
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(944,13): warning C4244: "inicjowanie": konwersja z "double" do "float", możliwa utrata danych
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(957,108): warning C4305: "argument": obcięcie z "double" do "T"
with with
[ [
T=float T=float
] ]
C:\Users\jedrz\Desktop\graf\GRK_Project\cw 9\src\ex_9_1.hpp(702,87): warning C4305: "argument": obcięcie z "double" do "T" C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(966,87): warning C4305: "argument": obcięcie z "double" do "T"
with with
[ [
T=float T=float
] ]
C:\Users\jedrz\Desktop\graf\GRK_Project\cw 9\src\ex_9_1.hpp(702,223): warning C4305: "argument": obcięcie z "double" do "float" C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(966,223): warning C4305: "argument": obcięcie z "double" do "float"
C:\Users\jedrz\Desktop\graf\GRK_Project\cw 9\src\ex_9_1.hpp(705,59): warning C4305: "argument": obcięcie z "double" do "T" C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(967,86): warning C4305: "argument": obcięcie z "double" do "float"
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(968,96): warning C4305: "argument": obcięcie z "double" do "float"
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(988,2): warning C4305: "argument": obcięcie z "double" do "float"
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(1088,108): warning C4305: "argument": obcięcie z "double" do "T"
with with
[ [
T=float T=float
] ]
C:\Users\jedrz\Desktop\graf\GRK_Project\cw 9\src\ex_9_1.hpp(706,37): warning C4305: "argument": obcięcie z "double" do "float" C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(1371,66): warning C4244: "=": konwersja z "double" do "T", możliwa utrata danych
C:\Users\jedrz\Desktop\graf\GRK_Project\cw 9\src\ex_9_1.hpp(726,2): warning C4305: "argument": obcięcie z "double" do "float"
C:\Users\jedrz\Desktop\graf\GRK_Project\cw 9\src\ex_9_1.hpp(825,108): warning C4305: "argument": obcięcie z "double" do "T"
with with
[ [
T=float T=float
] ]
C:\Users\jedrz\Desktop\graf\GRK_Project\cw 9\src\ex_9_1.hpp(1088,21): warning C4305: "-=": obcięcie z "double" do "float" C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(1388,21): warning C4305: "-=": obcięcie z "double" do "float"
C:\Users\jedrz\Desktop\graf\GRK_Project\cw 9\src\ex_9_1.hpp(1090,21): warning C4305: "+=": obcięcie z "double" do "float" C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(1390,21): warning C4305: "+=": obcięcie z "double" do "float"
Trwa generowanie kodu Trwa generowanie kodu
2 of 687 functions ( 0.3%) were compiled, the rest were copied from previous compilation. 2 of 705 functions ( 0.3%) were compiled, the rest were copied from previous compilation.
0 functions were new in current compilation 0 functions were new in current compilation
10 functions had inline decision re-evaluated but remain unchanged 8 functions had inline decision re-evaluated but remain unchanged
Zakończono generowanie kodu Zakończono generowanie kodu
grk-cw9.vcxproj -> C:\Users\jedrz\Desktop\graf\GRK_Project\Release\grk-cw9.exe grk-cw9.vcxproj -> C:\Users\jedrz\Desktop\g\GRK_Project\Release\grk-cw9.exe

View File

@ -1,2 +1,2 @@
PlatformToolSet=v143:VCToolArchitecture=Native32Bit:VCToolsVersion=14.33.31629:TargetPlatformVersion=10.0.19041.0: PlatformToolSet=v143:VCToolArchitecture=Native32Bit:VCToolsVersion=14.33.31629:TargetPlatformVersion=10.0.19041.0:
Release|Win32|C:\Users\jedrz\Desktop\graf\GRK_Project\| Release|Win32|C:\Users\jedrz\Desktop\g\GRK_Project\|

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -154,7 +154,11 @@
<None Include="shaders\shader_tex_pbr_arm.vert"> <None Include="shaders\shader_tex_pbr_arm.vert">
<Filter>Shader Files</Filter> <Filter>Shader Files</Filter>
</None> </None>
<None Include="shaders\shader_bubble.frag" /> <None Include="shaders\shader_bubble.frag">
<None Include="shaders\shader_bubble.vert" /> <Filter>Shader Files</Filter>
</None>
<None Include="shaders\shader_bubble.vert">
<Filter>Shader Files</Filter>
</None>
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@ -78,6 +78,8 @@ namespace models {
Core::RenderContext books1Context; Core::RenderContext books1Context;
Core::RenderContext books2Context; Core::RenderContext books2Context;
Core::RenderContext cactusContext; Core::RenderContext cactusContext;
Core::RenderContext fanContext;
Core::RenderContext fanTopContext;
} }
std::vector<std::string> faces = { std::vector<std::string> faces = {
@ -224,6 +226,7 @@ namespace texture {
GLuint cactus_ao; GLuint cactus_ao;
GLuint cactus_normal; GLuint cactus_normal;
GLuint metal;
} }
GLuint depthMapFBO; GLuint depthMapFBO;
@ -231,6 +234,8 @@ GLuint depthMap;
GLuint depthMapFBO2; GLuint depthMapFBO2;
GLuint depthMap2; GLuint depthMap2;
int speed = 300;
GLuint program; GLuint program;
GLuint programSun; GLuint programSun;
GLuint programTest; GLuint programTest;
@ -267,7 +272,7 @@ glm::vec3 bubbleOriginalLocationInRoom[bubblenumber];
bool bubbleZdirInRoom[bubblenumber]; bool bubbleZdirInRoom[bubblenumber];
bool bubbleXdirInRoom[bubblenumber]; bool bubbleXdirInRoom[bubblenumber];
glm::vec3 sunPos = glm::vec3(-4.740971f, 2.149999f, 0.369280f); glm::vec3 sunPos = glm::vec3(-4.740971f, 2.149999f, -0.069280f);
glm::vec3 sunDir = glm::vec3(-0.93633f, 0.351106, 0.003226f); glm::vec3 sunDir = glm::vec3(-0.93633f, 0.351106, 0.003226f);
glm::vec3 sunPos2 = glm::vec3(4.040971f, 2.149999f, -0.739280f); glm::vec3 sunPos2 = glm::vec3(4.040971f, 2.149999f, -0.739280f);
glm::vec3 sunDir2 = glm::vec3(0.93633f, 0.351106, -0.003226f); glm::vec3 sunDir2 = glm::vec3(0.93633f, 0.351106, -0.003226f);
@ -592,7 +597,7 @@ void drawBubble(glm::mat4 transformSphere) {
} }
void renderShadowapSun() { void renderShadowapSun(float angle) {
float time = glfwGetTime(); float time = glfwGetTime();
glViewport(0, 0, SHADOW_WIDTH, SHADOW_HEIGHT); glViewport(0, 0, SHADOW_WIDTH, SHADOW_HEIGHT);
//uzupelnij o renderowanie glebokosci do tekstury //uzupelnij o renderowanie glebokosci do tekstury
@ -607,6 +612,10 @@ void renderShadowapSun() {
//ustawianie programu //ustawianie programu
glUseProgram(programDepth); glUseProgram(programDepth);
glm::mat4 p1 = glm::translate(glm::mat4(), -glm::vec3(-2.103f, 1.0699f, -2.3338f));
glm::mat4 p2 = glm::translate(glm::mat4(), glm::vec3(-2.103f, 1.0699f, -2.3338f));
glm::mat4 rotate = p2 * glm::rotate(glm::mat4(), glm::radians(angle * speed), glm::vec3(1, 0, 0)) * p1;
drawObjectDepth(sphereContext, lightVP, 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))); drawObjectDepth(sphereContext, lightVP, 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)));
drawObjectDepth(sphereContext, drawObjectDepth(sphereContext,
@ -637,6 +646,9 @@ void renderShadowapSun() {
drawObjectDepth(models::books1Context, lightVP, glm::mat4()); drawObjectDepth(models::books1Context, lightVP, glm::mat4());
drawObjectDepth(models::books2Context, lightVP, glm::mat4()); drawObjectDepth(models::books2Context, lightVP, glm::mat4());
drawObjectDepth(models::cactusContext, lightVP, glm::mat4()); drawObjectDepth(models::cactusContext, lightVP, glm::mat4());
drawObjectDepth(models::fanContext, lightVP,glm::mat4());
drawObjectDepth(models::fanTopContext, lightVP, glm::mat4()*rotate);
drawObjectDepth(models::tableContext, lightVP, glm::mat4());
glBindFramebuffer(GL_FRAMEBUFFER, 0); glBindFramebuffer(GL_FRAMEBUFFER, 0);
glViewport(0, 0, WIDTH, HEIGHT); glViewport(0, 0, WIDTH, HEIGHT);
} }
@ -686,6 +698,10 @@ void renderShadowapSun2() {
drawObjectDepth(models::books1Context, lightVP2, glm::mat4()); drawObjectDepth(models::books1Context, lightVP2, glm::mat4());
drawObjectDepth(models::books2Context, lightVP2, glm::mat4()); drawObjectDepth(models::books2Context, lightVP2, glm::mat4());
drawObjectDepth(models::cactusContext, lightVP2, glm::mat4()); drawObjectDepth(models::cactusContext, lightVP2, glm::mat4());
drawObjectDepth(models::fanContext, lightVP2, glm::mat4());
drawObjectDepth(models::fanTopContext, lightVP2, glm::mat4());
drawObjectDepth(models::tableContext, lightVP2, glm::mat4());
glBindFramebuffer(GL_FRAMEBUFFER, 0); glBindFramebuffer(GL_FRAMEBUFFER, 0);
glViewport(0, 0, WIDTH, HEIGHT); glViewport(0, 0, WIDTH, HEIGHT);
@ -927,8 +943,12 @@ void renderScene(GLFWwindow* window)
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
float time = glfwGetTime(); float time = glfwGetTime();
updateDeltaTime(time); updateDeltaTime(time);
float angle = 0;
renderShadowapSun(); angle += static_cast<float>(glfwGetTime());
glm::mat4 p1 = glm::translate(glm::mat4(), -glm::vec3(-2.103f, 1.0699f, -2.3338f));
glm::mat4 p2 = glm::translate(glm::mat4(), glm::vec3(-2.103f, 1.0699f, -2.3338f));
glm::mat4 rotate = p2 * glm::rotate(glm::mat4(), glm::radians(angle * speed), glm::vec3(1, 0, 0)) * p1;
renderShadowapSun(angle);
renderShadowapSun2(); renderShadowapSun2();
//space lamp //space lamp
@ -941,9 +961,11 @@ void renderScene(GLFWwindow* window)
Core::DrawContext(sphereContext); Core::DrawContext(sphereContext);
drawSkybox(models::cubeContext, createPerspectiveMatrix() * glm::mat4(glm::mat3(createCameraMatrix())), skyboxTexture); drawSkybox(models::cubeContext, createPerspectiveMatrix() * glm::mat4(glm::mat3(createCameraMatrix())), skyboxTexture);
glUseProgram(program); glUseProgram(program);
glm::mat4 transform(1.0f);
//transform = glm::rotate(glm::mat4(), angle, glm::vec3(1.0f, 0.0f, 0.0f));
drawObjectPBR(sphereContext, 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)), glm::vec3(0.2, 0.7, 0.3), 0.3, 0.0); drawObjectPBR(sphereContext, 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)), glm::vec3(0.2, 0.7, 0.3), 0.3, 0.0);
drawObjectPBR(models::fanContext, glm::mat4(), glm::vec3(0.01, 0.01, 0.01), 0.1, 0.2);
drawObjectPBR(models::fanTopContext, glm::mat4()*rotate, glm::vec3(0.01, 0.01, 0.01), 0.1, 0.2);
glm::vec3 spaceshipSide = glm::normalize(glm::cross(spaceshipDir, glm::vec3(0.f, 1.f, 0.f))); glm::vec3 spaceshipSide = glm::normalize(glm::cross(spaceshipDir, glm::vec3(0.f, 1.f, 0.f)));
glm::vec3 spaceshipUp = glm::normalize(glm::cross(spaceshipSide, spaceshipDir)); glm::vec3 spaceshipUp = glm::normalize(glm::cross(spaceshipSide, spaceshipDir));
@ -975,7 +997,7 @@ void renderScene(GLFWwindow* window)
drawObjectTex(models::screenContext, glm::mat4(), 0, 0, texture::screen); drawObjectTex(models::screenContext, glm::mat4(), 0, 0, texture::screen);
glUseProgram(programTexPBR); glUseProgram(programTexPBR);
//drawObjectTexPBR(models::deskContext, glm::mat4(), texture::table_roughness, texture::table_metallic, texture::table_albedo, texture::table_normal, texture::table_ao); drawObjectTexPBR(models::tableContext, glm::mat4(), texture::table_roughness, texture::table_metallic, texture::table_albedo, texture::table_normal, texture::table_ao);
drawObjectTexPBR(models::bedContext, glm::mat4(), texture::wood_roughness, texture::wood_metallic, texture::wood_albedo, texture::wood_normal, texture::wood_ao); drawObjectTexPBR(models::bedContext, glm::mat4(), texture::wood_roughness, texture::wood_metallic, texture::wood_albedo, texture::wood_normal, texture::wood_ao);
drawObjectTexPBR(models::mattressContext, glm::mat4(), texture::sheets_roughness, texture::sheets_metallic, texture::sheets_albedo, texture::sheets_normal, texture::sheets_ao); drawObjectTexPBR(models::mattressContext, glm::mat4(), texture::sheets_roughness, texture::sheets_metallic, texture::sheets_albedo, texture::sheets_normal, texture::sheets_ao);
drawObjectTexPBR(models::bed_pillowContext, glm::mat4(), texture::sheets_roughness, texture::sheets_metallic, texture::sheets_albedo, texture::sheets_normal, texture::sheets_ao); drawObjectTexPBR(models::bed_pillowContext, glm::mat4(), texture::sheets_roughness, texture::sheets_metallic, texture::sheets_albedo, texture::sheets_normal, texture::sheets_ao);
@ -1083,11 +1105,11 @@ void init(GLFWwindow* window)
water.readOBJ("./models/plane2.obj"); water.readOBJ("./models/plane2.obj");
texture::water = Core::LoadTexture("textures/test.png"); texture::water = Core::LoadTexture("textures/test.png");
texture::rust = Core::LoadTexture("textures/rust.jpg"); texture::rust = Core::LoadTexture("textures/rust.jpg");
texture::table_albedo = Core::LoadTexture("textures/table_albedo.png"); texture::table_albedo = Core::LoadTexture("textures/table/albedo.png");
texture::table_metallic = Core::LoadTexture("textures/table_metallic.png"); texture::table_metallic = Core::LoadTexture("textures/table/metallic.png");
texture::table_roughness = Core::LoadTexture("textures/table_roughness.png"); texture::table_roughness = Core::LoadTexture("textures/table/roughness.png");
texture::table_ao = Core::LoadTexture("textures/table_ao.png"); texture::table_ao = Core::LoadTexture("textures/table/ao.png");
texture::table_normal = Core::LoadTexture("textures/table_normal.jpg"); texture::table_normal = Core::LoadTexture("textures/table/normal.png");
texture::wood_albedo = Core::LoadTexture("textures/wood_albedo.jpg"); texture::wood_albedo = Core::LoadTexture("textures/wood_albedo.jpg");
texture::wood_metallic = Core::LoadTexture("textures/wood_metallic.jpg"); texture::wood_metallic = Core::LoadTexture("textures/wood_metallic.jpg");
texture::wood_roughness = Core::LoadTexture("textures/wood_roughness.jpg"); texture::wood_roughness = Core::LoadTexture("textures/wood_roughness.jpg");
@ -1210,6 +1232,8 @@ void init(GLFWwindow* window)
texture::cactus_roughness = Core::LoadTexture("textures/cactus/roughness.png"); texture::cactus_roughness = Core::LoadTexture("textures/cactus/roughness.png");
texture::cactus_ao = Core::LoadTexture("textures/cactus/ao.png"); texture::cactus_ao = Core::LoadTexture("textures/cactus/ao.png");
texture::cactus_normal = Core::LoadTexture("textures/cactus/normal.png"); texture::cactus_normal = Core::LoadTexture("textures/cactus/normal.png");
texture::metal = Core::LoadTexture("textures/metal.png");
loadModelToContext("models/bubble.obj", bubbleContext, false); loadModelToContext("models/bubble.obj", bubbleContext, false);
loadModelToContext("./models/sphere.obj", sphereContext, false); loadModelToContext("./models/sphere.obj", sphereContext, false);
loadModelToContext("./models/spaceship.obj", shipContext, false); loadModelToContext("./models/spaceship.obj", shipContext, false);
@ -1228,7 +1252,7 @@ void init(GLFWwindow* window)
//loadModelToContext("./models/window.obj", models::windowContext, true); //loadModelToContext("./models/window.obj", models::windowContext, true);
loadModelToContext("./models/test.obj", models::testContext, false); loadModelToContext("./models/test.obj", models::testContext, false);
loadModelToContext("./models/cube.obj", models::cubeContext, false); loadModelToContext("./models/cube.obj", models::cubeContext, false);
//loadModelToContext("./models/table.obj", models::tableContext, false); loadModelToContext("./models/tab.obj", models::tableContext, false);
loadModelToContext("./models/wall.obj", models::wallContext, false); loadModelToContext("./models/wall.obj", models::wallContext, false);
loadModelToContext("./models/roof.obj", models::roofContext, false); loadModelToContext("./models/roof.obj", models::roofContext, false);
loadModelToContext("./models/window.obj", models::windowContext, true); loadModelToContext("./models/window.obj", models::windowContext, true);
@ -1261,6 +1285,8 @@ void init(GLFWwindow* window)
loadModelToContext("./models/cactus.obj", models::cactusContext, false); loadModelToContext("./models/cactus.obj", models::cactusContext, false);
loadModelToContext("./models/books1.obj", models::books1Context, false); loadModelToContext("./models/books1.obj", models::books1Context, false);
loadModelToContext("./models/books2.obj", models::books2Context, false); loadModelToContext("./models/books2.obj", models::books2Context, false);
loadModelToContext("./models/fan.obj", models::fanContext, false);
loadModelToContext("./models/fan_top.obj", models::fanTopContext, false);
collisionSystem.calculateSceneBounding(); collisionSystem.calculateSceneBounding();
@ -1322,7 +1348,7 @@ void processInput(GLFWwindow* window)
texture::screen = Core::LoadTexture("textures/visual.png"); texture::screen = Core::LoadTexture("textures/visual.png");
PlaySound(TEXT("sound/ocean.wav"), NULL, SND_ASYNC|SND_LOOP); PlaySound(TEXT("sound/ocean.wav"), NULL, SND_ASYNC|SND_LOOP);
} }
if (glfwGetKey(window, GLFW_KEY_K) == GLFW_PRESS) { if (glfwGetKey(window, GLFW_KEY_R) == GLFW_PRESS) {
for (int i = 0; i < bubbleQuantity; i++) for (int i = 0; i < bubbleQuantity; i++)
{ {
// srand(time(NULL)); // srand(time(NULL));
@ -1373,6 +1399,15 @@ void processInput(GLFWwindow* window)
float z = collisionSystem.getRelativeZ(spaceshipPos.z); float z = collisionSystem.getRelativeZ(spaceshipPos.z);
printf("matrix[%ff][%ff]\n", z, x); printf("matrix[%ff][%ff]\n", z, x);
} }
if (glfwGetKey(window, GLFW_KEY_I) == GLFW_PRESS) {
speed = 0;
}
if (glfwGetKey(window, GLFW_KEY_O) == GLFW_PRESS) {
speed = 300;
}
if (glfwGetKey(window, GLFW_KEY_P) == GLFW_PRESS) {
speed = 600;
}
//cameraDir = glm::normalize(-cameraPos); //cameraDir = glm::normalize(-cameraPos);
} }

BIN
cw 9/textures/metal.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 MiB

BIN
cw 9/textures/table/ao.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 298 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 MiB