adding color range as runtime property for billboards

This commit is contained in:
Micah
2020-10-14 16:31:21 -04:00
parent 364dafbde5
commit bf79414263
3 changed files with 19 additions and 1 deletions

View File

@@ -27,7 +27,7 @@ local object = {
File = speck .. "/SDSSgals.speck",
ColorMap = speck .. "/SDSSgals.cmap",
ColorOption = { "redshift", "proximity" },
ColorRange = { { 0.0, 0.075 }, { 1.0, 50.0 } },
ColorRange = { { 0.001, 2.0 }, { 1.0, 50.0 } },
Texture = textures .. "/point3A.png",
Unit = "Mpc",
-- Fade in value in the same unit as "Unit"

View File

@@ -186,6 +186,12 @@ namespace {
"astronomical objects."
};
constexpr openspace::properties::Property::PropertyInfo OptionColorRangeInfo = {
"OptionColorRange",
"Option Color Range",
"This value changes the range of values to be mapped with the current color map."
};
constexpr openspace::properties::Property::PropertyInfo SizeOptionInfo = {
"SizeOption",
"Size Option Variable",
@@ -435,6 +441,8 @@ RenderableBillboardsCloud::RenderableBillboardsCloud(const ghoul::Dictionary& di
, _drawLabels(DrawLabelInfo, false)
, _pixelSizeControl(PixelSizeControlInfo, false)
, _colorOption(ColorOptionInfo, properties::OptionProperty::DisplayType::Dropdown)
, _optionColorRangeData(OptionColorRangeInfo, glm::vec2(0.f))
, _datavarSizeOption(
SizeOptionInfo,
properties::OptionProperty::DisplayType::Dropdown
@@ -548,6 +556,8 @@ RenderableBillboardsCloud::RenderableBillboardsCloud(const ghoul::Dictionary& di
}
_colorOption.onChange([&]() {
_dataIsDirty = true;
const glm::vec2 colorRange = _colorRangeData[_colorOption.value()];
_optionColorRangeData = colorRange;
_colorOptionString = _optionConversionMap[_colorOption.value()];
});
addProperty(_colorOption);
@@ -561,7 +571,14 @@ RenderableBillboardsCloud::RenderableBillboardsCloud(const ghoul::Dictionary& di
rangeDataDict.value<glm::vec2>(std::to_string(i + 1))
);
}
_optionColorRangeData = _colorRangeData[_colorRangeData.size() - 1];
}
_optionColorRangeData.onChange([&]() {
const glm::vec2 colorRange = _optionColorRangeData;
_colorRangeData[_colorOption.value()] = colorRange;
_dataIsDirty = true;
});
addProperty(_optionColorRangeData);
if (dictionary.hasKey(ExactColorMapInfo.identifier)) {
_isColorMapExact = dictionary.value<bool>(ExactColorMapInfo.identifier);

View File

@@ -123,6 +123,7 @@ private:
properties::BoolProperty _drawLabels;
properties::BoolProperty _pixelSizeControl;
properties::OptionProperty _colorOption;
properties::Vec2Property _optionColorRangeData;
properties::OptionProperty _datavarSizeOption;
properties::Vec2Property _fadeInDistance;
properties::BoolProperty _disableFadeInDistance;