diff --git a/Debug/grk-cw9.exe b/Debug/grk-cw9.exe index 26fe524..936974c 100644 Binary files a/Debug/grk-cw9.exe and b/Debug/grk-cw9.exe differ diff --git a/Debug/grk-cw9.pdb b/Debug/grk-cw9.pdb index 0baf82c..bc370a1 100644 Binary files a/Debug/grk-cw9.pdb and b/Debug/grk-cw9.pdb differ diff --git a/cw 9/Debug/grk-cw9.log b/cw 9/Debug/grk-cw9.log index 11a86eb..4065626 100644 --- a/cw 9/Debug/grk-cw9.log +++ b/cw 9/Debug/grk-cw9.log @@ -1,62 +1,62 @@  main.cpp C:\Program Files (x86)\Windows Kits\10\Include\10.0.22000.0\shared\minwindef.h(130,1): warning C4005: 'APIENTRY': macro redefinition C:\Users\arciom\Desktop\GRK_game_scene_new2\dependencies\glfw-3.3.8.bin.WIN32\include\GLFW\glfw3.h(123): message : see previous definition of 'APIENTRY' -C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(172,30): warning C4305: 'initializing': truncation from 'double' to 'float' -C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(226,38): warning C4305: '=': truncation from 'double' to 'float' -C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(249,16): warning C4305: 'initializing': truncation from 'double' to 'float' -C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(297,20): warning C4018: '<': signed/unsigned mismatch -C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(366,20): warning C4018: '<': signed/unsigned mismatch -C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(396,13): warning C4244: 'initializing': conversion from 'double' to 'float', possible loss of data -C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(410,98): warning C4305: 'argument': truncation from 'double' to 'T' +C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(174,30): warning C4305: 'initializing': truncation from 'double' to 'float' +C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(234,38): warning C4305: '=': truncation from 'double' to 'float' +C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(257,16): warning C4305: 'initializing': truncation from 'double' to 'float' +C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(305,20): warning C4018: '<': signed/unsigned mismatch +C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(374,20): warning C4018: '<': signed/unsigned mismatch +C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(404,13): warning C4244: 'initializing': conversion from 'double' to 'float', possible loss of data +C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(418,98): warning C4305: 'argument': truncation from 'double' to 'T' with [ T=float ] -C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(413,68): warning C4305: 'argument': truncation from 'double' to 'T' +C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(421,68): warning C4305: 'argument': truncation from 'double' to 'T' with [ T=float ] -C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(459,13): warning C4244: 'initializing': conversion from 'double' to 'float', possible loss of data -C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(491,13): warning C4244: 'initializing': conversion from 'double' to 'float', possible loss of data -C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(520,80): warning C4305: 'argument': truncation from 'double' to 'float' -C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(529,80): warning C4305: 'argument': truncation from 'double' to 'float' -C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(552,80): warning C4305: 'argument': truncation from 'double' to 'float' -C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(615,13): warning C4244: 'initializing': conversion from 'double' to 'float', possible loss of data -C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(626,108): warning C4305: 'argument': truncation from 'double' to 'T' +C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(467,13): warning C4244: 'initializing': conversion from 'double' to 'float', possible loss of data +C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(499,13): warning C4244: 'initializing': conversion from 'double' to 'float', possible loss of data +C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(528,80): warning C4305: 'argument': truncation from 'double' to 'float' +C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(537,80): warning C4305: 'argument': truncation from 'double' to 'float' +C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(560,80): warning C4305: 'argument': truncation from 'double' to 'float' +C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(642,13): warning C4244: 'initializing': conversion from 'double' to 'float', possible loss of data +C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(654,108): warning C4305: 'argument': truncation from 'double' to 'T' with [ T=float ] -C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(634,87): warning C4305: 'argument': truncation from 'double' to 'T' +C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(662,87): warning C4305: 'argument': truncation from 'double' to 'T' with [ T=float ] -C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(634,223): warning C4305: 'argument': truncation from 'double' to 'float' -C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(637,59): warning C4305: 'argument': truncation from 'double' to 'T' +C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(662,223): warning C4305: 'argument': truncation from 'double' to 'float' +C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(665,59): warning C4305: 'argument': truncation from 'double' to 'T' with [ T=float ] -C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(638,37): warning C4305: 'argument': truncation from 'double' to 'float' -C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(705,20): warning C4018: '<': signed/unsigned mismatch -C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(710,50): warning C4305: 'argument': truncation from 'double' to 'float' -C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(711,51): warning C4305: 'argument': truncation from 'double' to 'float' -C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(788,21): warning C4018: '<': signed/unsigned mismatch -C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(790,49): warning C4244: 'argument': conversion from 'double' to 'float', possible loss of data -C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(813,17): warning C4101: 'data': unreferenced local variable -C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(952,28): warning C4305: 'initializing': truncation from 'double' to 'float' -C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(953,28): warning C4305: 'initializing': truncation from 'double' to 'float' -C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(954,28): warning C4305: 'initializing': truncation from 'double' to 'float' -C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(978,32): warning C4305: 'initializing': truncation from 'double' to 'float' -C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(979,32): warning C4305: 'initializing': truncation from 'double' to 'float' -C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(980,32): warning C4305: 'initializing': truncation from 'double' to 'float' -C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(1016,28): warning C4305: 'initializing': truncation from 'double' to 'float' -C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(1017,28): warning C4305: 'initializing': truncation from 'double' to 'float' -C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(1018,28): warning C4305: 'initializing': truncation from 'double' to 'float' -C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(1175,21): warning C4305: '-=': truncation from 'double' to 'float' -C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(1177,21): warning C4305: '+=': truncation from 'double' to 'float' +C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(666,37): warning C4305: 'argument': truncation from 'double' to 'float' +C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(737,20): warning C4018: '<': signed/unsigned mismatch +C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(742,50): warning C4305: 'argument': truncation from 'double' to 'float' +C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(743,51): warning C4305: 'argument': truncation from 'double' to 'float' +C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(820,21): warning C4018: '<': signed/unsigned mismatch +C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(822,49): warning C4244: 'argument': conversion from 'double' to 'float', possible loss of data +C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(845,17): warning C4101: 'data': unreferenced local variable +C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(988,28): warning C4305: 'initializing': truncation from 'double' to 'float' +C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(989,28): warning C4305: 'initializing': truncation from 'double' to 'float' +C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(990,28): warning C4305: 'initializing': truncation from 'double' to 'float' +C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(1014,32): warning C4305: 'initializing': truncation from 'double' to 'float' +C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(1015,32): warning C4305: 'initializing': truncation from 'double' to 'float' +C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(1016,32): warning C4305: 'initializing': truncation from 'double' to 'float' +C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(1052,28): warning C4305: 'initializing': truncation from 'double' to 'float' +C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(1053,28): warning C4305: 'initializing': truncation from 'double' to 'float' +C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(1054,28): warning C4305: 'initializing': truncation from 'double' to 'float' +C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(1220,21): warning C4305: '-=': truncation from 'double' to 'float' +C:\Users\arciom\Desktop\GRK_game_scene_new2\cw 9\src\ex_9_1.hpp(1222,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\arciom\Desktop\GRK_game_scene_new2\Debug\grk-cw9.exe diff --git a/cw 9/Debug/grk-cw9.tlog/CL.read.1.tlog b/cw 9/Debug/grk-cw9.tlog/CL.read.1.tlog index 76b8d2c..3a33d7a 100644 Binary files a/cw 9/Debug/grk-cw9.tlog/CL.read.1.tlog and b/cw 9/Debug/grk-cw9.tlog/CL.read.1.tlog differ diff --git a/cw 9/Debug/main.obj b/cw 9/Debug/main.obj index d6d169e..db08ed1 100644 Binary files a/cw 9/Debug/main.obj and b/cw 9/Debug/main.obj differ diff --git a/cw 9/Debug/vc142.idb b/cw 9/Debug/vc142.idb index df14ef9..cbb293e 100644 Binary files a/cw 9/Debug/vc142.idb and b/cw 9/Debug/vc142.idb differ diff --git a/cw 9/Debug/vc142.pdb b/cw 9/Debug/vc142.pdb index 41cfe49..1adf63d 100644 Binary files a/cw 9/Debug/vc142.pdb and b/cw 9/Debug/vc142.pdb differ diff --git a/cw 9/src/ex_9_1.hpp b/cw 9/src/ex_9_1.hpp index d9b082c..a79b8d7 100644 --- a/cw 9/src/ex_9_1.hpp +++ b/cw 9/src/ex_9_1.hpp @@ -4,6 +4,8 @@ #include "ext.hpp" #include #include +#include +#include #include "Shader_Loader.h" #include "Render_Utils.h" @@ -216,6 +218,12 @@ float enemyShipAxisZ = 0.0f; float startEnemy = 0; + + +glm::vec3 pawnCoord; +glm::vec3 towerCoord; +glm::vec3 horseCoord; + void updateDeltaTime(float time) { if (lastTime < 0) { lastTime = time; @@ -432,9 +440,9 @@ void renderShadowapSun(GLuint depthMapFBO, glm::mat4 lightVP) { drawObjectDepth(models::paintFaceContext, lightVP, glm::mat4()); //FIGURES - drawObjectDepth(models::pawnFigureContext, lightVP, glm::mat4() * glm::translate(glm::vec3(0, 0.58, 0)) * glm::scale(glm::vec3(0.1f))); - drawObjectDepth(models::towerFigureContext, lightVP, glm::mat4() * glm::translate(glm::vec3(0.2, 0.58, 0.3)) * glm::scale(glm::vec3(0.1f))); - drawObjectDepth(models::horseFigureContext, lightVP, glm::mat4() * glm::translate(glm::vec3(-0.2, 0.58, -0.13)) * glm::scale(glm::vec3(0.1f))); + drawObjectDepth(models::pawnFigureContext, lightVP, glm::mat4() * glm::translate(pawnCoord) * glm::scale(glm::vec3(0.1f))); + drawObjectDepth(models::towerFigureContext, lightVP, glm::mat4() * glm::translate(towerCoord) * glm::scale(glm::vec3(0.1f))); + drawObjectDepth(models::horseFigureContext, lightVP, glm::mat4() * glm::translate(horseCoord) * glm::scale(glm::vec3(0.1f))); glm::vec3 spaceshipSide = glm::normalize(glm::cross(spaceShip.getSpaceShipDir(), glm::vec3(0.f, 1.f, 0.f))); glm::vec3 spaceshipUp = glm::normalize(glm::cross(spaceshipSide, spaceShip.getSpaceShipDir())); @@ -605,7 +613,26 @@ void initDepthMap() glBindFramebuffer(GL_FRAMEBUFFER, 0); } +glm::vec3 randomFiguresCoord() { + //srand(time(0)); + std::random_device rd; + std::mt19937 generator(rd()); + std::uniform_real_distribution distributionX(-0.2, 0.2); + double random_x_number = floor(distributionX(generator) / 0.01) * 0.01; + + + std::uniform_real_distribution distributionZ(-0.13, 0.3); + double random_z_number = floor(distributionZ(generator) / 0.01) * 0.01; + + + /*double random_x_number = (rand() / double(RAND_MAX)) * 0.4 - 0.2; + + + double random_z_number = floor((rand() / double(RAND_MAX)) * (0.3 - (-0.13) / 0.01 + 1) * 0.01 - 0.13 / 0.01) * 0.01 + (-0.13);*///(rand() / double(RAND_MAX)) * (0.3 + 0.13) - 0.13; + std::cout << "Rand X = " << random_x_number << ", Rand Z = " << random_z_number << "\n"; + return glm::vec3(random_x_number, 0.58, random_z_number); +} void renderScene(GLFWwindow* window) @@ -616,6 +643,7 @@ void renderScene(GLFWwindow* window) updateDeltaTime(time); glm::mat4 lightVPSun = glm::ortho(-3.f, 2.3f, -1.3f, 3.f, -1.0f, 40.0f) * glm::lookAt(sunPos, sunPos - sunDir, glm::vec3(0, 1, 0)); + renderShadowapSun(depthMapFBOSun, lightVPSun); drawSkybox(skyboxContext, texture::skybox); @@ -653,11 +681,15 @@ void renderScene(GLFWwindow* window) //FIGURES //x = -0.2, z = -0.13 //x = -0.2, z = 0.3 - // + //x = 0.2, z = 0.3 //x = 0.2, z = -0.13 - drawObjectPBR(models::pawnFigureContext, glm::mat4() * glm::translate(glm::vec3(0, 0.58, 0)) * glm::scale(glm::vec3(0.1f)), glm::vec3(0.402978f, 0.120509f, 0.057729f), 0.2f, 0.0f); - drawObjectPBR(models::towerFigureContext, glm::mat4() * glm::translate(glm::vec3(0.2, 0.58, 0.3)) * glm::scale(glm::vec3(0.1f)), glm::vec3(0.402978f, 0.120509f, 0.057729f), 0.2f, 0.0f); - drawObjectPBR(models::horseFigureContext, glm::mat4() * glm::translate(glm::vec3(-0.2, 0.58, -0.13)) * glm::scale(glm::vec3(0.1f)), glm::vec3(0.402978f, 0.120509f, 0.057729f), 0.2f, 0.0f); + //randomFiguresCoord(); + + + + drawObjectPBR(models::pawnFigureContext, glm::mat4() * glm::translate(pawnCoord) * glm::scale(glm::vec3(0.1f)), glm::vec3(0.402978f, 0.120509f, 0.057729f), 0.2f, 0.0f); + drawObjectPBR(models::towerFigureContext, glm::mat4() * glm::translate(towerCoord) * glm::scale(glm::vec3(0.1f)), glm::vec3(0.1f, 0.1f, 0.1f), 0.2f, 0.0f); + drawObjectPBR(models::horseFigureContext, glm::mat4() * glm::translate(horseCoord) * glm::scale(glm::vec3(0.1f)), glm::vec3(0.402978f, 0.120509f, 0.057729f), 0.2f, 0.0f); //drawObjectPBR(models::sofaContext, glm::mat4(), glm::vec3(0.620f, 0.313f, 0.131f), 0.2f, 0.0f); //drawObjectPBR(models::xThingContext, glm::mat4(), glm::vec3(0.10039f, 0.018356f, 0.001935f), 0.1f, 0.0f); @@ -849,6 +881,10 @@ void init(GLFWwindow* window) initparallaxMappingData(); + pawnCoord = randomFiguresCoord(); + towerCoord = randomFiguresCoord(); + horseCoord = randomFiguresCoord(); + 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"); @@ -1167,6 +1203,15 @@ void processInput(GLFWwindow* window) }*/ } } + if (glfwGetKey(window, GLFW_KEY_R) == GLFW_PRESS) { + //spaceshipDir = glm::vec3(glm::eulerAngleY(-angleSpeed) * glm::vec4(spaceShip.getSpaceShipDir(), 0)); + + pawnCoord = randomFiguresCoord(); + towerCoord = randomFiguresCoord(); + horseCoord = randomFiguresCoord(); + } + + cameraPos = spaceShip.getSpaceShipPos() - 0.5 * spaceShip.getSpaceShipDir() + glm::vec3(0, 1, 0) * 0.2f; cameraDir = spaceShip.getSpaceShipDir();