From 0615cd790d7966b081a8778d1b9d49da3ef05ea1 Mon Sep 17 00:00:00 2001 From: Nicholas Sharp Date: Thu, 15 Aug 2024 22:54:08 -0700 Subject: [PATCH] rename manual ground plane option --- include/polyscope/types.h | 2 +- src/options.cpp | 2 +- src/render/ground_plane.cpp | 18 +++++++++--------- test/src/basics_test.cpp | 4 ++-- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/include/polyscope/types.h b/include/polyscope/types.h index e2b961c2..6a85b225 100644 --- a/include/polyscope/types.h +++ b/include/polyscope/types.h @@ -13,7 +13,7 @@ enum class BackgroundView { None = 0 }; enum class ProjectionMode { Perspective = 0, Orthographic }; enum class TransparencyMode { None = 0, Simple, Pretty }; enum class GroundPlaneMode { None, Tile, TileReflection, ShadowOnly }; -enum class GroundPlaneHeightMode { Relative = 0, Absolute }; +enum class GroundPlaneHeightMode { Automatic = 0, Manual }; enum class BackFacePolicy { Identical, Different, Custom, Cull }; enum class PointRenderMode { Sphere = 0, Quad }; diff --git a/src/options.cpp b/src/options.cpp index 960bcbc2..5bcaca32 100644 --- a/src/options.cpp +++ b/src/options.cpp @@ -31,7 +31,7 @@ std::string screenshotExtension = ".png"; // Ground plane / shadows bool groundPlaneEnabled = true; GroundPlaneMode groundPlaneMode = GroundPlaneMode::TileReflection; -GroundPlaneHeightMode groundPlaneHeightMode = GroundPlaneHeightMode::Relative; +GroundPlaneHeightMode groundPlaneHeightMode = GroundPlaneHeightMode::Automatic; ScaledValue groundPlaneHeightFactor = 0; float groundPlaneHeight = 0.; int shadowBlurIters = 2; diff --git a/src/render/ground_plane.cpp b/src/render/ground_plane.cpp index 1f86270d..dec2e205 100644 --- a/src/render/ground_plane.cpp +++ b/src/render/ground_plane.cpp @@ -199,11 +199,11 @@ void GroundPlane::draw(bool isRedraw) { double groundHeight = -777; switch (options::groundPlaneHeightMode) { - case GroundPlaneHeightMode::Relative: { + case GroundPlaneHeightMode::Automatic: { groundHeight = bboxBottom - sign * (options::groundPlaneHeightFactor.asAbsolute() + heightEPS); break; } - case GroundPlaneHeightMode::Absolute: { + case GroundPlaneHeightMode::Manual: { groundHeight = options::groundPlaneHeight; break; } @@ -400,10 +400,10 @@ void GroundPlane::buildGui() { auto heightModeName = [](const GroundPlaneHeightMode& m) -> std::string { switch (m) { - case GroundPlaneHeightMode::Relative: - return "Relative"; - case GroundPlaneHeightMode::Absolute: - return "Absolute"; + case GroundPlaneHeightMode::Automatic: + return "Automatic"; + case GroundPlaneHeightMode::Manual: + return "Manual"; } return ""; }; @@ -428,11 +428,11 @@ void GroundPlane::buildGui() { // Height ImGui::PushItemWidth(80); switch (options::groundPlaneHeightMode) { - case GroundPlaneHeightMode::Relative: + case GroundPlaneHeightMode::Automatic: if (ImGui::SliderFloat("##HeightValue", options::groundPlaneHeightFactor.getValuePtr(), -1.0, 1.0)) requestRedraw(); break; - case GroundPlaneHeightMode::Absolute: + case GroundPlaneHeightMode::Manual: int iP; float sign; std::tie(iP, sign) = getGroundPlaneAxisAndSign(); @@ -448,7 +448,7 @@ void GroundPlane::buildGui() { ImGui::SameLine(); ImGui::PushItemWidth(100); if (ImGui::BeginCombo("Height##Mode", heightModeName(options::groundPlaneHeightMode).c_str())) { - for (GroundPlaneHeightMode m : {GroundPlaneHeightMode::Relative, GroundPlaneHeightMode::Absolute}) { + for (GroundPlaneHeightMode m : {GroundPlaneHeightMode::Automatic, GroundPlaneHeightMode::Manual}) { std::string mName = heightModeName(m); if (ImGui::Selectable(mName.c_str(), options::groundPlaneHeightMode == m)) { options::groundPlaneHeightMode = m; diff --git a/test/src/basics_test.cpp b/test/src/basics_test.cpp index 040f1fcf..df87c353 100644 --- a/test/src/basics_test.cpp +++ b/test/src/basics_test.cpp @@ -134,11 +134,11 @@ TEST_F(PolyscopeTest, GroundPlaneTest) { polyscope::refresh(); polyscope::show(3); - polyscope::options::groundPlaneHeightMode = polyscope::GroundPlaneHeightMode::Absolute; + polyscope::options::groundPlaneHeightMode = polyscope::GroundPlaneHeightMode::Manual; polyscope::options::groundPlaneHeight = -0.3; polyscope::show(3); - polyscope::options::groundPlaneHeightMode = polyscope::GroundPlaneHeightMode::Relative; + polyscope::options::groundPlaneHeightMode = polyscope::GroundPlaneHeightMode::Automatic; polyscope::show(3); polyscope::removeAllStructures();