100% final

This commit is contained in:
s464921 2023-02-12 14:47:40 +01:00
parent 18e6ebc7af
commit fabeef2cd6
16 changed files with 179 additions and 46 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -9,77 +9,88 @@ C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\Collision_System.cpp(100,9): warni
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\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\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\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\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\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\g\GRK_Project\cw 9\src\ex_9_1.hpp(338,30): warning C4305: "inicjowanie": obcięcie z "double" do "float" C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(337,30): warning C4305: "inicjowanie": obcięcie z "double" do "float"
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(355,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(375,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(380,38): warning C4305: "=": obcięcie z "double" do "float" C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(400,38): warning C4305: "=": obcięcie z "double" do "float"
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(409,16): warning C4305: "inicjowanie": obcięcie z "double" do "float" C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(429,16): warning C4305: "inicjowanie": obcięcie z "double" do "float"
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(614,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(642,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(622,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(650,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(622,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(650,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(637,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(665,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(655,98): warning C4305: "argument": obcięcie z "double" do "T" C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(683,98): warning C4305: "argument": obcięcie z "double" do "T"
with with
[ [
T=float T=float
] ]
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(658,68): warning C4305: "argument": obcięcie z "double" do "T" C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(686,68): warning C4305: "argument": obcięcie z "double" do "T"
with with
[ [
T=float T=float
] ]
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(702,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(731,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(716,99): warning C4305: "argument": obcięcie z "double" do "T" C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(745,99): warning C4305: "argument": obcięcie z "double" do "T"
with with
[ [
T=float T=float
] ]
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(719,69): warning C4305: "argument": obcięcie z "double" do "T" C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(748,69): warning C4305: "argument": obcięcie z "double" do "T"
with with
[ [
T=float T=float
] ]
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(822,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(793,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(823,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(807,99): warning C4305: "argument": obcięcie z "double" do "T"
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(824,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(827,31): warning C4305: "inicjowanie": obcięcie z "double" do "float"
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(828,25): warning C4305: "inicjowanie": obcięcie z "double" do "float"
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(884,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(885,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(886,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(889,31): warning C4305: "inicjowanie": obcięcie z "double" do "float"
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(890,25): warning C4305: "inicjowanie": obcięcie z "double" do "float"
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(996,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(1009,108): warning C4305: "argument": obcięcie z "double" do "T"
with with
[ [
T=float T=float
] ]
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(1018,87): warning C4305: "argument": obcięcie z "double" do "T" C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(810,69): warning C4305: "argument": obcięcie z "double" do "T"
with with
[ [
T=float T=float
] ]
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(1018,223): warning C4305: "argument": obcięcie z "double" do "float" C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(934,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(1047,73): warning C4305: "argument": obcięcie z "double" do "float" C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(935,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(1051,81): warning C4305: "argument": obcięcie z "double" do "float" C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(936,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(1052,93): warning C4305: "argument": obcięcie z "double" do "float" C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(939,31): warning C4305: "inicjowanie": obcięcie z "double" do "float"
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(1053,83): warning C4305: "argument": obcięcie z "double" do "float" C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(940,25): warning C4305: "inicjowanie": obcięcie z "double" do "float"
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(1054,83): warning C4305: "argument": obcięcie z "double" do "float" C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(996,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(1149,108): warning C4305: "argument": obcięcie z "double" do "T" C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(997,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(998,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(1001,31): warning C4305: "inicjowanie": obcięcie z "double" do "float"
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(1002,25): warning C4305: "inicjowanie": obcięcie z "double" do "float"
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(1108,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(1122,108): warning C4305: "argument": obcięcie z "double" do "T"
with with
[ [
T=float T=float
] ]
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(1470,66): warning C4244: "=": konwersja z "double" do "T", możliwa utrata danych C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(1131,87): warning C4305: "argument": obcięcie z "double" do "T"
with with
[ [
T=float T=float
] ]
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(1487,21): warning C4305: "-=": obcięcie z "double" do "float" C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(1131,223): warning C4305: "argument": obcięcie z "double" do "float"
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(1489,21): warning C4305: "+=": obcięcie z "double" do "float" C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(1160,73): warning C4305: "argument": obcięcie z "double" do "float"
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(1164,81): warning C4305: "argument": obcięcie z "double" do "float"
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(1165,93): warning C4305: "argument": obcięcie z "double" do "float"
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(1166,83): warning C4305: "argument": obcięcie z "double" do "float"
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(1167,83): warning C4305: "argument": obcięcie z "double" do "float"
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(1263,108): warning C4305: "argument": obcięcie z "double" do "T"
with
[
T=float
]
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(1592,66): warning C4244: "=": konwersja z "double" do "T", możliwa utrata danych
with
[
T=float
]
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(1609,21): warning C4305: "-=": obcięcie z "double" do "float"
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(1611,21): warning C4305: "+=": obcięcie z "double" do "float"
Trwa generowanie kodu Trwa generowanie kodu
1 of 717 functions ( 0.1%) were compiled, the rest were copied from previous compilation. 1 of 723 functions ( 0.1%) were compiled, the rest were copied from previous compilation.
0 functions were new in current compilation 0 functions were new in current compilation
7 functions had inline decision re-evaluated but remain unchanged 9 functions had inline decision re-evaluated but remain unchanged
Zakończono generowanie kodu Zakończono generowanie kodu
grk-cw9.vcxproj -> C:\Users\jedrz\Desktop\g\GRK_Project\Release\grk-cw9.exe grk-cw9.vcxproj -> C:\Users\jedrz\Desktop\g\GRK_Project\Release\grk-cw9.exe

Binary file not shown.

View File

@ -92,6 +92,7 @@ namespace models {
Core::RenderContext painting2Context; Core::RenderContext painting2Context;
Core::RenderContext mug2Context; Core::RenderContext mug2Context;
Core::RenderContext bookContext; Core::RenderContext bookContext;
Core::RenderContext lampContext;
} }
std::vector<std::string> faces = { std::vector<std::string> faces = {
@ -263,12 +264,20 @@ namespace texture {
GLuint spray_roughness; GLuint spray_roughness;
GLuint spray_ao; GLuint spray_ao;
GLuint spray_normal; GLuint spray_normal;
GLuint lamp_albedo;
GLuint lamp_metallic;
GLuint lamp_ao;
GLuint lamp_roughness;
GLuint lamp_normal;
} }
GLuint depthMapFBO; GLuint depthMapFBO;
GLuint depthMap; GLuint depthMap;
GLuint depthMapFBO2; GLuint depthMapFBO2;
GLuint depthMap2; GLuint depthMap2;
GLuint depthMapFBO3;
GLuint depthMap3;
int speed = 300; int speed = 300;
@ -325,17 +334,28 @@ GLuint VAO, VBO;
float aspectRatio = 1.f; float aspectRatio = 1.f;
float exposition = 1.f; float exposition = 1.f;
float spotlightPhi = 3.14 / 4;
glm::vec3 spotlightPos = glm::vec3(1.5, 1.15, -1.1);
glm::vec3 spotlightConeDir = glm::vec3(0, -1, 0);
glm::vec3 spotlightColor = glm::vec3(0.4, 0.4, 0.9) * 3;
glm::mat4 lightVP = glm::ortho(-3.f, 2.3f, -1.3f, 3.f, -1.0f, 40.0f) * glm::lookAt(sunPos, sunPos - sunDir, glm::vec3(0, 1, 0)); glm::mat4 lightVP = glm::ortho(-3.f, 2.3f, -1.3f, 3.f, -1.0f, 40.0f) * glm::lookAt(sunPos, sunPos - sunDir, glm::vec3(0, 1, 0));
glm::mat4 lightVP2 = glm::ortho(-3.f, 2.3f, -1.3f, 3.f, -1.0f, 40.0f) * glm::lookAt(sunPos2, sunPos2 - sunDir2, glm::vec3(0, 1, 0)); glm::mat4 lightVP2 = glm::ortho(-3.f, 2.3f, -1.3f, 3.f, -1.0f, 40.0f) * glm::lookAt(sunPos2, sunPos2 - sunDir2, glm::vec3(0, 1, 0));
glm::mat4 lightVP3 = glm::ortho(-3.f, 2.3f, -1.3f, 3.f, -1.0f, 40.0f) * glm::lookAt(spotlightPos, spotlightPos - spotlightConeDir, glm::vec3(0, 1, 0));
//glm::mat4 lightVP3 = glm::ortho(-10.0f,10.0f,-10.0f,10.0f,0.1f,10.f) * glm::lookAt(spotlightPos, -spotlightConeDir,glm::vec3(0.0,1.0,0.0));
glm::mat4 ort = glm::ortho(-3.0f, 3.0f, -3.0f, 3.0f, 0.1f, 3.0f);
glm::mat4 lightView = glm::lookAt(spotlightPos, spotlightPos+spotlightConeDir, glm::vec3(0.0, 1.0, 0.0));
//glm::mat4 lightVP3 = glm::perspective(glm::radians(180.0f), 1.0f, 0.05f, 25.0f) * glm::lookAt(spotlightPos, spotlightPos - spotlightConeDir, glm::vec3(0, 1, 0));
//glm::mat4 lightVP3 = ort * lightView;
glm::vec3 pointlightPos = glm::vec3(0, 2, 0); glm::vec3 pointlightPos = glm::vec3(0, 2, 0);
glm::vec3 pointlightColor = glm::vec3(0.9, 0.6, 0.6); glm::vec3 pointlightColor = glm::vec3(0.9, 0.6, 0.6);
glm::vec3 spotlightPos = glm::vec3(0, 0, 0); //glm::vec3 spotlightPos = glm::vec3(0, 0, 0);
glm::vec3 spotlightConeDir = glm::vec3(0, 0, 0); //glm::vec3 spotlightConeDir = glm::vec3(0, 0, 0);
glm::vec3 spotlightColor = glm::vec3(0.4, 0.4, 0.9) * 3; //glm::vec3 spotlightColor = glm::vec3(0.4, 0.4, 0.9) * 3;
float spotlightPhi = 3.14 / 4;
glm::vec3 lightPos = glm::vec3(-8, 4, 2); glm::vec3 lightPos = glm::vec3(-8, 4, 2);
@ -456,6 +476,8 @@ void drawObjectPBR(Core::RenderContext& context, glm::mat4 modelMatrix, glm::vec
Core::SetActiveTexture(depthMap, "depthMap", program, 0); Core::SetActiveTexture(depthMap, "depthMap", program, 0);
glUniformMatrix4fv(glGetUniformLocation(program, "LightVP2"), 1, GL_FALSE, (float*)&lightVP2); glUniformMatrix4fv(glGetUniformLocation(program, "LightVP2"), 1, GL_FALSE, (float*)&lightVP2);
Core::SetActiveTexture(depthMap2, "depthMap2", program, 1); Core::SetActiveTexture(depthMap2, "depthMap2", program, 1);
glUniformMatrix4fv(glGetUniformLocation(program, "LightVP3"), 1, GL_FALSE, (float*)&lightVP3);
Core::SetActiveTexture(depthMap3, "depthMap3", program, 2);
Core::DrawContext(context); Core::DrawContext(context);
} }
@ -496,6 +518,8 @@ void drawObjectTex(Core::RenderContext& context, glm::mat4 modelMatrix, float ro
Core::SetActiveTexture(depthMap, "depthMap", programTex, 1); Core::SetActiveTexture(depthMap, "depthMap", programTex, 1);
glUniformMatrix4fv(glGetUniformLocation(programTex, "LightVP2"), 1, GL_FALSE, (float*)&lightVP2); glUniformMatrix4fv(glGetUniformLocation(programTex, "LightVP2"), 1, GL_FALSE, (float*)&lightVP2);
Core::SetActiveTexture(depthMap2, "depthMap2", programTex, 2); Core::SetActiveTexture(depthMap2, "depthMap2", programTex, 2);
glUniformMatrix4fv(glGetUniformLocation(program, "LightVP3"), 1, GL_FALSE, (float*)&lightVP3);
Core::SetActiveTexture(depthMap3, "depthMap3", program, 3);
Core::DrawContext(context); Core::DrawContext(context);
} }
@ -540,6 +564,8 @@ void drawObjectTexPBR(Core::RenderContext& context, glm::mat4 modelMatrix, GLuin
Core::SetActiveTexture(depthMap, "depthMap", programTexPBR, 0); Core::SetActiveTexture(depthMap, "depthMap", programTexPBR, 0);
glUniformMatrix4fv(glGetUniformLocation(programTexPBR, "LightVP2"), 1, GL_FALSE, (float*)&lightVP2); glUniformMatrix4fv(glGetUniformLocation(programTexPBR, "LightVP2"), 1, GL_FALSE, (float*)&lightVP2);
Core::SetActiveTexture(depthMap2, "depthMap2", programTexPBR, 6); Core::SetActiveTexture(depthMap2, "depthMap2", programTexPBR, 6);
glUniformMatrix4fv(glGetUniformLocation(program, "LightVP3"), 1, GL_FALSE, (float*)&lightVP3);
Core::SetActiveTexture(depthMap3, "depthMap3", program, 7);
Core::DrawContext(context); Core::DrawContext(context);
} }
@ -582,6 +608,8 @@ void drawObjectTexPBR_ARM(Core::RenderContext& context, glm::mat4 modelMatrix, G
Core::SetActiveTexture(depthMap, "depthMap", programTexPBR_ARM, 0); Core::SetActiveTexture(depthMap, "depthMap", programTexPBR_ARM, 0);
glUniformMatrix4fv(glGetUniformLocation(programTexPBR_ARM, "LightVP2"), 1, GL_FALSE, (float*)&lightVP2); glUniformMatrix4fv(glGetUniformLocation(programTexPBR_ARM, "LightVP2"), 1, GL_FALSE, (float*)&lightVP2);
Core::SetActiveTexture(depthMap2, "depthMap2", programTexPBR_ARM, 4); Core::SetActiveTexture(depthMap2, "depthMap2", programTexPBR_ARM, 4);
glUniformMatrix4fv(glGetUniformLocation(program, "LightVP3"), 1, GL_FALSE, (float*)&lightVP3);
Core::SetActiveTexture(depthMap3, "depthMap3", program, 5);
Core::DrawContext(context); Core::DrawContext(context);
} }
@ -693,6 +721,7 @@ void renderShadowapSun(float angle) {
drawObjectDepth(models::painting2Context, lightVP, glm::mat4()); drawObjectDepth(models::painting2Context, lightVP, glm::mat4());
drawObjectDepth(models::mug2Context, lightVP, glm::mat4()); drawObjectDepth(models::mug2Context, lightVP, glm::mat4());
drawObjectDepth(models::bookContext, lightVP, glm::mat4()); drawObjectDepth(models::bookContext, lightVP, glm::mat4());
drawObjectDepth(models::lampContext, lightVP, glm::mat4());
glBindFramebuffer(GL_FRAMEBUFFER, 0); glBindFramebuffer(GL_FRAMEBUFFER, 0);
glViewport(0, 0, WIDTH, HEIGHT); glViewport(0, 0, WIDTH, HEIGHT);
@ -754,6 +783,69 @@ void renderShadowapSun2() {
drawObjectDepth(models::painting2Context, lightVP2, glm::mat4()); drawObjectDepth(models::painting2Context, lightVP2, glm::mat4());
drawObjectDepth(models::mug2Context, lightVP2, glm::mat4()); drawObjectDepth(models::mug2Context, lightVP2, glm::mat4());
drawObjectDepth(models::bookContext, lightVP2, glm::mat4()); drawObjectDepth(models::bookContext, lightVP2, glm::mat4());
drawObjectDepth(models::lampContext, lightVP2, glm::mat4());
glBindFramebuffer(GL_FRAMEBUFFER, 0);
glViewport(0, 0, WIDTH, HEIGHT);
}
void renderShadowapLamp() {
float time = glfwGetTime();
glViewport(0, 0, SHADOW_WIDTH, SHADOW_HEIGHT);
//uzupelnij o renderowanie glebokosci do tekstury
glUseProgram(programDepth);
//ustawianie przestrzeni rysowania
glViewport(0, 0, SHADOW_WIDTH, SHADOW_HEIGHT);
//bindowanie FBO
glBindFramebuffer(GL_FRAMEBUFFER, depthMapFBO3);
//czyszczenie mapy głębokości
glClear(GL_DEPTH_BUFFER_BIT);
//ustawianie programu
glUseProgram(programDepth);
drawObjectDepth(sphereContext, lightVP3, 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,
lightVP3, 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)));
drawObjectDepth(models::bedContext, lightVP3, glm::mat4());
drawObjectDepth(models::mattressContext, lightVP3, glm::mat4());
drawObjectDepth(models::bed_pillowContext, lightVP3, glm::mat4());
drawObjectDepth(models::floorContext, lightVP3, glm::mat4());
drawObjectDepth(models::desk_topContext, lightVP3, glm::mat4());
drawObjectDepth(models::desk_bottomContext, lightVP3, glm::mat4());
drawObjectDepth(models::framesContext, lightVP3, glm::mat4());
drawObjectDepth(models::wallContext, lightVP3, glm::mat4());
drawObjectDepth(models::foldingContext, lightVP3, glm::mat4());
drawObjectDepth(models::couchContext, lightVP3, glm::mat4());
drawObjectDepth(models::laptopContext, lightVP3, glm::mat4());
drawObjectDepth(models::doorContext, lightVP3, glm::mat4());
drawObjectDepth(models::chairContext, lightVP3, glm::mat4());
drawObjectDepth(models::roofContext, lightVP3, glm::mat4());
drawObjectDepth(models::blanketContext, lightVP3, glm::mat4());
drawObjectDepth(models::drawerContext, lightVP3, glm::mat4());
drawObjectDepth(models::clockContext, lightVP3, glm::mat4());
drawObjectDepth(models::plantContext, lightVP3, glm::mat4());
drawObjectDepth(models::c_tableContext, lightVP3, glm::mat4());
drawObjectDepth(models::foldingContext, lightVP3, glm::mat4());
drawObjectDepth(models::mugContext, lightVP3, glm::mat4());
drawObjectDepth(models::carContext, lightVP3, glm::mat4());
drawObjectDepth(models::books1Context, lightVP3, glm::mat4());
drawObjectDepth(models::books2Context, lightVP3, glm::mat4());
drawObjectDepth(models::cactusContext, lightVP3, glm::mat4());
drawObjectDepth(models::fanContext, lightVP3, glm::mat4());
drawObjectDepth(models::fanTopContext, lightVP3, glm::mat4());
drawObjectDepth(models::tableContext, lightVP3, glm::mat4());
drawObjectDepth(models::handleContext, lightVP3, glm::mat4());
drawObjectDepth(models::pillow1Context, lightVP3, glm::mat4());
drawObjectDepth(models::pillow2Context, lightVP3, glm::mat4());
drawObjectDepth(models::pillow3Context, lightVP3, glm::mat4());
drawObjectDepth(models::painting1Context, lightVP3, glm::mat4());
drawObjectDepth(models::painting2Context, lightVP3, glm::mat4());
drawObjectDepth(models::mug2Context, lightVP3, glm::mat4());
drawObjectDepth(models::bookContext, lightVP3, glm::mat4());
drawObjectDepth(models::lampContext, lightVP3, glm::mat4());
glBindFramebuffer(GL_FRAMEBUFFER, 0); glBindFramebuffer(GL_FRAMEBUFFER, 0);
glViewport(0, 0, WIDTH, HEIGHT); glViewport(0, 0, WIDTH, HEIGHT);
@ -799,6 +891,26 @@ void initDepthMap2()
glBindFramebuffer(GL_FRAMEBUFFER, 0); glBindFramebuffer(GL_FRAMEBUFFER, 0);
} }
void initDepthMap3()
{
glGenFramebuffers(1, &depthMapFBO3);
glGenTextures(1, &depthMap3);
glBindTexture(GL_TEXTURE_2D, depthMap3);
glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT,
SHADOW_WIDTH, SHADOW_HEIGHT, 0, GL_DEPTH_COMPONENT, GL_FLOAT, NULL);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glBindFramebuffer(GL_FRAMEBUFFER, depthMapFBO3);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, depthMap3, 0);
glDrawBuffer(GL_NONE);
glReadBuffer(GL_NONE);
glBindFramebuffer(GL_FRAMEBUFFER, 0);
}
void drawObjectColorWater(Core::RenderContext& context, glm::mat4 modelMatrix, glm::vec3 color, float time, GLuint textureID) { void drawObjectColorWater(Core::RenderContext& context, glm::mat4 modelMatrix, glm::vec3 color, float time, GLuint textureID) {
glm::mat4 viewProjectionMatrix = createPerspectiveMatrix() * glm::mat4(glm::mat3(createCameraMatrix())); glm::mat4 viewProjectionMatrix = createPerspectiveMatrix() * glm::mat4(glm::mat3(createCameraMatrix()));
@ -1002,6 +1114,7 @@ void renderScene(GLFWwindow* window)
glm::mat4 rotate = p2 * glm::rotate(glm::mat4(), glm::radians(angle * speed), glm::vec3(1, 0, 0)) * p1; glm::mat4 rotate = p2 * glm::rotate(glm::mat4(), glm::radians(angle * speed), glm::vec3(1, 0, 0)) * p1;
renderShadowapSun(angle); renderShadowapSun(angle);
renderShadowapSun2(); renderShadowapSun2();
renderShadowapLamp();
//space lamp //space lamp
glUseProgram(programSun); glUseProgram(programSun);
@ -1036,8 +1149,8 @@ void renderScene(GLFWwindow* window)
// ); // );
spotlightPos = spaceshipPos + 0.2 * spaceshipDir; //spotlightPos = spaceshipPos + 0.2 * spaceshipDir;
spotlightConeDir = spaceshipDir; //spotlightConeDir = spaceshipDir;
glUseProgram(programTex); glUseProgram(programTex);
//drawObjectTex(models::marbleBustContext, glm::translate(glm::mat4(), glm::vec3(0, 0, -0.2)), 0.2, 0, texture::rust); //drawObjectTex(models::marbleBustContext, glm::translate(glm::mat4(), glm::vec3(0, 0, -0.2)), 0.2, 0, texture::rust);
@ -1080,6 +1193,7 @@ void renderScene(GLFWwindow* window)
glm::translate(spaceshipPos) * specshipCameraRotrationMatrix * glm::eulerAngleY(glm::pi<float>()) * glm::scale(glm::vec3(0.03f)), glm::translate(spaceshipPos) * specshipCameraRotrationMatrix * glm::eulerAngleY(glm::pi<float>()) * glm::scale(glm::vec3(0.03f)),
texture::spray_roughness, texture::spray_metallic, texture::spray_albedo, texture::spray_normal, texture::spray_ao texture::spray_roughness, texture::spray_metallic, texture::spray_albedo, texture::spray_normal, texture::spray_ao
); );
drawObjectTexPBR(models::lampContext, glm::mat4(), texture::lamp_roughness, texture::lamp_metallic, texture::lamp_albedo, texture::lamp_normal, texture::lamp_ao);
glUseProgram(programTexPBR_ARM); glUseProgram(programTexPBR_ARM);
//drawObjectTexPBR_ARM(models::chairContext, glm::mat4(), texture::rock_albedo, texture::rock_normal, texture::rock_arm); //drawObjectTexPBR_ARM(models::chairContext, glm::mat4(), texture::rock_albedo, texture::rock_normal, texture::rock_arm);
@ -1105,7 +1219,7 @@ void renderScene(GLFWwindow* window)
/*glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); /*glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glUseProgram(programTest); glUseProgram(programTest);
glActiveTexture(GL_TEXTURE0); glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, depthMap); glBindTexture(GL_TEXTURE_2D, depthMap3);
Core::DrawContext(models::testContext);*/ Core::DrawContext(models::testContext);*/
bubbleManager(); bubbleManager();
@ -1150,6 +1264,7 @@ void init(GLFWwindow* window)
glfwSetFramebufferSizeCallback(window, framebuffer_size_callback); glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);
initDepthMap(); initDepthMap();
initDepthMap2(); initDepthMap2();
initDepthMap3();
PlaySound(TEXT("sound/ocean.wav"), NULL, SND_ASYNC|SND_LOOP); PlaySound(TEXT("sound/ocean.wav"), NULL, SND_ASYNC|SND_LOOP);
glEnable(GL_DEPTH_TEST); glEnable(GL_DEPTH_TEST);
program = shaderLoader.CreateProgram("shaders/shader_9_1.vert", "shaders/shader_9_1.frag"); program = shaderLoader.CreateProgram("shaders/shader_9_1.vert", "shaders/shader_9_1.frag");
@ -1318,6 +1433,12 @@ void init(GLFWwindow* window)
texture::spray_ao = Core::LoadTexture("textures/spray/ao.png"); texture::spray_ao = Core::LoadTexture("textures/spray/ao.png");
texture::spray_normal = Core::LoadTexture("textures/spray/normal.png"); texture::spray_normal = Core::LoadTexture("textures/spray/normal.png");
texture::lamp_albedo = Core::LoadTexture("textures/lamp/albedo.png");
texture::lamp_metallic = Core::LoadTexture("textures/lamp/metallic.png");
texture::lamp_roughness = Core::LoadTexture("textures/lamp/roughness.png");
texture::lamp_ao = Core::LoadTexture("textures/lamp/ao.png");
texture::lamp_normal = Core::LoadTexture("textures/lamp/normal.png");
texture::metal = Core::LoadTexture("textures/metal.png"); texture::metal = Core::LoadTexture("textures/metal.png");
loadModelToContext("models/bubble.obj", bubbleContext, false); loadModelToContext("models/bubble.obj", bubbleContext, false);
@ -1349,7 +1470,7 @@ void init(GLFWwindow* window)
loadModelToContext("./models/bed_pillow.obj", models::bed_pillowContext, false); loadModelToContext("./models/bed_pillow.obj", models::bed_pillowContext, false);
loadModelToContext("./models/paplan.obj", models::blanketContext, false); loadModelToContext("./models/paplan.obj", models::blanketContext, false);
loadModelToContext("./models/PC_desk_bake_003.obj", models::desk_topContext, true); loadModelToContext("./models/PC_desk_bake_003.obj", models::desk_topContext, false);
loadModelToContext("./models/PC_desk_bake_004.obj", models::desk_bottomContext, false); loadModelToContext("./models/PC_desk_bake_004.obj", models::desk_bottomContext, false);
loadModelToContext("./models/Cube_002.obj", models::paper_stack2Context, false); loadModelToContext("./models/Cube_002.obj", models::paper_stack2Context, false);
loadModelToContext("./models/Cube_009.obj", models::paper_stack3Context, false); loadModelToContext("./models/Cube_009.obj", models::paper_stack3Context, false);
@ -1385,6 +1506,7 @@ void init(GLFWwindow* window)
loadModelToContext("./models/painting2.obj", models::painting2Context, false); loadModelToContext("./models/painting2.obj", models::painting2Context, false);
loadModelToContext("./models/mug2.obj", models::mug2Context, false); loadModelToContext("./models/mug2.obj", models::mug2Context, false);
loadModelToContext("./models/book.obj", models::bookContext, false); loadModelToContext("./models/book.obj", models::bookContext, false);
loadModelToContext("./models/lamp.obj", models::lampContext, false);
collisionSystem.calculateSceneBounding(); collisionSystem.calculateSceneBounding();

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 MiB

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 488 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 MiB