diff --git a/demos/pli_demo/src/pli_demo.cpp b/demos/pli_demo/src/pli_demo.cpp index eff6c1d82ab482924b56ac26dcfc2f9fd25cbe4a..44714b67e82d58f1000d6c4ca5adebad070d841b 100644 --- a/demos/pli_demo/src/pli_demo.cpp +++ b/demos/pli_demo/src/pli_demo.cpp @@ -51,8 +51,8 @@ #pragma clang diagnostic ignored "-Wmissing-prototypes" #endif -int main(int, char**) { - bool use_vr = false; +int main_real(int, char**) { + bool use_vr = true; auto cut_plane_point = glm::vec3(1, 0, 1); auto cut_plane_norm = glm::vec3(0, 1, 0); @@ -266,7 +266,7 @@ int main(int, char**) { return EXIT_SUCCESS; } -int main_bm(int, char**) { +int main(int, char**) { bool use_vr = true; std::unique_ptr<phx::Engine> engine = @@ -366,8 +366,8 @@ int main_bm(int, char**) { nlohmann::json declaration = { {"from", {{"X", 0.0f}, {"Y", 0.0f}, {"Z", 0.0f}}}, - {"to", {{"X", 500.0f}, {"Y", 500.0f}, {"Z", 150.0f}}}, - {"stride", {{"X", 1.0f}, {"Y", 1.0f}, {"Z", 1.0f}}}}; + {"to", {{"X", 360.0f}, {"Y", 500.0f}, {"Z", 50.0f}}}, + {"stride", {{"X", 3.0f}, {"Y", 3.0f}, {"Z", 3.0f}}}}; nlohmann::json planes_dec = {}; @@ -387,54 +387,9 @@ int main_bm(int, char**) { auto pli_resource = phx::ResourceUtils::LoadResourceFromFile<phx::PLIRegion>( R"(/data/MSA0309_s0536-0695.h5)", declaration); - auto session = bm::run<float, std::milli>( - 10, [&](bm::session_recorder<float, std::milli>& recorder) { - - for (int i = 1; i < 11; i++) { - declaration = { - {"from", {{"X", 0.0f}, {"Y", 0.0f}, {"Z", 0.0f}}}, - {"to", {{"X", 50.0f * i}, {"Y", 50.0f * i}, {"Z", 15.0f * i}}}, - {"stride", {{"X", 1.0f}, {"Y", 1.0f}, {"Z", 1.0f}}}}; - - planes_dec = {}; - - planes_dec.push_back({ - {"A", 0}, - {"B", -1}, - {"C", 0}, - {"D", -(1 * 0 + (40 * i) * (-1) + 1 * 0)}, - }); - - planes_dec.push_back({ - {"A", 0}, - {"B", 1}, - {"C", 0}, - {"D", -(1 * 0 + (10 * i) * (1) + 1 * 0)}, - }); - - declaration["cuttingPlane"] = planes_dec; - pli_resource = - phx::ResourceUtils::LoadResourceFromFile<phx::PLIRegion>( - R"(/data/MSA0309_s0536-0695.h5)", declaration); - - recorder.record("load_" + std::to_string((50 * 50 * 15 * i * i * i)), - [&]() { - phx::PliDemoUtil::load_surface_representation( - entity, pli_resource, false); - }); - } - - }); + phx::PliDemoUtil::load(scene, std::vector<std::pair<glm::vec3, glm::vec3>>()); - for (auto record : session.records) { - auto record_name = record.first; - auto mean = record.second.mean(); - auto variance = record.second.variance(); - auto standard_deviation = record.second.standard_deviation(); - std::cout << record_name << " m: " << mean << " v: " << variance - << " std: " << standard_deviation << std::endl; - } - session.to_csv("loading_stride1_withplanes_sizes.csv", true); + auto ray = phx::Ray(glm::vec3(0, 300, -50), glm::vec3(0, 0, 1)); entity->FindOrAddComponent<phx::Transform>(); @@ -453,6 +408,31 @@ int main_bm(int, char**) { raycast->SetMarker(marker_entity); } + auto session = bm::run<float, std::milli>( + 10, [&](bm::session_recorder<float, std::milli>& recorder) { + + for (int i = 1; i < 11; i++) { + recorder.record("trace," + std::to_string(30 * i) + "x" + + std::to_string(40 * i) + "x50", + [&]() { + phx::PliDemoUtil::trace( + scene, glm::vec3(100.0, 100.0, 0), + glm::vec3(100 + 30 * i, 100 + 40 * i, 50)); + }); + } + + }); + + for (auto record : session.records) { + auto record_name = record.first; + auto mean = record.second.mean(); + auto variance = record.second.variance(); + auto standard_deviation = record.second.standard_deviation(); + std::cout << record_name << " m: " << mean << " v: " << variance + << " std: " << standard_deviation << std::endl; + } + session.to_csv("trace_sizes.csv", true); + rendering_system->SetEnabled(true); splash->SetEnabled(false); diff --git a/demos/pli_demo/src/pli_util.cpp b/demos/pli_demo/src/pli_util.cpp index cfadaad731d74767c7f489ee298e7d52cb3a574a..3bee6a179fc33bb185a0b5c85e28cfbedbaa453d 100644 --- a/demos/pli_demo/src/pli_util.cpp +++ b/demos/pli_demo/src/pli_util.cpp @@ -123,8 +123,8 @@ void PliDemoUtil::load( nlohmann::json declaration = { {"from", {{"X", 0.0f}, {"Y", 0.0f}, {"Z", 0.0f}}}, - {"to", {{"X", 500.0f}, {"Y", 500.0f}, {"Z", 150.0f}}}, - {"stride", {{"X", 1.0f}, {"Y", 1.0f}, {"Z", 1.0f}}}}; + {"to", {{"X", 360.0f}, {"Y", 500.0f}, {"Z", 50.0f}}}, + {"stride", {{"X", 3.0f}, {"Y", 3.0f}, {"Z", 3.0f}}}}; if (!cutting_planes.empty()) { nlohmann::json planes_dec = {}; diff --git a/library/phx/core/engine.cpp b/library/phx/core/engine.cpp index 5dc9536a7e4e8684ee144538625f6575f68decb9..4166af59c84a9f836401ac494437f1549e8657f5 100644 --- a/library/phx/core/engine.cpp +++ b/library/phx/core/engine.cpp @@ -76,8 +76,8 @@ void Engine::UpdateSystems() { acc_time += frame_time; // Send FPS to cout - if (frame_timer_.GetTimeInfo().frame_count % 10 == 0) { - float avg_time = acc_time / 10.0f; + if (frame_timer_.GetTimeInfo().frame_count % 100 == 0) { + float avg_time = acc_time / 100.0f; float frame_rate = 1000.0f / avg_time; std::cout << "Framerate: " << std::to_string(frame_rate) << std::endl; acc_time = 0.0f;