diff --git a/GrafikaProjekt/Debug/grk-cw6.exe b/GrafikaProjekt/Debug/grk-cw6.exe index bf162fa..1fb1cc7 100644 Binary files a/GrafikaProjekt/Debug/grk-cw6.exe and b/GrafikaProjekt/Debug/grk-cw6.exe differ diff --git a/GrafikaProjekt/Debug/grk-cw6.pdb b/GrafikaProjekt/Debug/grk-cw6.pdb index 5e1b82e..3bf0b75 100644 Binary files a/GrafikaProjekt/Debug/grk-cw6.pdb and b/GrafikaProjekt/Debug/grk-cw6.pdb differ diff --git a/GrafikaProjekt/pliki/Debug/Camera.obj b/GrafikaProjekt/pliki/Debug/Camera.obj index 1ebad8d..093a318 100644 Binary files a/GrafikaProjekt/pliki/Debug/Camera.obj and b/GrafikaProjekt/pliki/Debug/Camera.obj differ diff --git a/GrafikaProjekt/pliki/Debug/Render_Utils.obj b/GrafikaProjekt/pliki/Debug/Render_Utils.obj index f03e86b..ae8f10c 100644 Binary files a/GrafikaProjekt/pliki/Debug/Render_Utils.obj and b/GrafikaProjekt/pliki/Debug/Render_Utils.obj differ diff --git a/GrafikaProjekt/pliki/Debug/SOIL.obj b/GrafikaProjekt/pliki/Debug/SOIL.obj index 786afb0..7405706 100644 Binary files a/GrafikaProjekt/pliki/Debug/SOIL.obj and b/GrafikaProjekt/pliki/Debug/SOIL.obj differ diff --git a/GrafikaProjekt/pliki/Debug/Shader_Loader.obj b/GrafikaProjekt/pliki/Debug/Shader_Loader.obj index 5b88c9c..5d93899 100644 Binary files a/GrafikaProjekt/pliki/Debug/Shader_Loader.obj and b/GrafikaProjekt/pliki/Debug/Shader_Loader.obj differ diff --git a/GrafikaProjekt/pliki/Debug/Texture.obj b/GrafikaProjekt/pliki/Debug/Texture.obj index f9b9c13..8857802 100644 Binary files a/GrafikaProjekt/pliki/Debug/Texture.obj and b/GrafikaProjekt/pliki/Debug/Texture.obj differ diff --git a/GrafikaProjekt/pliki/Debug/grk-cw6.exe.recipe b/GrafikaProjekt/pliki/Debug/grk-cw6.exe.recipe index 4a59f13..b5f96c4 100644 --- a/GrafikaProjekt/pliki/Debug/grk-cw6.exe.recipe +++ b/GrafikaProjekt/pliki/Debug/grk-cw6.exe.recipe @@ -2,7 +2,7 @@ - C:\Users\Tomek\Source\Repos\Grafika\GrafikaProjekt\Debug\grk-cw6.exe + C:\Users\luksli\Desktop\GrafikaProjekt\GrafikaProjekt\Debug\grk-cw6.exe diff --git a/GrafikaProjekt/pliki/Debug/grk-cw6.tlog/CL.command.1.tlog b/GrafikaProjekt/pliki/Debug/grk-cw6.tlog/CL.command.1.tlog index a413fb0..527b339 100644 Binary files a/GrafikaProjekt/pliki/Debug/grk-cw6.tlog/CL.command.1.tlog and b/GrafikaProjekt/pliki/Debug/grk-cw6.tlog/CL.command.1.tlog differ diff --git a/GrafikaProjekt/pliki/Debug/grk-cw6.tlog/CL.read.1.tlog b/GrafikaProjekt/pliki/Debug/grk-cw6.tlog/CL.read.1.tlog index afc910d..1850ea4 100644 Binary files a/GrafikaProjekt/pliki/Debug/grk-cw6.tlog/CL.read.1.tlog and b/GrafikaProjekt/pliki/Debug/grk-cw6.tlog/CL.read.1.tlog differ diff --git a/GrafikaProjekt/pliki/Debug/grk-cw6.tlog/CL.write.1.tlog b/GrafikaProjekt/pliki/Debug/grk-cw6.tlog/CL.write.1.tlog index a99a02c..e0310db 100644 Binary files a/GrafikaProjekt/pliki/Debug/grk-cw6.tlog/CL.write.1.tlog and b/GrafikaProjekt/pliki/Debug/grk-cw6.tlog/CL.write.1.tlog differ diff --git a/GrafikaProjekt/pliki/Debug/grk-cw6.tlog/grk-cw6.lastbuildstate b/GrafikaProjekt/pliki/Debug/grk-cw6.tlog/grk-cw6.lastbuildstate index da31a9b..24f5976 100644 --- a/GrafikaProjekt/pliki/Debug/grk-cw6.tlog/grk-cw6.lastbuildstate +++ b/GrafikaProjekt/pliki/Debug/grk-cw6.tlog/grk-cw6.lastbuildstate @@ -1,2 +1,2 @@ PlatformToolSet=v143:VCToolArchitecture=Native32Bit:VCToolsVersion=14.30.30705:TargetPlatformVersion=10.0.19041.0: -Debug|Win32|C:\Users\Tomek\Source\Repos\Grafika\GrafikaProjekt\| +Debug|Win32|C:\Users\luksli\Desktop\GrafikaProjekt\GrafikaProjekt\| diff --git a/GrafikaProjekt/pliki/Debug/grk-cw6.tlog/link.read.1.tlog b/GrafikaProjekt/pliki/Debug/grk-cw6.tlog/link.read.1.tlog index 5baad64..db52ed0 100644 Binary files a/GrafikaProjekt/pliki/Debug/grk-cw6.tlog/link.read.1.tlog and b/GrafikaProjekt/pliki/Debug/grk-cw6.tlog/link.read.1.tlog differ diff --git a/GrafikaProjekt/pliki/Debug/grk-cw6.tlog/link.write.1.tlog b/GrafikaProjekt/pliki/Debug/grk-cw6.tlog/link.write.1.tlog index 1c823a5..d9d9222 100644 Binary files a/GrafikaProjekt/pliki/Debug/grk-cw6.tlog/link.write.1.tlog and b/GrafikaProjekt/pliki/Debug/grk-cw6.tlog/link.write.1.tlog differ diff --git a/GrafikaProjekt/pliki/Debug/image_DXT.obj b/GrafikaProjekt/pliki/Debug/image_DXT.obj index 28a43a0..647a381 100644 Binary files a/GrafikaProjekt/pliki/Debug/image_DXT.obj and b/GrafikaProjekt/pliki/Debug/image_DXT.obj differ diff --git a/GrafikaProjekt/pliki/Debug/image_helper.obj b/GrafikaProjekt/pliki/Debug/image_helper.obj index e8aa39c..d167754 100644 Binary files a/GrafikaProjekt/pliki/Debug/image_helper.obj and b/GrafikaProjekt/pliki/Debug/image_helper.obj differ diff --git a/GrafikaProjekt/pliki/Debug/main.obj b/GrafikaProjekt/pliki/Debug/main.obj index f64f4c4..6a9897a 100644 Binary files a/GrafikaProjekt/pliki/Debug/main.obj and b/GrafikaProjekt/pliki/Debug/main.obj differ diff --git a/GrafikaProjekt/pliki/Debug/projekt.log b/GrafikaProjekt/pliki/Debug/projekt.log index 84eb470..6444fe7 100644 --- a/GrafikaProjekt/pliki/Debug/projekt.log +++ b/GrafikaProjekt/pliki/Debug/projekt.log @@ -1 +1,4 @@ - projekt.vcxproj -> C:\Users\Tomek\Source\Repos\Grafika\GrafikaProjekt\Debug\grk-cw6.exe + main.cpp +C:\Users\luksli\Desktop\GrafikaProjekt\GrafikaProjekt\pliki\src\main.cpp(289,12): warning C4244: "argument": konwersja z "time_t" do "unsigned int", możliwa utrata danych +Camera.obj : warning LNK4075: zignorowano opcję „/EDITANDCONTINUE” z powodu określenia opcji „/INCREMENTAL:NO” + projekt.vcxproj -> C:\Users\luksli\Desktop\GrafikaProjekt\GrafikaProjekt\Debug\grk-cw6.exe diff --git a/GrafikaProjekt/pliki/Debug/stb_image_aug.obj b/GrafikaProjekt/pliki/Debug/stb_image_aug.obj index 7c5be08..75a5aaa 100644 Binary files a/GrafikaProjekt/pliki/Debug/stb_image_aug.obj and b/GrafikaProjekt/pliki/Debug/stb_image_aug.obj differ diff --git a/GrafikaProjekt/pliki/Debug/vc143.idb b/GrafikaProjekt/pliki/Debug/vc143.idb index 09a2591..058ae81 100644 Binary files a/GrafikaProjekt/pliki/Debug/vc143.idb and b/GrafikaProjekt/pliki/Debug/vc143.idb differ diff --git a/GrafikaProjekt/pliki/Debug/vc143.pdb b/GrafikaProjekt/pliki/Debug/vc143.pdb index edae861..c24d34c 100644 Binary files a/GrafikaProjekt/pliki/Debug/vc143.pdb and b/GrafikaProjekt/pliki/Debug/vc143.pdb differ diff --git a/GrafikaProjekt/pliki/src/main.cpp b/GrafikaProjekt/pliki/src/main.cpp index f4f89e0..c7a27d8 100644 --- a/GrafikaProjekt/pliki/src/main.cpp +++ b/GrafikaProjekt/pliki/src/main.cpp @@ -5,6 +5,7 @@ #include #include #include +#include #include "stb_image.h" #include "Shader_Loader.h" @@ -16,6 +17,8 @@ GLuint programCubemap; GLuint programTexture; Core::Shader_Loader shaderLoader; +int random[320]; +int random2[320]; Core::RenderContext shipContext; Core::RenderContext sphereContext; @@ -79,6 +82,7 @@ glm::vec3 cameraUp; float cameraAngle = 0; int lastMouseX, lastMouseY, mouseX, mouseY; +int rypa = 0; unsigned int cubemapTexture; glm::mat4 cameraMatrix, perspectiveMatrix; @@ -205,6 +209,26 @@ void drawObjectCubemap(glm::mat4 modelMatrix, unsigned int textureId) glUseProgram(0); } +size_t split(const std::string& txt, std::vector& strs, char ch) +{ + size_t pos = txt.find(ch); + size_t initialPos = 0; + strs.clear(); + + // Decompose statement + while (pos != std::string::npos) { + strs.push_back(txt.substr(initialPos, pos - initialPos)); + initialPos = pos + 1; + + pos = txt.find(ch, initialPos); + } + + // Add the last one + strs.push_back(txt.substr(initialPos, std::min(pos, txt.size()) - initialPos + 1)); + + return strs.size(); +} + void renderScene() { // Aktualizacja macierzy widoku i rzutowania @@ -223,9 +247,26 @@ void renderScene() drawObjectTexture(shipContext, shipModelMatrix, textureSubmarine); drawObjectTexture(sphereContext, glm::translate(glm::vec3(0, -1.2, 0)), textureAsteroid); drawObjectTexture(fish1Context, glm::translate(glm::vec3(0, 0, 0)), textureFish1); - drawObjectTexture(fish2Context, glm::translate(glm::vec3(0.25f, 0, 0)), textureFish2); - drawObjectTexture(plant1, glm::translate(glm::vec3(0.25f, -0.4f, 0)), texturePlant1); - drawObjectTexture(plant3, glm::translate(glm::vec3(0.25f, 0, 0)), texturePlant3); + rypa = (rypa + 1) % 360; + drawObjectTexture(fish2Context, glm::translate(glm::vec3(0.25f, 0, (float)rypa/(float)360)) * glm::rotate(glm::degrees((float)rypa / (float)360), glm::vec3(0, 1, 0)), textureFish2); + + std::ifstream MyReadFile("models/teren1.obj"); + std::string myText; + std::vector v; + for (int i = 1; i < 320; i++) + { + for (int j = 0; j < random[i]; j++) + { + std::getline(MyReadFile, myText); + if (j == 25) + { + split(myText, v, ' '); + drawObjectTexture(plant1, glm::translate(glm::vec3(std::stof(v[1]), std::stof(v[2]) - 1.25, std::stof(v[3]))) * glm::rotate(glm::degrees((float)random2[i]), glm::vec3(0, 1, 0)), texturePlant1); + } + } + split(myText, v, ' '); + drawObjectTexture(plant3, glm::translate(glm::vec3(std::stof(v[1]), std::stof(v[2]) - 0.9, std::stof(v[3]))), texturePlant3); + } glutSwapBuffers(); } @@ -246,6 +287,11 @@ void loadModelToContext(std::string path, Core::RenderContext& context) void init() { srand(time(0)); + for (int i = 0; i < 320; i++) + { + random[i] = rand() % 50 + 25; + random2[i] = rand() % 361 + 1; + } glEnable(GL_DEPTH_TEST); programCubemap = shaderLoader.CreateProgram("shaders/shader_cubemap.vert", "shaders/shader_cubemap.frag"); programTexture = shaderLoader.CreateProgram("shaders/shader_tex.vert", "shaders/shader_tex.frag");