From f247b500c08f40f476da2afef1e4eaca08f12ea1 Mon Sep 17 00:00:00 2001 From: Malin E Date: Tue, 30 Aug 2022 18:03:47 +0200 Subject: [PATCH] Address some more PR comments --- data/assets/scene/digitaluniverse/grids.asset | 14 ++++---- .../base/rendering/grids/renderablegrid.cpp | 34 +++++++++---------- 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/data/assets/scene/digitaluniverse/grids.asset b/data/assets/scene/digitaluniverse/grids.asset index ac28d20348..7cbbbe7102 100644 --- a/data/assets/scene/digitaluniverse/grids.asset +++ b/data/assets/scene/digitaluniverse/grids.asset @@ -365,7 +365,7 @@ local plane1kly = { }, Scale = { Type = "StaticScale", - Scale = 1000 + Scale = 1E3 } }, Renderable = { @@ -393,7 +393,7 @@ local plane10kly = { }, Scale = { Type = "StaticScale", - Scale = 10000 + Scale = 10E3 } }, Renderable = { @@ -416,7 +416,7 @@ local plane100kly = { Transform = { Scale = { Type = "StaticScale", - Scale = 100000 + Scale = 100E3 } }, Renderable = { @@ -441,7 +441,7 @@ local plane1Mly = { Transform = { Scale = { Type = "StaticScale", - Scale = 1000000 + Scale = 1E6 } }, Renderable = { @@ -466,7 +466,7 @@ local plane10Mly = { Transform = { Scale = { Type = "StaticScale", - Scale = 10000000 + Scale = 10E6 } }, Renderable = { @@ -491,7 +491,7 @@ local plane100Mly = { Transform = { Scale = { Type = "StaticScale", - Scale = 100000000 + Scale = 100E6 } }, Renderable = { @@ -516,7 +516,7 @@ local plane20Gly = { Transform = { Scale = { Type = "StaticScale", - Scale = 20000000000 + Scale = 20E9 } }, Renderable = { diff --git a/modules/base/rendering/grids/renderablegrid.cpp b/modules/base/rendering/grids/renderablegrid.cpp index bc4a260a34..fc4d6605b2 100644 --- a/modules/base/rendering/grids/renderablegrid.cpp +++ b/modules/base/rendering/grids/renderablegrid.cpp @@ -58,7 +58,9 @@ namespace { constexpr openspace::properties::Property::PropertyInfo HighlightRateInfo = { "HighlightRate", "Highlight Rate", - "The rate the columns and rows are highlighted" + "The rate that the columns and rows are highlighted, counted with respect to the " + "center of the grid. If the number of segments in the grid is odd, the " + "highlighting might be offsett from the center." }; constexpr openspace::properties::Property::PropertyInfo LineWidthInfo = { @@ -285,16 +287,15 @@ void RenderableGrid::update(const UpdateData&) { const float x1 = x0 + step.x; // Line in y direction + bool shouldHighlight = false; if (_highlightRate.value().y != 0) { int rest = static_cast(i - center.y) % _highlightRate.value().y; - if (abs(rest) == 0) { - _highlightArray.push_back({ x0, y0, 0.f }); - _highlightArray.push_back({ x0, y1, 0.f }); - } - else { - _varray.push_back({ x0, y0, 0.f }); - _varray.push_back({ x0, y1, 0.f }); - } + shouldHighlight = abs(rest) == 0; + } + + if (shouldHighlight) { + _highlightArray.push_back({ x0, y0, 0.f }); + _highlightArray.push_back({ x0, y1, 0.f }); } else { _varray.push_back({ x0, y0, 0.f }); @@ -302,16 +303,15 @@ void RenderableGrid::update(const UpdateData&) { } // Line in x direction + shouldHighlight = false; if (_highlightRate.value().x != 0) { int rest = static_cast(j - center.x) % _highlightRate.value().x; - if (abs(rest) == 0) { - _highlightArray.push_back({ x0, y0, 0.f }); - _highlightArray.push_back({ x1, y0, 0.f }); - } - else { - _varray.push_back({ x0, y0, 0.f }); - _varray.push_back({ x1, y0, 0.f }); - } + shouldHighlight = abs(rest) == 0; + } + + if (shouldHighlight) { + _highlightArray.push_back({ x0, y0, 0.f }); + _highlightArray.push_back({ x1, y0, 0.f }); } else { _varray.push_back({ x0, y0, 0.f });