This commit is contained in:
AnielaWalczak 2023-02-11 13:26:59 +01:00
parent de7216a411
commit 57fc609f7f
22 changed files with 110 additions and 72 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -2,7 +2,7 @@
<Project> <Project>
<ProjectOutputs> <ProjectOutputs>
<ProjectOutput> <ProjectOutput>
<FullPath>C:\Users\walcz\Desktop\nowe\GRK_Project\GRK_Project\Debug\grk-cw9.exe</FullPath> <FullPath>C:\Users\walcz\Desktop\GRK_Project2\Debug\grk-cw9.exe</FullPath>
</ProjectOutput> </ProjectOutput>
</ProjectOutputs> </ProjectOutputs>
<ContentFiles /> <ContentFiles />

View File

@ -1,65 +1 @@
 main.cpp  grk-cw9.vcxproj -> C:\Users\walcz\Desktop\GRK_Project2\Debug\grk-cw9.exe
C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\shared\minwindef.h(130,1): warning C4005: 'APIENTRY': macro redefinition
C:\Users\walcz\Desktop\nowe\GRK_Project\GRK_Project\dependencies\glfw-3.3.8.bin.WIN32\include\GLFW\glfw3.h(123): message : see previous definition of 'APIENTRY'
C:\Users\walcz\Desktop\nowe\GRK_Project\GRK_Project\cw 9\src\Collision_System.cpp(87,16): warning C4244: 'initializing': conversion from 'float' to 'int', possible loss of data
C:\Users\walcz\Desktop\nowe\GRK_Project\GRK_Project\cw 9\src\Collision_System.cpp(88,14): warning C4244: 'initializing': conversion from 'float' to 'int', possible loss of data
C:\Users\walcz\Desktop\nowe\GRK_Project\GRK_Project\cw 9\src\Collision_System.cpp(90,17): warning C4244: 'initializing': conversion from 'float' to 'int', possible loss of data
C:\Users\walcz\Desktop\nowe\GRK_Project\GRK_Project\cw 9\src\Collision_System.cpp(91,15): warning C4244: 'initializing': conversion from 'float' to 'int', possible loss of data
C:\Users\walcz\Desktop\nowe\GRK_Project\GRK_Project\cw 9\src\Collision_System.cpp(100,9): warning C4244: 'initializing': conversion from 'float' to 'int', possible loss of data
C:\Users\walcz\Desktop\nowe\GRK_Project\GRK_Project\cw 9\src\Collision_System.cpp(101,9): warning C4244: 'initializing': conversion from 'float' to 'int', possible loss of data
C:\Users\walcz\Desktop\nowe\GRK_Project\GRK_Project\cw 9\src\Collision_System.cpp(111,29): warning C4244: 'return': conversion from 'int' to 'float', possible loss of data
C:\Users\walcz\Desktop\nowe\GRK_Project\GRK_Project\cw 9\src\Collision_System.cpp(115,29): warning C4244: 'return': conversion from 'int' to 'float', possible loss of data
C:\Users\walcz\Desktop\nowe\GRK_Project\GRK_Project\cw 9\src\ex_9_1.hpp(242,30): warning C4305: 'initializing': truncation from 'double' to 'float'
C:\Users\walcz\Desktop\nowe\GRK_Project\GRK_Project\cw 9\src\ex_9_1.hpp(259,17): warning C4101: 'data': unreferenced local variable
C:\Users\walcz\Desktop\nowe\GRK_Project\GRK_Project\cw 9\src\ex_9_1.hpp(284,38): warning C4305: '=': truncation from 'double' to 'float'
C:\Users\walcz\Desktop\nowe\GRK_Project\GRK_Project\cw 9\src\ex_9_1.hpp(313,16): warning C4305: 'initializing': truncation from 'double' to 'float'
C:\Users\walcz\Desktop\nowe\GRK_Project\GRK_Project\cw 9\src\ex_9_1.hpp(507,13): warning C4244: 'initializing': conversion from 'double' to 'float', possible loss of data
C:\Users\walcz\Desktop\nowe\GRK_Project\GRK_Project\cw 9\src\ex_9_1.hpp(523,98): warning C4305: 'argument': truncation from 'double' to 'T'
with
[
T=float
]
C:\Users\walcz\Desktop\nowe\GRK_Project\GRK_Project\cw 9\src\ex_9_1.hpp(526,68): warning C4305: 'argument': truncation from 'double' to 'T'
with
[
T=float
]
C:\Users\walcz\Desktop\nowe\GRK_Project\GRK_Project\cw 9\src\ex_9_1.hpp(587,8): warning C4244: 'initializing': conversion from 'float' to 'int', possible loss of data
C:\Users\walcz\Desktop\nowe\GRK_Project\GRK_Project\cw 9\src\ex_9_1.hpp(588,8): warning C4244: 'initializing': conversion from 'float' to 'int', possible loss of data
C:\Users\walcz\Desktop\nowe\GRK_Project\GRK_Project\cw 9\src\ex_9_1.hpp(589,8): warning C4244: 'initializing': conversion from 'float' to 'int', possible loss of data
C:\Users\walcz\Desktop\nowe\GRK_Project\GRK_Project\cw 9\src\ex_9_1.hpp(592,31): warning C4305: 'initializing': truncation from 'double' to 'float'
C:\Users\walcz\Desktop\nowe\GRK_Project\GRK_Project\cw 9\src\ex_9_1.hpp(593,25): warning C4305: 'initializing': truncation from 'double' to 'float'
C:\Users\walcz\Desktop\nowe\GRK_Project\GRK_Project\cw 9\src\ex_9_1.hpp(648,8): warning C4244: 'initializing': conversion from 'float' to 'int', possible loss of data
C:\Users\walcz\Desktop\nowe\GRK_Project\GRK_Project\cw 9\src\ex_9_1.hpp(649,8): warning C4244: 'initializing': conversion from 'float' to 'int', possible loss of data
C:\Users\walcz\Desktop\nowe\GRK_Project\GRK_Project\cw 9\src\ex_9_1.hpp(650,8): warning C4244: 'initializing': conversion from 'float' to 'int', possible loss of data
C:\Users\walcz\Desktop\nowe\GRK_Project\GRK_Project\cw 9\src\ex_9_1.hpp(653,31): warning C4305: 'initializing': truncation from 'double' to 'float'
C:\Users\walcz\Desktop\nowe\GRK_Project\GRK_Project\cw 9\src\ex_9_1.hpp(654,25): warning C4305: 'initializing': truncation from 'double' to 'float'
C:\Users\walcz\Desktop\nowe\GRK_Project\GRK_Project\cw 9\src\ex_9_1.hpp(730,13): warning C4244: 'initializing': conversion from 'double' to 'float', possible loss of data
C:\Users\walcz\Desktop\nowe\GRK_Project\GRK_Project\cw 9\src\ex_9_1.hpp(738,108): warning C4305: 'argument': truncation from 'double' to 'T'
with
[
T=float
]
C:\Users\walcz\Desktop\nowe\GRK_Project\GRK_Project\cw 9\src\ex_9_1.hpp(746,87): warning C4305: 'argument': truncation from 'double' to 'T'
with
[
T=float
]
C:\Users\walcz\Desktop\nowe\GRK_Project\GRK_Project\cw 9\src\ex_9_1.hpp(746,223): warning C4305: 'argument': truncation from 'double' to 'float'
C:\Users\walcz\Desktop\nowe\GRK_Project\GRK_Project\cw 9\src\ex_9_1.hpp(749,59): warning C4305: 'argument': truncation from 'double' to 'T'
with
[
T=float
]
C:\Users\walcz\Desktop\nowe\GRK_Project\GRK_Project\cw 9\src\ex_9_1.hpp(750,37): warning C4305: 'argument': truncation from 'double' to 'float'
C:\Users\walcz\Desktop\nowe\GRK_Project\GRK_Project\cw 9\src\ex_9_1.hpp(782,2): warning C4305: 'argument': truncation from 'double' to 'float'
C:\Users\walcz\Desktop\nowe\GRK_Project\GRK_Project\cw 9\src\ex_9_1.hpp(875,108): warning C4305: 'argument': truncation from 'double' to 'T'
with
[
T=float
]
C:\Users\walcz\Desktop\nowe\GRK_Project\GRK_Project\cw 9\src\ex_9_1.hpp(1112,21): warning C4305: '-=': truncation from 'double' to 'float'
C:\Users\walcz\Desktop\nowe\GRK_Project\GRK_Project\cw 9\src\ex_9_1.hpp(1114,21): warning C4305: '+=': truncation from 'double' to 'float'
Box.obj : warning LNK4075: ignoring '/EDITANDCONTINUE' due to '/INCREMENTAL:NO' specification
LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library
grk-cw9.vcxproj -> C:\Users\walcz\Desktop\nowe\GRK_Project\GRK_Project\Debug\grk-cw9.exe

View File

@ -1,2 +1,2 @@
PlatformToolSet=v143:VCToolArchitecture=Native32Bit:VCToolsVersion=14.30.30705:TargetPlatformVersion=10.0.19041.0: PlatformToolSet=v143:VCToolArchitecture=Native32Bit:VCToolsVersion=14.30.30705:TargetPlatformVersion=10.0.19041.0:
Debug|Win32|C:\Users\walcz\Desktop\nowe\GRK_Project\GRK_Project\| Debug|Win32|C:\Users\walcz\Desktop\GRK_Project2\|

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -210,6 +210,11 @@ glm::vec3 bubbleOriginalLocation[bubbleQuantity];
bool bubbleZdir[bubbleQuantity]; bool bubbleZdir[bubbleQuantity];
bool bubbleXdir[bubbleQuantity]; bool bubbleXdir[bubbleQuantity];
CONST int bubblenumber = 1;
glm::vec3 bubbleLocationInRoom[bubblenumber];
glm::vec3 bubbleOriginalLocationInRoom[bubblenumber];
bool bubbleZdirInRoom[bubblenumber];
bool bubbleXdirInRoom[bubblenumber];
@ -243,6 +248,8 @@ float lastTime = -1.f;
float deltaTime = 0.f; float deltaTime = 0.f;
void bubbleManager(); void bubbleManager();
void bubbleManagerInRoom();
unsigned int loadSkybox(std::vector<std::string> faces) unsigned int loadSkybox(std::vector<std::string> faces)
{ {
@ -637,10 +644,74 @@ void bubbleMovement(int i) {
} }
void bubbleMovementInRoom(int i) {
float bubbleWobblingDivider = 100;
int x = floor(bubbleLocationInRoom[i].x);
int y = floor(bubbleLocationInRoom[i].y);
int z = floor(bubbleLocationInRoom[i].z);
float bubbleWobbling = 0.0005;
float bubbleDown = 0.05;
//printf(xDir ? "true\n" : "false\n");
//printf(zDir ? "true\n" : "false\n");
if (bubbleLocationInRoom[i].x >= bubbleOriginalLocationInRoom[i].x + bubbleWobbling * bubbleWobblingDivider) {
bubbleXdirInRoom[i] = false;
//printf("herex1\n");
}
else if (bubbleLocationInRoom[i].x < bubbleOriginalLocationInRoom[i].x - bubbleWobbling * bubbleWobblingDivider) {
bubbleXdirInRoom[i] = true;
//printf("herex2\n");
}
if (bubbleLocationInRoom[i].z >= bubbleOriginalLocationInRoom[i].z + bubbleWobbling * bubbleWobblingDivider) {
bubbleZdirInRoom[i] = false;
}
else if (bubbleLocationInRoom[i].z < bubbleOriginalLocationInRoom[i].z - bubbleWobbling * bubbleWobblingDivider) {
bubbleZdir[i] = true;
}
bubbleZdirInRoom[i] = false;
bubbleXdirInRoom[i] = false;
if (bubbleXdirInRoom[i]) {
bubbleLocation[i].x += bubbleWobbling;
}
else {
bubbleLocationInRoom[i].x -= bubbleWobbling;
}
if (bubbleZdirInRoom[i]) {
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 (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 -= bubbleDown;
}
void bubbleManager() { void bubbleManager() {
for (int i = 0; i < bubbleQuantity; i++) for (int i = 0; i < bubbleQuantity; i++)
{ {
bubbleMovement(i); bubbleMovement(i);
@ -653,16 +724,34 @@ void bubbleManager() {
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;
//bubbleLocation[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;
bubbleLocation[i].y = (((float)rand() / (float)(RAND_MAX)) * 10) - 5; bubbleLocation[i].y = (((float)rand() / (float)(RAND_MAX)) * 10) - 5;
//bubbleLocation[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;
bubbleOriginalLocation[i] = bubbleLocation[i]; bubbleOriginalLocation[i] = bubbleLocation[i];
bubbleZdir[i] = true; bubbleZdir[i] = true;
bubbleXdir[i] = false; bubbleXdir[i] = false;
}
}
void bubbleManagerInRoom() {
for (int j = 0;j < bubblenumber; j++) {
bubbleMovementInRoom(j);
glm::mat4 modelMatrix = glm::translate(bubbleLocationInRoom[j]);
// Scaling models
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));
// srand(time(NULL));
} }
} }
@ -781,6 +870,7 @@ void renderScene(GLFWwindow* window)
Core::DrawContext(models::testContext);*/ Core::DrawContext(models::testContext);*/
bubbleManager(); bubbleManager();
bubbleManagerInRoom();
glUseProgram(0); glUseProgram(0);
glfwSwapBuffers(window); glfwSwapBuffers(window);
} }
@ -1040,6 +1130,18 @@ void processInput(GLFWwindow* window)
bubbleXdir[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;
cameraPos = newSpaceshipPos - 0.5 * spaceshipDir + glm::vec3(0, 1, 0) * 0.2f; cameraPos = newSpaceshipPos - 0.5 * spaceshipDir + glm::vec3(0, 1, 0) * 0.2f;