Skip to content

Commit

Permalink
rename manual ground plane option
Browse files Browse the repository at this point in the history
  • Loading branch information
nmwsharp committed Aug 16, 2024
1 parent df6e137 commit 0615cd7
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion include/polyscope/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 };
Expand Down
2 changes: 1 addition & 1 deletion src/options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<float> groundPlaneHeightFactor = 0;
float groundPlaneHeight = 0.;
int shadowBlurIters = 2;
Expand Down
18 changes: 9 additions & 9 deletions src/render/ground_plane.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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 "";
};
Expand All @@ -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();
Expand All @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions test/src/basics_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 0615cd7

Please sign in to comment.