diff --git a/.gitignore b/.gitignore index ccb3304..1626e07 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ -PlanetCreator/PlanetCreator.vcxproj.filters -PlanetCreator/PlanetCreator.vcxproj.user -PlanetCreator/PlanetCreator/.vs/ \ No newline at end of file +PlanetCreator/cw 6/PlanetCreator.vcxproj.filters +PlanetCreator/cw 6/PlanetCreator.vcxproj.user +PlanetCreator/.vs/ +.vs/ +PlanetCreator/Debug/ \ No newline at end of file diff --git a/PlanetCreator/.vs/grk-cw/v16/.suo b/PlanetCreator/.vs/grk-cw/v16/.suo index e3527b5..7a09e4c 100644 Binary files a/PlanetCreator/.vs/grk-cw/v16/.suo and b/PlanetCreator/.vs/grk-cw/v16/.suo differ diff --git a/PlanetCreator/.vs/grk-cw/v16/Browse.VC.db b/PlanetCreator/.vs/grk-cw/v16/Browse.VC.db index 4d3e228..c1afac1 100644 Binary files a/PlanetCreator/.vs/grk-cw/v16/Browse.VC.db and b/PlanetCreator/.vs/grk-cw/v16/Browse.VC.db differ diff --git a/PlanetCreator/.vs/grk-cw/v16/ipch/AutoPCH/cdb7b51c336fbdf8/MAIN.ipch b/PlanetCreator/.vs/grk-cw/v16/ipch/AutoPCH/cdb7b51c336fbdf8/MAIN.ipch index 6fc87e0..f70d684 100644 Binary files a/PlanetCreator/.vs/grk-cw/v16/ipch/AutoPCH/cdb7b51c336fbdf8/MAIN.ipch and b/PlanetCreator/.vs/grk-cw/v16/ipch/AutoPCH/cdb7b51c336fbdf8/MAIN.ipch differ diff --git a/PlanetCreator/Debug/grk-cw6.exe b/PlanetCreator/Debug/grk-cw6.exe index 52953a2..f72a909 100644 Binary files a/PlanetCreator/Debug/grk-cw6.exe and b/PlanetCreator/Debug/grk-cw6.exe differ diff --git a/PlanetCreator/Debug/grk-cw6.pdb b/PlanetCreator/Debug/grk-cw6.pdb index 8fde8bb..75fbcfe 100644 Binary files a/PlanetCreator/Debug/grk-cw6.pdb and b/PlanetCreator/Debug/grk-cw6.pdb differ diff --git a/PlanetCreator/cw 6/Debug/grk-cw6.log b/PlanetCreator/cw 6/Debug/grk-cw6.log index 90e08dd..80f5d04 100644 --- a/PlanetCreator/cw 6/Debug/grk-cw6.log +++ b/PlanetCreator/cw 6/Debug/grk-cw6.log @@ -2,8 +2,8 @@ main.cpp C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\shared\minwindef.h(130,1): warning C4005: 'APIENTRY': macro redefinition j:\Desktop\grk\Grafika2023\PlanetCreator\dependencies\glfw-3.3.8.bin.WIN32\include\GLFW\glfw3.h(123): message : see previous definition of 'APIENTRY' -j:\Desktop\grk\Grafika2023\PlanetCreator\cw 6\src\ex_6_1.hpp(76,16): warning C4305: 'initializing': truncation from 'double' to 'float' -j:\Desktop\grk\Grafika2023\PlanetCreator\cw 6\src\ex_6_1.hpp(135,13): warning C4244: 'initializing': conversion from 'double' to 'float', possible loss of data +j:\Desktop\grk\Grafika2023\PlanetCreator\cw 6\src\ex_6_1.hpp(109,16): warning C4305: 'initializing': truncation from 'double' to 'float' +j:\Desktop\grk\Grafika2023\PlanetCreator\cw 6\src\ex_6_1.hpp(168,13): warning C4244: 'initializing': conversion from 'double' to 'float', possible loss of data 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-cw6.vcxproj -> j:\Desktop\grk\Grafika2023\PlanetCreator\Debug\grk-cw6.exe diff --git a/PlanetCreator/cw 6/Debug/grk-cw6.tlog/CL.command.1.tlog b/PlanetCreator/cw 6/Debug/grk-cw6.tlog/CL.command.1.tlog index cbb706d..2dc78ec 100644 Binary files a/PlanetCreator/cw 6/Debug/grk-cw6.tlog/CL.command.1.tlog and b/PlanetCreator/cw 6/Debug/grk-cw6.tlog/CL.command.1.tlog differ diff --git a/PlanetCreator/cw 6/Debug/grk-cw6.tlog/CL.read.1.tlog b/PlanetCreator/cw 6/Debug/grk-cw6.tlog/CL.read.1.tlog index 30ebc7d..cf4de1b 100644 Binary files a/PlanetCreator/cw 6/Debug/grk-cw6.tlog/CL.read.1.tlog and b/PlanetCreator/cw 6/Debug/grk-cw6.tlog/CL.read.1.tlog differ diff --git a/PlanetCreator/cw 6/Debug/grk-cw6.tlog/CL.write.1.tlog b/PlanetCreator/cw 6/Debug/grk-cw6.tlog/CL.write.1.tlog index 7570f6c..b69c0fb 100644 Binary files a/PlanetCreator/cw 6/Debug/grk-cw6.tlog/CL.write.1.tlog and b/PlanetCreator/cw 6/Debug/grk-cw6.tlog/CL.write.1.tlog differ diff --git a/PlanetCreator/cw 6/Debug/imgui.obj b/PlanetCreator/cw 6/Debug/imgui.obj index 393d0bf..606cb10 100644 Binary files a/PlanetCreator/cw 6/Debug/imgui.obj and b/PlanetCreator/cw 6/Debug/imgui.obj differ diff --git a/PlanetCreator/cw 6/Debug/imgui_demo.obj b/PlanetCreator/cw 6/Debug/imgui_demo.obj index 324d96f..cf65399 100644 Binary files a/PlanetCreator/cw 6/Debug/imgui_demo.obj and b/PlanetCreator/cw 6/Debug/imgui_demo.obj differ diff --git a/PlanetCreator/cw 6/Debug/imgui_draw.obj b/PlanetCreator/cw 6/Debug/imgui_draw.obj index 08c85dd..e36fba1 100644 Binary files a/PlanetCreator/cw 6/Debug/imgui_draw.obj and b/PlanetCreator/cw 6/Debug/imgui_draw.obj differ diff --git a/PlanetCreator/cw 6/Debug/imgui_impl_glfw.obj b/PlanetCreator/cw 6/Debug/imgui_impl_glfw.obj index 6d5dfa4..25a41f0 100644 Binary files a/PlanetCreator/cw 6/Debug/imgui_impl_glfw.obj and b/PlanetCreator/cw 6/Debug/imgui_impl_glfw.obj differ diff --git a/PlanetCreator/cw 6/Debug/imgui_impl_opengl3.obj b/PlanetCreator/cw 6/Debug/imgui_impl_opengl3.obj index 1460549..6da02fe 100644 Binary files a/PlanetCreator/cw 6/Debug/imgui_impl_opengl3.obj and b/PlanetCreator/cw 6/Debug/imgui_impl_opengl3.obj differ diff --git a/PlanetCreator/cw 6/Debug/imgui_tables.obj b/PlanetCreator/cw 6/Debug/imgui_tables.obj index 44162ec..b3af928 100644 Binary files a/PlanetCreator/cw 6/Debug/imgui_tables.obj and b/PlanetCreator/cw 6/Debug/imgui_tables.obj differ diff --git a/PlanetCreator/cw 6/Debug/imgui_widgets.obj b/PlanetCreator/cw 6/Debug/imgui_widgets.obj index 0bf6688..a0e65a2 100644 Binary files a/PlanetCreator/cw 6/Debug/imgui_widgets.obj and b/PlanetCreator/cw 6/Debug/imgui_widgets.obj differ diff --git a/PlanetCreator/cw 6/Debug/main.obj b/PlanetCreator/cw 6/Debug/main.obj index f73a302..da094f7 100644 Binary files a/PlanetCreator/cw 6/Debug/main.obj and b/PlanetCreator/cw 6/Debug/main.obj differ diff --git a/PlanetCreator/cw 6/Debug/vc142.idb b/PlanetCreator/cw 6/Debug/vc142.idb index 0989b12..01c04eb 100644 Binary files a/PlanetCreator/cw 6/Debug/vc142.idb and b/PlanetCreator/cw 6/Debug/vc142.idb differ diff --git a/PlanetCreator/cw 6/Debug/vc142.pdb b/PlanetCreator/cw 6/Debug/vc142.pdb index a91a563..1b08849 100644 Binary files a/PlanetCreator/cw 6/Debug/vc142.pdb and b/PlanetCreator/cw 6/Debug/vc142.pdb differ diff --git a/PlanetCreator/cw 6/imgui.ini b/PlanetCreator/cw 6/imgui.ini index 66af9ba..fe61d1a 100644 --- a/PlanetCreator/cw 6/imgui.ini +++ b/PlanetCreator/cw 6/imgui.ini @@ -6,3 +6,11 @@ Size=400,400 Pos=270,87 Size=205,58 +[Window][Control Panel] +Pos=4,3 +Size=218,129 + +[Window][Dodawanie nowej planety] +Pos=9,13 +Size=260,108 + diff --git a/PlanetCreator/cw 6/src/ex_6_1.hpp b/PlanetCreator/cw 6/src/ex_6_1.hpp index 96fbafe..782b1e4 100644 --- a/PlanetCreator/cw 6/src/ex_6_1.hpp +++ b/PlanetCreator/cw 6/src/ex_6_1.hpp @@ -69,6 +69,39 @@ glm::mat4 createCameraMatrix() return cameraMatrix; } +void renderImGui() { + //glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + + // Начало нового кадра ImGui + ImGui_ImplOpenGL3_NewFrame(); + ImGui_ImplGlfw_NewFrame(); + ImGui::NewFrame(); + + // Создание окон и элементов ImGui + ImGui::Begin("Dodawanie nowej planety"); + + // Добавление слайдеров для "Влажности" и "Осадков" + static float humidity = 0.0f; // Начальное значение для влажности + static float precipitation = 0.0f; // Начальное значение для осадков + ImGui::SliderFloat("Wilgotnosc", &humidity, 0.0f, 100.0f); // Слайдер для влажности + ImGui::SliderFloat("Opady", &precipitation, 0.0f, 100.0f); // Слайдер для осадков + + // Добавление кнопок "Очистить" и "Добавить" + if (ImGui::Button("Wyczyscic")) { + // Логика обработки кнопки "Очистить" + } + ImGui::SameLine(); // Расположить следующую кнопку на той же линии + if (ImGui::Button("Dodac")) { + // Логика обработки кнопки "Добавить" + } + + ImGui::End(); + + // Рендеринг ImGui + ImGui::Render(); + ImGui_ImplOpenGL3_RenderDrawData(ImGui::GetDrawData()); +} + glm::mat4 createPerspectiveMatrix() { @@ -130,7 +163,7 @@ void drawObjectTexture(Core::RenderContext& context, glm::mat4 modelMatrix, GLui void renderScene(GLFWwindow* window) { glClearColor(0.0f, 0.3f, 0.3f, 1.0f); - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + //glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glm::mat4 transformation; float time = glfwGetTime(); @@ -146,8 +179,8 @@ void renderScene(GLFWwindow* window) drawObjectColor(plant2Context, plantModelMatrix, glm::vec3(1,1,1), program); drawObjectColor(plant3Context,glm::translate(glm::vec3(1.0f, 0.5f, 3.0f)) *glm::scale(glm::vec3(0.03f)) *glm::rotate(glm::mat4(1.0f), glm::radians(-90.0f), glm::vec3(1.0f, 0.0f, 0.0f)),glm::vec3(1, 1, 1), program); - - glfwSwapBuffers(window); + + //glfwSwapBuffers(window); } void framebuffer_size_callback(GLFWwindow* window, int width, int height) { @@ -202,7 +235,7 @@ void shutdown(GLFWwindow* window) //obsluga wejscia void processInput(GLFWwindow* window) { - float cameraSpeed = 0.001f; + float cameraSpeed = 0.1f; if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS) glfwSetWindowShouldClose(window, true); @@ -239,29 +272,25 @@ void processInput(GLFWwindow* window) //} ////} + + + void renderLoop(GLFWwindow* window) { while (!glfwWindowShouldClose(window)) { - - // ImGui кадр - //ImGui_ImplOpenGL3_NewFrame(); - //ImGui_ImplGlfw_NewFrame(); - //ImGui::NewFrame(); - - //// Создание ImGui окон и элементов - //ImGui::Begin("Demo window"); - //ImGui::Text("Hello, ImGui!"); - //// Добавьте другие элементы управления здесь - //ImGui::End(); - processInput(window); - renderScene(window); glfwPollEvents(); - //ImGui::Render(); + processInput(window); // Обработка ввода - //glClear(GL_COLOR_BUFFER_BIT); // Очистка экрана + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); - //ImGui_ImplOpenGL3_RenderDrawData(ImGui::GetDrawData()); - //glfwSwapInterval(1); - //glfwSwapBuffers(window); + // Рендеринг сцены + renderScene(window); + + // Рендеринг ImGui + renderImGui(); + + glEnable(GL_DEPTH_TEST); + + glfwSwapBuffers(window); } } diff --git a/PlanetCreator/cw 6/src/main.cpp b/PlanetCreator/cw 6/src/main.cpp index 75da10c..b71ae16 100644 --- a/PlanetCreator/cw 6/src/main.cpp +++ b/PlanetCreator/cw 6/src/main.cpp @@ -60,6 +60,7 @@ int main(int argc, char** argv) return -1; } glfwMakeContextCurrent(window); + glfwSwapInterval(1); // ladowanie OpenGL za pomoca glew glewInit();