2
2

fix #9

Merged
s464921 merged 2 commits from fix into master 2023-02-12 19:48:20 +01:00
12 changed files with 147 additions and 130 deletions
Showing only changes of commit d994de46eb - Show all commits

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -9,88 +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(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(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(400,38): warning C4305: "=": 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(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(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(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(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(683,98): warning C4305: "argument": obcięcie z "double" do "T"
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"
with
[
T=float
]
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"
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"
with
[
T=float
]
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(745,99): warning C4305: "argument": obcięcie z "double" do "T"
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"
with
[
T=float
]
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"
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"
with
[
T=float
]
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(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(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"
with
[
T=float
]
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"
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"
with
[
T=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(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(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(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(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(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(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"
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"
with
[
T=float
]
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"
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"
with
[
T=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(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"
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"
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"
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"
Trwa generowanie kodu
1 of 723 functions ( 0.1%) were compiled, the rest were copied from previous compilation.
0 functions were new in current compilation
9 functions had inline decision re-evaluated but remain unchanged
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
Zakończono generowanie kodu
grk-cw9.vcxproj -> C:\Users\jedrz\Desktop\g\GRK_Project\Release\grk-cw9.exe

Binary file not shown.

View File

@ -9,6 +9,7 @@ uniform vec3 cameraPos;
uniform sampler2D depthMap;
uniform sampler2D depthMap2;
uniform sampler2D depthMap3;
uniform sampler2D colorTexture;
uniform sampler2D metallicTexture;
uniform sampler2D roughnessTexture;
@ -17,6 +18,7 @@ uniform sampler2D normalSampler;
uniform vec3 sunDir;
uniform vec3 sunDir2;
uniform vec3 lampDir;
uniform vec3 sunColor;
uniform vec3 lightPos;
@ -49,6 +51,7 @@ float roughness;
in vec4 sunSpacePos;
in vec4 sunSpacePos2;
in vec4 lampSpacePos;
float DistributionGGX(vec3 normal, vec3 H, float roughness){
@ -133,6 +136,19 @@ float calculateShadow2() {
return (0.5*(diff)/abs(diff))+0.5;
}
float calculateShadow3() {
vec4 sunSpacePosNormalized = (0.5 * sunSpacePos / (sunSpacePos.w)) + 0.5;
float closestDepth = texture2D(depthMap3, sunSpacePosNormalized.xy).r;
if(closestDepth + 0.01 > sunSpacePosNormalized.z){
return 1.0;
} else {
return 0.0;
}
}
void main()
{
@ -175,5 +191,8 @@ void main()
//sun2
ilumination=ilumination+PBRLight(sunDir2, sunColor * calculateShadow2(), normal, viewDir);
ilumination=ilumination+PBRLight(lampDir, sunColor * calculateShadow3(), normal, viewDir);
outColor = vec4(vec3(1.0) - exp(-ilumination*exposition),1);
}

View File

@ -10,6 +10,7 @@ uniform mat4 transformation;
uniform mat4 modelMatrix;
uniform mat4 LightVP;
uniform mat4 LightVP2;
uniform mat4 LightVP3;
out vec3 vecNormal;
out vec3 worldPos;
@ -26,6 +27,7 @@ out vec3 sunDirTS;
out vec2 vecTex;
out vec4 sunSpacePos;
out vec4 sunSpacePos2;
out vec4 lampSpacePos;
void main()
@ -49,5 +51,5 @@ void main()
sunDirTS = TBN*sunDir;
sunSpacePos=LightVP*modelMatrix*vec4(vertexPosition,1);
sunSpacePos2=LightVP2*modelMatrix*vec4(vertexPosition,1);
lampSpacePos=LightVP3*modelMatrix*vec4(vertexPosition,1);
}

View File

@ -9,12 +9,14 @@ uniform vec3 cameraPos;
uniform sampler2D depthMap;
uniform sampler2D depthMap2;
uniform sampler2D depthMap3;
uniform sampler2D colorTexture;
uniform sampler2D armTexture;
uniform sampler2D normalSampler;
uniform vec3 sunDir;
uniform vec3 sunDir2;
uniform vec3 lampDir;
uniform vec3 sunColor;
uniform vec3 lightPos;
@ -47,7 +49,7 @@ float roughness;
in vec4 sunSpacePos;
in vec4 sunSpacePos2;
in vec4 lampSpacePos;
float DistributionGGX(vec3 normal, vec3 H, float roughness){
float a = roughness*roughness;
@ -132,6 +134,19 @@ float calculateShadow2() {
return (0.5*(diff)/abs(diff))+0.5;
}
float calculateShadow3() {
vec4 sunSpacePosNormalized = (0.5 * sunSpacePos / (sunSpacePos.w)) + 0.5;
float closestDepth = texture2D(depthMap3, sunSpacePosNormalized.xy).r;
if(closestDepth + 0.01 > sunSpacePosNormalized.z){
return 1.0;
} else {
return 0.0;
}
}
void main()
{
color = texture2D(colorTexture, vecTex).xyz;
@ -159,12 +174,12 @@ void main()
//flashlight
//vec3 spotlightDir= normalize(spotlightDirTS);
vec3 spotlightDir= normalize(spotlightPos-worldPos);
//vec3 spotlightDir= normalize(spotlightPos-worldPos);
float angle_atenuation = clamp((dot(-normalize(spotlightPos-worldPos),spotlightConeDir)-0.5)*3,0,1);
attenuatedlightColor = angle_atenuation*spotlightColor/pow(length(spotlightPos-worldPos),2);
ilumination=ilumination+PBRLight(spotlightDir,attenuatedlightColor,normal,viewDir);
//float angle_atenuation = clamp((dot(-normalize(spotlightPos-worldPos),spotlightConeDir)-0.5)*3,0,1);
//attenuatedlightColor = angle_atenuation*spotlightColor/pow(length(spotlightPos-worldPos),2);
//ilumination=ilumination+PBRLight(spotlightDir,attenuatedlightColor,normal,viewDir);
//sun
//ilumination=ilumination+PBRLight(sunDir,sunColor,normal,viewDir);
@ -173,5 +188,8 @@ void main()
//sun2
ilumination=ilumination+PBRLight(sunDir2, sunColor * calculateShadow2(), normal, viewDir);
//lamp
ilumination=ilumination+PBRLight(lampDir, sunColor * calculateShadow3(), normal, viewDir);
outColor = vec4(vec3(1.0) - exp(-ilumination*exposition),1);
}

View File

@ -10,6 +10,7 @@ uniform mat4 transformation;
uniform mat4 modelMatrix;
uniform mat4 LightVP;
uniform mat4 LightVP2;
uniform mat4 LightVP3;
out vec3 vecNormal;
out vec3 worldPos;
@ -26,6 +27,7 @@ out vec3 sunDirTS;
out vec2 vecTex;
out vec4 sunSpacePos;
out vec4 sunSpacePos2;
out vec4 lampSpacePos;
void main()
{
@ -48,5 +50,5 @@ void main()
sunDirTS = TBN*sunDir;
sunSpacePos=LightVP*modelMatrix*vec4(vertexPosition,1);
sunSpacePos2=LightVP2*modelMatrix*vec4(vertexPosition,1);
lampSpacePos=LightVP3*modelMatrix*vec4(vertexPosition,1);
}

View File

@ -265,11 +265,11 @@ namespace texture {
GLuint spray_ao;
GLuint spray_normal;
GLuint lamp_albedo;
GLuint lamp_metallic;
GLuint lamp_ao;
GLuint lamp_roughness;
GLuint lamp_metallic;
GLuint lamp_albedo;
GLuint lamp_normal;
GLuint lamp_ao;
}
GLuint depthMapFBO;
@ -311,12 +311,13 @@ glm::vec3 bubbleOriginalLocation[bubbleQuantity];
bool bubbleZdir[bubbleQuantity];
bool bubbleXdir[bubbleQuantity];
CONST int bubblenumber = 1;
CONST int bubblenumber = 500;
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);
@ -644,8 +645,8 @@ void drawBubble(glm::mat4 transformSphere) {
glm::mat4 cameraMatrix = createCameraMatrix();
glm::mat4 perspectiveMatrix = createPerspectiveMatrix();
glm::mat4 viewProjectionMatrix = perspectiveMatrix * cameraMatrix;
//glm::mat4 transformation = viewProjectionMatrix * glm::translate(pointlightPos) * glm::scale(glm::vec3(0.1));
glm::mat4 bubbleSkyboxViewMatrix = perspectiveMatrix * glm::mat4(glm::mat3(cameraMatrix));
glm::mat4 transformation = viewProjectionMatrix * transformSphere;
glm::mat4 bubbleSkyboxViewMatrix = glm::mat3(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);
@ -958,9 +959,6 @@ 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]) {
@ -989,6 +987,7 @@ void bubbleMovement(int i) {
}
void bubbleMovementInRoom(int i) {
float bubbleWobblingDivider = 100;
@ -999,7 +998,7 @@ void bubbleMovementInRoom(int i) {
float bubbleWobbling = 0.0005;
float bubbleDown = 0.05;
float bubbleUp = 0.05;
//printf(xDir ? "true\n" : "false\n");
//printf(zDir ? "true\n" : "false\n");
@ -1018,40 +1017,35 @@ void bubbleMovementInRoom(int i) {
bubbleZdirInRoom[i] = false;
}
else if (bubbleLocationInRoom[i].z < bubbleOriginalLocationInRoom[i].z - bubbleWobbling * bubbleWobblingDivider) {
bubbleZdir[i] = true;
bubbleZdirInRoom[i] = true;
}
bubbleZdirInRoom[i] = false;
bubbleXdirInRoom[i] = false;
if (bubbleXdirInRoom[i]) {
bubbleLocation[i].x += bubbleWobbling;
bubbleLocationInRoom[i].x += bubbleWobbling;
}
else {
bubbleLocationInRoom[i].x -= bubbleWobbling;
}
if (bubbleZdirInRoom[i]) {
bubbleLocation[i].z += bubbleWobbling;
bubbleLocationInRoom[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 (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 (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;
}
bubbleLocationInRoom[i].y -= bubbleDown;
bubbleLocationInRoom[i].y += bubbleUp;
}
@ -1066,8 +1060,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;
@ -1085,22 +1079,24 @@ void bubbleManager() {
}
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
glm::vec3 scale = glm::vec3(0.01, 0.04, 0.02);
glm::vec3 scale = glm::vec3(0.1, 0.1, 0.1);
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));
// srand(time(NULL));
drawBubble(modelMatrix);
}
}
void renderScene(GLFWwindow* window)
{
glClearColor(0.4f, 0.4f, 0.8f, 1.0f);
@ -1222,8 +1218,8 @@ void renderScene(GLFWwindow* window)
glBindTexture(GL_TEXTURE_2D, depthMap3);
Core::DrawContext(models::testContext);*/
bubbleManager();
bubbleManagerInRoom();
bubbleManager();
glUseProgram(0);
glfwSwapBuffers(window);
@ -1433,12 +1429,6 @@ 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);
@ -1515,6 +1505,8 @@ void init(GLFWwindow* window)
//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);
@ -1569,33 +1561,22 @@ void processInput(GLFWwindow* window)
texture::screen = Core::LoadTexture("textures/visual.png");
PlaySound(TEXT("sound/ocean.wav"), NULL, SND_ASYNC | SND_LOOP);
}
if (glfwGetKey(window, GLFW_KEY_R) == GLFW_PRESS) {
for (int i = 0; i < bubbleQuantity; i++)
if (glfwGetKey(window, GLFW_KEY_B) == GLFW_PRESS) {
for (int i = 0; i < bubblenumber; i++)
{
// srand(time(NULL));
float MAX_NUM = 20.0;
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;
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;
bubbleOriginalLocation[i] = bubbleLocation[i];
bubbleOriginalLocationInRoom[i] = bubbleLocationInRoom[i];
bubbleZdir[i] = true;
bubbleXdir[i] = false;
bubbleZdirInRoom[i] = true;
bubbleXdirInRoom[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;