Updated trail fade property

This commit is contained in:
Your Name
2020-01-31 11:42:34 -05:00
parent 58b1400051
commit b61efaf965
2 changed files with 35 additions and 21 deletions
+19 -19
View File
@@ -81,31 +81,31 @@ local getPeriodFromElement = function(element)
return per
end
function satellites(title, file, color, group)
return {
Identifier = title,
Parent = transforms.EarthInertial.Identifier,
Renderable = {
Type = "RenderableSatellites",
Path = file,
Segments = 120,
Color = color,
Fade = 0.5
},
Tag = { "earth_satellite_" .. group, "earth_satellite_" .. group .. "_trail"},
GUI = {
Path = "/Solar System/Planets/Earth/Satellites"
}
}
end
local registerSatelliteGroupObjects = function(containingAsset, group, tleFolder, shouldAddDuplicates)
local filename = group.Url:match("([^/]+)$")
local filenameSansExt = filename:gsub(filename:match("(%.%w+)$"), "")
local path = tleFolder .. "/" .. filename
function satellites(title, file, color)
return {
Identifier = title,
Parent = transforms.EarthInertial.Identifier,
Renderable = {
Type = "RenderableSatellites",
Path = file,
Segments = 120,
Color = color,
Fade = 0.5
},
--Tag = { "earth_satellite_" .. group, "earth_satellite_" .. group .. "_trail"},
GUI = {
Path = "/Solar System/Planets/Earth/Satellites"
}
}
end
local SatelliteBatch = satellites(filenameSansExt, path, group.TrailColor)
local SatelliteBatch = satellites(filenameSansExt, path, group.TrailColor, group)
assetHelper.registerSceneGraphNodesAndExport(containingAsset, { SatelliteBatch })
end
@@ -71,6 +71,11 @@ namespace {
"Color",
"This value determines the RGB main color for the lines and points of the trail."
};
constexpr openspace::properties::Property::PropertyInfo TrailFadeInfo = {
"TrailFade",
"Trail Fade",
"This value determines how fast the trail fades and is an appearance property. "
};
constexpr const char* KeyFile = "Path";
constexpr const char* KeyLineNum = "LineNumber";
@@ -321,15 +326,24 @@ RenderableSatellites::RenderableSatellites(const ghoul::Dictionary& dictionary)
if (dictionary.hasKeyAndValue<glm::vec3>(LineColorInfo.identifier)) {
_appearance.lineColor = dictionary.value<glm::vec3>(LineColorInfo.identifier);
}
if (dictionary.hasKeyAndValue<double>("FadeInfo")) {
if (dictionary.hasKeyAndValue<double>(TrailFadeInfo.identifier)) {
_appearance.lineFade = static_cast<float>(
dictionary.value<double>("FadeInfo")
dictionary.value<double>(TrailFadeInfo.identifier)
);
}
else {
_appearance.lineFade = 20;
}
if (dictionary.hasKeyAndValue<double>(LineWidthInfo.identifier)) {
_appearance.lineWidth = static_cast<float>(
dictionary.value<double>(LineWidthInfo.identifier)
);
}
else {
_appearance.lineWidth = 2.0;
}
auto reinitializeTrailBuffers = [this]() {
initializeGL();
};