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(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(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(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(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(401,38): warning C4305: "=": obcięcie z "double" do "float" 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(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(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(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(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(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(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(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(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(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(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(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(681,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(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 with
[ [
T=float 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(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(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(743,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(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 with
[ [
T=float 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(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(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(805,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(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 with
[ [
T=float 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(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(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(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(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(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(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(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(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(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(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(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(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,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(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(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(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(1120,108): warning C4305: "argument": obcięcie z "double" do "T"
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"
with with
[ [
T=float 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 with
[ [
T=float 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(1592,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(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"
with with
[ [
T=float 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(1609,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(1611,21): warning C4305: "+=": obcięcie z "double" do "float"
Trwa generowanie kodu Trwa generowanie kodu
124 of 725 functions (17.1%) were compiled, the rest were copied from previous compilation. 97 of 724 functions (13.4%) were compiled, the rest were copied from previous compilation.
2 functions were new in current compilation 0 functions were new in current compilation
17 functions had inline decision re-evaluated but remain unchanged 16 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

@ -93,8 +93,10 @@ namespace models {
Core::RenderContext mug2Context; Core::RenderContext mug2Context;
Core::RenderContext bookContext; Core::RenderContext bookContext;
Core::RenderContext lampContext; Core::RenderContext lampContext;
Core::RenderContext cableContext;
} }
std::vector<std::string> faces = { std::vector<std::string> faces = {
"textures/skybox_2/right.jpg", "textures/skybox_2/right.jpg",
"textures/skybox_2/left.jpg", "textures/skybox_2/left.jpg",
@ -265,11 +267,11 @@ namespace texture {
GLuint spray_ao; GLuint spray_ao;
GLuint spray_normal; GLuint spray_normal;
GLuint lamp_roughness;
GLuint lamp_metallic;
GLuint lamp_albedo; GLuint lamp_albedo;
GLuint lamp_normal; GLuint lamp_metallic;
GLuint lamp_ao; GLuint lamp_ao;
GLuint lamp_roughness;
GLuint lamp_normal;
} }
GLuint depthMapFBO; GLuint depthMapFBO;
@ -311,17 +313,18 @@ glm::vec3 bubbleOriginalLocation[bubbleQuantity];
bool bubbleZdir[bubbleQuantity]; bool bubbleZdir[bubbleQuantity];
bool bubbleXdir[bubbleQuantity]; bool bubbleXdir[bubbleQuantity];
CONST int bubblenumber = 500; CONST int bubblenumber = 1;
glm::vec3 bubbleLocationInRoom[bubblenumber]; glm::vec3 bubbleLocationInRoom[bubblenumber];
glm::vec3 bubbleOriginalLocationInRoom[bubblenumber]; 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.069280f); 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);
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 sunColor = glm::vec3(0.9f, 0.9f, 0.7f) * 5;
glm::vec3 cameraPos = glm::vec3(0.479490f, 1.250000f, -2.124680f); glm::vec3 cameraPos = glm::vec3(0.479490f, 1.250000f, -2.124680f);
@ -338,26 +341,16 @@ float exposition = 1.f;
float spotlightPhi = 3.14 / 4; float spotlightPhi = 3.14 / 4;
glm::vec3 spotlightPos = glm::vec3(1.5, 1.15, -1.1); 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::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(-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 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); glm::vec3 lightPos = glm::vec3(-8, 4, 2);
float lastTime = -1.f; 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, "sunDir"), sunDir.x, sunDir.y, sunDir.z);
glUniform3f(glGetUniformLocation(program, "sunDir2"), sunDir2.x, sunDir2.y, sunDir2.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, "sunColor"), sunColor.x, sunColor.y, sunColor.z);
glUniform3f(glGetUniformLocation(program, "lightPos"), pointlightPos.x, pointlightPos.y, pointlightPos.z); glUniform3f(glGetUniformLocation(program, "lightPos"), pointlightPos.x, pointlightPos.y, pointlightPos.z);
@ -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, "sunDir"), sunDir.x, sunDir.y, sunDir.z);
glUniform3f(glGetUniformLocation(programTex, "sunDir2"), sunDir2.x, sunDir2.y, sunDir2.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, "sunColor"), sunColor.x, sunColor.y, sunColor.z);
glUniform3f(glGetUniformLocation(programTex, "lightPos"), pointlightPos.x, pointlightPos.y, pointlightPos.z); glUniform3f(glGetUniformLocation(programTex, "lightPos"), pointlightPos.x, pointlightPos.y, pointlightPos.z);
@ -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, "sunDir"), sunDir.x, sunDir.y, sunDir.z);
glUniform3f(glGetUniformLocation(programTexPBR, "sunDir2"), sunDir2.x, sunDir2.y, sunDir2.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, "sunColor"), sunColor.x, sunColor.y, sunColor.z);
glUniform3f(glGetUniformLocation(programTexPBR, "lightPos"), pointlightPos.x, pointlightPos.y, pointlightPos.z); glUniform3f(glGetUniformLocation(programTexPBR, "lightPos"), pointlightPos.x, pointlightPos.y, pointlightPos.z);
@ -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, "sunDir"), sunDir.x, sunDir.y, sunDir.z);
glUniform3f(glGetUniformLocation(programTexPBR_ARM, "sunDir2"), sunDir2.x, sunDir2.y, sunDir2.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, "sunColor"), sunColor.x, sunColor.y, sunColor.z);
glUniform3f(glGetUniformLocation(programTexPBR_ARM, "lightPos"), pointlightPos.x, pointlightPos.y, pointlightPos.z); glUniform3f(glGetUniformLocation(programTexPBR_ARM, "lightPos"), pointlightPos.x, pointlightPos.y, pointlightPos.z);
@ -645,8 +642,8 @@ void drawBubble(glm::mat4 transformSphere) {
glm::mat4 cameraMatrix = createCameraMatrix(); glm::mat4 cameraMatrix = createCameraMatrix();
glm::mat4 perspectiveMatrix = createPerspectiveMatrix(); glm::mat4 perspectiveMatrix = createPerspectiveMatrix();
glm::mat4 viewProjectionMatrix = perspectiveMatrix * cameraMatrix; glm::mat4 viewProjectionMatrix = perspectiveMatrix * cameraMatrix;
glm::mat4 transformation = viewProjectionMatrix * transformSphere; //glm::mat4 transformation = viewProjectionMatrix * glm::translate(pointlightPos) * glm::scale(glm::vec3(0.1));
glm::mat4 bubbleSkyboxViewMatrix = glm::mat3(perspectiveMatrix * glm::mat4(glm::mat3(cameraMatrix))); glm::mat4 bubbleSkyboxViewMatrix = perspectiveMatrix * glm::mat4(glm::mat3(cameraMatrix));
glUniformMatrix4fv(glGetUniformLocation(programBubble, "transformation"), 1, GL_FALSE, (float*)&transformSphere); glUniformMatrix4fv(glGetUniformLocation(programBubble, "transformation"), 1, GL_FALSE, (float*)&transformSphere);
glUniform3f(glGetUniformLocation(programBubble, "iResolution"), WIDTH, HEIGHT, 1.0); glUniform3f(glGetUniformLocation(programBubble, "iResolution"), WIDTH, HEIGHT, 1.0);
glUniform1f(glGetUniformLocation(programBubble, "time"), time); glUniform1f(glGetUniformLocation(programBubble, "time"), time);
@ -711,8 +708,8 @@ void renderShadowapSun(float angle) {
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::fanContext, lightVP,glm::mat4());
drawObjectDepth(models::fanTopContext, lightVP, glm::mat4() * rotate); drawObjectDepth(models::fanTopContext, lightVP, glm::mat4()*rotate);
drawObjectDepth(models::tableContext, lightVP, glm::mat4()); drawObjectDepth(models::tableContext, lightVP, glm::mat4());
drawObjectDepth(models::handleContext, lightVP, glm::mat4()); drawObjectDepth(models::handleContext, lightVP, glm::mat4());
drawObjectDepth(models::pillow1Context, 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) { else if (bubbleLocation[i].z < bubbleOriginalLocation[i].z - bubbleWobbling * bubbleWobblingDivider) {
bubbleZdir[i] = true; bubbleZdir[i] = true;
} }
bubbleZdir[i] = false;
bubbleXdir[i] = false;
if (bubbleXdir[i]) { if (bubbleXdir[i]) {
@ -975,10 +975,10 @@ void bubbleMovement(int i) {
bubbleLocation[i].z -= bubbleWobbling; bubbleLocation[i].z -= bubbleWobbling;
} }
if (y <= -10.0) { if (y <= -10.0 ) {
bubbleLocation[i].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 = 10.0;
} }
@ -987,7 +987,6 @@ void bubbleMovement(int i) {
} }
void bubbleMovementInRoom(int i) { void bubbleMovementInRoom(int i) {
float bubbleWobblingDivider = 100; float bubbleWobblingDivider = 100;
@ -998,7 +997,7 @@ void bubbleMovementInRoom(int i) {
float bubbleWobbling = 0.0005; float bubbleWobbling = 0.0005;
float bubbleUp = 0.05; float bubbleDown = 0.05;
//printf(xDir ? "true\n" : "false\n"); //printf(xDir ? "true\n" : "false\n");
//printf(zDir ? "true\n" : "false\n"); //printf(zDir ? "true\n" : "false\n");
@ -1017,35 +1016,40 @@ void bubbleMovementInRoom(int i) {
bubbleZdirInRoom[i] = false; bubbleZdirInRoom[i] = false;
} }
else if (bubbleLocationInRoom[i].z < bubbleOriginalLocationInRoom[i].z - bubbleWobbling * bubbleWobblingDivider) { 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]) { if (bubbleXdirInRoom[i]) {
bubbleLocationInRoom[i].x += bubbleWobbling; bubbleLocation[i].x += bubbleWobbling;
} }
else { else {
bubbleLocationInRoom[i].x -= bubbleWobbling; bubbleLocationInRoom[i].x -= bubbleWobbling;
} }
if (bubbleZdirInRoom[i]) { if (bubbleZdirInRoom[i]) {
bubbleLocationInRoom[i].z += bubbleWobbling; bubbleLocation[i].z += bubbleWobbling;
} }
else { else {
bubbleLocationInRoom[i].z -= bubbleWobbling; 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.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;
} }
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;
} }
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); glm::vec3 scale = glm::vec3(0.01, 0.04, 0.02);
modelMatrix = glm::scale(modelMatrix, scale); modelMatrix = glm::scale(modelMatrix, scale);
//glUseProgram(programTex); //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)); //drawBubbleColor(bubbleContext, modelMatrix, glm::vec3(.3f, .55f, 0.96f));
// srand(time(NULL)); // srand(time(NULL));
float MAX_NUM = 20.0; float MAX_NUM = 20.0;
@ -1079,24 +1083,22 @@ void bubbleManager() {
} }
void bubbleManagerInRoom() { void bubbleManagerInRoom() {
for (int j = 0;j < bubblenumber; j++) {
bubbleMovementInRoom(j);
glm::mat4 modelMatrix = glm::translate(bubbleLocationInRoom[j]);
for (int i = 0; i < bubblenumber; i++)
{
bubbleMovementInRoom(i);
glm::mat4 modelMatrix = glm::translate(bubbleLocationInRoom[i]);
// Scaling models // 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); modelMatrix = glm::scale(modelMatrix, scale);
//glUseProgram(programTex); //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)); //drawBubbleColor(bubbleContext, modelMatrix, glm::vec3(.3f, .55f, 0.96f));
drawBubble(modelMatrix); // srand(time(NULL));
} }
} }
void renderScene(GLFWwindow* window) void renderScene(GLFWwindow* window)
{ {
glClearColor(0.4f, 0.4f, 0.8f, 1.0f); glClearColor(0.4f, 0.4f, 0.8f, 1.0f);
@ -1124,10 +1126,11 @@ void renderScene(GLFWwindow* window)
glUseProgram(program); glUseProgram(program);
glm::mat4 transform(1.0f); glm::mat4 transform(1.0f);
//transform = glm::rotate(glm::mat4(), angle, glm::vec3(1.0f, 0.0f, 0.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::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::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 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));
@ -1218,8 +1221,8 @@ void renderScene(GLFWwindow* window)
glBindTexture(GL_TEXTURE_2D, depthMap3); glBindTexture(GL_TEXTURE_2D, depthMap3);
Core::DrawContext(models::testContext);*/ Core::DrawContext(models::testContext);*/
bubbleManagerInRoom();
bubbleManager(); bubbleManager();
bubbleManagerInRoom();
glUseProgram(0); glUseProgram(0);
glfwSwapBuffers(window); glfwSwapBuffers(window);
@ -1261,7 +1264,7 @@ void init(GLFWwindow* window)
initDepthMap(); initDepthMap();
initDepthMap2(); initDepthMap2();
initDepthMap3(); 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");
programTest = shaderLoader.CreateProgram("shaders/test.vert", "shaders/test.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_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);
@ -1436,7 +1445,7 @@ void init(GLFWwindow* window)
loadModelToContext("./models/spray.obj", shipContext, false); loadModelToContext("./models/spray.obj", shipContext, false);
//loadModelToContext("./models/bed.obj", models::bedContext, true); //loadModelToContext("./models/bed.obj", models::bedContext, true);
//loadModelToContext("./models/chair.obj", models::chairContext, 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/door.obj", models::doorContext, false);
//loadModelToContext("./models/drawer.obj", models::drawerContext, false); //loadModelToContext("./models/drawer.obj", models::drawerContext, false);
loadModelToContext("./models/marbleBust.obj", models::marbleBustContext, 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/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, 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/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);
@ -1473,7 +1482,7 @@ void init(GLFWwindow* window)
loadModelToContext("./models/20848_Folding_Screen_v3.obj", models::foldingContext, true); loadModelToContext("./models/20848_Folding_Screen_v3.obj", models::foldingContext, true);
loadModelToContext("./models/Foot_Rest_001.obj", models::couchContext, true); loadModelToContext("./models/Foot_Rest_001.obj", models::couchContext, true);
loadModelToContext("./models/dor.obj", models::doorContext, false); 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/ceramic_vase_01.obj", models::vaseContext, false);
loadModelToContext("./models/laptop.obj", models::laptopContext, false); loadModelToContext("./models/laptop.obj", models::laptopContext, false);
loadModelToContext("./models/screen.obj", models::screenContext, false); loadModelToContext("./models/screen.obj", models::screenContext, false);
@ -1497,6 +1506,7 @@ void init(GLFWwindow* window)
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); loadModelToContext("./models/lamp.obj", models::lampContext, false);
loadModelToContext("./models/cable.obj", models::cableContext, false);
collisionSystem.calculateSceneBounding(); collisionSystem.calculateSceneBounding();
@ -1505,8 +1515,6 @@ void init(GLFWwindow* window)
//collisionSystem.calculateSceneBounding(); //collisionSystem.calculateSceneBounding();
skyboxTexture = loadSkybox(faces); skyboxTexture = loadSkybox(faces);
bubbleTexture0 = loadSkybox(facesBubble);
bubbleTexture1 = Core::LoadTexture("textures/bubbleNoise.jpg");
//drawSkybox(models::cubeContext, transformation, skyboxTexture); //drawSkybox(models::cubeContext, transformation, skyboxTexture);
/*glUseProgram(programSkybox); /*glUseProgram(programSkybox);
glUniform1i(glGetUniformLocation(programSkybox, "skybox"), skyboxTexture); glUniform1i(glGetUniformLocation(programSkybox, "skybox"), skyboxTexture);
@ -1559,24 +1567,35 @@ void processInput(GLFWwindow* window)
} }
if (glfwGetKey(window, GLFW_KEY_L) == GLFW_PRESS) { if (glfwGetKey(window, GLFW_KEY_L) == GLFW_PRESS) {
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_B) == GLFW_PRESS) { if (glfwGetKey(window, GLFW_KEY_R) == GLFW_PRESS) {
for (int i = 0; i < bubblenumber; i++) for (int i = 0; i < bubbleQuantity; i++)
{ {
// srand(time(NULL)); // srand(time(NULL));
float MAX_NUM = 20.0; float MAX_NUM = 20.0;
bubbleLocationInRoom[i].x = (((float)rand() / (float)(RAND_MAX)) * MAX_NUM) - MAX_NUM / 2; bubbleLocation[i].x = (((float)rand() / (float)(RAND_MAX)) * MAX_NUM) - MAX_NUM / 2;
bubbleLocationInRoom[i].y = (((float)rand() / (float)(RAND_MAX)) * 10) - 5; bubbleLocation[i].y = (((float)rand() / (float)(RAND_MAX)) * 10) - 5;
bubbleLocationInRoom[i].z = (((float)rand() / (float)(RAND_MAX)) * MAX_NUM) - MAX_NUM / 2; bubbleLocation[i].z = (((float)rand() / (float)(RAND_MAX)) * MAX_NUM) - MAX_NUM / 2;
bubbleOriginalLocationInRoom[i] = bubbleLocationInRoom[i]; bubbleOriginalLocation[i] = bubbleLocation[i];
bubbleZdirInRoom[i] = true; bubbleZdir[i] = true;
bubbleXdirInRoom[i] = false; 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; cameraDir = spaceshipDir;