diff --git a/PlanetCreator/Release/grk-cw6.exe b/PlanetCreator/Release/grk-cw6.exe index 7ee9887..6d03a67 100644 Binary files a/PlanetCreator/Release/grk-cw6.exe and b/PlanetCreator/Release/grk-cw6.exe differ diff --git a/PlanetCreator/Release/grk-cw6.pdb b/PlanetCreator/Release/grk-cw6.pdb index 0e84f7f..f48f915 100644 Binary files a/PlanetCreator/Release/grk-cw6.pdb and b/PlanetCreator/Release/grk-cw6.pdb differ diff --git a/PlanetCreator/cw 6/Release/Render_Utils.obj b/PlanetCreator/cw 6/Release/Render_Utils.obj index 08e6313..853021e 100644 Binary files a/PlanetCreator/cw 6/Release/Render_Utils.obj and b/PlanetCreator/cw 6/Release/Render_Utils.obj differ diff --git a/PlanetCreator/cw 6/Release/grk-cw6.iobj b/PlanetCreator/cw 6/Release/grk-cw6.iobj index e28ba8c..5cbc921 100644 Binary files a/PlanetCreator/cw 6/Release/grk-cw6.iobj and b/PlanetCreator/cw 6/Release/grk-cw6.iobj differ diff --git a/PlanetCreator/cw 6/Release/grk-cw6.ipdb b/PlanetCreator/cw 6/Release/grk-cw6.ipdb index 127f477..a6cb0f1 100644 Binary files a/PlanetCreator/cw 6/Release/grk-cw6.ipdb and b/PlanetCreator/cw 6/Release/grk-cw6.ipdb differ diff --git a/PlanetCreator/cw 6/Release/grk-cw6.log b/PlanetCreator/cw 6/Release/grk-cw6.log index 720c4d3..b8c2fd0 100644 --- a/PlanetCreator/cw 6/Release/grk-cw6.log +++ b/PlanetCreator/cw 6/Release/grk-cw6.log @@ -1,21 +1,20 @@ - Render_Utils.cpp - main.cpp + main.cpp C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\shared\minwindef.h(130,1): warning C4005: "APIENTRY": ponowna definicja makra D:\DANE\CppProjects\grk_cw1 (1)\PlanetCreator\PlanetCreator\dependencies\glfw-3.3.8.bin.WIN32\include\GLFW\glfw3.h(123,1): message : zobacz poprzednią definicję „APIENTRY” -D:\DANE\CppProjects\grk_cw1 (1)\PlanetCreator\PlanetCreator\cw 6\src\ex_6_1.hpp(126,15): warning C4244: "inicjowanie": konwersja z "double" do "float", możliwa utrata danych -D:\DANE\CppProjects\grk_cw1 (1)\PlanetCreator\PlanetCreator\cw 6\src\ex_6_1.hpp(166,30): warning C4244: "=": konwersja z "float" do "int", możliwa utrata danych -D:\DANE\CppProjects\grk_cw1 (1)\PlanetCreator\PlanetCreator\cw 6\src\ex_6_1.hpp(172,20): warning C4244: "=": konwersja z "int" do "float", możliwa utrata danych -D:\DANE\CppProjects\grk_cw1 (1)\PlanetCreator\PlanetCreator\cw 6\src\ex_6_1.hpp(321,10): warning C4305: "inicjowanie": obcięcie z "double" do "float" -D:\DANE\CppProjects\grk_cw1 (1)\PlanetCreator\PlanetCreator\cw 6\src\ex_6_1.hpp(404,57): warning C4305: "argument": obcięcie z "double" do "GLfloat" -D:\DANE\CppProjects\grk_cw1 (1)\PlanetCreator\PlanetCreator\cw 6\src\ex_6_1.hpp(405,58): warning C4305: "argument": obcięcie z "double" do "GLfloat" -D:\DANE\CppProjects\grk_cw1 (1)\PlanetCreator\PlanetCreator\cw 6\src\ex_6_1.hpp(426,57): warning C4305: "argument": obcięcie z "double" do "GLfloat" -D:\DANE\CppProjects\grk_cw1 (1)\PlanetCreator\PlanetCreator\cw 6\src\ex_6_1.hpp(427,58): warning C4305: "argument": obcięcie z "double" do "GLfloat" -D:\DANE\CppProjects\grk_cw1 (1)\PlanetCreator\PlanetCreator\cw 6\src\ex_6_1.hpp(437,17): warning C4244: "inicjowanie": konwersja z "double" do "float", możliwa utrata danych -D:\DANE\CppProjects\grk_cw1 (1)\PlanetCreator\PlanetCreator\cw 6\src\ex_6_1.hpp(514,13): warning C4244: "inicjowanie": konwersja z "double" do "float", możliwa utrata danych -D:\DANE\CppProjects\grk_cw1 (1)\PlanetCreator\PlanetCreator\cw 6\src\ex_6_1.hpp(553,87): warning C4305: "argument": obcięcie z "double" do "float" -D:\DANE\CppProjects\grk_cw1 (1)\PlanetCreator\PlanetCreator\cw 6\src\ex_6_1.hpp(641,44): warning C4305: "argument": obcięcie z "double" do "float" -D:\DANE\CppProjects\grk_cw1 (1)\PlanetCreator\PlanetCreator\cw 6\src\ex_6_1.hpp(642,44): warning C4305: "argument": obcięcie z "double" do "float" -D:\DANE\CppProjects\grk_cw1 (1)\PlanetCreator\PlanetCreator\cw 6\src\ex_6_1.hpp(643,44): warning C4305: "argument": obcięcie z "double" do "float" +D:\DANE\CppProjects\grk_cw1 (1)\PlanetCreator\PlanetCreator\cw 6\src\ex_6_1.hpp(141,15): warning C4244: "inicjowanie": konwersja z "double" do "float", możliwa utrata danych +D:\DANE\CppProjects\grk_cw1 (1)\PlanetCreator\PlanetCreator\cw 6\src\ex_6_1.hpp(175,30): warning C4305: "inicjowanie": obcięcie z "double" do "float" +D:\DANE\CppProjects\grk_cw1 (1)\PlanetCreator\PlanetCreator\cw 6\src\ex_6_1.hpp(181,30): warning C4244: "=": konwersja z "float" do "int", możliwa utrata danych +D:\DANE\CppProjects\grk_cw1 (1)\PlanetCreator\PlanetCreator\cw 6\src\ex_6_1.hpp(187,20): warning C4244: "=": konwersja z "int" do "float", możliwa utrata danych +D:\DANE\CppProjects\grk_cw1 (1)\PlanetCreator\PlanetCreator\cw 6\src\ex_6_1.hpp(312,57): warning C4305: "argument": obcięcie z "double" do "GLfloat" +D:\DANE\CppProjects\grk_cw1 (1)\PlanetCreator\PlanetCreator\cw 6\src\ex_6_1.hpp(313,58): warning C4305: "argument": obcięcie z "double" do "GLfloat" +D:\DANE\CppProjects\grk_cw1 (1)\PlanetCreator\PlanetCreator\cw 6\src\ex_6_1.hpp(388,10): warning C4305: "inicjowanie": obcięcie z "double" do "float" +D:\DANE\CppProjects\grk_cw1 (1)\PlanetCreator\PlanetCreator\cw 6\src\ex_6_1.hpp(471,57): warning C4305: "argument": obcięcie z "double" do "GLfloat" +D:\DANE\CppProjects\grk_cw1 (1)\PlanetCreator\PlanetCreator\cw 6\src\ex_6_1.hpp(472,58): warning C4305: "argument": obcięcie z "double" do "GLfloat" +D:\DANE\CppProjects\grk_cw1 (1)\PlanetCreator\PlanetCreator\cw 6\src\ex_6_1.hpp(506,17): warning C4244: "inicjowanie": konwersja z "double" do "float", możliwa utrata danych +D:\DANE\CppProjects\grk_cw1 (1)\PlanetCreator\PlanetCreator\cw 6\src\ex_6_1.hpp(595,13): warning C4244: "inicjowanie": konwersja z "double" do "float", możliwa utrata danych +D:\DANE\CppProjects\grk_cw1 (1)\PlanetCreator\PlanetCreator\cw 6\src\ex_6_1.hpp(641,70): warning C4305: "argument": obcięcie z "double" do "float" +D:\DANE\CppProjects\grk_cw1 (1)\PlanetCreator\PlanetCreator\cw 6\src\ex_6_1.hpp(722,44): warning C4305: "argument": obcięcie z "double" do "float" +D:\DANE\CppProjects\grk_cw1 (1)\PlanetCreator\PlanetCreator\cw 6\src\ex_6_1.hpp(723,45): warning C4305: "argument": obcięcie z "double" do "float" C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\include\tuple(144,47): warning C4244: "inicjowanie": konwersja z "_Ty" do "_Ty", możliwa utrata danych with [ @@ -58,8 +57,8 @@ C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.3253 _Tag=std::_Unpack_tuple_t, _Tpl=std::tuple ] -D:\DANE\CppProjects\grk_cw1 (1)\PlanetCreator\PlanetCreator\cw 6\src\ex_6_1.hpp(173,50): message : zobacz odwołanie do kompilowanego tworzenia wystąpienia „std::tuple::tuple(std::tuple &&) noexcept” funkcji szablon -D:\DANE\CppProjects\grk_cw1 (1)\PlanetCreator\PlanetCreator\cw 6\src\ex_6_1.hpp(173,33): message : zobacz pierwsze odwołanie do elementu „std::tuple::tuple” w „populatePlanet” +D:\DANE\CppProjects\grk_cw1 (1)\PlanetCreator\PlanetCreator\cw 6\src\ex_6_1.hpp(188,50): message : zobacz odwołanie do kompilowanego tworzenia wystąpienia „std::tuple::tuple(std::tuple &&) noexcept” funkcji szablon +D:\DANE\CppProjects\grk_cw1 (1)\PlanetCreator\PlanetCreator\cw 6\src\ex_6_1.hpp(188,33): message : zobacz pierwsze odwołanie do elementu „std::tuple::tuple” w „populatePlanet” C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\include\tuple(144,47): warning C4244: "inicjowanie": konwersja z "const int" do "_Ty", możliwa utrata danych with [ @@ -110,7 +109,7 @@ C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.3253 _RanIt=std::tuple *, _Pr=bool (__cdecl *)(std::tuple,std::tuple) ] -D:\DANE\CppProjects\grk_cw1 (1)\PlanetCreator\PlanetCreator\cw 6\src\ex_6_1.hpp(181,7): message : zobacz odwołanie do kompilowanego tworzenia wystąpienia „void std::sort>>,bool(__cdecl *)(std::tuple,std::tuple)>(const _RanIt,const _RanIt,_Pr)” funkcji szablon +D:\DANE\CppProjects\grk_cw1 (1)\PlanetCreator\PlanetCreator\cw 6\src\ex_6_1.hpp(197,7): message : zobacz odwołanie do kompilowanego tworzenia wystąpienia „void std::sort>>,bool(__cdecl *)(std::tuple,std::tuple)>(const _RanIt,const _RanIt,_Pr)” funkcji szablon with [ _Ty=std::tuple, @@ -118,8 +117,8 @@ D:\DANE\CppProjects\grk_cw1 (1)\PlanetCreator\PlanetCreator\cw 6\src\ex_6_1.hpp( _Pr=bool (__cdecl *)(std::tuple,std::tuple) ] Trwa generowanie kodu - 9 of 2414 functions ( 0.4%) were compiled, the rest were copied from previous compilation. - 4 functions were new in current compilation - 23 functions had inline decision re-evaluated but remain unchanged + 79 of 2545 functions ( 3.1%) were compiled, the rest were copied from previous compilation. + 3 functions were new in current compilation + 21 functions had inline decision re-evaluated but remain unchanged Zakończono generowanie kodu grk-cw6.vcxproj -> D:\DANE\CppProjects\grk_cw1 (1)\PlanetCreator\PlanetCreator\Release\grk-cw6.exe diff --git a/PlanetCreator/cw 6/Release/grk-cw6.tlog/CL.read.1.tlog b/PlanetCreator/cw 6/Release/grk-cw6.tlog/CL.read.1.tlog index 61be83f..e574687 100644 Binary files a/PlanetCreator/cw 6/Release/grk-cw6.tlog/CL.read.1.tlog and b/PlanetCreator/cw 6/Release/grk-cw6.tlog/CL.read.1.tlog differ diff --git a/PlanetCreator/cw 6/Release/grk-cw6.tlog/CL.write.1.tlog b/PlanetCreator/cw 6/Release/grk-cw6.tlog/CL.write.1.tlog index 0ce9227..373d0c1 100644 Binary files a/PlanetCreator/cw 6/Release/grk-cw6.tlog/CL.write.1.tlog and b/PlanetCreator/cw 6/Release/grk-cw6.tlog/CL.write.1.tlog differ diff --git a/PlanetCreator/cw 6/Release/grk-cw6.tlog/link.read.1.tlog b/PlanetCreator/cw 6/Release/grk-cw6.tlog/link.read.1.tlog index 03f9b2d..a927d7b 100644 Binary files a/PlanetCreator/cw 6/Release/grk-cw6.tlog/link.read.1.tlog and b/PlanetCreator/cw 6/Release/grk-cw6.tlog/link.read.1.tlog differ diff --git a/PlanetCreator/cw 6/Release/main.obj b/PlanetCreator/cw 6/Release/main.obj index 272c0fe..7a70d1d 100644 Binary files a/PlanetCreator/cw 6/Release/main.obj and b/PlanetCreator/cw 6/Release/main.obj differ diff --git a/PlanetCreator/cw 6/Release/vc143.pdb b/PlanetCreator/cw 6/Release/vc143.pdb index 8d958b3..faab6ab 100644 Binary files a/PlanetCreator/cw 6/Release/vc143.pdb and b/PlanetCreator/cw 6/Release/vc143.pdb differ diff --git a/PlanetCreator/cw 6/grk-cw6.vcxproj b/PlanetCreator/cw 6/grk-cw6.vcxproj index 5df33d9..544bf57 100644 --- a/PlanetCreator/cw 6/grk-cw6.vcxproj +++ b/PlanetCreator/cw 6/grk-cw6.vcxproj @@ -83,7 +83,7 @@ Application true Unicode - v142 + v143 Application diff --git a/PlanetCreator/cw 6/imgui.ini b/PlanetCreator/cw 6/imgui.ini index 81714f8..f3be94c 100644 --- a/PlanetCreator/cw 6/imgui.ini +++ b/PlanetCreator/cw 6/imgui.ini @@ -11,6 +11,6 @@ Pos=4,3 Size=218,129 [Window][Dodawanie nowej planety] -Pos=0,-22 +Pos=1,-20 Size=282,158 diff --git a/PlanetCreator/cw 6/src/ex_6_1.hpp b/PlanetCreator/cw 6/src/ex_6_1.hpp index b196242..b1c2d63 100644 --- a/PlanetCreator/cw 6/src/ex_6_1.hpp +++ b/PlanetCreator/cw 6/src/ex_6_1.hpp @@ -121,8 +121,8 @@ namespace Plant class Plant { public: - float humMean; float humSD; float tempMean; float tempSD; std::string name; std::string fileName; Core::RenderContext modelContext; glm::vec3 pos; - Plant(float humMean, float humSD, float tempMean, float tempSD, std::string name, std::string fileName) { + float humMean; float humSD; float tempMean; float tempSD; std::string name; std::string fileName; Core::RenderContext modelContext; glm::vec3 pos; Material material; + Plant(float humMean, float humSD, float tempMean, float tempSD, std::string name, std::string fileName,Material material) { this->humMean = humMean; this->humSD = humSD; this->tempMean = tempMean; @@ -132,6 +132,7 @@ namespace Plant loadModelToContext(fileName, modelContext); this->pos = glm::vec3(1,0,0); + this->material = material; //this->pos = glm::vec3((rand() % 100) / 100, (rand() % 100) / 100, (rand() % 100) / 100); } @@ -171,7 +172,7 @@ PlanetParams populatePlanet(PlanetParams planet, std::vector plant float probability=0.5f; int HOW_MANY_PLANTS = 10000; int PRECISION = 10000; - float NOTHING_SPAWNS_CUTOFF = 0.0; + float NOTHING_SPAWNS_CUTOFF = 0.2; int sum = 0; int chosen_number = 0; std::vector> probabilities; @@ -188,6 +189,7 @@ PlanetParams populatePlanet(PlanetParams planet, std::vector plant probabilities.push_back(probIdPair); j++; } + probabilities.push_back(std::make_tuple(-1, NOTHING_SPAWNS_CUTOFF * PRECISION)); for (auto& probability : probabilities) { sum += std::get<1>(probability); } @@ -200,7 +202,7 @@ PlanetParams populatePlanet(PlanetParams planet, std::vector plant int winnerId = -1; for (auto& probability : probabilities) { - if (counter + chosen_number < std::get<1>(probability)) + if (chosen_number > std::get<1>(probability)) { winnerId = std::get<0>(probability); break; @@ -308,7 +310,7 @@ void DrawContextInstanced(Core::RenderContext& context, std::vector t //glUniform1f(glGetUniformLocation(program, "dissolve"), material.d); glUniform1i(glGetUniformLocation(program, "illuminationModel"), material.illum); glUniform1f(glGetUniformLocation(program, "metallic"), 0.05); - glUniform1f(glGetUniformLocation(program, "roughness"), 0.2); + glUniform1f(glGetUniformLocation(program, "roughness"), 0.9); glDrawElementsInstanced( GL_TRIANGLES, // mode @@ -366,8 +368,8 @@ void renderImGui() { static PlanetParams newPlanetParams; ImGui::InputFloat3("Pozycja", &newPlanetParams.position[0]); ImGui::SliderFloat("Rozmiar", &newPlanetParams.size, 0.1f, 10.0f); - ImGui::SliderFloat("Wilgotnosc", &newPlanetParams.humidity, 0.0f, 10.0f); // Слайдер для влажности - ImGui::SliderFloat("Temperatura", &newPlanetParams.temperature, 0.0f, 10.0f); // Слайдер для осадков + ImGui::SliderFloat("Wilgotnosc", &newPlanetParams.humidity, 0.0f, 100.0f); // Слайдер для влажности + ImGui::SliderFloat("Temperatura", &newPlanetParams.temperature, 0.0f, 100.0f); // Слайдер для осадков if (ImGui::Button("Dodac")) { newPlanetParams =populatePlanet(newPlanetParams, plant_specimens); @@ -496,7 +498,7 @@ void drawObjectTexture_plantInstanced(Core::RenderContext& context, std::vector< DrawContextInstanced(context, transformations,modelMatrices,count,material,program); glUseProgram(0); } -void placeObjectOnPlanet(Core::RenderContext& objectContext, glm::mat4 objectMatrix,float scale,std::vectorplacePoints, PlanetParams planetParams,int count) { +void placeObjectOnPlanet(Core::RenderContext& objectContext, glm::mat4 objectMatrix,float scale,std::vectorplacePoints, PlanetParams planetParams,int count,Material material) { float planetScale = planetParams.size; glm::mat4 savedobjectMatrix; @@ -522,7 +524,7 @@ void placeObjectOnPlanet(Core::RenderContext& objectContext, glm::mat4 objectMat - drawObjectTexture_plantInstanced(objectContext, matrices, plant2_1Material, program_pbr_instanced,count); + drawObjectTexture_plantInstanced(objectContext, matrices, material, program_pbr_instanced,count); @@ -636,7 +638,7 @@ void renderScene(GLFWwindow* window) current_type_plant_positions.push_back(std::get<1>(plant)); } //placeObjectOnPlanet(plant_specimens[std::get<0>(plant)].modelContext, glm::mat4(), 0.2, std::get<1>(plant), planet, plant_type_count); - placeObjectOnPlanet(plant_specimens[0].modelContext, glm::mat4(), 0.2, current_type_plant_positions, planet, plant_type_count); + placeObjectOnPlanet(plant_specimens[0].modelContext, glm::mat4(), 0.2, current_type_plant_positions, planet, plant_type_count, plant_specimens[0].material); } //for (const auto& plant : plants) @@ -715,10 +717,11 @@ void init(GLFWwindow* window) //material loadMTLAndGetTextureID("./models/plant_1_1.mtl", plant3Material); loadMTLAndGetTextureID("./models/plant_2_1_small.mtl", plant2_1Material); + loadMTLAndGetTextureID("./models/plant_2_1_small.mtl", plant2_1Material); + + plant_specimens.push_back(Plant::Plant(5, 0.99, 5, 1, "plant1_s", "./models/plant_1_1_zmn.obj", plant3Material)); + plant_specimens.push_back(Plant::Plant(20, 0.95, 20, 1, "plant1_m", "./models/plant_2_1.obj", plant2_1Material)); - plant_specimens.push_back(Plant::Plant(1, 0.99, 1, 1, "plant1_s", "./models/plant_1_1_zmn.obj")); - plant_specimens.push_back(Plant::Plant(1, 0.95, 1, 1, "plant1_m", "./models/plant_1_1.obj")); - plant_specimens.push_back(Plant::Plant(1, 0.93, 1, 1, "plant1_l", "./models/plant_1_1.obj")); //plant_specimens.push_back(Plant::Plant(1, 0.90, 1, 1, "testPlantCCCCCCCCCCC", "./models/plant_4.ply")); //plant_specimens.push_back(Plant::Plant(1, 0.5, 1, 1, "testPlantBBBBBBBBB", "./models/plant_4.ply")); //plant_specimens.push_back(Plant::Plant(1, 1, 1, 1, "testPlantFFFFFFFFFFFF", "./models/plant_4.ply"));