created two different maps with billboardscloud

This commit is contained in:
Lovisa Hassler
2018-12-12 18:26:55 -05:00
parent 041436d37a
commit b2b4c17e34
4 changed files with 57 additions and 36 deletions

View File

@@ -75,7 +75,14 @@ local Keybindings = {
propertyHelper.invert('Scene.EquatorialSphereLabels.Renderable.Enabled'),
Documentation = "Toggles visibility of the equatorial sphere and its labels",
Local = false
},
},
{
Key = "l",
Command = propertyHelper.invert('Scene.OuterSpaceLabels.Renderable.Enabled') ..
propertyHelper.invert('Scene.MarsLabels.Renderable.Enabled'),
Documentation = "Toggles visibility of the spacecraft labels",
Local = false
}
}
local earthAsset = asset.require('scene/solarsystem/planets/earth/earth')
@@ -93,8 +100,7 @@ asset.onInitialize(function ()
openspace.setDefaultGuiSorting()
openspace.setPropertyValue('Scene.*Trail.Renderable.Enabled', false)
openspace.setPropertyValue('Scene.StarsLabels.Renderable.Enabled', true)
openspace.setPropertyValue('Scene.SpacecraftsLabels.Renderable.Enabled', true)
--openspace.setPropertyValue('Scene.StarsLabels.Renderable.Enabled', true)
openspace.globebrowsing.loadWMSServersFromFile(
openspace.absPath("${DATA}/globebrowsing_servers.lua")

View File

@@ -1,30 +1,48 @@
local assetHelper = asset.require('util/asset_helper')
local spacecrafts = asset.require('scene/solarsystem/missions/dsn/spacecrafts')
local object = {
Identifier = "SpacecraftsLabels",
local OuterSpaceLabels = {
Identifier = "OuterSpaceLabels",
Renderable = {
Type = "RenderableBillboardsCloud",
Enabled = false,
Color = { 1.0, 1.0, 1.0 },
--Color = { 1.0, 1.0, 1.0 },
Transparency = 1.0,
--LabelFile = speck .. "/stars.label",
LabelIdentifierMap = spacecrafts.labelMap,
TextColor = { 1.0, 0.0, 0.0, 1.0 },
LabelIdentifierMap = spacecrafts.labelMapVoyagers,
TextColor = { 1.0, 0.6, 0.2, 1.0 },
DrawLabels = true,
--PolygonSides = 4,
--ColorMap = colormap .. "/colorbv.cmap",
TextSize = 10.0,
TextMinSize = 1.0,
TextMaxSize = 80.0,
Unit = "km" --meters
Unit = "m"
},
GUI = {
Name = "Spacecrafts Labels",
Path = "/Milky Way/Spacecrafts"
Name = "Outer Space Labels",
Path = "/Labels"
}
}
local MarsLabels = {
Identifier = "MarsLabels",
Renderable = {
Type = "RenderableBillboardsCloud",
Enabled = false,
--Color = { 1.0, 1.0, 1.0 },
Transparency = 1.0,
LabelIdentifierMap = spacecrafts.labelMapMars,
TextColor = { 0.4, 0.4, 0.4, 1.0 },
DrawLabels = true,
TextSize = 5.0,
TextMinSize = 1.0,
TextMaxSize = 80.0,
Unit = "m"
},
GUI = {
Name = "Mars Labels",
Path = "/Labels"
}
}
assetHelper.registerSceneGraphNodesAndExport(asset, { object })
assetHelper.registerSceneGraphNodesAndExport(asset, { OuterSpaceLabels, MarsLabels })

View File

@@ -10,14 +10,16 @@ asset.require('scene/solarsystem/missions/dsn/mro/mro')
asset.require('scene/solarsystem/missions/dsn/marsodyssey/marsodyssey')
asset.require('scene/solarsystem/missions/dsn/stereoa/stereoa')
-- needed for the labels
local labelMap = {
VGR1 = "Voyager 1",
VGR2 = "Voyager 2",
MarsRecOrbiter = "Mars Recon Orbiter",
--MarsOdyssey = "MarsOdyssey",
StereoA = "StereoA"
-- wdgn = "hej"
}
-- labels
local labelMapMars = {
MarsRecOrbiter = "Mars Recon Orbiter",
MarsOdyssey = "MarsOdyssey",
}
asset.export("labelMap", labelMap)
local labelMapVoyagers = {
VGR1 = "Voyager 1",
VGR2 = "Voyager 2",
}
asset.export("labelMapVoyagers", labelMapVoyagers)
asset.export("labelMapMars", labelMapMars)

View File

@@ -259,7 +259,7 @@ documentation::Documentation RenderableBillboardsCloud::Documentation() {
{
keyColor,
new Vector3Verifier<float>,
Optional::No,
Optional::Yes,
"Astronomical Object Color (r,g,b)."
},
{
@@ -564,8 +564,6 @@ RenderableBillboardsCloud::RenderableBillboardsCloud(const ghoul::Dictionary& di
}
else if (dictionary.hasKey(LabelIdentifierMapInfo.identifier)) {
//LDEBUG(fmt::format("Hej {}", LabelIdentifierMapInfo.identifier));
_labelIdMap = dictionary.value<ghoul::Dictionary>(LabelIdentifierMapInfo.identifier);
_hasLabel = true;
@@ -584,7 +582,6 @@ RenderableBillboardsCloud::RenderableBillboardsCloud(const ghoul::Dictionary& di
if (dictionary.hasKey(TextColorInfo.identifier)) {
_textColor = dictionary.value<glm::vec4>(TextColorInfo.identifier);
//_hasLabel = true;
}
_textColor.setViewOption(properties::Property::ViewOptions::Color);
addProperty(_textColor);
@@ -1345,18 +1342,16 @@ bool RenderableBillboardsCloud::loadLabelDataFromId() {
std::string label = _labelIdMap.value<std::string>(keys.at(i));
if (global::renderEngine.scene()->sceneGraphNode(id)) {
// LDEBUG(fmt::format("Scenegraphnode found for the spacecraft {}", id));
glm::dvec3 position = global::renderEngine.scene()->sceneGraphNode(id)->worldPosition();
//glm::vec3 transformedPos = glm::vec3(
// _transformationMatrix * glm::dvec4(position, 1.0)
// );
_labelData.emplace_back(std::make_pair(position, label));
glm::dvec3 transformedPos = glm::dvec3(
_transformationMatrix * glm::dvec4(position, 1.0)
);
_labelData.emplace_back(std::make_pair(transformedPos, label));
}
else {
LERROR(fmt::format("No scenegraphnode found for the spacecraft {}", id));
LERROR(fmt::format("No SceneGraphNode found with identifier {}", id));
return false;
}