minor fixes

This commit is contained in:
s464921 2023-02-12 18:31:51 +01:00
parent d994de46eb
commit d0fe09283c
8 changed files with 134 additions and 115 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -9,83 +9,83 @@ 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(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\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(376,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(401,38): warning C4305: "=": obcięcie z "double" do "float"
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(430,16): warning C4305: "inicjowanie": obcięcie z "double" do "float"
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(643,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(651,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(651,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(666,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(684,98): warning C4305: "argument": obcięcie z "double" do "T"
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(341,30): warning C4305: "inicjowanie": obcięcie z "double" do "float"
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(369,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(394,38): warning C4305: "=": obcięcie z "double" do "float"
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(423,16): warning C4305: "inicjowanie": obcięcie z "double" do "float"
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(640,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(648,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(648,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(663,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(681,98): 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(687,68): warning C4305: "argument": obcięcie z "double" do "T"
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(684,68): 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(732,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(746,99): warning C4305: "argument": obcięcie z "double" do "T"
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(729,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(743,99): 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(749,69): warning C4305: "argument": obcięcie z "double" do "T"
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(746,69): 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(794,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(808,99): warning C4305: "argument": obcięcie z "double" do "T"
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(791,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(805,99): 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(811,69): warning C4305: "argument": obcięcie z "double" do "T"
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(808,69): 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(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(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(937,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(940,31): warning C4305: "inicjowanie": obcięcie z "double" do "float"
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(941,25): warning C4305: "inicjowanie": obcięcie z "double" do "float"
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(932,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(933,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(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(937,31): warning C4305: "inicjowanie": obcięcie z "double" do "float"
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(938,25): warning C4305: "inicjowanie": obcięcie z "double" do "float"
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(994,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(995,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(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(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(1000,31): warning C4305: "inicjowanie": obcięcie z "double" do "float"
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(1001,23): warning C4305: "inicjowanie": obcięcie z "double" do "float"
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(1104,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(1118,108): warning C4305: "argument": obcięcie z "double" do "T"
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(999,31): warning C4305: "inicjowanie": obcięcie z "double" do "float"
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(1000,25): warning C4305: "inicjowanie": obcięcie z "double" do "float"
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(1106,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(1120,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(1127,87): warning C4305: "argument": obcięcie z "double" do "T"
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(1133,85): warning C4305: "argument": obcięcie z "double" do "float"
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(1159,73): warning C4305: "argument": obcięcie z "double" do "float"
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(1163,81): warning C4305: "argument": obcięcie z "double" do "float"
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(1164,93): warning C4305: "argument": obcięcie z "double" do "float"
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(1165,83): 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(1262,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(1127,223): warning C4305: "argument": obcięcie z "double" do "float"
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(1156,73): warning C4305: "argument": obcięcie z "double" do "float"
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(1160,81): warning C4305: "argument": obcięcie z "double" do "float"
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(1161,93): warning C4305: "argument": obcięcie z "double" do "float"
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(1162,83): warning C4305: "argument": obcięcie z "double" do "float"
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(1163,83): warning C4305: "argument": obcięcie z "double" do "float"
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(1259,108): warning C4305: "argument": obcięcie z "double" do "T"
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(1590,21): warning C4305: "-=": obcięcie z "double" do "float"
C:\Users\jedrz\Desktop\g\GRK_Project\cw 9\src\ex_9_1.hpp(1592,21): warning C4305: "+=": obcięcie z "double" do "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
124 of 725 functions (17.1%) were compiled, the rest were copied from previous compilation.
2 functions were new in current compilation
17 functions had inline decision re-evaluated but remain unchanged
97 of 724 functions (13.4%) were compiled, the rest were copied from previous compilation.
0 functions were new in current compilation
16 functions had inline decision re-evaluated but remain unchanged
Zakończono generowanie kodu
grk-cw9.vcxproj -> C:\Users\jedrz\Desktop\g\GRK_Project\Release\grk-cw9.exe

Binary file not shown.

View File

@ -93,8 +93,10 @@ namespace models {
Core::RenderContext mug2Context;
Core::RenderContext bookContext;
Core::RenderContext lampContext;
Core::RenderContext cableContext;
}
std::vector<std::string> faces = {
"textures/skybox_2/right.jpg",
"textures/skybox_2/left.jpg",
@ -265,11 +267,11 @@ namespace texture {
GLuint spray_ao;
GLuint spray_normal;
GLuint lamp_roughness;
GLuint lamp_metallic;
GLuint lamp_albedo;
GLuint lamp_normal;
GLuint lamp_metallic;
GLuint lamp_ao;
GLuint lamp_roughness;
GLuint lamp_normal;
}
GLuint depthMapFBO;
@ -311,17 +313,18 @@ glm::vec3 bubbleOriginalLocation[bubbleQuantity];
bool bubbleZdir[bubbleQuantity];
bool bubbleXdir[bubbleQuantity];
CONST int bubblenumber = 500;
CONST int bubblenumber = 1;
glm::vec3 bubbleLocationInRoom[bubblenumber];
glm::vec3 bubbleOriginalLocationInRoom[bubblenumber];
bool bubbleZdirInRoom[bubblenumber];
bool bubbleXdirInRoom[bubblenumber];
glm::vec3 sunPos = glm::vec3(-4.740971f, 2.149999f, -0.069280f);
glm::vec3 sunDir = glm::vec3(-0.93633f, 0.351106, 0.003226f);
glm::vec3 sunPos2 = glm::vec3(4.040971f, 2.149999f, -0.739280f);
glm::vec3 sunDir2 = glm::vec3(0.93633f, 0.351106, -0.003226f);
glm::vec3 lampPos = glm::vec3(1.5, 1.15, -1.1);
glm::vec3 lampDir = glm::vec3(-0.2, -1.0, 0.3);
glm::vec3 sunColor = glm::vec3(0.9f, 0.9f, 0.7f) * 5;
glm::vec3 cameraPos = glm::vec3(0.479490f, 1.250000f, -2.124680f);
@ -338,26 +341,16 @@ 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 spotlightConeDir = glm::vec3(-0.2, -1.0, 0.3);
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 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 pointlightColor = glm::vec3(0.9, 0.6, 0.6);
//glm::vec3 spotlightPos = 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 lightPos = glm::vec3(-8, 4, 2);
float lastTime = -1.f;
@ -462,6 +455,7 @@ void drawObjectPBR(Core::RenderContext& context, glm::mat4 modelMatrix, glm::vec
glUniform3f(glGetUniformLocation(program, "sunDir"), sunDir.x, sunDir.y, sunDir.z);
glUniform3f(glGetUniformLocation(program, "sunDir2"), sunDir2.x, sunDir2.y, sunDir2.z);
glUniform3f(glGetUniformLocation(program, "lampDir"), lampDir.x, lampDir.y, lampDir.z);
glUniform3f(glGetUniformLocation(program, "sunColor"), sunColor.x, sunColor.y, sunColor.z);
glUniform3f(glGetUniformLocation(program, "lightPos"), pointlightPos.x, pointlightPos.y, pointlightPos.z);
@ -472,7 +466,7 @@ 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);
glUniformMatrix4fv(glGetUniformLocation(program, "LightVP"), 1, GL_FALSE, (float*)&lightVP);
Core::SetActiveTexture(depthMap, "depthMap", program, 0);
glUniformMatrix4fv(glGetUniformLocation(program, "LightVP2"), 1, GL_FALSE, (float*)&lightVP2);
@ -501,6 +495,7 @@ void drawObjectTex(Core::RenderContext& context, glm::mat4 modelMatrix, float ro
glUniform3f(glGetUniformLocation(programTex, "sunDir"), sunDir.x, sunDir.y, sunDir.z);
glUniform3f(glGetUniformLocation(programTex, "sunDir2"), sunDir2.x, sunDir2.y, sunDir2.z);
glUniform3f(glGetUniformLocation(program, "lampDir"), lampDir.x, lampDir.y, lampDir.z);
glUniform3f(glGetUniformLocation(programTex, "sunColor"), sunColor.x, sunColor.y, sunColor.z);
glUniform3f(glGetUniformLocation(programTex, "lightPos"), pointlightPos.x, pointlightPos.y, pointlightPos.z);
@ -514,7 +509,7 @@ void drawObjectTex(Core::RenderContext& context, glm::mat4 modelMatrix, float ro
//Core::DrawContext(context);
glUniformMatrix4fv(glGetUniformLocation(programTex, "LightVP"), 1, GL_FALSE, (float*)&lightVP);
Core::SetActiveTexture(depthMap, "depthMap", programTex, 1);
glUniformMatrix4fv(glGetUniformLocation(programTex, "LightVP2"), 1, GL_FALSE, (float*)&lightVP2);
@ -543,6 +538,7 @@ void drawObjectTexPBR(Core::RenderContext& context, glm::mat4 modelMatrix, GLuin
glUniform3f(glGetUniformLocation(programTexPBR, "sunDir"), sunDir.x, sunDir.y, sunDir.z);
glUniform3f(glGetUniformLocation(programTexPBR, "sunDir2"), sunDir2.x, sunDir2.y, sunDir2.z);
glUniform3f(glGetUniformLocation(program, "lampDir"), lampDir.x, lampDir.y, lampDir.z);
glUniform3f(glGetUniformLocation(programTexPBR, "sunColor"), sunColor.x, sunColor.y, sunColor.z);
glUniform3f(glGetUniformLocation(programTexPBR, "lightPos"), pointlightPos.x, pointlightPos.y, pointlightPos.z);
@ -560,7 +556,7 @@ void drawObjectTexPBR(Core::RenderContext& context, glm::mat4 modelMatrix, GLuin
//Core::DrawContext(context);
glUniformMatrix4fv(glGetUniformLocation(programTexPBR, "LightVP"), 1, GL_FALSE, (float*)&lightVP);
Core::SetActiveTexture(depthMap, "depthMap", programTexPBR, 0);
glUniformMatrix4fv(glGetUniformLocation(programTexPBR, "LightVP2"), 1, GL_FALSE, (float*)&lightVP2);
@ -589,6 +585,7 @@ void drawObjectTexPBR_ARM(Core::RenderContext& context, glm::mat4 modelMatrix, G
glUniform3f(glGetUniformLocation(programTexPBR_ARM, "sunDir"), sunDir.x, sunDir.y, sunDir.z);
glUniform3f(glGetUniformLocation(programTexPBR_ARM, "sunDir2"), sunDir2.x, sunDir2.y, sunDir2.z);
glUniform3f(glGetUniformLocation(program, "lampDir"), lampDir.x, lampDir.y, lampDir.z);
glUniform3f(glGetUniformLocation(programTexPBR_ARM, "sunColor"), sunColor.x, sunColor.y, sunColor.z);
glUniform3f(glGetUniformLocation(programTexPBR_ARM, "lightPos"), pointlightPos.x, pointlightPos.y, pointlightPos.z);
@ -604,7 +601,7 @@ void drawObjectTexPBR_ARM(Core::RenderContext& context, glm::mat4 modelMatrix, G
//Core::DrawContext(context);
glUniformMatrix4fv(glGetUniformLocation(programTexPBR_ARM, "LightVP"), 1, GL_FALSE, (float*)&lightVP);
Core::SetActiveTexture(depthMap, "depthMap", programTexPBR_ARM, 0);
glUniformMatrix4fv(glGetUniformLocation(programTexPBR_ARM, "LightVP2"), 1, GL_FALSE, (float*)&lightVP2);
@ -645,15 +642,15 @@ void drawBubble(glm::mat4 transformSphere) {
glm::mat4 cameraMatrix = createCameraMatrix();
glm::mat4 perspectiveMatrix = createPerspectiveMatrix();
glm::mat4 viewProjectionMatrix = perspectiveMatrix * cameraMatrix;
glm::mat4 transformation = viewProjectionMatrix * transformSphere;
glm::mat4 bubbleSkyboxViewMatrix = glm::mat3(perspectiveMatrix * glm::mat4(glm::mat3(cameraMatrix)));
//glm::mat4 transformation = viewProjectionMatrix * glm::translate(pointlightPos) * glm::scale(glm::vec3(0.1));
glm::mat4 bubbleSkyboxViewMatrix = perspectiveMatrix * glm::mat4(glm::mat3(cameraMatrix));
glUniformMatrix4fv(glGetUniformLocation(programBubble, "transformation"), 1, GL_FALSE, (float*)&transformSphere);
glUniform3f(glGetUniformLocation(programBubble, "iResolution"), WIDTH, HEIGHT, 1.0);
glUniform1f(glGetUniformLocation(programBubble, "time"), time);
//glUniform3f(glGetUniformLocation(programBubble, "cameraPos"), cameraPos.x, cameraPos.y, cameraPos.z);
//glUniform3f(glGetUniformLocation(programBubble, "cameraDir"), cameraDir.x, cameraDir.y, cameraDir.z);
glUniformMatrix3fv(glGetUniformLocation(programBubble, "camMat"), 1, GL_FALSE, (float*)&glm::mat3(bubbleSkyboxViewMatrix));
Core::SetActiveTexture(bubbleTexture0, "iChannel0", programBubble, 1);
glBindTexture(GL_TEXTURE_CUBE_MAP, bubbleTexture0);
Core::SetActiveTexture(bubbleTexture1, "iChannel1", programBubble, 0);
@ -676,7 +673,7 @@ void renderShadowapSun(float angle) {
glClear(GL_DEPTH_BUFFER_BIT);
//ustawianie programu
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;
@ -711,8 +708,8 @@ void renderShadowapSun(float angle) {
drawObjectDepth(models::books1Context, lightVP, glm::mat4());
drawObjectDepth(models::books2Context, lightVP, glm::mat4());
drawObjectDepth(models::cactusContext, lightVP, glm::mat4());
drawObjectDepth(models::fanContext, lightVP, glm::mat4());
drawObjectDepth(models::fanTopContext, lightVP, glm::mat4() * rotate);
drawObjectDepth(models::fanContext, lightVP,glm::mat4());
drawObjectDepth(models::fanTopContext, lightVP, glm::mat4()*rotate);
drawObjectDepth(models::tableContext, lightVP, glm::mat4());
drawObjectDepth(models::handleContext, lightVP, glm::mat4());
drawObjectDepth(models::pillow1Context, lightVP, glm::mat4());
@ -959,6 +956,9 @@ void bubbleMovement(int i) {
else if (bubbleLocation[i].z < bubbleOriginalLocation[i].z - bubbleWobbling * bubbleWobblingDivider) {
bubbleZdir[i] = true;
}
bubbleZdir[i] = false;
bubbleXdir[i] = false;
if (bubbleXdir[i]) {
@ -975,19 +975,18 @@ void bubbleMovement(int i) {
bubbleLocation[i].z -= bubbleWobbling;
}
if (y <= -10.0) {
if (y <= -10.0 ) {
bubbleLocation[i].y = 10.0;
}
if (x <= (-1.0 + 2.9) && x > (-1.0 - 2.9) && z <= (-1.2 + 3.2) && z > (-1.2 - 3.2) && y <= (1.0 + 2.36)) {
if (x <= (-1.0 + 2.9) && x > (-1.0 - 2.9) && z <= (-1.2 + 3.2) && z > (-1.2 - 3.2) && y <= (1.0 + 2.36) ) {
bubbleLocation[i].y = 10.0;
}
bubbleLocation[i].y -= bubbleDown;
}
void bubbleMovementInRoom(int i) {
float bubbleWobblingDivider = 100;
@ -998,7 +997,7 @@ void bubbleMovementInRoom(int i) {
float bubbleWobbling = 0.0005;
float bubbleUp = 0.05;
float bubbleDown = 0.05;
//printf(xDir ? "true\n" : "false\n");
//printf(zDir ? "true\n" : "false\n");
@ -1017,35 +1016,40 @@ void bubbleMovementInRoom(int i) {
bubbleZdirInRoom[i] = false;
}
else if (bubbleLocationInRoom[i].z < bubbleOriginalLocationInRoom[i].z - bubbleWobbling * bubbleWobblingDivider) {
bubbleZdirInRoom[i] = true;
bubbleZdir[i] = true;
}
bubbleZdirInRoom[i] = false;
bubbleXdirInRoom[i] = false;
if (bubbleXdirInRoom[i]) {
bubbleLocationInRoom[i].x += bubbleWobbling;
bubbleLocation[i].x += bubbleWobbling;
}
else {
bubbleLocationInRoom[i].x -= bubbleWobbling;
}
if (bubbleZdirInRoom[i]) {
bubbleLocationInRoom[i].z += bubbleWobbling;
bubbleLocation[i].z += bubbleWobbling;
}
else {
bubbleLocationInRoom[i].z -= bubbleWobbling;
}
//if (y <= -10.0) {
// bubbleLocationInRoom[i].y = 10.0;
//}
//if (x > (-1.0 + 0.5) && x <= (-1.0 - 0.5) && z > (-1.2 + 0.5) && z <= (-1.2 - 0.5) && y > (1.0 + 2.36)) {
//bubbleLocationInRoom[i].y = 4.0;
if (y >= (1.0 + 1.9)) {
bubbleLocationInRoom[i].y = -1;
}
if (x <= (-1.0 + 2) && x > (-1.0 - 2) && z <= (-1.2 + 2.3) && z > (-1.2 - 2.3) && y <= (1.0 + 1.9)) {
int l = 0;
}
else {
bubbleLocationInRoom[i].y = -1.0;
//}
if (x <= (-1.0 + 2.9) && x > (-1.0 - 2.9) && z <= (-1.2 + 3.2) && z > (-1.2 - 3.2) && y <= (1.0 + 2.36)) {
if (x > (0 + 0.01) || x <= (0 - 0.01) || z > (0 + 0.01) || z <= (0 - 0.01) || y > 2 || y <= 0)
{
bubbleLocationInRoom[i].y = 3;
}
}
bubbleLocationInRoom[i].y += bubbleUp;
bubbleLocationInRoom[i].y -= bubbleDown;
}
@ -1060,8 +1064,8 @@ void bubbleManager() {
glm::vec3 scale = glm::vec3(0.01, 0.04, 0.02);
modelMatrix = glm::scale(modelMatrix, scale);
//glUseProgram(programTex);
//drawObjectTex(bubbleContext, modelMatrix, 0, 0, texture::water);
drawBubbleColor(bubbleContext, modelMatrix, glm::vec3(.3f, .55f, 0.96f));
drawObjectTex(bubbleContext, modelMatrix, 0, 0, texture::water);
//drawBubbleColor(bubbleContext, modelMatrix, glm::vec3(.3f, .55f, 0.96f));
// srand(time(NULL));
float MAX_NUM = 20.0;
@ -1079,24 +1083,22 @@ void bubbleManager() {
}
void bubbleManagerInRoom() {
for (int j = 0;j < bubblenumber; j++) {
bubbleMovementInRoom(j);
for (int i = 0; i < bubblenumber; i++)
{
bubbleMovementInRoom(i);
glm::mat4 modelMatrix = glm::translate(bubbleLocationInRoom[i]);
glm::mat4 modelMatrix = glm::translate(bubbleLocationInRoom[j]);
// Scaling models
glm::vec3 scale = glm::vec3(0.1, 0.1, 0.1);
glm::vec3 scale = glm::vec3(0.01, 0.04, 0.02);
modelMatrix = glm::scale(modelMatrix, scale);
//glUseProgram(programTex);
//drawObjectTex(bubbleContext, modelMatrix, 0, 0, texture::water);
drawObjectTex(bubbleContext, modelMatrix, 0, 0, texture::water);
//drawBubbleColor(bubbleContext, modelMatrix, glm::vec3(.3f, .55f, 0.96f));
drawBubble(modelMatrix);
// srand(time(NULL));
}
}
void renderScene(GLFWwindow* window)
{
glClearColor(0.4f, 0.4f, 0.8f, 1.0f);
@ -1124,10 +1126,11 @@ void renderScene(GLFWwindow* window)
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);
drawObjectPBR(models::ceilingContext, glm::mat4(), glm::vec3(1, 1, 1), 0.5, 0);
drawObjectPBR(models::ceilingContext, glm::mat4(), glm::vec3(1,1,1), 0.5, 0);
drawObjectPBR(models::cableContext, glm::mat4(), glm::vec3(0.1, 0.1, 0.1), 0.3, 0.3);
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));
@ -1143,7 +1146,7 @@ void renderScene(GLFWwindow* window)
// glm::translate(cameraPos + 1.5 * cameraDir + cameraUp * -0.5f) * inveseCameraRotrationMatrix * glm::eulerAngleY(glm::pi<float>()),
// glm::vec3(0.3, 0.3, 0.5)
// );
//spotlightPos = spaceshipPos + 0.2 * spaceshipDir;
//spotlightConeDir = spaceshipDir;
@ -1217,9 +1220,9 @@ void renderScene(GLFWwindow* window)
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, depthMap3);
Core::DrawContext(models::testContext);*/
bubbleManagerInRoom();
bubbleManager();
bubbleManagerInRoom();
glUseProgram(0);
glfwSwapBuffers(window);
@ -1261,7 +1264,7 @@ void init(GLFWwindow* window)
initDepthMap();
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);
program = shaderLoader.CreateProgram("shaders/shader_9_1.vert", "shaders/shader_9_1.frag");
programTest = shaderLoader.CreateProgram("shaders/test.vert", "shaders/test.frag");
@ -1429,6 +1432,12 @@ void init(GLFWwindow* window)
texture::spray_ao = Core::LoadTexture("textures/spray/ao.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");
loadModelToContext("models/bubble.obj", bubbleContext, false);
@ -1436,7 +1445,7 @@ void init(GLFWwindow* window)
loadModelToContext("./models/spray.obj", shipContext, false);
//loadModelToContext("./models/bed.obj", models::bedContext, true);
//loadModelToContext("./models/chair.obj", models::chairContext, true);
loadModelToContext("./models/desk.obj", models::deskContext, true);
loadModelToContext("./models/desk.obj", models::deskContext, false);
//loadModelToContext("./models/door.obj", models::doorContext, false);
//loadModelToContext("./models/drawer.obj", models::drawerContext, false);
loadModelToContext("./models/marbleBust.obj", models::marbleBustContext, false);
@ -1460,7 +1469,7 @@ void init(GLFWwindow* window)
loadModelToContext("./models/bed_pillow.obj", models::bed_pillowContext, false);
loadModelToContext("./models/paplan.obj", models::blanketContext, false);
loadModelToContext("./models/PC_desk_bake_003.obj", models::desk_topContext, false);
loadModelToContext("./models/PC_desk_bake_003.obj", models::desk_topContext, true);
loadModelToContext("./models/PC_desk_bake_004.obj", models::desk_bottomContext, false);
loadModelToContext("./models/Cube_002.obj", models::paper_stack2Context, false);
loadModelToContext("./models/Cube_009.obj", models::paper_stack3Context, false);
@ -1473,7 +1482,7 @@ void init(GLFWwindow* window)
loadModelToContext("./models/20848_Folding_Screen_v3.obj", models::foldingContext, true);
loadModelToContext("./models/Foot_Rest_001.obj", models::couchContext, true);
loadModelToContext("./models/dor.obj", models::doorContext, false);
loadModelToContext("./models/uploads_files_1938755_KAUSTBY.obj", models::chairContext, false);
loadModelToContext("./models/uploads_files_1938755_KAUSTBY.obj", models::chairContext, true);
loadModelToContext("./models/ceramic_vase_01.obj", models::vaseContext, false);
loadModelToContext("./models/laptop.obj", models::laptopContext, false);
loadModelToContext("./models/screen.obj", models::screenContext, false);
@ -1497,16 +1506,15 @@ void init(GLFWwindow* window)
loadModelToContext("./models/mug2.obj", models::mug2Context, false);
loadModelToContext("./models/book.obj", models::bookContext, false);
loadModelToContext("./models/lamp.obj", models::lampContext, false);
loadModelToContext("./models/cable.obj", models::cableContext, false);
collisionSystem.calculateSceneBounding();
loadModelToContext("./models/ceramic_vase_01.obj", models::vaseContext, true);
//collisionSystem.calculateSceneBounding();
skyboxTexture = loadSkybox(faces);
bubbleTexture0 = loadSkybox(facesBubble);
bubbleTexture1 = Core::LoadTexture("textures/bubbleNoise.jpg");
//drawSkybox(models::cubeContext, transformation, skyboxTexture);
/*glUseProgram(programSkybox);
glUniform1i(glGetUniformLocation(programSkybox, "skybox"), skyboxTexture);
@ -1559,24 +1567,35 @@ void processInput(GLFWwindow* window)
}
if (glfwGetKey(window, GLFW_KEY_L) == GLFW_PRESS) {
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_B) == GLFW_PRESS) {
for (int i = 0; i < bubblenumber; i++)
if (glfwGetKey(window, GLFW_KEY_R) == GLFW_PRESS) {
for (int i = 0; i < bubbleQuantity; i++)
{
// srand(time(NULL));
float MAX_NUM = 20.0;
bubbleLocationInRoom[i].x = (((float)rand() / (float)(RAND_MAX)) * MAX_NUM) - MAX_NUM / 2;
bubbleLocationInRoom[i].y = (((float)rand() / (float)(RAND_MAX)) * 10) - 5;
bubbleLocationInRoom[i].z = (((float)rand() / (float)(RAND_MAX)) * MAX_NUM) - MAX_NUM / 2;
bubbleLocation[i].x = (((float)rand() / (float)(RAND_MAX)) * MAX_NUM) - MAX_NUM / 2;
bubbleLocation[i].y = (((float)rand() / (float)(RAND_MAX)) * 10) - 5;
bubbleLocation[i].z = (((float)rand() / (float)(RAND_MAX)) * MAX_NUM) - MAX_NUM / 2;
bubbleOriginalLocationInRoom[i] = bubbleLocationInRoom[i];
bubbleOriginalLocation[i] = bubbleLocation[i];
bubbleZdirInRoom[i] = true;
bubbleXdirInRoom[i] = false;
bubbleZdir[i] = true;
bubbleXdir[i] = false;
}
}
if (glfwGetKey(window, GLFW_KEY_B) == GLFW_PRESS) {
for (int j = 0; j < bubblenumber;j++) {
bubbleLocationInRoom[j].x = (float)rand() / (float)(RAND_MAX);
bubbleLocationInRoom[j].z = (float)rand() / (float)(RAND_MAX);
bubbleLocationInRoom[j].y = (int)rand() % (int)(3.0 - 2.5 + 1) + 2.5;
bubbleOriginalLocationInRoom[j] = bubbleLocationInRoom[j];
bubbleZdirInRoom[j] = true;
bubbleXdirInRoom[j] = false;
}
}
cameraDir = spaceshipDir;