Initial pass of merging satellite debris into master and switching satellites to use grouped scenegraphnodes.

This commit is contained in:
GPayne
2019-08-13 15:39:06 -06:00
parent ba07837865
commit 39f4dc33cb
62 changed files with 105 additions and 945 deletions
-1
View File
@@ -1,7 +1,6 @@
asset.require('./base')
local earthAsset = asset.require('scene/solarsystem/planets/earth/earth')
asset.request('scene/solarsystem/planets/earth/satellites/satellites_debris')
asset.onInitialize(function ()
local now = openspace.time.currentWallTime()
+27
View File
@@ -0,0 +1,27 @@
asset.require('./base')
asset.request('scene/solarsystem/planets/earth/satellites/satellites_all')
asset.onInitialize(function ()
local now = openspace.time.currentWallTime()
--local now = "2019-06-26T00:00:00"
-- Jump back one day to show a complete planet
openspace.time.setTime(openspace.time.advancedTime(now, "-1d"))
openspace.addVirtualProperty(
"BoolProperty",
"Show Trails",
"Scene.*Trail.Renderable.Enabled",
"Disable or enable all trails of the scene at the same time",
true,
nil,
nil
)
openspace.globebrowsing.goToGeo(58.5877, 16.1924, 20000000)
end)
asset.onDeinitialize(function ()
openspace.removeVirtualProperty("*Trail.Renderable.Enabled")
end)
@@ -8,17 +8,4 @@ local group = {
}
local tle = shared.downloadTLEFile(asset, group.Url, group.Title)
local objectNames = {}
asset.onInitialize(function ()
objectNames = shared.addSatelliteGroupObjects(group, tle, false)
end)
asset.onDeinitialize(function ()
for _, n in ipairs(objectNames) do
openspace.removeSceneGraphNode(n)
end
end)
shared.registerSatelliteGroupObjects(asset, group, tle, true)
@@ -8,17 +8,4 @@ local group = {
}
local tle = shared.downloadTLEFile(asset, group.Url, group.Title)
local objectNames = {}
asset.onInitialize(function ()
objectNames = shared.addSatelliteGroupObjects(group, tle, false)
end)
asset.onDeinitialize(function ()
for _, n in ipairs(objectNames) do
openspace.removeSceneGraphNode(n)
end
end)
shared.registerSatelliteGroupObjects(asset, group, tle, true)
@@ -8,17 +8,4 @@ local group = {
}
local tle = shared.downloadTLEFile(asset, group.Url, group.Title)
local objectNames = {}
asset.onInitialize(function ()
objectNames = shared.addSatelliteGroupObjects(group, tle, false)
end)
asset.onDeinitialize(function ()
for _, n in ipairs(objectNames) do
openspace.removeSceneGraphNode(n)
end
end)
shared.registerSatelliteGroupObjects(asset, group, tle, true)
@@ -8,17 +8,4 @@ local group = {
}
local tle = shared.downloadTLEFile(asset, group.Url, group.Title)
local objectNames = {}
asset.onInitialize(function ()
objectNames = shared.addSatelliteGroupObjects(group, tle, false)
end)
asset.onDeinitialize(function ()
for _, n in ipairs(objectNames) do
openspace.removeSceneGraphNode(n)
end
end)
shared.registerSatelliteGroupObjects(asset, group, tle, true)
@@ -8,17 +8,4 @@ local group = {
}
local tle = shared.downloadTLEFile(asset, group.Url, group.Title)
local objectNames = {}
asset.onInitialize(function ()
objectNames = shared.addSatelliteGroupObjects(group, tle, false)
end)
asset.onDeinitialize(function ()
for _, n in ipairs(objectNames) do
openspace.removeSceneGraphNode(n)
end
end)
shared.registerSatelliteGroupObjects(asset, group, tle, true)
@@ -8,17 +8,4 @@ local group = {
}
local tle = shared.downloadTLEFile(asset, group.Url, group.Title)
local objectNames = {}
asset.onInitialize(function ()
objectNames = shared.addSatelliteGroupObjects(group, tle, false)
end)
asset.onDeinitialize(function ()
for _, n in ipairs(objectNames) do
openspace.removeSceneGraphNode(n)
end
end)
shared.registerSatelliteGroupObjects(asset, group, tle, true)
@@ -8,17 +8,4 @@ local group = {
}
local tle = shared.downloadTLEFile(asset, group.Url, group.Title)
local objectNames = {}
asset.onInitialize(function ()
objectNames = shared.addSatelliteGroupObjects(group, tle, false)
end)
asset.onDeinitialize(function ()
for _, n in ipairs(objectNames) do
openspace.removeSceneGraphNode(n)
end
end)
shared.registerSatelliteGroupObjects(asset, group, tle, true)
@@ -8,17 +8,4 @@ local group = {
}
local tle = shared.downloadTLEFile(asset, group.Url, group.Title)
local objectNames = {}
asset.onInitialize(function ()
objectNames = shared.addSatelliteGroupObjects(group, tle, false)
end)
asset.onDeinitialize(function ()
for _, n in ipairs(objectNames) do
openspace.removeSceneGraphNode(n)
end
end)
shared.registerSatelliteGroupObjects(asset, group, tle, true)
@@ -8,17 +8,4 @@ local group = {
}
local tle = shared.downloadTLEFile(asset, group.Url, group.Title)
local objectNames = {}
asset.onInitialize(function ()
objectNames = shared.addSatelliteGroupObjects(group, tle, false)
end)
asset.onDeinitialize(function ()
for _, n in ipairs(objectNames) do
openspace.removeSceneGraphNode(n)
end
end)
shared.registerSatelliteGroupObjects(asset, group, tle, true)
@@ -8,17 +8,4 @@ local group = {
}
local tle = shared.downloadTLEFile(asset, group.Url, group.Title)
local objectNames = {}
asset.onInitialize(function ()
objectNames = shared.addSatelliteGroupObjects(group, tle, false)
end)
asset.onDeinitialize(function ()
for _, n in ipairs(objectNames) do
openspace.removeSceneGraphNode(n)
end
end)
shared.registerSatelliteGroupObjects(asset, group, tle, true)
@@ -8,17 +8,4 @@ local group = {
}
local tle = shared.downloadTLEFile(asset, group.Url, group.Title)
local objectNames = {}
asset.onInitialize(function ()
objectNames = shared.addSatelliteGroupObjects(group, tle, false)
end)
asset.onDeinitialize(function ()
for _, n in ipairs(objectNames) do
openspace.removeSceneGraphNode(n)
end
end)
shared.registerSatelliteGroupObjects(asset, group, tle, true)
@@ -8,17 +8,4 @@ local group = {
}
local tle = shared.downloadTLEFile(asset, group.Url, group.Title)
local objectNames = {}
asset.onInitialize(function ()
objectNames = shared.addSatelliteGroupObjects(group, tle, false)
end)
asset.onDeinitialize(function ()
for _, n in ipairs(objectNames) do
openspace.removeSceneGraphNode(n)
end
end)
shared.registerSatelliteGroupObjects(asset, group, tle, true)
@@ -8,16 +8,4 @@ local group = {
}
local tle = shared.downloadTLEFile(asset, group.Url, group.Title)
local objectNames = {}
asset.onInitialize(function ()
objectNames = shared.addSatelliteGroupObjects(group, tle, false)
end)
asset.onDeinitialize(function ()
for _, n in ipairs(objectNames) do
openspace.removeSceneGraphNode(n)
end
end)
shared.registerSatelliteGroupObjects(asset, group, tle, true)
@@ -56,21 +56,9 @@ local registerSatelliteGroupObjects = function(containingAsset, group, tleFolder
Renderable = {
Type = "RenderableSatellites",
Path = file,
-- The initialization with "-" is just a placeholder.
-- (needed to be initialized)
Segments = 160,
--EccentricityColumn = "-",
--SemiMajorAxisColumn = "-",
--SemiMajorAxisUnit = 1,
--InclinationColumn = "-",
--AscendingNodeColumn = "-",
--ArgumentOfPeriapsisColumn = "-",
--MeanAnomalyAtEpochColumn = "-",
--EpochColumn = "-",
Color = color,
Fade = 0.5
Fade = 0.5
},
GUI = {
Path = "/Solar System/Planets/Earth/Satellites"
@@ -84,6 +72,3 @@ end
asset.export("downloadTLEFile", downloadTLEFile)
asset.export("registerSatelliteGroupObjects", registerSatelliteGroupObjects)
@@ -8,16 +8,4 @@ local group = {
}
local tle = shared.downloadTLEFile(asset, group.Url, group.Title)
local objectNames = {}
asset.onInitialize(function ()
objectNames = shared.addSatelliteGroupObjects(group, tle, true)
end)
asset.onDeinitialize(function ()
for _, n in ipairs(objectNames) do
openspace.removeSceneGraphNode(n)
end
end)
shared.registerSatelliteGroupObjects(asset, group, tle, true)
@@ -8,16 +8,4 @@ local group = {
}
local tle = shared.downloadTLEFile(asset, group.Url, group.Title)
local objectNames = {}
asset.onInitialize(function ()
objectNames = shared.addSatelliteGroupObjects(group, tle, false)
end)
asset.onDeinitialize(function ()
for _, n in ipairs(objectNames) do
openspace.removeSceneGraphNode(n)
end
end)
shared.registerSatelliteGroupObjects(asset, group, tle, true)
@@ -8,16 +8,4 @@ local group = {
}
local tle = shared.downloadTLEFile(asset, group.Url, group.Title)
local objectNames = {}
asset.onInitialize(function ()
objectNames = shared.addSatelliteGroupObjects(group, tle, false)
end)
asset.onDeinitialize(function ()
for _, n in ipairs(objectNames) do
openspace.removeSceneGraphNode(n)
end
end)
shared.registerSatelliteGroupObjects(asset, group, tle, true)
@@ -8,16 +8,4 @@ local group = {
}
local tle = shared.downloadTLEFile(asset, group.Url, group.Title)
local objectNames = {}
asset.onInitialize(function ()
objectNames = shared.addSatelliteGroupObjects(group, tle, false)
end)
asset.onDeinitialize(function ()
for _, n in ipairs(objectNames) do
openspace.removeSceneGraphNode(n)
end
end)
shared.registerSatelliteGroupObjects(asset, group, tle, true)
@@ -8,16 +8,4 @@ local group = {
}
local tle = shared.downloadTLEFile(asset, group.Url, group.Title)
local objectNames = {}
asset.onInitialize(function ()
objectNames = shared.addSatelliteGroupObjects(group, tle, false)
end)
asset.onDeinitialize(function ()
for _, n in ipairs(objectNames) do
openspace.removeSceneGraphNode(n)
end
end)
shared.registerSatelliteGroupObjects(asset, group, tle, true)
@@ -8,17 +8,4 @@ local group = {
}
local tle = shared.downloadTLEFile(asset, group.Url, group.Title)
local objectNames = {}
--shared.registerSatelliteGroupObjects(asset, group, tle, true) -- if thesis project of 2019 is used
asset.onInitialize(function ()
objectNames = shared.addSatelliteGroupObjects(group, tle, false)
end)
asset.onDeinitialize(function ()
for _, n in ipairs(objectNames) do
openspace.removeSceneGraphNode(n)
end
end)
shared.registerSatelliteGroupObjects(asset, group, tle, true)
@@ -8,16 +8,4 @@ local group = {
}
local tle = shared.downloadTLEFile(asset, group.Url, group.Title)
local objectNames = {}
asset.onInitialize(function ()
objectNames = shared.addSatelliteGroupObjects(group, tle, false)
end)
asset.onDeinitialize(function ()
for _, n in ipairs(objectNames) do
openspace.removeSceneGraphNode(n)
end
end)
shared.registerSatelliteGroupObjects(asset, group, tle, true)
@@ -8,16 +8,4 @@ local group = {
}
local tle = shared.downloadTLEFile(asset, group.Url, group.Title)
local objectNames = {}
asset.onInitialize(function ()
objectNames = shared.addSatelliteGroupObjects(group, tle, true)
end)
asset.onDeinitialize(function ()
for _, n in ipairs(objectNames) do
openspace.removeSceneGraphNode(n)
end
end)
shared.registerSatelliteGroupObjects(asset, group, tle, true)
@@ -8,16 +8,4 @@ local group = {
}
local tle = shared.downloadTLEFile(asset, group.Url, group.Title)
local objectNames = {}
asset.onInitialize(function ()
objectNames = shared.addSatelliteGroupObjects(group, tle, false)
end)
asset.onDeinitialize(function ()
for _, n in ipairs(objectNames) do
openspace.removeSceneGraphNode(n)
end
end)
shared.registerSatelliteGroupObjects(asset, group, tle, true)
@@ -8,16 +8,4 @@ local group = {
}
local tle = shared.downloadTLEFile(asset, group.Url, group.Title)
local objectNames = {}
asset.onInitialize(function ()
objectNames = shared.addSatelliteGroupObjects(group, tle, false)
end)
asset.onDeinitialize(function ()
for _, n in ipairs(objectNames) do
openspace.removeSceneGraphNode(n)
end
end)
shared.registerSatelliteGroupObjects(asset, group, tle, true)
@@ -8,16 +8,4 @@ local group = {
}
local tle = shared.downloadTLEFile(asset, group.Url, group.Title)
local objectNames = {}
asset.onInitialize(function ()
objectNames = shared.addSatelliteGroupObjects(group, tle, false)
end)
asset.onDeinitialize(function ()
for _, n in ipairs(objectNames) do
openspace.removeSceneGraphNode(n)
end
end)
shared.registerSatelliteGroupObjects(asset, group, tle, true)
@@ -8,16 +8,4 @@ local group = {
}
local tle = shared.downloadTLEFile(asset, group.Url, group.Title)
local objectNames = {}
asset.onInitialize(function ()
objectNames = shared.addSatelliteGroupObjects(group, tle, false)
end)
asset.onDeinitialize(function ()
for _, n in ipairs(objectNames) do
openspace.removeSceneGraphNode(n)
end
end)
shared.registerSatelliteGroupObjects(asset, group, tle, true)
@@ -8,16 +8,4 @@ local group = {
}
local tle = shared.downloadTLEFile(asset, group.Url, group.Title)
local objectNames = {}
asset.onInitialize(function ()
objectNames = shared.addSatelliteGroupObjects(group, tle, false)
end)
asset.onDeinitialize(function ()
for _, n in ipairs(objectNames) do
openspace.removeSceneGraphNode(n)
end
end)
shared.registerSatelliteGroupObjects(asset, group, tle, true)
@@ -8,16 +8,4 @@ local group = {
}
local tle = shared.downloadTLEFile(asset, group.Url, group.Title)
local objectNames = {}
asset.onInitialize(function ()
objectNames = shared.addSatelliteGroupObjects(group, tle, false)
end)
asset.onDeinitialize(function ()
for _, n in ipairs(objectNames) do
openspace.removeSceneGraphNode(n)
end
end)
shared.registerSatelliteGroupObjects(asset, group, tle, true)
@@ -1,5 +0,0 @@
asset.request('./debris/debris_breezem_old')
asset.request('./debris/debris_asat_old')
asset.request('./debris/debris_fengyum_old')
asset.request('./debris/debris_iridium33_old')
asset.request('./debris/debris_kosmos2251_old')
@@ -1,4 +1,5 @@
local transforms = asset.require('scene/solarsystem/planets/earth/transforms')
local assetHelper = asset.require('util/asset_helper')
local satImageFolder = asset.syncedResource({
Name = "Satellite Image Files",
@@ -20,7 +21,12 @@ function downloadTLEFile(sceneAsset, url, name)
})
end
local addSatelliteGroupObjects = function(group, tleFolder, shouldAddDuplicates)
local registerSatelliteGroupObjects = function(containingAsset, group, tleFolder, shouldAddDuplicates)
local filename = group.Url:match("([^/]+)$")
local filenameSansExt = filename:gsub(filename:match("(%.%w+)$"), "")
local path = tleFolder .. "/" .. filename
function numLinesInFile(filename)
local ctr = 0
for _ in io.lines(filename) do ctr = ctr + 1 end
@@ -43,125 +49,27 @@ local addSatelliteGroupObjects = function(group, tleFolder, shouldAddDuplicates)
return true
end
function getSat(title, file, lineNum, textureFile, group)
function satellites(title, file, color)
return {
Identifier = title,
Parent = transforms.EarthInertial.Identifier,
Renderable = {
Type = "RenderablePlaneImageLocal",
Enabled = false,
Size = 3e4,
Origin = "Center",
Body = "TLE",
Billboard = true,
Texture = textureFile
},
Transform = {
Translation = {
Type = "TLETranslation",
Body = title,
Observer = transforms.EarthInertial.Identifier,
File = file,
LineNumber = lineNum
},
Scale = {
Type = "StaticScale",
Scale = 1
}
},
Tag = { "earth_satellite_" .. group, "earth_satellite_" .. group .. "_marker" },
GUI = {
Path = "/Solar System/Planets/Earth/Satellites"
}
}
end
function getSatTrail(title, file, lineNum, per, color, group)
return {
Identifier = title .. "_trail",
Parent = transforms.EarthInertial.Identifier,
Renderable = {
Type = "RenderableTrailOrbit",
Translation = {
Type = "TLETranslation",
Body = title,
Observer = transforms.EarthInertial.Identifier,
File = file,
LineNumber = lineNum
},
Identifier = title,
Parent = transforms.EarthInertial.Identifier,
Renderable = {
Type = "RenderableSatellites",
Path = file,
Segments = 160,
Color = color,
Period = per,
Resolution = 160
Fade = 0.5
},
Tag = { "earth_satellite_" .. group, "earth_satellite_" .. group .. "_trail"},
--Tag = { "earth_satellite_" .. group, "earth_satellite_" .. group .. "_trail"},
GUI = {
Path = "/Solar System/Planets/Earth/Satellites"
}
}
}
end
local filename = group.Url:match("([^/]+)$")
local filenameSansExt = filename:gsub(filename:match("(%.%w+)$"), "")
local path = tleFolder .. "/" .. filename
local texture = satImageFolder .. "/" .. "satB.png"
local file = io.open(path, "r")
assert(file, "File not found: " .. path)
local obj = {}
--now loop through the tle file and get each set of 3 lines
for n = 1, numLinesInFile(path), 3 do
local line = {
file:read('*l'), --title line
file:read('*l'),
file:read('*l')
}
assert(isValidTLEFileFormat(line), "TLE file syntax error on line " .. n .. ": " .. path)
-- Trim string
line[1] = line[1]:gsub("^%s*(.-)%s*$", "%1")
line[1] = line[1]:gsub("%s+", "_")
line[1] = line[1]:gsub("[%-()]", "")
local title = line[1]
-- Get period from correct location of the string
local per = tonumber(string.sub(line[3], 53, 63))
-- Trail for 2x a single revolution
per = 1.0 / per * 2.0
local satName = filenameSansExt .. "_" .. title
local shouldAddNotes = true
if openspace.hasSceneGraphNode(satName) then
if shouldAddDuplicates then
local originalSatName = satName
local i = 1
while openspace.hasSceneGraphNode(satName) do
satName = originalSatName .. "_" .. tostring(i)
i = i + 1
end
else
shouldAddNotes = false
end
end
if shouldAddNotes then
-- Register satellite object and trail
local sat_var = getSat(satName, path, n, texture, group.Title)
openspace.addSceneGraphNode(sat_var)
table.insert(obj, sat_var.Identifier)
local satTrail_var = getSatTrail(satName, path, n, per, group.TrailColor, group.Title)
openspace.addSceneGraphNode(satTrail_var)
table.insert(obj, satTrail_var.Identifier)
end
end
return obj
local SatelliteBatch = satellites(filenameSansExt, path, group.TrailColor)
assetHelper.registerSceneGraphNodesAndExport(containingAsset, { SatelliteBatch })
end
asset.export("satImageFolder", satImageFolder)
asset.export("downloadTLEFile", downloadTLEFile)
asset.export("addSatelliteGroupObjects", addSatelliteGroupObjects)
asset.export("registerSatelliteGroupObjects", registerSatelliteGroupObjects)
@@ -8,16 +8,4 @@ local group = {
}
local tle = shared.downloadTLEFile(asset, group.Url, group.Title)
local objectNames = {}
asset.onInitialize(function ()
objectNames = shared.addSatelliteGroupObjects(group, tle, false)
end)
asset.onDeinitialize(function ()
for _, n in ipairs(objectNames) do
openspace.removeSceneGraphNode(n)
end
end)
shared.registerSatelliteGroupObjects(asset, group, tle, true)
@@ -8,16 +8,4 @@ local group = {
}
local tle = shared.downloadTLEFile(asset, group.Url, group.Title)
local objectNames = {}
asset.onInitialize(function ()
objectNames = shared.addSatelliteGroupObjects(group, tle, false)
end)
asset.onDeinitialize(function ()
for _, n in ipairs(objectNames) do
openspace.removeSceneGraphNode(n)
end
end)
shared.registerSatelliteGroupObjects(asset, group, tle, true)
@@ -8,16 +8,4 @@ local group = {
}
local tle = shared.downloadTLEFile(asset, group.Url, group.Title)
local objectNames = {}
asset.onInitialize(function ()
objectNames = shared.addSatelliteGroupObjects(group, tle, false)
end)
asset.onDeinitialize(function ()
for _, n in ipairs(objectNames) do
openspace.removeSceneGraphNode(n)
end
end)
shared.registerSatelliteGroupObjects(asset, group, tle, true)
@@ -8,15 +8,4 @@ local group = {
}
local tle = shared.downloadTLEFile(asset, group.Url, group.Title)
local objectNames = {}
asset.onInitialize(function ()
objectNames = shared.addSatelliteGroupObjects(group, tle, false)
end)
asset.onDeinitialize(function ()
for _, n in ipairs(objectNames) do
openspace.removeSceneGraphNode(n)
end
end)
shared.registerSatelliteGroupObjects(asset, group, tle, true)
@@ -8,16 +8,4 @@ local group = {
}
local tle = shared.downloadTLEFile(asset, group.Url, group.Title)
local objectNames = {}
asset.onInitialize(function ()
objectNames = shared.addSatelliteGroupObjects(group, tle, false)
end)
asset.onDeinitialize(function ()
for _, n in ipairs(objectNames) do
openspace.removeSceneGraphNode(n)
end
end)
shared.registerSatelliteGroupObjects(asset, group, tle, true)
@@ -8,16 +8,4 @@ local group = {
}
local tle = shared.downloadTLEFile(asset, group.Url, group.Title)
local objectNames = {}
asset.onInitialize(function ()
objectNames = shared.addSatelliteGroupObjects(group, tle, false)
end)
asset.onDeinitialize(function ()
for _, n in ipairs(objectNames) do
openspace.removeSceneGraphNode(n)
end
end)
shared.registerSatelliteGroupObjects(asset, group, tle, true)
@@ -8,16 +8,4 @@ local group = {
}
local tle = shared.downloadTLEFile(asset, group.Url, group.Title)
local objectNames = {}
asset.onInitialize(function ()
objectNames = shared.addSatelliteGroupObjects(group, tle, false)
end)
asset.onDeinitialize(function ()
for _, n in ipairs(objectNames) do
openspace.removeSceneGraphNode(n)
end
end)
shared.registerSatelliteGroupObjects(asset, group, tle, true)
@@ -8,16 +8,4 @@ local group = {
}
local tle = shared.downloadTLEFile(asset, group.Url, group.Title)
local objectNames = {}
asset.onInitialize(function ()
objectNames = shared.addSatelliteGroupObjects(group, tle, false)
end)
asset.onDeinitialize(function ()
for _, n in ipairs(objectNames) do
openspace.removeSceneGraphNode(n)
end
end)
shared.registerSatelliteGroupObjects(asset, group, tle, true)
@@ -8,16 +8,4 @@ local group = {
}
local tle = shared.downloadTLEFile(asset, group.Url, group.Title)
local objectNames = {}
asset.onInitialize(function ()
objectNames = shared.addSatelliteGroupObjects(group, tle, false)
end)
asset.onDeinitialize(function ()
for _, n in ipairs(objectNames) do
openspace.removeSceneGraphNode(n)
end
end)
shared.registerSatelliteGroupObjects(asset, group, tle, true)
@@ -8,16 +8,4 @@ local group = {
}
local tle = shared.downloadTLEFile(asset, group.Url, group.Title)
local objectNames = {}
asset.onInitialize(function ()
objectNames = shared.addSatelliteGroupObjects(group, tle, false)
end)
asset.onDeinitialize(function ()
for _, n in ipairs(objectNames) do
openspace.removeSceneGraphNode(n)
end
end)
shared.registerSatelliteGroupObjects(asset, group, tle, true)
@@ -8,16 +8,4 @@ local group = {
}
local tle = shared.downloadTLEFile(asset, group.Url, group.Title)
local objectNames = {}
asset.onInitialize(function ()
objectNames = shared.addSatelliteGroupObjects(group, tle, false)
end)
asset.onDeinitialize(function ()
for _, n in ipairs(objectNames) do
openspace.removeSceneGraphNode(n)
end
end)
shared.registerSatelliteGroupObjects(asset, group, tle, true)
@@ -8,16 +8,4 @@ local group = {
}
local tle = shared.downloadTLEFile(asset, group.Url, group.Title)
local objectNames = {}
asset.onInitialize(function ()
objectNames = shared.addSatelliteGroupObjects(group, tle, false)
end)
asset.onDeinitialize(function ()
for _, n in ipairs(objectNames) do
openspace.removeSceneGraphNode(n)
end
end)
shared.registerSatelliteGroupObjects(asset, group, tle, true)
@@ -8,16 +8,4 @@ local group = {
}
local tle = shared.downloadTLEFile(asset, group.Url, group.Title)
local objectNames = {}
asset.onInitialize(function ()
objectNames = shared.addSatelliteGroupObjects(group, tle, false)
end)
asset.onDeinitialize(function ()
for _, n in ipairs(objectNames) do
openspace.removeSceneGraphNode(n)
end
end)
shared.registerSatelliteGroupObjects(asset, group, tle, true)
@@ -8,16 +8,4 @@ local group = {
}
local tle = shared.downloadTLEFile(asset, group.Url, group.Title)
local objectNames = {}
asset.onInitialize(function ()
objectNames = shared.addSatelliteGroupObjects(group, tle, false)
end)
asset.onDeinitialize(function ()
for _, n in ipairs(objectNames) do
openspace.removeSceneGraphNode(n)
end
end)
shared.registerSatelliteGroupObjects(asset, group, tle, true)
+1 -87
View File
@@ -1,77 +1,7 @@
local assetHelper = asset.require('util/asset_helper')
local sceneHelper = asset.require('util/scene_helper')
local propertyHelper = asset.require('util/property_helper')
-- Specifying which other assets should be loaded in this scene
asset.require('spice/base')
--assetHelper.requestAll(asset, 'scene/solarsystem/sun')
asset.require('scene/solarsystem/planets/earth/earth')
--assetHelper.requestAll(asset, 'scene/digitaluniverse')
-- Load default key bindings applicable to most scenes
asset.require('util/default_keybindings')
asset.require('util/default_dashboard')
--asset.require('util/default_joystick')
asset.require('util/webgui')
--asset.request('customization/globebrowsing')
asset.require('./base')
--asset.request('scene/solarsystem/planets/earth/satellites/satellites_all')
asset.request('scene/solarsystem/planets/earth/satellites/satellites_debris')
--asset.request('scene/solarsystem/planets/earth/satellites/satellites_debris_old')
-- Keybindings that are specific for this scene
local Keybindings = {
{
Key = "s",
Command = propertyHelper.invert('Scene.Earth.Renderable.Layers.NightLayers.Earth at Night 2012.Enabled') ..
propertyHelper.invert('Scene.Earth.Renderable.PerformShading') ..
propertyHelper.invert('Scene.Earth.Renderable.Atmosphere') ..
propertyHelper.invert('Scene.Earth.Renderable.Layers.WaterMasks.MODIS_Water_Mask.Enabled'),
Name = "Night for earth",
Documentation = "Toggle night texture, shading, atmosphere, and water for Earth.",
GuiPath = "/Rendering",
Local = false
},
{
Key = "b",
Name = "Toggle background",
Command = propertyHelper.invert('Scene.MilkyWay.Renderable.Enabled') ..
propertyHelper.invert('Scene.Stars.Renderable.Enabled'),
Documentation = "Toggle background (Stars and Milkyway).",
GuiPath = "/Rendering",
Local = false
},
{
Key = "g",
Name = "Toggle background/shading",
Command = propertyHelper.invert('Scene.MilkyWay.Renderable.Enabled') ..
propertyHelper.invert('Scene.Stars.Renderable.Enabled') ..
propertyHelper.invert('Scene.Earth.Renderable.Layers.NightLayers.Earth_at_Night_2012.Enabled') ..
propertyHelper.invert('Scene.EarthAtmosphere.Renderable.Enabled') ..
propertyHelper.invert('Scene.MarsAtmosphere.Renderable.Enabled') ..
propertyHelper.invert('Scene.Earth.Renderable.Layers.WaterMasks.MODIS_Water_Mask.Enabled') ..
propertyHelper.invert('Scene.Moon.Renderable.Enabled') ..
propertyHelper.invert('Scene.Sun.Renderable.Enabled'),
Documentation = "Toogles background and shading mode on the Earth and Mars alongside visibility of the Moon and the Sun",
GuiPath = "/Rendering",
Local = false
},
{
Key = "h",
Name="Hide Trails",
Command = "openspace.setPropertyValue('Scene.*Trail.Renderable.Enabled', false)",
Documentation = "Disables visibility of the trails",
GuiPath = "/Rendering",
Local = false
},
}
local earthAsset = asset.require('scene/solarsystem/planets/earth/earth')
assetHelper.registerInterestingNodes(asset, {
"Earth", "Mars", "Moon", "Sun"
})
asset.onInitialize(function ()
local now = openspace.time.currentWallTime()
@@ -80,14 +10,6 @@ asset.onInitialize(function ()
-- Jump back one day to show a complete planet
openspace.time.setTime(openspace.time.advancedTime(now, "-1d"))
sceneHelper.bindKeys(Keybindings)
openspace.setDefaultGuiSorting()
openspace.globebrowsing.loadWMSServersFromFile(
openspace.absPath("${DATA}/globebrowsing_servers.lua")
)
openspace.addVirtualProperty(
"BoolProperty",
"Show Trails",
@@ -98,17 +20,9 @@ asset.onInitialize(function ()
nil
)
openspace.navigation.setCameraState({
Anchor = earthAsset.Earth.Identifier,
Position = { 0, 0, 0 },
Rotation = { 0.758797, 0.221490, -0.605693, -0.091135 },
})
openspace.globebrowsing.goToGeo(58.5877, 16.1924, 20000000)
end)
asset.onDeinitialize(function ()
sceneHelper.unbindKeys(Keybindings)
openspace.removeVirtualProperty("*Trail.Renderable.Enabled")
end)
+1 -1
View File
@@ -1,7 +1,7 @@
local fn =
"return function (x, y, z) " ..
" if math.sqrt(x^2 + y^2 + z^2) < 0.4 then " ..
" return 1.0 " ..
" return 0.8 " ..
" end " ..
" return 0.0 " ..
"end"
@@ -18,7 +18,7 @@ for i=1,length do
LowerDomainBound = {-0.5, -0.5, -0.5},
UpperDomainBound = {0.5, 0.5, 0.5},
ValueFunction = fn,
Time = "2018-05-04T00:00:01" .. step,
Time = "2018-05-04T00:00:" .. step,
RawVolumeOutput = "${DATA}/assets/examples/volume/generated/cartesiansequence/" .. step .. ".rawvolume",
DictionaryOutput = "${DATA}/assets/examples/volume/generated/cartesiansequence/" .. step .. ".dictionary"
}
+1 -1
View File
@@ -5,7 +5,7 @@ local fn =
return {{
Type = "GenerateRawVolumeTask",
Dimensions = {8, 8, 8},
Dimensions = {32, 32, 32},
LowerDomainBound = {0, 0, 0},
UpperDomainBound = {1, math.pi, 2 * math.pi},
ValueFunction = fn,