diff --git a/GrafikaProjekt/Debug/grk-cw6.exe b/GrafikaProjekt/Debug/grk-cw6.exe index 94007c6..f3502aa 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 a2f067c..70fb157 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 9c06ecd..07cad68 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 3b0379b..2af1645 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 80611c4..9e7679c 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 cc62dbe..a5da6d8 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 9b178a3..041f2a5 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 9f44b1e..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 9348a0a..f233d85 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 e46699a..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 50f5a03..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 48ade2b..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 0a131e9..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 dd1227f..212c7f3 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 ff83add..0424139 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 586fa30..ca89132 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 0670e59..8307022 100644 --- a/GrafikaProjekt/pliki/Debug/projekt.log +++ b/GrafikaProjekt/pliki/Debug/projekt.log @@ -1,4 +1,4 @@  main.cpp -C:\Users\Tomek\source\repos\Grafika\GrafikaProjekt\pliki\src\main.cpp(302,12): warning C4244: "argument": konwersja z "time_t" do "unsigned int", możliwa utrata danych +C:\Users\luksli\Desktop\GrafikaProjekt\GrafikaProjekt\pliki\src\main.cpp(329,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\Tomek\source\repos\Grafika\GrafikaProjekt\Debug\grk-cw6.exe + 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 97a7ad3..7816320 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 596660d..1582ec5 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 5bad9c6..21d9aa5 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 1112b36..de8ff05 100644 --- a/GrafikaProjekt/pliki/src/main.cpp +++ b/GrafikaProjekt/pliki/src/main.cpp @@ -19,6 +19,7 @@ GLuint programTexture; Core::Shader_Loader shaderLoader; int random[320]; int random2[320]; +int randomRock[65]; Core::RenderContext shipContext; Core::RenderContext sphereContext; @@ -113,7 +114,7 @@ void keyboard(unsigned char key, int x, int y) { float angleSpeed = 0.1f; - float moveSpeed = 0.1f; + float moveSpeed = 0.4f; switch(key) { case 'z': cameraAngle -= angleSpeed; break; @@ -135,7 +136,7 @@ void mouse(int x, int y) glm::mat4 createCameraMatrix() { - rotation = glm::normalize(rotation * glm::angleAxis((float)(mouseX * 0.01), cameraUp) * glm::angleAxis((float)(mouseY * 0.01), cameraSide)); + rotation = glm::normalize(rotation * glm::angleAxis((float)(mouseX * 0.05), cameraUp) * glm::angleAxis((float)(mouseY * 0.05), cameraSide)); mouseX = mouseY = 0; cameraDir = glm::inverse(rotation) * glm::vec3(0, 0, -1); cameraSide = glm::inverse(rotation) * glm::vec3(-1, 0, 0); @@ -237,6 +238,50 @@ size_t split(const std::string& txt, std::vector& strs, char ch) return strs.size(); } +void createFlora() +{ + 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, ' '); + if (random[i] > 50) + drawObjectTexture(plant1, glm::translate(glm::vec3(std::stof(v[1]), std::stof(v[2]) - 1.2, std::stof(v[3]))) * glm::rotate(glm::degrees((float)random2[i]), glm::vec3(0, 1, 0)), texturePlant1); + else + drawObjectTexture(grass, glm::translate(glm::vec3(std::stof(v[1]), std::stof(v[2]) - 1.15, std::stof(v[3]))) * glm::rotate(glm::degrees((float)random2[i]), glm::vec3(0, 1, 0)), texturePlant3); + } + } + split(myText, v, ' '); + if (random[i] > 50) + drawObjectTexture(plant3, glm::translate(glm::vec3(std::stof(v[1]), std::stof(v[2]) - 0.9, std::stof(v[3]))) * glm::rotate(glm::degrees((float)random2[i]), glm::vec3(0, 1, 0)), texturePlant3); + else + drawObjectTexture(plant4, glm::translate(glm::vec3(std::stof(v[1]), std::stof(v[2]) - 1.2, std::stof(v[3]))) * glm::rotate(glm::degrees((float)random2[i]), glm::vec3(0, 1, 0)), texturePlant4); + } +} + +void createRockFlora() +{ + std::ifstream MyReadFile("models/cave.obj"); + std::string myText; + std::vector v; + for (int i = 0; i < 65; i++) + { + for (int i = 0; i < randomRock[i]; i++) + std::getline(MyReadFile, myText); + split(myText, v, ' '); + if (randomRock[i] > 34) + drawObjectTexture(plant5, glm::translate(glm::vec3(std::stof(v[1]), std::stof(v[2]) - 0.6, std::stof(v[3]))) * glm::rotate(glm::degrees((float)random2[i * 3]), glm::vec3(0, 1, 0)), texturePlant5); + else + drawObjectTexture(plant4, glm::translate(glm::vec3(std::stof(v[1]), std::stof(v[2]) - 0.6, std::stof(v[3]))) * glm::rotate(glm::degrees((float)random2[i*3]), glm::vec3(0, 1, 0)), texturePlant4); + } +} + void renderScene() { // Aktualizacja macierzy widoku i rzutowania @@ -256,30 +301,12 @@ void renderScene() drawObjectTexture(sphereContext, glm::translate(glm::vec3(0, -1.2, 0)), textureAsteroid); drawObjectTexture(fish1Context, glm::translate(glm::vec3(0, 0, 0)), textureFish1); 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); + drawObjectTexture(fish2Context, glm::rotate(glm::degrees((float)rypa / (float)360), glm::vec3(0, -1, 0)) * glm::translate(glm::vec3(0.5, 0, (float)rypa/(float)360)), textureFish2); drawObjectTexture(smiglo, shipModelMatrix * glm::translate(glm::vec3(0, -0.3, -1)) * glm::rotate(glm::degrees((float)rypa), glm::vec3(0, 0, 1)), textureSmiglo); - drawObjectTexture(grass, glm::translate(glm::vec3(0, 1, 0)), texturePlant3); - drawObjectTexture(plant4, glm::translate(glm::vec3(0, 1, 0)), texturePlant4); - drawObjectTexture(plant5, glm::translate(glm::vec3(0, 1, 0)), texturePlant5); - drawObjectTexture(cave, glm::translate(glm::vec3(0, -0.4, 0)), textureAsteroid); + drawObjectTexture(cave, glm::translate(glm::vec3(0, -0.6, 0)), textureAsteroid); - 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); - } + createFlora(); + createRockFlora(); glutSwapBuffers(); } @@ -305,6 +332,10 @@ void init() random[i] = rand() % 50 + 25; random2[i] = rand() % 361 + 1; } + for (int i = 0; i < 65; i++) + { + randomRock[i] = rand() % 20 + 30; + } 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"); @@ -355,7 +386,7 @@ int main(int argc, char ** argv) { glutInit(&argc, argv); glutInitDisplayMode(GLUT_DEPTH | GLUT_DOUBLE | GLUT_RGBA); - glutInitWindowPosition(200, 200); + glutInitWindowPosition(200, 0); glutInitWindowSize(600, 600); glutCreateWindow("OpenGL Pierwszy Program"); glewInit();