mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-02-22 04:49:12 -06:00
Merge branch 'master' into issue/1102
This commit is contained in:
Submodule apps/OpenSpace/ext/sgct updated: 72aaa72369...95d4237eaf
@@ -57,7 +57,6 @@
|
||||
#include <sgct/viewport.h>
|
||||
#include <stb_image.h>
|
||||
#include <Tracy.hpp>
|
||||
#include <TracyOpenGL.hpp>
|
||||
#include <chrono>
|
||||
#include <ctime>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
#Asset
|
||||
scene/solarsystem/planets/earth/moon/moon required
|
||||
scene/solarsystem/missions/apollo/apollo8 required
|
||||
scene/solarsystem/missions/apollo/8/apollo8 required
|
||||
scene/solarsystem/planets/earth/earth required
|
||||
|
||||
#Property
|
||||
|
||||
@@ -5,7 +5,7 @@ local sceneHelper = asset.require('util/scene_helper')
|
||||
|
||||
|
||||
asset.require('scene/solarsystem/planets/earth/moon/moon')
|
||||
asset.require('scene/solarsystem/missions/apollo/apollo8.asset')
|
||||
asset.require('scene/solarsystem/missions/apollo/8/apollo8.asset')
|
||||
|
||||
-- Custom Keybindings
|
||||
local Keybindings = {
|
||||
@@ -118,7 +118,6 @@ asset.onInitialize(function ()
|
||||
openspace.markInterestingNodes({ "Earth", "Moon", "Apollo8", "Apollo8Launch" })
|
||||
|
||||
openspace.setPropertyValueSingle('NavigationHandler.OrbitalNavigator.MinimumAllowedDistance', 0.000000);
|
||||
openspace.setPropertyValueSingle('Scene.Moon.Renderable.LodScaleFactor', 24.0);
|
||||
|
||||
openspace.globebrowsing.goToGeo(earthAsset.Earth.Identifier, 20, -60, 15000000)
|
||||
end)
|
||||
|
||||
@@ -3,17 +3,15 @@
|
||||
|
||||
#Asset
|
||||
scene/solarsystem/planets/earth/moon/moon required
|
||||
scene/solarsystem/missions/apollo/apollo8 required
|
||||
scene/solarsystem/missions/apollo/apollo11 required
|
||||
scene/solarsystem/missions/apollo/a17_lem required
|
||||
scene/solarsystem/missions/apollo/8/apollo8 required
|
||||
scene/solarsystem/missions/apollo/11/apollo11 required
|
||||
scene/solarsystem/missions/apollo/17/lem required
|
||||
scene/solarsystem/missions/apollo/apollo_globebrowsing required
|
||||
scene/solarsystem/missions/apollo/apollo_11_lem_flipbook required
|
||||
scene/solarsystem/missions/apollo/11/lem_flipbook required
|
||||
scene/solarsystem/missions/apollo/insignias_map required
|
||||
|
||||
#Property
|
||||
setPropertyValueSingle Scene.Moon.Renderable.Layers.ColorLayers.A17_travmap.BlendMode 0
|
||||
setPropertyValueSingle Scene.Apollo11LemDescentModel.Renderable.RotationVector { 273.750,28.0,309.85 }
|
||||
setPropertyValueSingle Scene.Apollo11LemLandedModel.Renderable.RotationVector { 273.750,28.0,309.85 }
|
||||
setPropertyValueSingle Scene.Moon.Renderable.PerformShading false
|
||||
|
||||
#Keybinding
|
||||
|
||||
@@ -1,15 +1,14 @@
|
||||
asset.require('./base')
|
||||
|
||||
--moonrocks.scene
|
||||
local sceneHelper = asset.require('util/scene_helper')
|
||||
-- local station2 = asset.require('scene/solarsystem/missions/apollo/bouldersstation2')
|
||||
-- local station6 = asset.require('scene/solarsystem/missions/apollo/bouldersstation6')
|
||||
-- local station7 = asset.require('scene/solarsystem/missions/apollo/bouldersstation7')
|
||||
asset.require('scene/solarsystem/missions/apollo/apollo8')
|
||||
asset.require('scene/solarsystem/missions/apollo/apollo11')
|
||||
asset.require('scene/solarsystem/missions/apollo/a17_lem')
|
||||
-- local station2 = asset.require('scene/solarsystem/missions/apollo/17/bouldersstation2')
|
||||
-- local station6 = asset.require('scene/solarsystem/missions/apollo/17/bouldersstation6')
|
||||
-- local station7 = asset.require('scene/solarsystem/missions/apollo/17/bouldersstation7')
|
||||
asset.require('scene/solarsystem/missions/apollo/8/apollo8')
|
||||
asset.require('scene/solarsystem/missions/apollo/11/apollo11')
|
||||
asset.require('scene/solarsystem/missions/apollo/17/lem')
|
||||
asset.require('scene/solarsystem/missions/apollo/apollo_globebrowsing')
|
||||
asset.require('scene/solarsystem/missions/apollo/apollo_11_lem_flipbook')
|
||||
asset.require('scene/solarsystem/missions/apollo/11/lem_flipbook')
|
||||
asset.require('scene/solarsystem/missions/apollo/insignias_map')
|
||||
|
||||
local Keybindings = {
|
||||
@@ -100,9 +99,6 @@ asset.onInitialize(function ()
|
||||
-- openspace.setPropertyValueSingle('Scene.Moon.Renderable.Layers.HeightLayers.LRO_NAC_Apollo_11.Enabled', true);
|
||||
-- openspace.setPropertyValueSingle('Scene.Moon.Renderable.Layers.ColorLayers.A11_M177481212_p_longlat.Enabled', true);
|
||||
|
||||
openspace.setPropertyValueSingle('Scene.Apollo11LemDescentModel.Renderable.RotationVector', { 273.750,28.0,309.85 });
|
||||
openspace.setPropertyValueSingle('Scene.Apollo11LemLandedModel.Renderable.RotationVector', { 273.750,28.0,309.85 });
|
||||
|
||||
openspace.globebrowsing.goToGeo(moonAsset.Moon.Identifier, 20, -60, 15000000)
|
||||
|
||||
openspace.setPropertyValueSingle("Scene.Moon.Renderable.PerformShading", false)
|
||||
|
||||
@@ -18,3 +18,12 @@ end)
|
||||
asset.onDeinitialize(function ()
|
||||
openspace.removeInterestingNodes({ "Earth", "Mars", "Moon", "Sun" })
|
||||
end)
|
||||
|
||||
asset.meta = {
|
||||
Name = "Default scene",
|
||||
Version = "1.0",
|
||||
Description = [[ Bla bla, something something asteroids ]],
|
||||
Author = "OpenSpace Team",
|
||||
URL = "http://openspaceproject.com",
|
||||
License = "MIT license"
|
||||
}
|
||||
|
||||
@@ -43,6 +43,12 @@ local deepSkyPoints = {
|
||||
--CorrectionSizeFactor = 10.45
|
||||
EnablePixelSizeControl = true
|
||||
},
|
||||
Transform = {
|
||||
Rotation = {
|
||||
Type = "StaticRotation",
|
||||
Rotation = { 0, 0, 3.14159265359 }
|
||||
}
|
||||
},
|
||||
GUI = {
|
||||
Name = "Deep Sky Objects Points",
|
||||
Path = "/Universe/Galaxies"
|
||||
@@ -66,6 +72,12 @@ local deepSkyImages = {
|
||||
--FadeInDistances = {0.001, 0.05010},
|
||||
PlaneMinSize = 5.0
|
||||
},
|
||||
Transform = {
|
||||
Rotation = {
|
||||
Type = "StaticRotation",
|
||||
Rotation = {3.14159265359, 3.14159265359, 0 }
|
||||
}
|
||||
},
|
||||
GUI = {
|
||||
Name = "Deep Sky Objects Images",
|
||||
Path = "/Universe/Galaxies"
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
local constellation_helper = asset.require('./generate_constellations')
|
||||
|
||||
local constellationsCSV = asset.localResource('constellation_data.csv')
|
||||
|
||||
local nodes = {}
|
||||
|
||||
asset.onInitialize(function ()
|
||||
nodes = constellation_helper.createConstellations('Constellation Art', constellationsCSV)
|
||||
for _, n in ipairs(nodes) do
|
||||
openspace.addSceneGraphNode(n);
|
||||
end
|
||||
end)
|
||||
|
||||
asset.onDeinitialize(function ()
|
||||
for _, n in ipairs(nodes) do
|
||||
openspace.removeSceneGraphNode(n.Identifier);
|
||||
end
|
||||
end)
|
||||
|
||||
|
||||
asset.meta = {
|
||||
Name = "Constellation Images",
|
||||
Version = "1.0",
|
||||
Description = "Artistic images depicting the constellations",
|
||||
Author = "James Hedberg",
|
||||
URL = "ccnyplanetarium.org",
|
||||
License = ""
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
Data about Constellations columns are: group, name, x, y, z, scale, imageName, rotX, rotY, rotZ, centerStar
|
||||
normal,Ori,Orion,-550.8742,-259.3621,-188.9620,1.5,Ori.png,1.128407,1.058407,1.668407,HD37128
|
||||
zodiac,Tau,Taurus,-18.7277,-0.3175,-6.9092,1.2,Tau.png,1.198407,0.908407,1.378407,Aldebran
|
||||
zodiac,Ari,Aries,-13.2892,9.4519,-11.9378,0.8,Ari.png,0.668407,0.538407,0.518407,Hamal
|
||||
zodiac,Gem,Gemini,-362.5493,-102.2245,79.4030,0.85,Gem.png,-0.731593,2.268407,-0.451593,Mekbuda
|
||||
zodiac,Cnc,Cancer,-30.9209,-16.4584,22.6601,0.8,Cnc.png,-1.151593,1.888407,-1.041593,HD74442
|
||||
zodiac,Leo,Leo,-17.9030,-13.2719,31.4196,1.33,Leo.png,-0.131593,2.448407,0.418407,HD89484
|
||||
zodiac,Vir,Virgo,36.5809,-35.1877,62.3341,1.5,Vir.png,-0.371593,3.138407,0.518407,HD116658
|
||||
zodiac,Lib,Libra,17.5393,-6.2768,14.5916,1.0,Lib.png,-1.011593,3.138407,1.318407,HD130819
|
||||
zodiac,Sco,Scorpius,137.4378,-19.4456,37.3606,1.2,Sco.png,1.698407,-1.001593,-1.751593,HD148478
|
||||
zodiac,Sgr,Sagittarius,66.2304,11.1498,-14.8095,1.2,Sgr.png,1.728407,-1.321593,-1.751593,HD175191
|
||||
zodiac,Cap,Capricornus,32.9799,20.0621,-29.3945,1.3,Cap.png,1.158407,-0.881593,-0.561593,HD200761
|
||||
zodiac,Aqr,Aquarius,86.5090,149.4078,-155.8102,1.2,Aqr.png,-2.921593,-2.391593,-2.551593,-2.511593
|
||||
zodiac,Psc,Pisces,-28.0235,45.3150,-76.8893,1.6,Psc.png,0.458407,-0.001593,0.618407,HD4656
|
||||
northern,Uma,Ursa Major,-12.0503,7.1931,19.8974,1.6,UMa.png,0.748407,2.398407,0.658407,HD95418
|
||||
northern,Dra,Draco,-1.4340,20.6566,23.5098,1.9,Dra.png,0.658407,-2.541593,1.058407,HD137759
|
||||
southern,Ant,Antila,-0.2233,-103.8908,42.7940,1.3,Ant.png,1.848407,0.198407,-3.141593,HD90610
|
||||
southern,Crv,Corvus,8.0442,-16.8858,19.3984,1.1,Crv.png,2.198407,-0.041593,-2.221593,HD108767
|
||||
southern,Cet,Cetus,-28.7960,7.2425,-73.6693,1.5,Cet.png,0.238407,0.368407,0.688407,HD11353
|
||||
southern,Cha,Chameleon,53.5121,-108.3624,-38.1807,1.1,Cha.png,-1.801593,2.738407,0.448407,HD92305
|
||||
northern,Cam,Camelopardalis,-304.8155,179.0620,71.1454,1.7,Cam.png,2.128407,1.228407,1.478407,HD31910
|
||||
equatorial,Aql,Aquila,11.7741,9.7467,-1.6418,1.0,Aql.png,-2.601593,-2.511593,-3.141593,HD182640
|
||||
southern,Aps,Apus,31.6370,-32.5620,-16.5786,1.1,Aps.png,-1.691593,-2.281593,0.838407,HD149324
|
||||
northern,Lyn,Lynx,-98.3174,4.4830,67.2289,1.2,Lyn.png,1.688407,1.768407,1.668407,HD70272
|
||||
southern,Phe,Phoenix,5.0172,-4.2096,-22.8088,1.5,Phe.png,-3.141593,3.138407,-3.141593,HD6595
|
||||
northern,Cyg,Cygnus,78.7445,375.2440,12.4995,1.4,Cyg.png,1.668407,-0.931593,-0.261593,HD194093
|
||||
southern,Cen,Centaurus,20.1398,-33.1830,9.5915,2.7,Cen.png,-1.291593,3.088407,0.458407,HD110304
|
||||
northern,Aur,Auriga,-12.3062,3.8595,1.0302,1.5,Aur.png,1.378407,1.108407,1.178407,HD34029
|
||||
northern,Peg,Pegasus,0.9791,32.5947,-27.7339,2.42,Peg.png,0.918407,-0.221593,-0.191593,HD218045
|
||||
southern,Hya,Hydra,-2.9043,-33.5496,25.8962,3,Hya.png,-0.531593,2.838407,0.368407,HD93813
|
||||
southern,Oct,Octans,22.0434,-27.8601,-24.3108,1.0,Oct.png,-0.911593,0.398407,1.198407,HD214846
|
||||
southern,Nor,Norma,34.9251,-17.5643,0.0068,1.0,Nor.png,-1.631593,-2.421593,1.298407,HD146686
|
||||
southern,Mus,Musca,48.8888,-79.2952,-10.2828,1.25,Mus.png,-1.871593,3.138407,0.358407,HD109668
|
||||
southern,Hyi,Hydrus,3.2767,-4.7183,-4.7829,1.1,Hyi.png,2.438407,-3.141593,-2.381593,HD2151
|
||||
northern,Lac,Lacerta,-6.0878,30.5794,-3.6064,1.0,Lac.png,-1.521593,-2.391593,3.138407,HD213558
|
||||
equatorial,Lep,Lepus,-212.6297,-184.4909,-132.1156,1.0,Lep.png,-1.801593,-2.351593,-0.861593,HD36673
|
||||
southern,Lup,Lupus,129.1166,-102.2983,33.3251,1.2,Lup.png,-1.191593,-2.391593,0.798407,HD129056
|
||||
southern,Men,Mensa,2.4149,-8.5586,-4.8892,1.0,Men.png,-2.101593,-2.781593,0.828407,HD43834
|
||||
southern,Mic,Microscopium,51.0335,11.1671,-44.3692,1.0,Mic.png,0.728407,-0.831593,-0.561593,HD199951
|
||||
equatorial,Mon,Monoceros,-93.0725,-66.8909,8.6548,1.2,Mon.png,-1.331593,1.988407,-0.891593,HD55185
|
||||
southern,Pav,Pavo,4.4549,-2.5959,-3.2739,1.3,Pav.png,-2.391593,-2.171593,1.648407,HD190248
|
||||
southern,Ind,Indus,133.6149,-53.5569,-115.9552,1.5,Ind.png,-2.031593,-1.491593,1.758407,HD198700
|
||||
northern,LMi,Leo Minor,-23.3948,-2.5770,38.0756,1.1,LMi.png,-3.141593,0.478407,-2.201593,HD90537
|
||||
northern,Lyr,Lyra,2.8086,6.7630,2.5555,1.0,Lyr.png,-1.831593,-2.091593,3.141500,HD172167
|
||||
northern,Her,Hercules,14.0526,14.9773,12.5478,1.3,Her.png,-1.511593,-1.811593,2.288407,HD156164
|
||||
southern,Gru,Grus,18.6528,-3.2893,-24.6602,1.3,Gru.png,-3.141593,-2.511593,-2.901593,HD209952
|
||||
southern,Crt,Crater,1.5886,-43.9831,40.3390,1.3,Crt.png,-0.521593,3.140000,0.588407,HD98430
|
||||
northern,Del,Delphinus,14.8599,24.6150,-8.0550,1.2,Del.png,1.308407,-0.951593,-0.241593,HD196524
|
||||
southern,Dor,Dorado,-0.6460,-9.3172,-6.9654,1.2,Dor.png,2.118407,1.768407,-2.901593,HD33262
|
||||
northern,Equ,Equuleus,27.7363,41.7071,-27.4371,1.2,Equ.png,-1.801593,-2.511593,2.558407,HD202447
|
||||
southern,Eri,Eridanus,-37.5153,-23.5231,-65.6368,2.1,Eri.png,0.128407,0.698407,0.998407,HD20720
|
||||
southern,For,Fornax,-14.0351,-17.8282,-46.5514,1.4,For.png,3.138407,2.678407,-2.351593,HD17652
|
||||
southern,Hor,Horologium,2.1021,-27.1310,-40.5136,1.2,Hor.png,-3.141593,2.468407,-2.191593,HD16920
|
||||
southern,Pyx,Pyxis,-66.7424,-248.9639,26.0445,1.2,Pyx.png,1.838407,-1.651593,2.708407,HD74575
|
||||
southern,Ret,Reticulum,2.8130,-37.2904,-33.2644,1.5,Ret.png,1.998407,2.188407,-2.591593,HD27256
|
||||
northern,Sge,Sagitta,44.3886,70.9446,-7.6264,1.2,Sge.png,-0.741593,-2.231593,2.108407,HD189319
|
||||
southern,Scl,Sculptor,21.6545,-6.8861,-166.5240,1.3,Scl.png,-0.071593,-0.221593,0.638407,HD2429
|
||||
southern,Sct,Scutum,48.8939,21.5158,-0.1629,1.2,Sct.png,1.188407,-1.271593,-0.971593,HD171443
|
||||
southern,Tuc,Tucana,35.3950,-20.2535,-45.2324,1.1,Tuc.png,-0.351593,-0.161593,0.308407,HD211416
|
||||
northern,Tri,Triangulum,-26.6263,21.9119,-16.2254,1.2,Tri.png,1.168407,0.218407,0.558407,HD13161
|
||||
southern,TrA,Triangulum Australe,96.2283,-76.4459,-33.5257,1.2,TrA.png,-1.991593,-2.491593,1.128407,HD150798
|
||||
southern,Tel,Telescopium,72.3444,-14.5016,-20.0248,1.2,Tel.png,-0.461593,-1.731593,0.298407,HD169467
|
||||
southern,Ara,Ara,164.9273,-75.6246,-35.3100,1.1,Ara.png,-1.381593,-2.131593,1.048407,HD157244
|
||||
southern,Cae,Caelum,-6.0961,-13.7926,-13.3392,1.0,Cae.png,-0.661593,0.948407,0.418407,HD29875
|
||||
southern,CMa,Canis Major,-1.7693,-1.9125,-0.4074,1.3,CMa.png,1.128407,1.048407,1.878407,HD48915
|
||||
northern,CMi,Canis Minor,-2.8348,-1.8906,0.7881,1.2,CMi.png,2.538407,1.138407,-3.141593,HD61421
|
||||
southern,Vol,Volans,37.6000,-182.7856,-62.6559,1.2,Vol.png,-2.441593,1.988407,-0.351593,HD68520
|
||||
northern,UMi,Ursa Minor,-11.3527,27.2100,25.1835,1.3,UMi.png,-2.491593,-0.581593,-2.381593,HD131873
|
||||
northern,And,Andromdeda,-32.8276,43.3946,-27.8475,1.6,And.png,-2.021593,-3.141593,-2.521593,HD6860
|
||||
northern,Boo,Bootes,11.2468,14.9864,30.4945,2.0,Boo.png,-3.141593,-0.601593,-2.361593,HD135722
|
||||
northern,Vul,Vulpecula,46.7540,77.7780,5.3953,1.1,Vul.png,-2.301593,-2.061593,-3.141593,HD131873
|
||||
northern,CVn,Canes Venatici,-3.1198,5.7935,33.1368,1.3,CVn.png,0.148407,3.138407,0.428407,HD112413
|
||||
southern,Cir,Circinus,11.4255,-11.6937,-1.3129,1.0,Cir.png,1.448407,-0.391593,-2.211593,HD128898
|
||||
northern,Com,Coma Berenices,1.9257,-1.2062,12.2465,1.4,Com.png,3.138407,-0.051593,-2.711593,HD114378
|
||||
southern,CrA,Corona Australis,146.1322,-4.7492,-53.7124,1.0,CrA.png,-3.141593,-2.021593,-3.141593,HD178345
|
||||
northern,CrB,Corona Borealis,33.5737,32.0314,52.9729,1.3,CrB.png,-3.141593,-0.601593,-2.271593,HD143107
|
||||
northern,Cas,Cassiopeia,-36.3073,59.4424,-7.6926,1.4,Cas.png,-1.431593,3.128407,-2.331593,HD3712
|
||||
northern,Cep,Cepheus,-2.8178,14.4985,2.3848,1.7,Cep.png,-1.331593,-2.291593,-2.931593,HD203280
|
||||
southern,Car,Carina Vela Puppis,14.1325,-188.6018,-42.2785,2.0,Car.png,2.078407,1.048407,-3.111593,HD71129
|
||||
northern,Col,Columba,-11.2568,-20.5973,-11.9895,1.0,Col.png,2.518407,1.358407,-2.981593,HD39425
|
||||
northern,Per,Perseus,-139.8202,79.8063,-16.2631,1.3,Per.png,-1.751593,2.428407,-2.411593,HD22928
|
||||
northern,Oph,Ophiuchus,127.9419,14.0822,56.2015,3.2,Oph.png,2.178407,-0.781593,-1.681593,HD149757
|
||||
southern,PsA,Piscis Austrinus,99.9977,47.6679,-199.6345,1.0,PsA.png,3.138407,-2.541593,-2.881593,HD214748
|
||||
southern,Cru,Crux,49.3509,-85.0446,-0.6223,1.1,Cru.png,1.718407,0.048407,-2.741593,HD108248
|
||||
southern,Pic,Pictor,-4.5417,-45.5649,-27.1768,1.0,Pic.png,2.568407,2.138407,-2.081593,HD39523
|
||||
|
@@ -0,0 +1,38 @@
|
||||
local scene_helper = asset.require('util/scene_helper')
|
||||
|
||||
local Keybindings = {
|
||||
{
|
||||
Key = "c",
|
||||
Name = "Show Constellation Art",
|
||||
Command = "openspace.setPropertyValue('Scene.Constellation Art*.Renderable.Opacity', 0);" ..
|
||||
"openspace.setPropertyValue('Scene.Constellation Art*.Renderable.Enabled', true);" ..
|
||||
"openspace.setPropertyValue('Scene.Constellation Art*.Renderable.Opacity', 0.1, 2);",
|
||||
Documentation = "Enables and fades up constellation art work",
|
||||
GuiPath = "/Rendering",
|
||||
Local = false
|
||||
},
|
||||
{
|
||||
Key = "SHIFT+c",
|
||||
Name = "Hide Constellation Art",
|
||||
Command = "openspace.setPropertyValue('Scene.Constellation Art*.Renderable.Opacity', 0, 2);",
|
||||
Documentation = "Fades out constellation artwork",
|
||||
GuiPath = "/Rendering",
|
||||
Local = false
|
||||
},
|
||||
{
|
||||
Key = "CTRL+c",
|
||||
Name = "Disable Constellation Art",
|
||||
Command = "openspace.setPropertyValue('Scene.Constellation Art*.Renderable.Enabled', false);",
|
||||
Documentation = "Disable constellation artwork",
|
||||
GuiPath = "/Rendering",
|
||||
Local = false
|
||||
}
|
||||
}
|
||||
|
||||
asset.onInitialize(function ()
|
||||
scene_helper.bindKeys(Keybindings)
|
||||
end)
|
||||
|
||||
asset.onDeinitialize(function ()
|
||||
scene_helper.unbindKeys(Keybindings)
|
||||
end)
|
||||
@@ -0,0 +1,79 @@
|
||||
local assetHelper = asset.require('util/asset_helper')
|
||||
local transforms = asset.require("scene/solarsystem/sun/transforms")
|
||||
|
||||
local images = asset.syncedResource({
|
||||
Name = "Constellation Images",
|
||||
Type = "HttpSynchronization",
|
||||
Identifier = "constellation_images",
|
||||
Version = 1
|
||||
})
|
||||
|
||||
--function that reads the file
|
||||
local createConstellations = function (guiPath, constellationfile)
|
||||
local genConstellations = {};
|
||||
--skip the first line
|
||||
local notFirstLine = false;
|
||||
-- define parsec to meters
|
||||
local PARSEC_CONSTANT = 3.0856776E16;
|
||||
-- how many parsecs away do you want the images to be?
|
||||
-- this setting puts the billboards at the location of the constellation bounds grid from DU.
|
||||
-- but they can really be anywhere since the billboard size will scale with distance.
|
||||
local distanceMultiplier = 3.2;
|
||||
local baseScale = 1e17;
|
||||
for line in io.lines(openspace.absPath(constellationfile)) do
|
||||
if (notFirstLine) then
|
||||
-- describes the data
|
||||
local matchstring = '(.-),(.-),(.-),(.-),(.-),(.-),(.-),(.-),(.-),(.-),(.-),(.-)$'
|
||||
local group, abbreviation, name, x, y, z, scale, imageName, rotX, rotY, rotZ, centerStar = line:match(matchstring)
|
||||
local magVec = math.sqrt(x*x + y*y + z*z)
|
||||
local normx = x/magVec
|
||||
local normy = y/magVec
|
||||
local normz = z/magVec
|
||||
|
||||
group = (group == '' and globe or group)
|
||||
|
||||
local aconstellation = {
|
||||
Identifier = guiPath .. '-' .. name,
|
||||
Parent = transforms.SolarSystemBarycenter.Identifier,
|
||||
Transform = {
|
||||
Translation = {
|
||||
Type = "StaticTranslation",
|
||||
-- position is in parsecs from the SolarSystemBarycenter, so convert to meters
|
||||
Position = {
|
||||
normx * PARSEC_CONSTANT * distanceMultiplier,
|
||||
normy * PARSEC_CONSTANT * distanceMultiplier,
|
||||
normz * PARSEC_CONSTANT * distanceMultiplier
|
||||
}
|
||||
},
|
||||
Rotation = {
|
||||
Type = "StaticRotation",
|
||||
Rotation = { tonumber(rotX), tonumber(rotY), tonumber(rotZ) }
|
||||
}
|
||||
|
||||
},
|
||||
Renderable = {
|
||||
Type = "RenderablePlaneImageLocal",
|
||||
Size = tonumber(baseScale*scale*distanceMultiplier/10),
|
||||
Enabled = false,
|
||||
Origin = "Center",
|
||||
Billboard = false,
|
||||
Texture = images .. "/" .. imageName,
|
||||
BlendMode = "Additive",
|
||||
Opacity = 0.1
|
||||
},
|
||||
Tag = { "ConstellationArtImage", group },
|
||||
GUI = {
|
||||
Name = name .. ' Image',
|
||||
Path = '/Milky Way/' .. guiPath
|
||||
}
|
||||
}
|
||||
table.insert(genConstellations, aconstellation);
|
||||
|
||||
else
|
||||
notFirstLine = true
|
||||
end
|
||||
end
|
||||
return genConstellations
|
||||
end
|
||||
|
||||
asset.export('createConstellations', createConstellations)
|
||||
@@ -20,7 +20,7 @@ local C2019Q4BorisovTrail = {
|
||||
Color = { 0.9, 0.9, 0.0 },
|
||||
StartTime = "2015 JAN 01 00:00:00",
|
||||
EndTime = "2024 JAN 01 00:00:00",
|
||||
SampleInterval = 60
|
||||
SampleInterval = 60 * 60 * 24 * 7
|
||||
},
|
||||
GUI = {
|
||||
Name = "C-2019 Q4 Borisov Trail",
|
||||
|
||||
@@ -1,39 +1,24 @@
|
||||
local assetHelper = asset.require('util/asset_helper')
|
||||
local sunTransforms = asset.require('scene/solarsystem/sun/transforms')
|
||||
local descentKeyframes = asset.require('./apollo11_lem_descent.asset')
|
||||
local descentRotationKeyframes = asset.require('./apollo11_lem_descent_rotation.asset')
|
||||
local model = asset.require('scene/solarsystem/missions/apollo/lem_model')
|
||||
local asset_helper = asset.require('util/asset_helper')
|
||||
local sun_transforms = asset.require('scene/solarsystem/sun/transforms')
|
||||
local moon_transforms = asset.require('scene/solarsystem/planets/earth/moon/moon')
|
||||
|
||||
local descentKeyframes = asset.require('./lem_descent.asset')
|
||||
local descentRotationKeyframes = asset.require('./lem_descent_rotation.asset')
|
||||
|
||||
local lem_model = asset.require('scene/solarsystem/missions/apollo/lem_model')
|
||||
local kernels = asset.require('./kernels').kernels
|
||||
|
||||
local models = asset.require('./models').models
|
||||
|
||||
asset.require('spice/base')
|
||||
|
||||
local kernelsFolder = asset.syncedResource({
|
||||
Name = "Apollo Kernels",
|
||||
Type = "HttpSynchronization",
|
||||
Identifier = "apollo_11_spice",
|
||||
Version = 1
|
||||
})
|
||||
|
||||
local modelFolder = asset.syncedResource({
|
||||
Name = "Apollo Models",
|
||||
Type = "HttpSynchronization",
|
||||
Identifier = "apollo_11_models",
|
||||
Version = 1
|
||||
})
|
||||
|
||||
local kernels = {
|
||||
kernelsFolder .. "/moon_080317.tf",
|
||||
kernelsFolder .. "/apollo_naif_ids.tf",
|
||||
kernelsFolder .. "/moon_pa_de421_1900-2050.bpc",
|
||||
kernelsFolder .. '/apollo11_orbits_full9km.bsp',
|
||||
kernelsFolder .. '/apollo11_orbits_lm9km.bsp',
|
||||
}
|
||||
--landing - 1969-07-20T20:17:40
|
||||
local apolloSpiceId = "-911"
|
||||
local apolloLemSpiceId = "-911500"
|
||||
|
||||
local Apollo11Position = {
|
||||
Identifier = "Apollo11Position",
|
||||
Parent = "Moon",
|
||||
Parent = moon_transforms.Moon.Identifier,
|
||||
TimeFrame = {
|
||||
Type = "TimeFrameInterval",
|
||||
Start = "1969 JUL 19 19:38:29.183",
|
||||
@@ -58,28 +43,27 @@ local Apollo11Position = {
|
||||
local Apollo11Model = {
|
||||
Identifier = "Apollo11",
|
||||
Parent = Apollo11Position.Identifier,
|
||||
TimeFrame = {
|
||||
Type = "TimeFrameInterval",
|
||||
Start = "1969 JUL 19 19:38:29.183",
|
||||
End = "1969 JUL 22 04:55:35.183"
|
||||
},
|
||||
Transform = {
|
||||
Scale = {
|
||||
Type = "StaticScale",
|
||||
Scale = 20.0
|
||||
}
|
||||
},
|
||||
TimeFrame = {
|
||||
Type = "TimeFrameInterval",
|
||||
Start = "1969 JUL 19 19:38:29.183",
|
||||
End = "1969 JUL 22 04:55:35.183"
|
||||
},
|
||||
Renderable = {
|
||||
Type = "RenderableModel",
|
||||
Geometry = {
|
||||
Type = "MultiModelGeometry",
|
||||
GeometryFile = modelFolder .. "/Apollo_CSM_shrunk_rotated_xy_double_size.obj"
|
||||
GeometryFile = models .. "/Apollo_CSM_shrunk_rotated_xy_double_size.obj"
|
||||
},
|
||||
ColorTexture = modelFolder .. "/gray.png",
|
||||
LightSources = assetHelper.getDefaultLightSources(sunTransforms.SolarSystemBarycenter.Identifier)
|
||||
ColorTexture = models .. "/gray.png",
|
||||
LightSources = asset_helper.getDefaultLightSources(sun_transforms.SolarSystemBarycenter.Identifier)
|
||||
},
|
||||
GUI = {
|
||||
Hidden = false,
|
||||
Name = "Apollo 11 CSM",
|
||||
Path = "/Solar System/Missions/Apollo/11"
|
||||
}
|
||||
@@ -87,7 +71,7 @@ local Apollo11Model = {
|
||||
|
||||
local Apollo11MoonTrail = {
|
||||
Identifier = "Apollo11MoonTrail",
|
||||
Parent = "Moon",
|
||||
Parent = moon_transforms.Moon.Identifier,
|
||||
Renderable = {
|
||||
Type = "RenderableTrailTrajectory",
|
||||
Translation = {
|
||||
@@ -102,7 +86,7 @@ local Apollo11MoonTrail = {
|
||||
EndTime = "1969 JUL 22 04:55:35.183",
|
||||
SampleInterval = 60,
|
||||
EnableFade = false,
|
||||
Enabled = false,
|
||||
Enabled = false
|
||||
},
|
||||
GUI = {
|
||||
Name = "Apollo 11 Moon Orbits",
|
||||
@@ -140,7 +124,7 @@ local lemRotation = {
|
||||
|
||||
local Apollo11LemTrail = {
|
||||
Identifier = "Apollo11LemTrail",
|
||||
Parent = "Moon",
|
||||
Parent = moon_transforms.Moon.Identifier,
|
||||
Renderable = {
|
||||
Type = "RenderableTrailTrajectory",
|
||||
Translation = lemTranslation,
|
||||
@@ -159,7 +143,7 @@ local Apollo11LemTrail = {
|
||||
|
||||
local Apollo11LemPosition = {
|
||||
Identifier = "Apollo11LemPosition",
|
||||
Parent = "Moon",
|
||||
Parent = moon_transforms.Moon.Identifier,
|
||||
TimeFrame = {
|
||||
Type = "TimeFrameInterval",
|
||||
Start = "1969 JUL 20 19:10:25.183"
|
||||
@@ -169,7 +153,6 @@ local Apollo11LemPosition = {
|
||||
Rotation = lemRotation
|
||||
},
|
||||
GUI = {
|
||||
Hidden = false,
|
||||
Name = "Apollo 11 Lunar Lander Position",
|
||||
Path = "/Solar System/Missions/Apollo/11"
|
||||
}
|
||||
@@ -194,14 +177,14 @@ local Apollo11LemDescentModel = {
|
||||
Type = "RenderableModel",
|
||||
Geometry = {
|
||||
Type = "MultiModelGeometry",
|
||||
GeometryFile = model.modelFolder .. "/lmremoved.obj"
|
||||
GeometryFile = lem_model.modelFolder .. "/lmremoved.obj"
|
||||
},
|
||||
SpecularIntensity = 0.0,
|
||||
ColorTexture = model.modelFolder .. "/LM-2_ver2clean_u1_v1.jpeg",
|
||||
LightSources = assetHelper.getDefaultLightSources(sunTransforms.SolarSystemBarycenter.Identifier)
|
||||
RotationVector = { 273.750,28.0,309.85 },
|
||||
ColorTexture = lem_model.modelFolder .. "/LM-2_ver2clean_u1_v1.jpeg",
|
||||
LightSources = asset_helper.getDefaultLightSources(sun_transforms.SolarSystemBarycenter.Identifier)
|
||||
},
|
||||
GUI = {
|
||||
Hidden = false,
|
||||
Name = "Apollo 11 Descent Lem",
|
||||
Path = "/Solar System/Missions/Apollo/11"
|
||||
}
|
||||
@@ -224,14 +207,14 @@ local Apollo11LemLandedModel = {
|
||||
Type = "RenderableModel",
|
||||
Geometry = {
|
||||
Type = "MultiModelGeometry",
|
||||
GeometryFile = model.modelFolder .. "/LM-2_ver2clean.obj"
|
||||
GeometryFile = lem_model.modelFolder .. "/LM-2_ver2clean.obj"
|
||||
},
|
||||
SpecularIntensity = 0.0,
|
||||
ColorTexture = model.modelFolder .. "/LM-2_ver2clean_u1_v1.jpeg",
|
||||
LightSources = assetHelper.getDefaultLightSources(sunTransforms.SolarSystemBarycenter.Identifier)
|
||||
RotationVector = { 273.750,28.0,309.85 },
|
||||
ColorTexture = lem_model.modelFolder .. "/LM-2_ver2clean_u1_v1.jpeg",
|
||||
LightSources = asset_helper.getDefaultLightSources(sun_transforms.SolarSystemBarycenter.Identifier)
|
||||
},
|
||||
GUI = {
|
||||
Hidden = false,
|
||||
Name = "Apollo 11 Landed Lem",
|
||||
Path = "/Solar System/Missions/Apollo/11"
|
||||
}
|
||||
@@ -248,4 +231,4 @@ local exportList = {
|
||||
Apollo11LemTrail,
|
||||
}
|
||||
|
||||
assetHelper.registerSceneGraphNodesAndExport(asset, exportList)
|
||||
asset_helper.registerSceneGraphNodesAndExport(asset, exportList)
|
||||
@@ -0,0 +1,16 @@
|
||||
local kernelsFolder = asset.syncedResource({
|
||||
Name = "Apollo Kernels",
|
||||
Type = "HttpSynchronization",
|
||||
Identifier = "apollo_11_spice",
|
||||
Version = 1
|
||||
})
|
||||
|
||||
local kernels = {
|
||||
kernelsFolder .. "/moon_080317.tf",
|
||||
kernelsFolder .. "/apollo_naif_ids.tf",
|
||||
kernelsFolder .. "/moon_pa_de421_1900-2050.bpc",
|
||||
kernelsFolder .. '/apollo11_orbits_full9km.bsp',
|
||||
kernelsFolder .. '/apollo11_orbits_lm9km.bsp',
|
||||
}
|
||||
|
||||
asset.export('kernels', kernels)
|
||||
@@ -1,18 +1,18 @@
|
||||
-- a11_lem.asset
|
||||
local assetHelper = asset.require('util/asset_helper')
|
||||
local sunTransforms = asset.require('scene/solarsystem/sun/transforms')
|
||||
local moonAsset = asset.require('scene/solarsystem/planets/earth/moon/moon')
|
||||
local asset_helper = asset.require('util/asset_helper')
|
||||
local sun_transforms = asset.require('scene/solarsystem/sun/transforms')
|
||||
local moon_asset = asset.require('scene/solarsystem/planets/earth/moon/moon')
|
||||
|
||||
local model = asset.require('scene/solarsystem/missions/apollo/lem_model')
|
||||
local lem_model = asset.require('scene/solarsystem/missions/apollo/lem_model')
|
||||
|
||||
|
||||
local Apollo11Lem = {
|
||||
Identifier = "Apollo11Lem",
|
||||
Parent = moonAsset.Moon.Identifier,
|
||||
Parent = moon_asset.Moon.Identifier,
|
||||
Transform = {
|
||||
Translation = {
|
||||
Type = "GlobeTranslation",
|
||||
Globe = moonAsset.Moon.Identifier,
|
||||
Globe = moon_asset.Moon.Identifier,
|
||||
Longitude = -360+23.47306,
|
||||
Latitude = 0.67402,
|
||||
Altitude = -1927.65,
|
||||
@@ -38,10 +38,11 @@ local Apollo11LemModel = {
|
||||
Type = "RenderableModel",
|
||||
Geometry = {
|
||||
Type = "MultiModelGeometry",
|
||||
GeometryFile = model.modelFolder .. "/LM-2_ver2clean.obj"
|
||||
GeometryFile = lem_model.modelFolder .. "/LM-2_ver2clean.obj"
|
||||
},
|
||||
ColorTexture = model.modelFolder .. "/LM-2_ver2clean_u1_v1.jpeg",
|
||||
LightSources = assetHelper.getDefaultLightSources(sunTransforms.SolarSystemBarycenter.Identifier)
|
||||
RotationVector = { 91.044090,171.229706,111.666664 },
|
||||
ColorTexture = lem_model.modelFolder .. "/LM-2_ver2clean_u1_v1.jpeg",
|
||||
LightSources = asset_helper.getDefaultLightSources(sun_transforms.SolarSystemBarycenter.Identifier)
|
||||
},
|
||||
GUI = {
|
||||
Hidden = false,
|
||||
@@ -50,11 +51,4 @@ local Apollo11LemModel = {
|
||||
}
|
||||
}
|
||||
|
||||
assetHelper.registerSceneGraphNodesAndExport(asset, {
|
||||
Apollo11Lem,
|
||||
Apollo11LemModel
|
||||
})
|
||||
|
||||
asset.onInitialize(function ()
|
||||
openspace.setPropertyValueSingle('Scene.Apollo11LemModel.Renderable.RotationVector', { 91.044090,171.229706,111.666664} );
|
||||
end)
|
||||
asset_helper.registerSceneGraphNodesAndExport(asset, { Apollo11Lem, Apollo11LemModel })
|
||||
@@ -1,16 +1,16 @@
|
||||
-- The following keyframe data was converted from the_last_four_minutes_2019-06-09.kml,
|
||||
-- which is available at http://apollo.mem-tek.com/GoogleMoonKMZ.html
|
||||
|
||||
-- In the conversion, some assumptions and simplifications were made:
|
||||
-- * The descent markers in the KML have Point nodes expressed "relative to ground"
|
||||
-- We assume that the ground is fixed at altitude 1927.65 meters below the reference ellipsoid,
|
||||
-- in order to match height data from a height map constructed from LRO data.
|
||||
-- * We manually offset the coordiantes slightly, by 0.013496003622691433 degrees in longitude and -0.007472581881668883 degrees in latitude,
|
||||
-- in order to match the landing spot specified at long: 23.47306, lat: 0.67402 extracted from footage from LRO.
|
||||
-- The kml file provided 23.45956399637731, lat: 0.6814925818816688 as the landing coordinates - hence the manual offset.
|
||||
-- If more accurate height/color maps are aqcuired, these values can be adjusted by running the conversion script again.
|
||||
-- For more information, contact emil.axelsson@liu.se.
|
||||
|
||||
--[[
|
||||
In the conversion, some assumptions and simplifications were made:
|
||||
* The descent markers in the KML have Point nodes expressed "relative to ground".
|
||||
We assume that the ground is fixed at altitude 1927.65 meters below the reference ellipsoid,
|
||||
in order to match height data from a height map constructed from LRO data.
|
||||
* We manually offset the coordiantes slightly, by 0.013496003622691433 degrees in longitude and -0.007472581881668883 degrees in latitude,
|
||||
in order to match the landing spot specified at long: 23.47306, lat: 0.67402 extracted from footage from LRO.
|
||||
The kml file provided 23.45956399637731, lat: 0.6814925818816688 as the landing coordinates - hence the manual offset.
|
||||
If more accurate height/color maps are aqcuired, these values can be adjusted by running the conversion script again.
|
||||
]]--
|
||||
|
||||
local keyframes = {
|
||||
['1969-07-20T20:13:40'] = {
|
||||
@@ -1832,4 +1832,3 @@ local keyframes = {
|
||||
};
|
||||
|
||||
asset.export('keyframes', keyframes);
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
--apollo_11_lem_flipbook.asset
|
||||
local helper = asset.require('util/vrt_flipbook_helper')
|
||||
local moon_asset = asset.require('scene/solarsystem/planets/earth/moon/moon')
|
||||
|
||||
local assetPrefix = "A11flip";
|
||||
local assetGlobe = "Moon";
|
||||
local assetGlobe = moon_asset.Moon.Identifier;
|
||||
local flipbookCount = 19;
|
||||
|
||||
local flipbook = nil;
|
||||
@@ -0,0 +1,8 @@
|
||||
local modelFolder = asset.syncedResource({
|
||||
Name = "Apollo Models",
|
||||
Type = "HttpSynchronization",
|
||||
Identifier = "apollo_11_models",
|
||||
Version = 1
|
||||
})
|
||||
|
||||
asset.export('models', modelFolder)
|
||||
115
data/assets/scene/solarsystem/missions/apollo/15/apollo15.asset
Normal file
115
data/assets/scene/solarsystem/missions/apollo/15/apollo15.asset
Normal file
@@ -0,0 +1,115 @@
|
||||
local assetHelper = asset.require('util/asset_helper')
|
||||
local moon_transforms = asset.require('scene/solarsystem/planets/earth/moon/moon')
|
||||
local sun_transforms = asset.require('scene/solarsystem/sun/transforms')
|
||||
local csm = asset.require('../apollo_csm')
|
||||
asset.require('spice/base')
|
||||
|
||||
local kernels = asset.require('scene/solarsystem/missions/apollo/15/kernels').kernels
|
||||
|
||||
|
||||
-- local models = asset.syncedResource({
|
||||
-- Name = "Apollo 15 Models",
|
||||
-- Type = "HttpSynchronization",
|
||||
-- Identifier = "apollo_models",
|
||||
-- Version = 1
|
||||
-- })
|
||||
|
||||
local LightSources = {
|
||||
{
|
||||
Type = "SceneGraphLightSource",
|
||||
Identifier = "Sun",
|
||||
Node = sun_transforms.SolarSystemBarycenter.Identifier,
|
||||
Intensity = 1.0
|
||||
},
|
||||
-- {
|
||||
-- Identifier = "Camera",
|
||||
-- Type = "CameraLightSource",
|
||||
-- Intensity = 0.5,
|
||||
-- Enabled = false
|
||||
-- }
|
||||
}
|
||||
|
||||
|
||||
local Apollo15 = {
|
||||
Identifier = "Apollo15",
|
||||
Parent = moon_transforms.Moon.Identifier,
|
||||
Transform = {
|
||||
Translation = {
|
||||
Type = "SpiceTranslation",
|
||||
Target = "APOLLO 15",
|
||||
Observer = "MOON",
|
||||
Frame = "IAU_MOON",
|
||||
Kernels = kernels
|
||||
},
|
||||
Rotation = {
|
||||
Type = "SpiceRotation",
|
||||
SourceFrame = "A15_METRIC",
|
||||
DestinationFrame = "GALACTIC"
|
||||
}
|
||||
},
|
||||
TimeFrame = {
|
||||
Type = "TimeFrameInterval",
|
||||
Start = "1971-07-30T02:22:00.00",
|
||||
End = "1971-08-01T18:05:00.00"
|
||||
},
|
||||
GUI = {
|
||||
Name = "Apollo 15",
|
||||
Path = "/Solar System/Missions/Apollo/15"
|
||||
}
|
||||
}
|
||||
|
||||
-- local Apollo15Main = {
|
||||
-- Identifier = "Apollo15Main",
|
||||
-- Parent = Apollo15.Identifier,
|
||||
-- Renderable = {
|
||||
-- Type = "RenderableModel",
|
||||
-- Geometry = {
|
||||
-- Type = "MultiModelGeometry",
|
||||
-- -- GeometryFile = models .. "/Apollo_Spacecraft.obj"
|
||||
-- GeometryFile = models .. "/Apollo_CSM_shrunk_rotated_xy_doubble_size.obj"
|
||||
-- },
|
||||
-- ColorTexture = models .. "/gray.png",
|
||||
-- LightSources = LightSources,
|
||||
-- DisableFaceCulling = true
|
||||
-- },
|
||||
-- GUI = {
|
||||
-- Name = "Apollo 15 Main",
|
||||
-- Path = "/Solar System/Missions/Apollo 15"
|
||||
-- }
|
||||
-- }
|
||||
|
||||
local Apollo15Trail = {
|
||||
Identifier = "Apollo15Trail",
|
||||
Parent = moon_transforms.Moon.Identifier,
|
||||
Renderable = {
|
||||
Type = "RenderableTrailTrajectory",
|
||||
Translation = {
|
||||
Type = "SpiceTranslation",
|
||||
Target = "APOLLO 15",
|
||||
Observer = "MOON",
|
||||
Frame = "IAU_MOON",
|
||||
Kernels = kernels
|
||||
},
|
||||
Color = { 0.70, 0.50, 0.20 },
|
||||
StartTime = "1971 JUL 26",
|
||||
EndTime = "1971 AUG 01 14:30:41.680",
|
||||
SampleInterval = 2
|
||||
},
|
||||
GUI = {
|
||||
Name = "Apollo 15 Trail",
|
||||
Path = "/Solar System/Missions/Apollo/15"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
local model_part = csm.createCsmModel(Apollo15.Identifier)
|
||||
|
||||
local list = { Apollo15, Apollo15Trail }
|
||||
for k,v in pairs(model_part) do
|
||||
v.GUI.Path = "/Solar System/Missions/Apollo/15/Model"
|
||||
table.insert(list, v)
|
||||
end
|
||||
|
||||
|
||||
assetHelper.registerSceneGraphNodesAndExport(asset, list)
|
||||
|
||||
@@ -0,0 +1,92 @@
|
||||
local folder = asset.syncedResource({
|
||||
Name = "Apollo Kernels",
|
||||
Type = "HttpSynchronization",
|
||||
Identifier = "apollo_spice",
|
||||
Version = 1
|
||||
})
|
||||
|
||||
local kernels = {
|
||||
folder .. "/apollo15.0001.tsc",
|
||||
|
||||
-- folder .. '/AS15-P_v01.bc',
|
||||
folder .. '/apollo15.0001.tf',
|
||||
folder .. '/apollo15MetricAddendum002.ti',
|
||||
-- folder .. '/apollo15PanoramicAddendum001.ti',
|
||||
folder .. '/apollo15_metric.0002.ti',
|
||||
-- folder .. '/apollo15_panoramic.0001.ti',
|
||||
folder .. '/apollo15-1.bsp',
|
||||
folder .. '/AS15-M_v01.bc',
|
||||
-- folder .. '/AS15-M_v01.bsp',
|
||||
}
|
||||
|
||||
-- local kernels = {
|
||||
-- --sclk
|
||||
-- folder .. "apollo15.0001.tsc",
|
||||
|
||||
-- --pck
|
||||
-- folder .. "moon_080317.tf",
|
||||
-- folder .. "moon_assoc_me.tf",
|
||||
|
||||
-- --ik
|
||||
-- folder .. "apollo15_metric_v2.0001.ti",
|
||||
-- folder .. "apollo15_panoramic.0001.ti",
|
||||
|
||||
-- --tspk
|
||||
-- folder .. "de421.bsp",
|
||||
-- folder .. "moon_pa_de421_1900-2050.bpc",
|
||||
|
||||
-- --iak
|
||||
-- folder .. "apollo15MetricAddendum002.ti",
|
||||
-- folder .. "apolloPanAddendum001.ti",
|
||||
|
||||
-- --fk
|
||||
-- folder .. "apollo15_v2.0001.tf",
|
||||
-- folder .. "apollo15_v2.0002.tf",
|
||||
|
||||
-- --spk
|
||||
-- folder .. "AS15_M_REV23_SMITHED_V01.bsp",
|
||||
-- folder .. "AS15_M_REV4.bsp ",
|
||||
-- folder .. "AS15_M_REV70_SMITHED_V01.bsp",
|
||||
-- folder .. "AS15_M_REV04_v2.bsp ",
|
||||
-- folder .. "AS15_M_REV27_SMITHED_V01.bsp",
|
||||
-- folder .. "AS15_M_REV44_SMITHED_V01.bsp",
|
||||
-- folder .. "AS15_M_REV71_SMITHED_V01.bsp",
|
||||
-- folder .. "AS15_M_REV15_SMITHED_V01.bsp",
|
||||
-- folder .. "AS15_M_REV33_SMITHED_V01.bsp",
|
||||
-- folder .. "AS15_M_REV50_SMITHED_V01.bsp",
|
||||
-- folder .. "AS15_M_REV71_SMITHED_V02.bsp",
|
||||
-- folder .. "AS15_M_REV15_v2.bsp ",
|
||||
-- folder .. "AS15_M_REV34_SMITHED_V01.bsp",
|
||||
-- folder .. "AS15_M_REV60_SMITHED_V01.bsp",
|
||||
-- folder .. "AS15_M_REV72_v2.bsp",
|
||||
-- folder .. "AS15_M_REV16_SMITHED_V01.bsp",
|
||||
-- folder .. "AS15_M_REV35_SMITHED_V02.bsp",
|
||||
-- folder .. "AS15_M_REV62_SMITHED_V01.bsp",
|
||||
-- folder .. "AS15_M_REV22_SMITHED_V01.bsp",
|
||||
-- folder .. "AS15_M_REV38_SMITHED_V01.bsp",
|
||||
-- folder .. "AS15_M_REV63_SMITHED_V01.bsp",
|
||||
|
||||
-- --ck
|
||||
-- folder .. "AS15_M_REV04_SMITHED_V01.bc",
|
||||
-- folder .. "AS15_M_REV15_SMITHED_V01.bc",
|
||||
-- folder .. "AS15_M_REV16_SMITHED_V01.bc",
|
||||
-- folder .. "AS15_M_REV22_SMITHED_V01.bc",
|
||||
-- folder .. "AS15_M_REV23_SMITHED_V01.bc",
|
||||
-- folder .. "AS15_M_REV27_SMITHED_V01.bc",
|
||||
-- folder .. "AS15_M_REV33_SMITHED_V01.bc",
|
||||
-- folder .. "AS15_M_REV34_SMITHED_V01.bc",
|
||||
-- folder .. "AS15_M_REV35_SMITHED_V01.bc",
|
||||
-- folder .. "AS15_M_REV35_SMITHED_V02.bc",
|
||||
-- folder .. "AS15_M_REV38_SMITHED_V01.bc",
|
||||
-- folder .. "AS15_M_REV44_SMITHED_V01.bc",
|
||||
-- folder .. "AS15_M_REV50_SMITHED_V01.bc",
|
||||
-- folder .. "AS15_M_REV60_SMITHED_V01.bc",
|
||||
-- folder .. "AS15_M_REV62_SMITHED_V01.bc",
|
||||
-- folder .. "AS15_M_REV63_SMITHED_V01.bc",
|
||||
-- folder .. "AS15_M_REV70_SMITHED_V01.bc",
|
||||
-- folder .. "AS15_M_REV71_SMITHED_V01.bc",
|
||||
-- folder .. "AS15_M_REV71_SMITHED_V02.bc",
|
||||
-- folder .. "AS15_M_REV72_v2.bc",
|
||||
-- }
|
||||
|
||||
asset.export("kernels", kernels)
|
||||
@@ -0,0 +1,8 @@
|
||||
local models = asset.syncedResource({
|
||||
Name = "Apollo Boulders Models",
|
||||
Type = "HttpSynchronization",
|
||||
Identifier = "apollo_boulders",
|
||||
Version = 1
|
||||
})
|
||||
|
||||
asset.export('models', models)
|
||||
@@ -1,20 +1,13 @@
|
||||
local sunTransforms = asset.require('scene/solarsystem/sun/transforms')
|
||||
local assetHelper = asset.require('util/asset_helper')
|
||||
local earthAsset = asset.require('scene/solarsystem/planets/earth/earth')
|
||||
local moonAsset = asset.require('scene/solarsystem/planets/earth/moon/moon')
|
||||
|
||||
local models = asset.syncedResource({
|
||||
Name = "Apollo Models",
|
||||
Type = "HttpSynchronization",
|
||||
Identifier = "apollo_boulders",
|
||||
Version = 1
|
||||
})
|
||||
local sun_transforms = asset.require('scene/solarsystem/sun/transforms')
|
||||
local asset_helper = asset.require('util/asset_helper')
|
||||
local moon_asset = asset.require('scene/solarsystem/planets/earth/moon/moon')
|
||||
local models = asset.require('./boulder_models').models
|
||||
|
||||
local LightSources = {
|
||||
{
|
||||
Type = "SceneGraphLightSource",
|
||||
Identifier = "Sun",
|
||||
Node = sunTransforms.SolarSystemBarycenter.Identifier,
|
||||
Node = sun_transforms.SolarSystemBarycenter.Identifier,
|
||||
Intensity = 1.0
|
||||
},
|
||||
{
|
||||
@@ -26,11 +19,11 @@ local LightSources = {
|
||||
|
||||
local Station2Boulder1Holder = {
|
||||
Identifier = "Station_2_Boulder1",
|
||||
Parent = moonAsset.Moon.Identifier,
|
||||
Parent = moon_asset.Moon.Identifier,
|
||||
Transform = {
|
||||
Translation = {
|
||||
Type = "GlobeTranslation",
|
||||
Globe = moonAsset.Moon.Identifier,
|
||||
Globe = moon_asset.Moon.Identifier,
|
||||
Longitude = -360+30.5294692,
|
||||
Latitude = 20.098824,
|
||||
Altitude = -2442.8,
|
||||
@@ -58,6 +51,7 @@ local Station2Boulder1Model = {
|
||||
Type = "MultiModelGeometry",
|
||||
GeometryFile = models .. "/b1-v2.obj"
|
||||
},
|
||||
RotationVector = { 243.243256 ,206.270264, 309.677429 },
|
||||
ColorTexture = models .. "/b1-v2_u1_v1.jpeg",
|
||||
LightSources = LightSources,
|
||||
PerformShading = false,
|
||||
@@ -71,11 +65,11 @@ local Station2Boulder1Model = {
|
||||
|
||||
local Station2Boulder2Holder = {
|
||||
Identifier = "Station_2_Boulder2",
|
||||
Parent = moonAsset.Moon.Identifier,
|
||||
Parent = moon_asset.Moon.Identifier,
|
||||
Transform = {
|
||||
Translation = {
|
||||
Type = "GlobeTranslation",
|
||||
Globe = moonAsset.Moon.Identifier,
|
||||
Globe = moon_asset.Moon.Identifier,
|
||||
Longitude = -360+30.5287892,
|
||||
Latitude = 20.098240,
|
||||
Altitude = -2434.6,
|
||||
@@ -103,6 +97,7 @@ local Station2Boulder2Model = {
|
||||
Type = "MultiModelGeometry",
|
||||
GeometryFile = models .. "/b2model.obj"
|
||||
},
|
||||
RotationVector = { 66.162155, 7.783780, 114.193550 },
|
||||
ColorTexture = models .. "/b2model_u1_v1.jpeg",
|
||||
LightSources = LightSources,
|
||||
PerformShading = false,
|
||||
@@ -116,11 +111,11 @@ local Station2Boulder2Model = {
|
||||
|
||||
local Station2Boulder3Holder = {
|
||||
Identifier = "Station_2_Boulder3",
|
||||
Parent = moonAsset.Moon.Identifier,
|
||||
Parent = moon_asset.Moon.Identifier,
|
||||
Transform = {
|
||||
Translation = {
|
||||
Type = "GlobeTranslation",
|
||||
Globe = moonAsset.Moon.Identifier,
|
||||
Globe = moon_asset.Moon.Identifier,
|
||||
Longitude = -360+30.5294692,
|
||||
Latitude = 20.098610,
|
||||
Altitude = -2441.55,
|
||||
@@ -148,6 +143,7 @@ local Station2Boulder3Model = {
|
||||
Type = "MultiModelGeometry",
|
||||
GeometryFile = models .. "/b3model.obj"
|
||||
},
|
||||
RotationVector = { 161.513519 ,243.243256, 65.806450 },
|
||||
ColorTexture = models .. "/b3model_u1_v1.jpeg",
|
||||
LightSources = LightSources,
|
||||
PerformShading = false,
|
||||
@@ -159,25 +155,8 @@ local Station2Boulder3Model = {
|
||||
}
|
||||
}
|
||||
|
||||
assetHelper.registerSceneGraphNodesAndExport(asset, {
|
||||
asset_helper.registerSceneGraphNodesAndExport(asset, {
|
||||
Station2Boulder1Holder, Station2Boulder1Model,
|
||||
Station2Boulder2Holder, Station2Boulder2Model,
|
||||
Station2Boulder3Holder, Station2Boulder3Model
|
||||
})
|
||||
|
||||
asset.onInitialize(function ()
|
||||
openspace.setPropertyValueSingle(
|
||||
'Scene.Station2Boulder1Model.Renderable.RotationVector',
|
||||
{ 243.243256 ,206.270264, 309.677429 }
|
||||
);
|
||||
|
||||
openspace.setPropertyValueSingle(
|
||||
'Scene.Station2Boulder3Model.Renderable.RotationVector',
|
||||
{ 161.513519 ,243.243256, 65.806450 }
|
||||
);
|
||||
|
||||
openspace.setPropertyValueSingle(
|
||||
'Scene.Station2Boulder2Model.Renderable.RotationVector',
|
||||
{ 66.162155, 7.783780, 114.193550 }
|
||||
);
|
||||
end)
|
||||
@@ -1,20 +1,13 @@
|
||||
|
||||
local sunTransforms = asset.require('scene/solarsystem/sun/transforms')
|
||||
local assetHelper = asset.require('util/asset_helper')
|
||||
|
||||
local models = asset.syncedResource({
|
||||
Name = "Apollo Models",
|
||||
Type = "HttpSynchronization",
|
||||
Identifier = "apollo_boulders",
|
||||
Version = 1
|
||||
})
|
||||
|
||||
local sun_transforms = asset.require('scene/solarsystem/sun/transforms')
|
||||
local asset_helper = asset.require('util/asset_helper')
|
||||
local moon_asset = asset.require('scene/solarsystem/planets/earth/moon/moon')
|
||||
local models = asset.require('./boulder_models').models
|
||||
|
||||
local LightSources = {
|
||||
{
|
||||
Type = "SceneGraphLightSource",
|
||||
Identifier = "Sun",
|
||||
Node = sunTransforms.SolarSystemBarycenter.Identifier,
|
||||
Node = sun_transforms.SolarSystemBarycenter.Identifier,
|
||||
Intensity = 1.0
|
||||
},
|
||||
{
|
||||
@@ -24,17 +17,14 @@ local LightSources = {
|
||||
}
|
||||
}
|
||||
|
||||
local earthAsset = asset.require('scene/solarsystem/planets/earth/earth')
|
||||
local moonAsset = asset.require('scene/solarsystem/planets/earth/moon/moon')
|
||||
|
||||
|
||||
local Station6Frag1Holder = {
|
||||
Identifier = "Station_6_Fragment1",
|
||||
Parent = moonAsset.Moon.Identifier,
|
||||
Parent = moon_asset.Moon.Identifier,
|
||||
Transform = {
|
||||
Translation = {
|
||||
Type = "GlobeTranslation",
|
||||
Globe = moonAsset.Moon.Identifier,
|
||||
Globe = moon_asset.Moon.Identifier,
|
||||
Longitude = -360+30.80068,
|
||||
Latitude = 20.2903,
|
||||
Altitude = -2562.6,
|
||||
@@ -53,7 +43,7 @@ local Station6Frag1Model = {
|
||||
Transform = {
|
||||
Translation = {
|
||||
Type = "GlobeTranslation",
|
||||
Globe = moonAsset.Moon.Identifier,
|
||||
Globe = moon_asset.Moon.Identifier,
|
||||
Longitude = -360+30.8007,
|
||||
Latitude = 20.2903,
|
||||
Altitude = -2562.6,
|
||||
@@ -72,6 +62,7 @@ local Station6Frag1Model = {
|
||||
Type = "MultiModelGeometry",
|
||||
GeometryFile = models .. "/A17-S6-frag1.obj"
|
||||
},
|
||||
RotationVector = { 235.909088,165.000000,286.299194 },
|
||||
ColorTexture = models .. "/A17-S6-frag1.png",
|
||||
LightSources = LightSources,
|
||||
PerformShading = false,
|
||||
@@ -87,7 +78,7 @@ local Station6Frag1Model = {
|
||||
|
||||
local Station6Frag23Holder = {
|
||||
Identifier = "Station_6_Fragments_2_3",
|
||||
Parent = moonAsset.Moon.Identifier,
|
||||
Parent = moon_asset.Moon.Identifier,
|
||||
GUI = {
|
||||
Name = "Station 6 Fragments 2 & 3 Holder",
|
||||
Path = "/Solar System/Missions/Apollo/17/Station 6"
|
||||
@@ -105,7 +96,7 @@ local Station6Frag2Model = {
|
||||
},
|
||||
Translation = {
|
||||
Type = "GlobeTranslation",
|
||||
Globe = moonAsset.Moon.Identifier,
|
||||
Globe = moon_asset.Moon.Identifier,
|
||||
Longitude = -360+30.80055,
|
||||
Latitude = 20.289808,
|
||||
Altitude = -2566.5,
|
||||
@@ -118,6 +109,7 @@ local Station6Frag2Model = {
|
||||
Type = "MultiModelGeometry",
|
||||
GeometryFile = models .. "/station6_boulder_frag2.obj"
|
||||
},
|
||||
RotationVector = { 336.959991,210.239990,325.984253 },
|
||||
ColorTexture = models .. "/frag2crop_u1_v1.jpeg",
|
||||
LightSources = LightSources,
|
||||
PerformShading = false,
|
||||
@@ -129,8 +121,6 @@ local Station6Frag2Model = {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
local Station6Frag3Model = {
|
||||
Identifier = "A17S6F3",
|
||||
Parent = Station6Frag23Holder.Identifier,
|
||||
@@ -141,7 +131,7 @@ local Station6Frag3Model = {
|
||||
},
|
||||
Translation = {
|
||||
Type = "GlobeTranslation",
|
||||
Globe = moonAsset.Moon.Identifier,
|
||||
Globe = moon_asset.Moon.Identifier,
|
||||
Longitude = -360+30.80053,
|
||||
Latitude = 20.29030,
|
||||
Altitude = -2563.0,
|
||||
@@ -154,6 +144,7 @@ local Station6Frag3Model = {
|
||||
Type = "MultiModelGeometry",
|
||||
GeometryFile = models .. "/station6_boulder_frag3.obj"
|
||||
},
|
||||
RotationVector = { 293.181824,255.000000,4.090910 },
|
||||
ColorTexture = models .. "/frag3crop_u1_v1.jpeg",
|
||||
LightSources = LightSources,
|
||||
PerformShading = false,
|
||||
@@ -165,22 +156,6 @@ local Station6Frag3Model = {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
assetHelper.registerSceneGraphNodesAndExport(asset, {
|
||||
asset_helper.registerSceneGraphNodesAndExport(asset, {
|
||||
Station6Frag1Holder, Station6Frag1Model, Station6Frag23Holder, Station6Frag2Model, Station6Frag3Model,
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
asset.onInitialize(function ()
|
||||
|
||||
openspace.setPropertyValueSingle('Scene.Station6Frag1Model.Renderable.RotationVector', {235.909088,165.000000,286.299194});
|
||||
openspace.setPropertyValueSingle('Scene.A17S6F5.Renderable.RotationVector', {336.959991,210.239990,325.984253});
|
||||
openspace.setPropertyValueSingle('Scene.A17S6F3.Renderable.RotationVector', {293.181824,255.000000,4.090910});
|
||||
openspace.setPropertyValueSingle('Scene.Station6Frag1Model.Renderable.PerformShading', false);
|
||||
openspace.setPropertyValueSingle("NavigationHandler.OrbitalNavigator.MinimumAllowedDistance", 0.050000)
|
||||
|
||||
end)
|
||||
@@ -1,19 +1,13 @@
|
||||
|
||||
local sunTransforms = asset.require('scene/solarsystem/sun/transforms')
|
||||
local assetHelper = asset.require('util/asset_helper')
|
||||
|
||||
local models = asset.syncedResource({
|
||||
Name = "Apollo Models",
|
||||
Type = "HttpSynchronization",
|
||||
Identifier = "apollo_boulders",
|
||||
Version = 1
|
||||
})
|
||||
local sun_transforms = asset.require('scene/solarsystem/sun/transforms')
|
||||
local asset_helper = asset.require('util/asset_helper')
|
||||
local moon_asset = asset.require('scene/solarsystem/planets/earth/moon/moon')
|
||||
local models = asset.require('./boulder_models').models
|
||||
|
||||
local LightSources = {
|
||||
{
|
||||
Type = "SceneGraphLightSource",
|
||||
Identifier = "Sun",
|
||||
Node = sunTransforms.SolarSystemBarycenter.Identifier,
|
||||
Node = sun_transforms.SolarSystemBarycenter.Identifier,
|
||||
Intensity = 1.0
|
||||
},
|
||||
{
|
||||
@@ -23,15 +17,13 @@ local LightSources = {
|
||||
}
|
||||
}
|
||||
|
||||
local moonAsset = asset.require('scene/solarsystem/planets/earth/moon/moon')
|
||||
|
||||
local Station7BoulderHolder = {
|
||||
Identifier = "Station_7_Boulder",
|
||||
Parent = moonAsset.Moon.Identifier,
|
||||
Parent = moon_asset.Moon.Identifier,
|
||||
Transform = {
|
||||
Translation = {
|
||||
Type = "GlobeTranslation",
|
||||
Globe = moonAsset.Moon.Identifier,
|
||||
Globe = moon_asset.Moon.Identifier,
|
||||
Longitude = -360+30.8165882,
|
||||
Latitude = 20.2908556,
|
||||
Altitude = -2593.5,
|
||||
@@ -59,6 +51,7 @@ local Station7BoulderModel = {
|
||||
Type = "MultiModelGeometry",
|
||||
GeometryFile = models .. "/b7model.obj"
|
||||
},
|
||||
RotationVector = { 1.945950,274.378387,212.903214 },
|
||||
ColorTexture = models .. "/b7model_u1_v1.jpeg",
|
||||
LightSources = LightSources,
|
||||
PerformShading = false,
|
||||
@@ -70,11 +63,6 @@ local Station7BoulderModel = {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
assetHelper.registerSceneGraphNodesAndExport(asset, {
|
||||
asset_helper.registerSceneGraphNodesAndExport(asset, {
|
||||
Station7BoulderHolder, Station7BoulderModel
|
||||
})
|
||||
|
||||
asset.onInitialize(function ()
|
||||
openspace.setPropertyValueSingle('Scene.Station7BoulderModel.Renderable.RotationVector', {1.945950,274.378387,212.903214});
|
||||
end)
|
||||
@@ -1,17 +1,16 @@
|
||||
--a17_lem.asset
|
||||
local assetHelper = asset.require('util/asset_helper')
|
||||
local sunTransforms = asset.require('scene/solarsystem/sun/transforms')
|
||||
local moonAsset = asset.require('scene/solarsystem/planets/earth/moon/moon')
|
||||
local asset_helper = asset.require('util/asset_helper')
|
||||
local sun_transforms = asset.require('scene/solarsystem/sun/transforms')
|
||||
local moon_asset = asset.require('scene/solarsystem/planets/earth/moon/moon')
|
||||
|
||||
local model = asset.require('scene/solarsystem/missions/apollo/lem_model')
|
||||
|
||||
local Apollo17Lem = {
|
||||
Identifier = "Apollo17Lem",
|
||||
Parent = moonAsset.Moon.Identifier,
|
||||
Parent = moon_asset.Moon.Identifier,
|
||||
Transform = {
|
||||
Translation = {
|
||||
Type = "GlobeTranslation",
|
||||
Globe = moonAsset.Moon.Identifier,
|
||||
Globe = moon_asset.Moon.Identifier,
|
||||
Longitude = -329.22833,
|
||||
Latitude = 20.19092,
|
||||
UseHeightmap = true
|
||||
@@ -40,21 +39,14 @@ local Apollo17LemModel = {
|
||||
GeometryFile = model.modelFolder .. "/LM-2_ver2clean.obj"
|
||||
},
|
||||
SpecularIntensity = 0.0,
|
||||
RotationVector = { 110.255219,171.229706,126.666664 },
|
||||
ColorTexture = model.modelFolder .. "/LM-2_ver2clean_u1_v1.jpeg",
|
||||
LightSources = assetHelper.getDefaultLightSources(sunTransforms.SolarSystemBarycenter.Identifier)
|
||||
LightSources = asset_helper.getDefaultLightSources(sun_transforms.SolarSystemBarycenter.Identifier)
|
||||
},
|
||||
GUI = {
|
||||
Hidden = false,
|
||||
Name = "Apollo 17 Lem",
|
||||
Path = "/Solar System/Missions/Apollo/17"
|
||||
}
|
||||
}
|
||||
|
||||
assetHelper.registerSceneGraphNodesAndExport(asset, {
|
||||
Apollo17Lem,
|
||||
Apollo17LemModel,
|
||||
})
|
||||
|
||||
asset.onInitialize(function ()
|
||||
openspace.setPropertyValueSingle('Scene.Apollo17LemModel.Renderable.RotationVector', { 110.255219,171.229706,126.666664 });
|
||||
end)
|
||||
asset_helper.registerSceneGraphNodesAndExport(asset, { Apollo17Lem, Apollo17LemModel })
|
||||
@@ -0,0 +1,3 @@
|
||||
asset.require('./model')
|
||||
asset.require('./launch_model')
|
||||
asset.require('./trails')
|
||||
@@ -0,0 +1,17 @@
|
||||
local kernelsFolder = asset.syncedResource({
|
||||
Name = "Apollo Kernels",
|
||||
Type = "HttpSynchronization",
|
||||
Identifier = "apollo_spice",
|
||||
Version = 1
|
||||
})
|
||||
|
||||
local kernels = {
|
||||
kernelsFolder .. "/moon_080317.tf",
|
||||
kernelsFolder .. "/apollo8.tf",
|
||||
kernelsFolder .. "/moon_pa_de421_1900-2050.bpc",
|
||||
kernelsFolder .. '/apollo8.tsc',
|
||||
kernelsFolder .. '/apollo8.bsp',
|
||||
kernelsFolder .. '/apollo8_earthrise.bc',
|
||||
}
|
||||
|
||||
asset.export('kernels', kernels)
|
||||
@@ -0,0 +1,65 @@
|
||||
local asset_helper = asset.require('util/asset_helper')
|
||||
local earth_transforms = asset.require('scene/solarsystem/planets/earth/transforms')
|
||||
local kernels = asset.require('./kernels').kernels
|
||||
local csm = asset.require('../apollo_csm')
|
||||
|
||||
local apolloSpiceId = "-908"
|
||||
|
||||
local Apollo8Launch = {
|
||||
Identifier = "Apollo8Launch",
|
||||
Parent = earth_transforms.EarthIAU.Identifier,
|
||||
TimeFrame = {
|
||||
Type = "TimeFrameInterval",
|
||||
Start = "1968 DEC 21",
|
||||
End = "1968 DEC 28"
|
||||
},
|
||||
Transform = {
|
||||
Translation = {
|
||||
Type = "SpiceTranslation",
|
||||
Target = apolloSpiceId,
|
||||
Observer = "EARTH",
|
||||
Frame = "IAU_EARTH",
|
||||
Kernels = kernels
|
||||
},
|
||||
},
|
||||
GUI = {
|
||||
Name = "Apollo 8 Launch Capsule",
|
||||
Path = "/Solar System/Missions/Apollo"
|
||||
}
|
||||
}
|
||||
|
||||
local Apollo8LaunchModel = {
|
||||
Identifier = "Apollo8LaunchModel",
|
||||
Parent = Apollo8Launch.Identifier,
|
||||
TimeFrame = {
|
||||
Type = "TimeFrameInterval",
|
||||
Start = "1968 DEC 21",
|
||||
End = "1968 DEC 22"
|
||||
},
|
||||
Transform = {
|
||||
Scale = {
|
||||
Type = "StaticScale",
|
||||
-- The scale of the model is in cm; OpenSpace is in m
|
||||
Scale = 0.01
|
||||
},
|
||||
Rotation = {
|
||||
Type = "StaticRotation",
|
||||
Rotation = {0.0, 0.0, -3.1415 / 2}
|
||||
}
|
||||
},
|
||||
GUI = {
|
||||
Hidden = true,
|
||||
Name = "Apollo 8 Launch Model",
|
||||
Path = "/Solar System/Missions/Apollo/8"
|
||||
}
|
||||
}
|
||||
|
||||
local launch_model_part = csm.createCsmModel(Apollo8LaunchModel.Identifier)
|
||||
|
||||
local list = { Apollo8Launch, Apollo8LaunchModel }
|
||||
for k,v in pairs(launch_model_part) do
|
||||
v.GUI.Path = "/Solar System/Missions/Apollo/8/Model"
|
||||
table.insert(list, v)
|
||||
end
|
||||
|
||||
asset_helper.registerSceneGraphNodesAndExport(asset, list)
|
||||
93
data/assets/scene/solarsystem/missions/apollo/8/model.asset
Normal file
93
data/assets/scene/solarsystem/missions/apollo/8/model.asset
Normal file
@@ -0,0 +1,93 @@
|
||||
local asset_helper = asset.require('util/asset_helper')
|
||||
local earth_transforms = asset.require('scene/solarsystem/planets/earth/transforms')
|
||||
local kernels = asset.require('./kernels').kernels
|
||||
local csm = asset.require('../apollo_csm')
|
||||
|
||||
local apolloSpiceId = "-908"
|
||||
|
||||
local Apollo8 = {
|
||||
Identifier = "Apollo8",
|
||||
Parent = earth_transforms.EarthBarycenter.Identifier,
|
||||
TimeFrame = {
|
||||
Type = "TimeFrameInterval",
|
||||
Start = "1968 DEC 21",
|
||||
End = "1968 DEC 28"
|
||||
},
|
||||
Transform = {
|
||||
Translation = {
|
||||
Type = "SpiceTranslation",
|
||||
Target = apolloSpiceId,
|
||||
Observer = "EARTH BARYCENTER",
|
||||
Frame = "GALACTIC",
|
||||
Kernels = kernels
|
||||
},
|
||||
Rotation = {
|
||||
Type = "SpiceRotation",
|
||||
SourceFrame = "A8_EARTHRISE",
|
||||
DestinationFrame = "GALACTIC",
|
||||
TimeFrame = {
|
||||
-- The orientation of Apollo 8 is only available during the few minutes
|
||||
-- when the Earthrise picture was taken.
|
||||
Type = "TimeFrameInterval",
|
||||
Start = "1968 DEC 24 16:37:19",
|
||||
End = "1968 DEC 24 16:40:15"
|
||||
}
|
||||
}
|
||||
},
|
||||
GUI = {
|
||||
Name = "Apollo 8",
|
||||
Path = "/Solar System/Missions/Apollo"
|
||||
}
|
||||
}
|
||||
|
||||
local Apollo8Model = {
|
||||
Identifier = "Apollo8Model",
|
||||
Parent = Apollo8.Identifier,
|
||||
TimeFrame = {
|
||||
Type = "TimeFrameInterval",
|
||||
Start = "1968 DEC 22",
|
||||
End = "1968 DEC 28"
|
||||
},
|
||||
Transform = {
|
||||
Scale = {
|
||||
Type = "StaticScale",
|
||||
-- The scale of the model is in cm; OpenSpace is in m
|
||||
Scale = 0.01
|
||||
},
|
||||
Rotation = {
|
||||
Type = "StaticRotation",
|
||||
Rotation = {0.0, 0.0, -3.1415 / 2}
|
||||
}
|
||||
},
|
||||
GUI = {
|
||||
Hidden = true,
|
||||
Name = "Apollo 8 Model",
|
||||
Path = "/Solar System/Missions/Apollo"
|
||||
}
|
||||
}
|
||||
|
||||
-- The pivot node is used for navigation inside the spacecraft
|
||||
local Apollo8Pivot = {
|
||||
Identifier = "Apollo8Pivot",
|
||||
Parent = Apollo8.Identifier,
|
||||
Transform = {
|
||||
Translation = {
|
||||
Type = "StaticTranslation",
|
||||
Position = { 0, 2.5, 0 }
|
||||
},
|
||||
},
|
||||
GUI = {
|
||||
Name = "Apollo 8 Pivot",
|
||||
Path = "/Solar System/Missions/Apollo"
|
||||
}
|
||||
}
|
||||
|
||||
local model_part = csm.createCsmModel(Apollo8Model.Identifier)
|
||||
|
||||
local list = { Apollo8, Apollo8Model, Apollo8Pivot }
|
||||
for k,v in pairs(model_part) do
|
||||
v.GUI.Path = "/Solar System/Missions/Apollo/8/Model"
|
||||
table.insert(list, v)
|
||||
end
|
||||
|
||||
asset_helper.registerSceneGraphNodesAndExport(asset, list)
|
||||
81
data/assets/scene/solarsystem/missions/apollo/8/trails.asset
Normal file
81
data/assets/scene/solarsystem/missions/apollo/8/trails.asset
Normal file
@@ -0,0 +1,81 @@
|
||||
local assetHelper = asset.require('util/asset_helper')
|
||||
|
||||
local earth_transforms = asset.require('scene/solarsystem/planets/earth/transforms')
|
||||
local moon_transforms = asset.require('scene/solarsystem/planets/earth/moon/moon')
|
||||
local kernels = asset.require('./kernels').kernels
|
||||
|
||||
local apolloSpiceId = "-908"
|
||||
|
||||
|
||||
local LaunchTrail = {
|
||||
Identifier = "Apollo8LaunchTrail",
|
||||
Parent = earth_transforms.EarthIAU.Identifier,
|
||||
Renderable = {
|
||||
Type = "RenderableTrailTrajectory",
|
||||
Translation = {
|
||||
Type = "SpiceTranslation",
|
||||
Target = apolloSpiceId,
|
||||
Observer = "EARTH",
|
||||
Frame = "IAU_EARTH",
|
||||
Kernels = kernels
|
||||
},
|
||||
Color = { 0.70, 0.50, 0.20 },
|
||||
StartTime = "1968 DEC 21 12:51:00",
|
||||
EndTime = "1968 DEC 21 23:23:22",
|
||||
SampleInterval = 30
|
||||
},
|
||||
GUI = {
|
||||
Name = "Apollo 8 Launch Trail",
|
||||
Path = "/Solar System/Missions/Apollo"
|
||||
}
|
||||
}
|
||||
|
||||
local MoonTrail = {
|
||||
Identifier = "Apollo8MoonTrail",
|
||||
Parent = moon_transforms.Moon.Identifier,
|
||||
Renderable = {
|
||||
Type = "RenderableTrailTrajectory",
|
||||
Translation = {
|
||||
Type = "SpiceTranslation",
|
||||
Target = apolloSpiceId,
|
||||
Observer = "MOON",
|
||||
Frame = "IAU_MOON",
|
||||
Kernels = kernels
|
||||
},
|
||||
Color = { 0.70, 0.50, 0.20 },
|
||||
StartTime = "1968 DEC 23",
|
||||
EndTime = "1968 DEC 26",
|
||||
SampleInterval = 30,
|
||||
Enabled = false,
|
||||
},
|
||||
GUI = {
|
||||
Name = "Apollo 8 Moon Trail",
|
||||
Path = "/Solar System/Missions/Apollo"
|
||||
}
|
||||
}
|
||||
|
||||
local EarthBarycenterTrail = {
|
||||
Identifier = "Apollo8EarthBarycenterTrail",
|
||||
Parent = earth_transforms.EarthCenter.Identifier,
|
||||
Renderable = {
|
||||
Type = "RenderableTrailTrajectory",
|
||||
Translation = {
|
||||
Type = "SpiceTranslation",
|
||||
Target = apolloSpiceId,
|
||||
Observer = "EARTH",
|
||||
Frame = "GALACTIC",
|
||||
Kernels = kernels
|
||||
},
|
||||
Color = { 0.8, 0.2, 0.2 },
|
||||
StartTime = "1968 DEC 21",
|
||||
EndTime = "1968 DEC 28",
|
||||
SampleInterval = 30,
|
||||
Enabled = true,
|
||||
},
|
||||
GUI = {
|
||||
Name = "Apollo 8 Earth Barycenter Trail",
|
||||
Path = "/Solar System/Missions/Apollo"
|
||||
}
|
||||
}
|
||||
|
||||
assetHelper.registerSceneGraphNodesAndExport(asset, { LaunchTrail, MoonTrail, EarthBarycenterTrail })
|
||||
@@ -1,203 +0,0 @@
|
||||
local assetHelper = asset.require('util/asset_helper')
|
||||
local sunTransforms = asset.require('scene/solarsystem/sun/transforms')
|
||||
asset.require('spice/base')
|
||||
|
||||
--asset.require('scene/solarsystem/missions/apollo/a15kernels')
|
||||
|
||||
|
||||
local models = asset.syncedResource({
|
||||
Name = "Apollo 15 Models",
|
||||
Type = "HttpSynchronization",
|
||||
Identifier = "apollo_models",
|
||||
Version = 1
|
||||
})
|
||||
|
||||
local kernels = asset.syncedResource({
|
||||
Name = "Apollo Kernels",
|
||||
Type = "HttpSynchronization",
|
||||
Identifier = "apollo_spice",
|
||||
Version = 1
|
||||
})
|
||||
|
||||
local Kernels = {
|
||||
kernels .. "/apollo15.0001.tsc",
|
||||
|
||||
-- kernels .. '/AS15-P_v01.bc',
|
||||
kernels .. '/apollo15.0001.tf',
|
||||
kernels .. '/apollo15MetricAddendum002.ti',
|
||||
-- kernels .. '/apollo15PanoramicAddendum001.ti',
|
||||
kernels .. '/apollo15_metric.0002.ti',
|
||||
-- kernels .. '/apollo15_panoramic.0001.ti',
|
||||
kernels .. '/apollo15-1.bsp',
|
||||
kernels .. '/AS15-M_v01.bc',
|
||||
-- kernels .. '/AS15-M_v01.bsp',
|
||||
}
|
||||
|
||||
|
||||
|
||||
-- local Apollo15Kernels = {
|
||||
-- --sclk
|
||||
-- ApolloKernels .. "/apollo15.0001.tsc",
|
||||
|
||||
-- --pck
|
||||
-- ApolloKernels .. "/moon_080317.tf",
|
||||
-- ApolloKernels .. "/moon_assoc_me.tf",
|
||||
|
||||
-- --ik
|
||||
-- ApolloKernels .. "/apollo15_metric_v2.0001.ti",
|
||||
-- ApolloKernels .. "/apollo15_panoramic.0001.ti",
|
||||
|
||||
-- --tspk
|
||||
-- ApolloKernels .. "/de421.bsp",
|
||||
-- ApolloKernels .. "/moon_pa_de421_1900-2050.bpc",
|
||||
|
||||
-- --iak
|
||||
-- ApolloKernels .. "/apollo15MetricAddendum002.ti",
|
||||
-- ApolloKernels .. "/apolloPanAddendum001.ti",
|
||||
|
||||
-- --fk
|
||||
-- ApolloKernels .. "/apollo15_v2.0001.tf",
|
||||
-- ApolloKernels .. "/apollo15_v2.0002.tf",
|
||||
|
||||
-- --spk
|
||||
-- ApolloKernels .. "/AS15_M_REV23_SMITHED_V01.bsp",
|
||||
-- ApolloKernels .. "/AS15_M_REV4.bsp ",
|
||||
-- ApolloKernels .. "/AS15_M_REV70_SMITHED_V01.bsp",
|
||||
-- ApolloKernels .. "/AS15_M_REV04_v2.bsp ",
|
||||
-- ApolloKernels .. "/AS15_M_REV27_SMITHED_V01.bsp",
|
||||
-- ApolloKernels .. "/AS15_M_REV44_SMITHED_V01.bsp",
|
||||
-- ApolloKernels .. "/AS15_M_REV71_SMITHED_V01.bsp",
|
||||
-- ApolloKernels .. "/AS15_M_REV15_SMITHED_V01.bsp",
|
||||
-- ApolloKernels .. "/AS15_M_REV33_SMITHED_V01.bsp",
|
||||
-- ApolloKernels .. "/AS15_M_REV50_SMITHED_V01.bsp",
|
||||
-- ApolloKernels .. "/AS15_M_REV71_SMITHED_V02.bsp",
|
||||
-- ApolloKernels .. "/AS15_M_REV15_v2.bsp ",
|
||||
-- ApolloKernels .. "/AS15_M_REV34_SMITHED_V01.bsp",
|
||||
-- ApolloKernels .. "/AS15_M_REV60_SMITHED_V01.bsp",
|
||||
-- ApolloKernels .. "/AS15_M_REV72_v2.bsp",
|
||||
-- ApolloKernels .. "/AS15_M_REV16_SMITHED_V01.bsp",
|
||||
-- ApolloKernels .. "/AS15_M_REV35_SMITHED_V02.bsp",
|
||||
-- ApolloKernels .. "/AS15_M_REV62_SMITHED_V01.bsp",
|
||||
-- ApolloKernels .. "/AS15_M_REV22_SMITHED_V01.bsp",
|
||||
-- ApolloKernels .. "/AS15_M_REV38_SMITHED_V01.bsp",
|
||||
-- ApolloKernels .. "/AS15_M_REV63_SMITHED_V01.bsp",
|
||||
|
||||
-- --ck
|
||||
-- ApolloKernels .. "/AS15_M_REV04_SMITHED_V01.bc",
|
||||
-- ApolloKernels .. "/AS15_M_REV15_SMITHED_V01.bc",
|
||||
-- ApolloKernels .. "/AS15_M_REV16_SMITHED_V01.bc",
|
||||
-- ApolloKernels .. "/AS15_M_REV22_SMITHED_V01.bc",
|
||||
-- ApolloKernels .. "/AS15_M_REV23_SMITHED_V01.bc",
|
||||
-- ApolloKernels .. "/AS15_M_REV27_SMITHED_V01.bc",
|
||||
-- ApolloKernels .. "/AS15_M_REV33_SMITHED_V01.bc",
|
||||
-- ApolloKernels .. "/AS15_M_REV34_SMITHED_V01.bc",
|
||||
-- ApolloKernels .. "/AS15_M_REV35_SMITHED_V01.bc",
|
||||
-- ApolloKernels .. "/AS15_M_REV35_SMITHED_V02.bc",
|
||||
-- ApolloKernels .. "/AS15_M_REV38_SMITHED_V01.bc",
|
||||
-- ApolloKernels .. "/AS15_M_REV44_SMITHED_V01.bc",
|
||||
-- ApolloKernels .. "/AS15_M_REV50_SMITHED_V01.bc",
|
||||
-- ApolloKernels .. "/AS15_M_REV60_SMITHED_V01.bc",
|
||||
-- ApolloKernels .. "/AS15_M_REV62_SMITHED_V01.bc",
|
||||
-- ApolloKernels .. "/AS15_M_REV63_SMITHED_V01.bc",
|
||||
-- ApolloKernels .. "/AS15_M_REV70_SMITHED_V01.bc",
|
||||
-- ApolloKernels .. "/AS15_M_REV71_SMITHED_V01.bc",
|
||||
-- ApolloKernels .. "/AS15_M_REV71_SMITHED_V02.bc",
|
||||
-- ApolloKernels .. "/AS15_M_REV72_v2.bc",
|
||||
-- }
|
||||
|
||||
|
||||
|
||||
|
||||
local LightSources = {
|
||||
{
|
||||
Type = "SceneGraphLightSource",
|
||||
Identifier = "Sun",
|
||||
Node = sunTransforms.SolarSystemBarycenter.Identifier,
|
||||
Intensity = 1.0
|
||||
},
|
||||
-- {
|
||||
-- Identifier = "Camera",
|
||||
-- Type = "CameraLightSource",
|
||||
-- Intensity = 0.5,
|
||||
-- Enabled = false
|
||||
-- }
|
||||
}
|
||||
|
||||
|
||||
local Apollo15 = {
|
||||
Identifier = "Apollo15",
|
||||
Parent = "Moon",
|
||||
Transform = {
|
||||
Translation = {
|
||||
Type = "SpiceTranslation",
|
||||
Target = "APOLLO 15",
|
||||
Observer = "MOON",
|
||||
Frame = "IAU_MOON",
|
||||
Kernels = Kernels
|
||||
},
|
||||
Rotation = {
|
||||
Type = "SpiceRotation",
|
||||
SourceFrame = "A15_METRIC",
|
||||
DestinationFrame = "GALACTIC"
|
||||
}
|
||||
},
|
||||
TimeFrame = { -- Using Spice kernels for 1850-2150
|
||||
Type = "TimeFrameInterval",
|
||||
Start = "1971-07-30T02:22:00.00",
|
||||
End = "1971-08-01T18:05:00.00"
|
||||
},
|
||||
GUI = {
|
||||
Name = "Apollo 15",
|
||||
Path = "/Solar System/Missions/Apollo 15"
|
||||
}
|
||||
}
|
||||
|
||||
local Apollo15Main = {
|
||||
Identifier = "Apollo15Main",
|
||||
Parent = Apollo15.Identifier,
|
||||
Renderable = {
|
||||
Type = "RenderableModel",
|
||||
Geometry = {
|
||||
Type = "MultiModelGeometry",
|
||||
-- GeometryFile = models .. "/Apollo_Spacecraft.obj"
|
||||
GeometryFile = models .. "/Apollo_CSM_shrunk_rotated_xy_doubble_size.obj"
|
||||
},
|
||||
ColorTexture = models .. "/gray.png",
|
||||
LightSources = LightSources,
|
||||
DisableFaceCulling = true
|
||||
},
|
||||
GUI = {
|
||||
Name = "Apollo 15 Main",
|
||||
Path = "/Solar System/Missions/Apollo 15"
|
||||
}
|
||||
}
|
||||
|
||||
local Apollo15Trail = {
|
||||
Identifier = "Apollo15Trail",
|
||||
Parent = "Moon",
|
||||
Renderable = {
|
||||
Type = "RenderableTrailTrajectory",
|
||||
Translation = {
|
||||
Type = "SpiceTranslation",
|
||||
Target = "APOLLO 15",
|
||||
Observer = "MOON",
|
||||
Frame = "IAU_MOON",
|
||||
Kernels = Kernels
|
||||
},
|
||||
Color = { 0.70, 0.50, 0.20 },
|
||||
StartTime = "1971 JUL 26",
|
||||
EndTime = "1971 AUG 01 14:30:41.680",
|
||||
SampleInterval = 2
|
||||
},
|
||||
GUI = {
|
||||
Name = "Apollo 15 Trail",
|
||||
Path = "/Solar System/Missions/Apollo 15"
|
||||
}
|
||||
}
|
||||
|
||||
assetHelper.registerSceneGraphNodesAndExport(asset, {
|
||||
Apollo15,
|
||||
Apollo15Main,
|
||||
Apollo15Trail
|
||||
})
|
||||
|
||||
@@ -1,86 +0,0 @@
|
||||
local ApolloKernels = asset.syncedResource({
|
||||
Name = "Apollo Kernels",
|
||||
Type = "HttpSynchronization",
|
||||
Identifier = "apollo_spice",
|
||||
Version = 1
|
||||
})
|
||||
|
||||
local Apollo15Kernels = {
|
||||
|
||||
|
||||
|
||||
--sclk
|
||||
ApolloKernels .. "apollo15.0001.tsc",
|
||||
|
||||
--pck
|
||||
ApolloKernels .. "moon_080317.tf",
|
||||
ApolloKernels .. "moon_assoc_me.tf",
|
||||
|
||||
--ik
|
||||
ApolloKernels .. "apollo15_metric_v2.0001.ti",
|
||||
ApolloKernels .. "apollo15_panoramic.0001.ti",
|
||||
|
||||
--tspk
|
||||
ApolloKernels .. "de421.bsp",
|
||||
ApolloKernels .. "moon_pa_de421_1900-2050.bpc",
|
||||
|
||||
--iak
|
||||
ApolloKernels .. "apollo15MetricAddendum002.ti",
|
||||
ApolloKernels .. "apolloPanAddendum001.ti",
|
||||
|
||||
--fk
|
||||
ApolloKernels .. "apollo15_v2.0001.tf",
|
||||
ApolloKernels .. "apollo15_v2.0002.tf",
|
||||
|
||||
--spk
|
||||
ApolloKernels .. "AS15_M_REV23_SMITHED_V01.bsp",
|
||||
ApolloKernels .. "AS15_M_REV4.bsp ",
|
||||
ApolloKernels .. "AS15_M_REV70_SMITHED_V01.bsp",
|
||||
ApolloKernels .. "AS15_M_REV04_v2.bsp ",
|
||||
ApolloKernels .. "AS15_M_REV27_SMITHED_V01.bsp",
|
||||
ApolloKernels .. "AS15_M_REV44_SMITHED_V01.bsp",
|
||||
ApolloKernels .. "AS15_M_REV71_SMITHED_V01.bsp",
|
||||
ApolloKernels .. "AS15_M_REV15_SMITHED_V01.bsp",
|
||||
ApolloKernels .. "AS15_M_REV33_SMITHED_V01.bsp",
|
||||
ApolloKernels .. "AS15_M_REV50_SMITHED_V01.bsp",
|
||||
ApolloKernels .. "AS15_M_REV71_SMITHED_V02.bsp",
|
||||
ApolloKernels .. "AS15_M_REV15_v2.bsp ",
|
||||
ApolloKernels .. "AS15_M_REV34_SMITHED_V01.bsp",
|
||||
ApolloKernels .. "AS15_M_REV60_SMITHED_V01.bsp",
|
||||
ApolloKernels .. "AS15_M_REV72_v2.bsp",
|
||||
ApolloKernels .. "AS15_M_REV16_SMITHED_V01.bsp",
|
||||
ApolloKernels .. "AS15_M_REV35_SMITHED_V02.bsp",
|
||||
ApolloKernels .. "AS15_M_REV62_SMITHED_V01.bsp",
|
||||
ApolloKernels .. "AS15_M_REV22_SMITHED_V01.bsp",
|
||||
ApolloKernels .. "AS15_M_REV38_SMITHED_V01.bsp",
|
||||
ApolloKernels .. "AS15_M_REV63_SMITHED_V01.bsp",
|
||||
|
||||
--ck
|
||||
ApolloKernels .. "AS15_M_REV04_SMITHED_V01.bc",
|
||||
ApolloKernels .. "AS15_M_REV15_SMITHED_V01.bc",
|
||||
ApolloKernels .. "AS15_M_REV16_SMITHED_V01.bc",
|
||||
ApolloKernels .. "AS15_M_REV22_SMITHED_V01.bc",
|
||||
ApolloKernels .. "AS15_M_REV23_SMITHED_V01.bc",
|
||||
ApolloKernels .. "AS15_M_REV27_SMITHED_V01.bc",
|
||||
ApolloKernels .. "AS15_M_REV33_SMITHED_V01.bc",
|
||||
ApolloKernels .. "AS15_M_REV34_SMITHED_V01.bc",
|
||||
ApolloKernels .. "AS15_M_REV35_SMITHED_V01.bc",
|
||||
ApolloKernels .. "AS15_M_REV35_SMITHED_V02.bc",
|
||||
ApolloKernels .. "AS15_M_REV38_SMITHED_V01.bc",
|
||||
ApolloKernels .. "AS15_M_REV44_SMITHED_V01.bc",
|
||||
ApolloKernels .. "AS15_M_REV50_SMITHED_V01.bc",
|
||||
ApolloKernels .. "AS15_M_REV60_SMITHED_V01.bc",
|
||||
ApolloKernels .. "AS15_M_REV62_SMITHED_V01.bc",
|
||||
ApolloKernels .. "AS15_M_REV63_SMITHED_V01.bc",
|
||||
ApolloKernels .. "AS15_M_REV70_SMITHED_V01.bc",
|
||||
ApolloKernels .. "AS15_M_REV71_SMITHED_V01.bc",
|
||||
ApolloKernels .. "AS15_M_REV71_SMITHED_V02.bc",
|
||||
ApolloKernels .. "AS15_M_REV72_v2.bc",
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
--asset.export("ApolloKernels", Kernels)
|
||||
asset.export("Apollo15Kernels", Apollo15Kernels)
|
||||
@@ -1,235 +0,0 @@
|
||||
local assetHelper = asset.require('util/asset_helper')
|
||||
local sunTransforms = asset.require('scene/solarsystem/sun/transforms')
|
||||
local csm = asset.require('./apollo_csm')
|
||||
|
||||
asset.require('spice/base')
|
||||
|
||||
local kernelsFolder = asset.syncedResource({
|
||||
Name = "Apollo Kernels",
|
||||
Type = "HttpSynchronization",
|
||||
Identifier = "apollo_spice",
|
||||
Version = 1
|
||||
})
|
||||
|
||||
local kernels = {
|
||||
kernelsFolder .. "/moon_080317.tf",
|
||||
kernelsFolder .. "/apollo8.tf",
|
||||
kernelsFolder .. "/moon_pa_de421_1900-2050.bpc",
|
||||
kernelsFolder .. '/apollo8.tsc',
|
||||
kernelsFolder .. '/apollo8.bsp',
|
||||
kernelsFolder .. '/apollo8_earthrise.bc',
|
||||
}
|
||||
|
||||
local apolloSpiceId = "-908"
|
||||
|
||||
local Apollo8Launch = {
|
||||
Identifier = "Apollo8Launch",
|
||||
Parent = "Earth",
|
||||
TimeFrame = { -- Using Spice kernels for 1850-2150
|
||||
Type = "TimeFrameInterval",
|
||||
Start = "1968 DEC 21",
|
||||
End = "1968 DEC 28"
|
||||
},
|
||||
Transform = {
|
||||
Translation = {
|
||||
Type = "SpiceTranslation",
|
||||
Target = apolloSpiceId,
|
||||
Observer = "EARTH",
|
||||
Frame = "IAU_EARTH",
|
||||
Kernels = kernels
|
||||
},
|
||||
},
|
||||
GUI = {
|
||||
Name = "Apollo 8 Launch Capsule",
|
||||
Path = "/Solar System/Missions/Apollo"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
local Apollo8 = {
|
||||
Identifier = "Apollo8",
|
||||
Parent = "EarthBarycenter",
|
||||
TimeFrame = { -- Using Spice kernels for 1850-2150
|
||||
Type = "TimeFrameInterval",
|
||||
Start = "1968 DEC 21",
|
||||
End = "1968 DEC 28"
|
||||
},
|
||||
Transform = {
|
||||
Translation = {
|
||||
Type = "SpiceTranslation",
|
||||
Target = apolloSpiceId,
|
||||
Observer = "EARTH BARYCENTER",
|
||||
Frame = "GALACTIC",
|
||||
Kernels = kernels
|
||||
},
|
||||
Rotation = {
|
||||
Type = "SpiceRotation",
|
||||
SourceFrame = "A8_EARTHRISE",
|
||||
DestinationFrame = "GALACTIC",
|
||||
TimeFrame = {
|
||||
-- The orientation of Apollo 8 is only
|
||||
-- available during the few minutes when
|
||||
-- the famous Earthrise picture was taken.
|
||||
Type = "TimeFrameInterval",
|
||||
Start = "1968 DEC 24 16:37:19",
|
||||
End = "1968 DEC 24 16:40:15"
|
||||
}
|
||||
}
|
||||
},
|
||||
GUI = {
|
||||
Name = "Apollo 8",
|
||||
Path = "/Solar System/Missions/Apollo"
|
||||
}
|
||||
}
|
||||
|
||||
local Apollo8LaunchModel = {
|
||||
Identifier = "Apollo8LaunchModel",
|
||||
Parent = Apollo8Launch.Identifier,
|
||||
Transform = {
|
||||
Scale = {
|
||||
Type = "StaticScale",
|
||||
-- The scale of the model is in cm; OpenSpace is in m
|
||||
Scale = 0.01
|
||||
},
|
||||
Rotation = {
|
||||
Type = "StaticRotation",
|
||||
Rotation = {0.0, 0.0, -3.1415/2}
|
||||
}
|
||||
},
|
||||
GUI = {
|
||||
Hidden = true,
|
||||
Name = "Apollo 8 Launch Model",
|
||||
Path = "/Solar System/Missions/Apollo"
|
||||
}
|
||||
}
|
||||
|
||||
local Apollo8Model = {
|
||||
Identifier = "Apollo8Model",
|
||||
Parent = Apollo8.Identifier,
|
||||
Transform = {
|
||||
Scale = {
|
||||
Type = "StaticScale",
|
||||
-- The scale of the model is in cm; OpenSpace is in m
|
||||
Scale = 0.01
|
||||
},
|
||||
Rotation = {
|
||||
Type = "StaticRotation",
|
||||
Rotation = {0.0, 0.0, -3.1415/2}
|
||||
}
|
||||
},
|
||||
GUI = {
|
||||
Hidden = true,
|
||||
Name = "Apollo 8 Model",
|
||||
Path = "/Solar System/Missions/Apollo"
|
||||
}
|
||||
}
|
||||
|
||||
local PivotOffset = { 0, 2.5, 0 }
|
||||
|
||||
-- The pivot node is used for navigation inside the spacecraft
|
||||
|
||||
local Apollo8Pivot = {
|
||||
Identifier = "Apollo8Pivot",
|
||||
Parent = Apollo8.Identifier,
|
||||
Transform = {
|
||||
Translation = {
|
||||
Type = "StaticTranslation",
|
||||
Position = PivotOffset
|
||||
},
|
||||
},
|
||||
GUI = {
|
||||
Name = "Apollo 8 Pivot",
|
||||
Path = "/Solar System/Missions/Apollo"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
local Apollo8LaunchTrail = {
|
||||
Identifier = "Apollo8LaunchTrail",
|
||||
Parent = "Earth",
|
||||
Renderable = {
|
||||
Type = "RenderableTrailTrajectory",
|
||||
Translation = {
|
||||
Type = "SpiceTranslation",
|
||||
Target = apolloSpiceId,
|
||||
Observer = "EARTH",
|
||||
Frame = "IAU_EARTH",
|
||||
Kernels = kernels
|
||||
},
|
||||
Color = { 0.70, 0.50, 0.20 },
|
||||
StartTime = "1968 DEC 21 12:51:00",
|
||||
EndTime = "1968 DEC 21 23:23:22",
|
||||
SampleInterval = 30
|
||||
},
|
||||
GUI = {
|
||||
Name = "Apollo 8 Launch Trail",
|
||||
Path = "/Solar System/Missions/Apollo"
|
||||
}
|
||||
}
|
||||
|
||||
local Apollo8MoonTrail = {
|
||||
Identifier = "Apollo8MoonTrail",
|
||||
Parent = "Moon",
|
||||
Renderable = {
|
||||
Type = "RenderableTrailTrajectory",
|
||||
Translation = {
|
||||
Type = "SpiceTranslation",
|
||||
Target = apolloSpiceId,
|
||||
Observer = "MOON",
|
||||
Frame = "IAU_MOON",
|
||||
Kernels = kernels
|
||||
},
|
||||
Color = { 0.70, 0.50, 0.20 },
|
||||
StartTime = "1968 DEC 23",
|
||||
EndTime = "1968 DEC 26",
|
||||
SampleInterval = 30,
|
||||
Enabled = false,
|
||||
},
|
||||
GUI = {
|
||||
Name = "Apollo 8 Moon Trail",
|
||||
Path = "/Solar System/Missions/Apollo"
|
||||
}
|
||||
}
|
||||
|
||||
local Apollo8EarthBarycenterTrail = {
|
||||
Identifier = "Apollo8EarthBarycenterTrail",
|
||||
Parent = "EarthBarycenter",
|
||||
Renderable = {
|
||||
Type = "RenderableTrailTrajectory",
|
||||
Translation = {
|
||||
Type = "SpiceTranslation",
|
||||
Target = apolloSpiceId,
|
||||
Observer = "EARTH",
|
||||
Frame = "GALACTIC",
|
||||
Kernels = kernels
|
||||
},
|
||||
Color = { 0.8, 0.2, 0.2 },
|
||||
StartTime = "1968 DEC 21",
|
||||
EndTime = "1968 DEC 28",
|
||||
SampleInterval = 30,
|
||||
Enabled = true,
|
||||
},
|
||||
GUI = {
|
||||
Name = "Apollo 8 Earth Barycenter Trail",
|
||||
Path = "/Solar System/Missions/Apollo"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
local exportList = {
|
||||
Apollo8,
|
||||
Apollo8Model,
|
||||
Apollo8Launch,
|
||||
Apollo8LaunchModel,
|
||||
Apollo8Pivot,
|
||||
|
||||
Apollo8LaunchTrail,
|
||||
Apollo8MoonTrail,
|
||||
Apollo8EarthBarycenterTrail
|
||||
}
|
||||
|
||||
assetHelper.registerSceneGraphNodesAndExport(asset, exportList)
|
||||
-- Registering Command and Service module needs to happen fter the export list
|
||||
-- has been registered, since it depends on the Apollo8Model scene graph node.
|
||||
csm.registerCsm(asset, Apollo8Model.Identifier)
|
||||
csm.registerCsm(asset, Apollo8LaunchModel.Identifier)
|
||||
@@ -1,74 +0,0 @@
|
||||
local assetHelper = asset.require('util/asset_helper')
|
||||
local sunTransforms = asset.require('scene/solarsystem/sun/transforms')
|
||||
local kernelsFolder = asset.syncedResource({
|
||||
Name = "Apollo Kernels",
|
||||
Type = "HttpSynchronization",
|
||||
Identifier = "apollo_spice",
|
||||
Version = 1
|
||||
})
|
||||
|
||||
local kernels = {
|
||||
kernelsFolder .. "/moon_080317.tf",
|
||||
kernelsFolder .. "/apollo8.tf",
|
||||
kernelsFolder .. "/moon_pa_de421_1900-2050.bpc",
|
||||
kernelsFolder .. '/apollo8.tsc',
|
||||
kernelsFolder .. '/apollo8.bsp',
|
||||
kernelsFolder .. '/apollo8_earthrise.bc',
|
||||
}
|
||||
|
||||
local apolloSpiceId = "-908"
|
||||
|
||||
|
||||
local Apollo8LaunchTrail = {
|
||||
Identifier = "Apollo8LaunchTrail",
|
||||
Parent = "Earth",
|
||||
Renderable = {
|
||||
Type = "RenderableTrailTrajectory",
|
||||
Translation = {
|
||||
Type = "SpiceTranslation",
|
||||
Target = apolloSpiceId,
|
||||
Observer = "EARTH",
|
||||
Frame = "IAU_EARTH",
|
||||
Kernels = kernels
|
||||
},
|
||||
Color = { 0.70, 0.50, 0.20 },
|
||||
StartTime = "1968 DEC 21 12:51:00",
|
||||
EndTime = "1968 DEC 21 23:23:22",
|
||||
SampleInterval = 30
|
||||
},
|
||||
GUI = {
|
||||
Name = "Apollo 8 Launch Trail",
|
||||
Path = "/Solar System/Missions/Apollo"
|
||||
}
|
||||
}
|
||||
|
||||
local Apollo8EarthBarycenterTrail = {
|
||||
Identifier = "Apollo8EarthBarycenterTrail",
|
||||
Parent = "EarthBarycenter",
|
||||
Renderable = {
|
||||
Type = "RenderableTrailTrajectory",
|
||||
Translation = {
|
||||
Type = "SpiceTranslation",
|
||||
Target = apolloSpiceId,
|
||||
Observer = "EARTH BARYCENTER",
|
||||
Frame = "GALACTIC",
|
||||
Kernels = kernels
|
||||
},
|
||||
Color = { 1, 0.0, 0.0 },
|
||||
StartTime = "1968 DEC 21",
|
||||
EndTime = "1968 DEC 28",
|
||||
SampleInterval = 30,
|
||||
Enabled = false,
|
||||
},
|
||||
GUI = {
|
||||
Name = "Apollo 8 Earth Barycenter Trail",
|
||||
Path = "/Solar System/Missions/Apollo"
|
||||
}
|
||||
}
|
||||
|
||||
local exportList = {
|
||||
Apollo8LaunchTrail,
|
||||
Apollo8EarthBarycenterTrail,
|
||||
}
|
||||
|
||||
assetHelper.registerSceneGraphNodesAndExport(asset, exportList)
|
||||
@@ -1,11 +1,11 @@
|
||||
-- This asset exports a function to create an Apollo Command and Service Module (CSM).
|
||||
-- Instead of hard-coding the scene graph node parent,
|
||||
-- client assets can decide which object that the CSM should be attached to.
|
||||
-- Usage example: registerCsm(asset, Apollo8.Idenfitier)
|
||||
-- Usage example: createCsmModel(asset, Apollo8.Idenfitier)
|
||||
-- ...where Apollo8 is the scene graph node identifier to attach the CSM to.
|
||||
|
||||
local assetHelper = asset.require('util/asset_helper')
|
||||
local sunTransforms = asset.require('scene/solarsystem/sun/transforms')
|
||||
local asset_helper = asset.require('util/asset_helper')
|
||||
local sun_transforms = asset.require('scene/solarsystem/sun/transforms')
|
||||
|
||||
local models = asset.syncedResource({
|
||||
Name = "Apollo Models",
|
||||
@@ -18,115 +18,115 @@ local partsInfo = {
|
||||
-- Data is structured as: Geometry file name (except .obj suffix), texture file name, shading
|
||||
|
||||
-- Exterior
|
||||
{"AP08_cone_command_module", "Command_module_diff.png", true},
|
||||
{"AP08_cone_hatchdoor_handle_scratched_metal", "scratched_metal_gloss.png", true},
|
||||
{"AP08_cone_vent_ports_black", "black.png", true},
|
||||
{"AP08_cone_vent_ports_red", "red.png", true},
|
||||
{"AP08_cone_hatchdoor_interior", "apollo_hatchdoor_interior.jpg", false},
|
||||
{ "AP08_cone_command_module", "Command_module_diff.png", true },
|
||||
{ "AP08_cone_hatchdoor_handle_scratched_metal", "scratched_metal_gloss.png", true },
|
||||
{ "AP08_cone_vent_ports_black", "black.png", true },
|
||||
{ "AP08_cone_vent_ports_red", "red.png", true },
|
||||
{ "AP08_cone_hatchdoor_interior", "apollo_hatchdoor_interior.jpg", false },
|
||||
|
||||
{"AP08_service_black", "black.png", true},
|
||||
{"AP08_service_brown", "brown.png", true},
|
||||
{"AP08_service_grey", "gray.png", true},
|
||||
{"AP08_service_high_gain_antenna", "Antenna_diff.png", true},
|
||||
{"AP08_service_module", "Service_module_diff.png", true},
|
||||
{"AP08_service_nozzle", "Nozzle_diff.png", true},
|
||||
{"AP08_service_pink", "pink.png", true},
|
||||
{"AP08_service_red", "red.png", true},
|
||||
{"AP08_service_scratched_metal", "scratched_metal_gloss.png", true},
|
||||
{"AP08_service_white", "white.png", true},
|
||||
{ "AP08_service_black", "black.png", true },
|
||||
{ "AP08_service_brown", "brown.png", true },
|
||||
{ "AP08_service_grey", "gray.png", true },
|
||||
{ "AP08_service_high_gain_antenna", "Antenna_diff.png", true },
|
||||
{ "AP08_service_module", "Service_module_diff.png", true },
|
||||
{ "AP08_service_nozzle", "Nozzle_diff.png", true },
|
||||
{ "AP08_service_pink", "pink.png", true },
|
||||
{ "AP08_service_red", "red.png", true },
|
||||
{ "AP08_service_scratched_metal", "scratched_metal_gloss.png", true },
|
||||
{ "AP08_service_white", "white.png", true },
|
||||
|
||||
-- Interior
|
||||
-- {"AP11_int_back_wall_left", "AP11_int_back_wall_left.png", false},
|
||||
-- {"AP11_int_back_wall_right", "AP11_int_back_wall_right.png", false},
|
||||
-- {"AP11_interior_back_wall_top_0Shape3", "back_wall_top_0Shape3_tpAmbient_paint_03.png", false},
|
||||
-- {"AP11_interior_belt_buckles_02_L2", "belt_buckles_02_L2Shape_tpAmbient.png", false},
|
||||
-- {"AP11_interior_belt_straps_02", "belt_straps_02Shape_tpAmbient_paint_01.png", false},
|
||||
-- {"AP11_interior_black_push_buttons", "push_buttonsShape_tpAmbient.png", false},
|
||||
-- {"AP11_interior_bottom_boxes_03", "bottom_boxes_03_paint_01.png", false},
|
||||
-- {"AP11_interior_bottom_floor_tp", "bottom_floor_tpAmbient_paint_v002.png", false},
|
||||
-- {"AP11_interior_box_back_01", "box_back_01_paint_v001.png", false},
|
||||
-- {"AP11_interior_box_back_02", "box_back_02_paint_v001.png", false},
|
||||
-- {"AP11_interior_box_back_04", "box_back_04_paint_v001.png", false},
|
||||
-- {"AP11_interior_box_lft_lower_01", "box_lft_lower_01Shape_Diffuse_paint_v002.png", false},
|
||||
-- {"AP11_interior_box_lft_top", "box_lft_topShape_Diffuse_paint_v009.png", false},
|
||||
-- {"AP11_interior_box_mid_tp", "box_mid_tpDiffuse_paint_v001.png", false},
|
||||
-- {"AP11_interior_box_rt_top_02", "box_rt_top_02_paint_04.png", false},
|
||||
-- {"AP11_interior_brushed_blue_ano", "brushed_blue_ano_paint_01.png", false},
|
||||
-- {"AP11_interior_brushed_brass", "brushed_brass_paint_01.png", false},
|
||||
-- {"AP11_interior_brushed_grey_ano", "brushed_grey_ano_paint_02.png", false},
|
||||
-- {"AP11_interior_canvas_cover", "canvas_coverShape_tpAmbient_paint_01.png", false},
|
||||
-- {"AP11_interior_Channel_attachment", "Channel_attachment_Diffuse.png", false},
|
||||
-- {"AP11_interior_Channel_baseMetal", "Channel_baseMetal_Diffuse.png", false},
|
||||
-- {"AP11_interior_Channel_Material", "Channel_Material_Diffuse.png", false},
|
||||
-- {"AP11_interior_Channel_rsMaterial2", "Channel_rsMaterial2_Diffuse.png", false},
|
||||
-- {"AP11_interior_cloth_01", "cloth_01Shape_tpAmbient_paint_01.png", false},
|
||||
-- {"AP11_interior_coiled_hose", "coiled_hoseShape_tpAmbient.png", false},
|
||||
-- {"AP11_interior_control_panel_left_win_plates", "control_panel_left_win_platesShape_tpAmbient.png", false},
|
||||
-- {"AP11_interior_control_panel_rt_win_plates", "control_panel_rt_win_platesShape_tpAmbient.png", false},
|
||||
-- {"AP11_interior_copper_parts_main_cp", "copper_parts_main_cpShape_tpAmbient.png", false},
|
||||
-- {"AP11_interior_dials_main2", "dials_main2Shape_tpAmbient.png", false},
|
||||
-- {"AP11_interior_dials_t2", "dials_t2Shape_tpAmbient.png", false},
|
||||
-- {"AP11_interior_dial_fixes_01", "dial_fixes_01Shape_tpAmbient.png", false},
|
||||
-- {"AP11_interior_fire_ex_02", "fire_ex_02_paint_v001.png", false},
|
||||
-- {"AP11_interior_floor_panels_3", "floor_panels_3Shape_tpAmbient_paint_01.png", false},
|
||||
-- {"AP11_interior_floor_tile_tex_01", "floor_tile_tex_01.png", false},
|
||||
-- {"AP11_interior_grey", "gray.png", false},
|
||||
-- {"AP11_interior_handholds_cp", "handholds_cpShape_tpAmbient_paint_05.png", false},
|
||||
-- {"AP11_interior_hatch_release_0Shape5", "hatch_release_0Shape5_tpAmbient_paint_02.png", false},
|
||||
-- {"AP11_interior_headrests_02", "headrests_02Shape_tpAmbient_paint_01.png", false},
|
||||
-- {"AP11_interior_hoses_black_01", "hoses_black_01Shape_tpAmbient_paint_01.png", false},
|
||||
-- {"AP11_interior_hoses_white_0Shape1", "hoses_white_0Shape1_tpAmbient_paint_01.png", false},
|
||||
-- {"AP11_interior_josticks1", "joysticks1Shape_tpAmbient_paint_01.png", false},
|
||||
-- {"AP11_interior_joysticks_fabric1", "joysticks_fabric1_Shape_tpAmbient_paint_01.png", false},
|
||||
-- {"AP11_interior_joystick_poles_lft_05", "joystick_poles_lft_05_paint_v002.png", false},
|
||||
-- {"AP11_interior_joystick_poles_lft_long_05", "joystick_poles_lft_long_05_paint_v002.png", false},
|
||||
-- {"AP11_interior_joystick_poles_rt_05", "joystick_poles_rt_05_paint_v002.png", false},
|
||||
-- {"AP11_interior_latch_mechanisms_01", "latch_mechanisms_01Shape_tpAmbient.png", false},
|
||||
-- {"AP11_interior_lower_push_buttons", "lower_push_buttonsShape_tpAmbient.png", false},
|
||||
-- {"AP11_interior_lower_walls_back", "lower_walls_back_paint_04.png", false},
|
||||
-- {"AP11_interior_lower_walls_boxes_head", "lower_walls_boxes_headShape_tpAmbient_paint_v001.png", false},
|
||||
-- {"AP11_interior_main_cp_left_smth_03", "main_cp_left_0Shape3_tpAmbient_paint_02.png", false},
|
||||
-- {"AP11_interior_main_cp_mid_smth_02", "main_cp_mid_smth_02Shape_tpAmbient_paint_02.png", false},
|
||||
-- {"AP11_interior_main_cp_rt_smth", "main_cp_rt_smthShape_tpAmbient_paint_02.png", false},
|
||||
-- {"AP11_interior_main_cp_wheels", "main_cp_wheelsShape_tpAmbient.png", false},
|
||||
-- {"AP11_interior_metal_brackets_under_hatch", "metal_brackets_under_hatchShape_tpAmbient.png", false},
|
||||
-- {"AP11_interior_metal_tunnel_parts", "metal_tunnel_partsShape_tpAmbient_paint_01.png", false},
|
||||
-- {"AP11_interior_metal_window_parts", "metal_window_partsShape_tpAmbient_paint_01.png", false},
|
||||
-- {"AP11_interior_middle_walls_05", "middle_walls_05_tpAmbient_paint_02.png", false},
|
||||
-- {"AP11_interior_middle_walls_0Shape8", "middle_walls_0Shape8_tpAmbient_paint_01.png", false},
|
||||
-- {"AP11_interior_mid_tunnel_parts", "mid_tunnel_parts_03Shape_tpAmbient_paint_02.png", false},
|
||||
-- {"AP11_interior_new_switch_rails1", "new_switch_rails1Shape_tpAmbient.png", false},
|
||||
-- {"AP11_interior_nozzles_02", "nozzles_02Shape_tpAmbient_paint_01.png", false},
|
||||
-- {"AP11_interior_outlet_fabric3", "outlet_fabric3Shape_tpAmbient_paint_02.png", false},
|
||||
-- {"AP11_interior_pole_end_02", "pole_end_02.png", false},
|
||||
-- {"AP11_interior_pole_end_03", "pole_end_03.png", false},
|
||||
-- {"AP11_interior_pole_tex_03", "pole_tex_03.png", false},
|
||||
-- {"AP11_interior_pole_tex_04", "pole_tex_04.png", false},
|
||||
-- {"AP11_interior_pole_tex_05", "pole_tex_05.png", false},
|
||||
-- {"AP11_interior_pole_tex_lower_01", "pole_tex_lower_01.png", false},
|
||||
-- {"AP11_interior_pole_under_seat_paint_01", "pole_under_seat_paint_01.png", false},
|
||||
-- {"AP11_interior_pole_under_seat_square_bar", "pole_under_seat_square_bar_paint_01.png", false},
|
||||
-- {"AP11_interior_push_switches_lft1", "push_switches_lft1Shape_tpAmbient.png", false},
|
||||
-- {"AP11_interior_random_small_parts_01", "random_small_parts_01Shape_tpAmbient_paint_02.png", false},
|
||||
-- {"AP11_interior_red", "red.png", false},
|
||||
-- {"AP11_interior_reticle_wheel_tp", "reticle_wheel_tpAmbient_paint_01.png", false},
|
||||
-- {"AP11_interior_rivet_paint_v001", "rivet_paint_v001.png", false},
|
||||
-- {"AP11_interior_seats_fabric", "seats_fabric_paint_01.png", false},
|
||||
-- {"AP11_interior_seat_left_tp", "seat_left_tpAmbient_paint_v001.png", false},
|
||||
-- {"AP11_interior_seat_lights_left", "seat_lights_left_Shape_tpAmbient_paint_v001.png", false},
|
||||
-- {"AP11_interior_seat_lights_rt", "seat_lights_rt_Shape_tpAmbient_paint_v001.png", false},
|
||||
-- {"AP11_interior_seat_middle_tp", "seat_middle_tpAmbient_paint_v001.png", false},
|
||||
-- {"AP11_interior_seat_poles_0Shape1", "seat_poles_0Shape1_tpAmbient_paint_01.png", false},
|
||||
-- {"AP11_interior_seat_pole_mirror_0Shape1", "seat_pole_mirror_0Shape1_tpAmbient_paint_01.png", false},
|
||||
-- {"AP11_interior_seat_rt_tp", "seat_rt_tpAmbient_paint_v001.png", false},
|
||||
-- {"AP11_interior_sextant_0Shape2", "sextant_0Shape2_tpAmbient.png", false},
|
||||
-- {"AP11_interior_switch_covers_main_middle1", "switch_covers_main_middle1Shape_tpAmbient.png", false},
|
||||
-- {"AP11_interior_switch_rails_lft", "switch_rails_lftShape_tpAmbient.png", false},
|
||||
-- {"AP11_interior_tunnel_main_cylinder1", "switch_rails_lftShape_tpAmbient.png", false},
|
||||
-- {"AP11_interior_tunnel_switches_01", "tunnel_switches_01Shape_tpAmbient.png", false},
|
||||
-- {"AP11_interior_tunnel_wheelsShape", "tunnel_wheelsShape_tpAmbient.png", false},
|
||||
-- {"AP11_interior_walls_mid_left", "walls_mid_leftShape_tpAmbient_paint_01.png", false},
|
||||
-- {"AP11_interior_windows_front_0Shape4", "windows_front_0Shape4_tpAmbient_paint_01.png", false}
|
||||
-- { "AP11_int_back_wall_left", "AP11_int_back_wall_left.png", false},
|
||||
-- { "AP11_int_back_wall_right", "AP11_int_back_wall_right.png", false },
|
||||
-- { "AP11_interior_back_wall_top_0Shape3", "back_wall_top_0Shape3_tpAmbient_paint_03.png", false },
|
||||
-- { "AP11_interior_belt_buckles_02_L2", "belt_buckles_02_L2Shape_tpAmbient.png", false },
|
||||
-- { "AP11_interior_belt_straps_02", "belt_straps_02Shape_tpAmbient_paint_01.png", false },
|
||||
-- { "AP11_interior_black_push_buttons", "push_buttonsShape_tpAmbient.png", false },
|
||||
-- { "AP11_interior_bottom_boxes_03", "bottom_boxes_03_paint_01.png", false },
|
||||
-- { "AP11_interior_bottom_floor_tp", "bottom_floor_tpAmbient_paint_v002.png", false },
|
||||
-- { "AP11_interior_box_back_01", "box_back_01_paint_v001.png", false },
|
||||
-- { "AP11_interior_box_back_02", "box_back_02_paint_v001.png", false },
|
||||
-- { "AP11_interior_box_back_04", "box_back_04_paint_v001.png", false },
|
||||
-- { "AP11_interior_box_lft_lower_01", "box_lft_lower_01Shape_Diffuse_paint_v002.png", false },
|
||||
-- { "AP11_interior_box_lft_top", "box_lft_topShape_Diffuse_paint_v009.png", false },
|
||||
-- { "AP11_interior_box_mid_tp", "box_mid_tpDiffuse_paint_v001.png", false },
|
||||
-- { "AP11_interior_box_rt_top_02", "box_rt_top_02_paint_04.png", false },
|
||||
-- { "AP11_interior_brushed_blue_ano", "brushed_blue_ano_paint_01.png", false },
|
||||
-- { "AP11_interior_brushed_brass", "brushed_brass_paint_01.png", false },
|
||||
-- { "AP11_interior_brushed_grey_ano", "brushed_grey_ano_paint_02.png", false },
|
||||
-- { "AP11_interior_canvas_cover", "canvas_coverShape_tpAmbient_paint_01.png", false },
|
||||
-- { "AP11_interior_Channel_attachment", "Channel_attachment_Diffuse.png", false },
|
||||
-- { "AP11_interior_Channel_baseMetal", "Channel_baseMetal_Diffuse.png", false },
|
||||
-- { "AP11_interior_Channel_Material", "Channel_Material_Diffuse.png", false },
|
||||
-- { "AP11_interior_Channel_rsMaterial2", "Channel_rsMaterial2_Diffuse.png", false },
|
||||
-- { "AP11_interior_cloth_01", "cloth_01Shape_tpAmbient_paint_01.png", false },
|
||||
-- { "AP11_interior_coiled_hose", "coiled_hoseShape_tpAmbient.png", false },
|
||||
-- { "AP11_interior_control_panel_left_win_plates", "control_panel_left_win_platesShape_tpAmbient.png", false },
|
||||
-- { "AP11_interior_control_panel_rt_win_plates", "control_panel_rt_win_platesShape_tpAmbient.png", false },
|
||||
-- { "AP11_interior_copper_parts_main_cp", "copper_parts_main_cpShape_tpAmbient.png", false },
|
||||
-- { "AP11_interior_dials_main2", "dials_main2Shape_tpAmbient.png", false },
|
||||
-- { "AP11_interior_dials_t2", "dials_t2Shape_tpAmbient.png", false },
|
||||
-- { "AP11_interior_dial_fixes_01", "dial_fixes_01Shape_tpAmbient.png", false },
|
||||
-- { "AP11_interior_fire_ex_02", "fire_ex_02_paint_v001.png", false },
|
||||
-- { "AP11_interior_floor_panels_3", "floor_panels_3Shape_tpAmbient_paint_01.png", false },
|
||||
-- { "AP11_interior_floor_tile_tex_01", "floor_tile_tex_01.png", false },
|
||||
-- { "AP11_interior_grey", "gray.png", false },
|
||||
-- { "AP11_interior_handholds_cp", "handholds_cpShape_tpAmbient_paint_05.png", false },
|
||||
-- { "AP11_interior_hatch_release_0Shape5", "hatch_release_0Shape5_tpAmbient_paint_02.png", false },
|
||||
-- { "AP11_interior_headrests_02", "headrests_02Shape_tpAmbient_paint_01.png", false },
|
||||
-- { "AP11_interior_hoses_black_01", "hoses_black_01Shape_tpAmbient_paint_01.png", false },
|
||||
-- { "AP11_interior_hoses_white_0Shape1", "hoses_white_0Shape1_tpAmbient_paint_01.png", false },
|
||||
-- { "AP11_interior_josticks1", "joysticks1Shape_tpAmbient_paint_01.png", false },
|
||||
-- { "AP11_interior_joysticks_fabric1", "joysticks_fabric1_Shape_tpAmbient_paint_01.png", false },
|
||||
-- { "AP11_interior_joystick_poles_lft_05", "joystick_poles_lft_05_paint_v002.png", false },
|
||||
-- { "AP11_interior_joystick_poles_lft_long_05", "joystick_poles_lft_long_05_paint_v002.png", false },
|
||||
-- { "AP11_interior_joystick_poles_rt_05", "joystick_poles_rt_05_paint_v002.png", false },
|
||||
-- { "AP11_interior_latch_mechanisms_01", "latch_mechanisms_01Shape_tpAmbient.png", false },
|
||||
-- { "AP11_interior_lower_push_buttons", "lower_push_buttonsShape_tpAmbient.png", false },
|
||||
-- { "AP11_interior_lower_walls_back", "lower_walls_back_paint_04.png", false },
|
||||
-- { "AP11_interior_lower_walls_boxes_head", "lower_walls_boxes_headShape_tpAmbient_paint_v001.png", false },
|
||||
-- { "AP11_interior_main_cp_left_smth_03", "main_cp_left_0Shape3_tpAmbient_paint_02.png", false },
|
||||
-- { "AP11_interior_main_cp_mid_smth_02", "main_cp_mid_smth_02Shape_tpAmbient_paint_02.png", false },
|
||||
-- { "AP11_interior_main_cp_rt_smth", "main_cp_rt_smthShape_tpAmbient_paint_02.png", false },
|
||||
-- { "AP11_interior_main_cp_wheels", "main_cp_wheelsShape_tpAmbient.png", false },
|
||||
-- { "AP11_interior_metal_brackets_under_hatch", "metal_brackets_under_hatchShape_tpAmbient.png", false },
|
||||
-- { "AP11_interior_metal_tunnel_parts", "metal_tunnel_partsShape_tpAmbient_paint_01.png", false },
|
||||
-- { "AP11_interior_metal_window_parts", "metal_window_partsShape_tpAmbient_paint_01.png", false },
|
||||
-- { "AP11_interior_middle_walls_05", "middle_walls_05_tpAmbient_paint_02.png", false },
|
||||
-- { "AP11_interior_middle_walls_0Shape8", "middle_walls_0Shape8_tpAmbient_paint_01.png", false },
|
||||
-- { "AP11_interior_mid_tunnel_parts", "mid_tunnel_parts_03Shape_tpAmbient_paint_02.png", false },
|
||||
-- { "AP11_interior_new_switch_rails1", "new_switch_rails1Shape_tpAmbient.png", false },
|
||||
-- { "AP11_interior_nozzles_02", "nozzles_02Shape_tpAmbient_paint_01.png", false },
|
||||
-- { "AP11_interior_outlet_fabric3", "outlet_fabric3Shape_tpAmbient_paint_02.png", false },
|
||||
-- { "AP11_interior_pole_end_02", "pole_end_02.png", false },
|
||||
-- { "AP11_interior_pole_end_03", "pole_end_03.png", false },
|
||||
-- { "AP11_interior_pole_tex_03", "pole_tex_03.png", false },
|
||||
-- { "AP11_interior_pole_tex_04", "pole_tex_04.png", false },
|
||||
-- { "AP11_interior_pole_tex_05", "pole_tex_05.png", false },
|
||||
-- { "AP11_interior_pole_tex_lower_01", "pole_tex_lower_01.png", false },
|
||||
-- { "AP11_interior_pole_under_seat_paint_01", "pole_under_seat_paint_01.png", false },
|
||||
-- { "AP11_interior_pole_under_seat_square_bar", "pole_under_seat_square_bar_paint_01.png", false },
|
||||
-- { "AP11_interior_push_switches_lft1", "push_switches_lft1Shape_tpAmbient.png", false },
|
||||
-- { "AP11_interior_random_small_parts_01", "random_small_parts_01Shape_tpAmbient_paint_02.png", false },
|
||||
-- { "AP11_interior_red", "red.png", false },
|
||||
-- { "AP11_interior_reticle_wheel_tp", "reticle_wheel_tpAmbient_paint_01.png", false },
|
||||
-- { "AP11_interior_rivet_paint_v001", "rivet_paint_v001.png", false },
|
||||
-- { "AP11_interior_seats_fabric", "seats_fabric_paint_01.png", false },
|
||||
-- { "AP11_interior_seat_left_tp", "seat_left_tpAmbient_paint_v001.png", false },
|
||||
-- { "AP11_interior_seat_lights_left", "seat_lights_left_Shape_tpAmbient_paint_v001.png", false },
|
||||
-- { "AP11_interior_seat_lights_rt", "seat_lights_rt_Shape_tpAmbient_paint_v001.png", false },
|
||||
-- { "AP11_interior_seat_middle_tp", "seat_middle_tpAmbient_paint_v001.png", false },
|
||||
-- { "AP11_interior_seat_poles_0Shape1", "seat_poles_0Shape1_tpAmbient_paint_01.png", false },
|
||||
-- { "AP11_interior_seat_pole_mirror_0Shape1", "seat_pole_mirror_0Shape1_tpAmbient_paint_01.png", false },
|
||||
-- { "AP11_interior_seat_rt_tp", "seat_rt_tpAmbient_paint_v001.png", false },
|
||||
-- { "AP11_interior_sextant_0Shape2", "sextant_0Shape2_tpAmbient.png", false },
|
||||
-- { "AP11_interior_switch_covers_main_middle1", "switch_covers_main_middle1Shape_tpAmbient.png", false },
|
||||
-- { "AP11_interior_switch_rails_lft", "switch_rails_lftShape_tpAmbient.png", false },
|
||||
-- { "AP11_interior_tunnel_main_cylinder1", "switch_rails_lftShape_tpAmbient.png", false },
|
||||
-- { "AP11_interior_tunnel_switches_01", "tunnel_switches_01Shape_tpAmbient.png", false },
|
||||
-- { "AP11_interior_tunnel_wheelsShape", "tunnel_wheelsShape_tpAmbient.png", false },
|
||||
-- { "AP11_interior_walls_mid_left", "walls_mid_leftShape_tpAmbient_paint_01.png", false },
|
||||
-- { "AP11_interior_windows_front_0Shape4", "windows_front_0Shape4_tpAmbient_paint_01.png", false }
|
||||
}
|
||||
|
||||
|
||||
@@ -134,147 +134,147 @@ local partsInfoFull = {
|
||||
-- Data is structured as: Geometry file name (except .obj suffix), texture file name, shading
|
||||
|
||||
-- Exterior
|
||||
{"AP08_cone_command_module", "Command_module_diff.png", true},
|
||||
{"AP08_cone_hatchdoor_handle_scratched_metal", "scratched_metal_gloss.png", true},
|
||||
{"AP08_cone_vent_ports_black", "black.png", true},
|
||||
{"AP08_cone_vent_ports_red", "red.png", true},
|
||||
{"AP08_cone_hatchdoor_interior", "apollo_hatchdoor_interior.jpg", false},
|
||||
{ "AP08_cone_command_module", "Command_module_diff.png", true },
|
||||
{ "AP08_cone_hatchdoor_handle_scratched_metal", "scratched_metal_gloss.png", true },
|
||||
{ "AP08_cone_vent_ports_black", "black.png", true },
|
||||
{ "AP08_cone_vent_ports_red", "red.png", true },
|
||||
{ "AP08_cone_hatchdoor_interior", "apollo_hatchdoor_interior.jpg", false },
|
||||
|
||||
{"AP08_service_black", "black.png", true},
|
||||
{"AP08_service_brown", "brown.png", true},
|
||||
{"AP08_service_grey", "gray.png", true},
|
||||
{"AP08_service_high_gain_antenna", "Antenna_diff.png", true},
|
||||
{"AP08_service_module", "Service_module_diff.png", true},
|
||||
{"AP08_service_nozzle", "Nozzle_diff.png", true},
|
||||
{"AP08_service_pink", "pink.png", true},
|
||||
{"AP08_service_red", "red.png", true},
|
||||
{"AP08_service_scratched_metal", "scratched_metal_gloss.png", true},
|
||||
{"AP08_service_white", "white.png", true},
|
||||
{ "AP08_service_black", "black.png", true },
|
||||
{ "AP08_service_brown", "brown.png", true },
|
||||
{ "AP08_service_grey", "gray.png", true },
|
||||
{ "AP08_service_high_gain_antenna", "Antenna_diff.png", true },
|
||||
{ "AP08_service_module", "Service_module_diff.png", true },
|
||||
{ "AP08_service_nozzle", "Nozzle_diff.png", true },
|
||||
{ "AP08_service_pink", "pink.png", true },
|
||||
{ "AP08_service_red", "red.png", true },
|
||||
{ "AP08_service_scratched_metal", "scratched_metal_gloss.png", true },
|
||||
{ "AP08_service_white", "white.png", true },
|
||||
|
||||
-- Interior
|
||||
{"AP11_int_back_wall_left", "AP11_int_back_wall_left.png", false},
|
||||
{"AP11_int_back_wall_right", "AP11_int_back_wall_right.png", false},
|
||||
{"AP11_interior_back_wall_top_0Shape3", "back_wall_top_0Shape3_tpAmbient_paint_03.png", false},
|
||||
{"AP11_interior_belt_buckles_02_L2", "belt_buckles_02_L2Shape_tpAmbient.png", false},
|
||||
{"AP11_interior_belt_straps_02", "belt_straps_02Shape_tpAmbient_paint_01.png", false},
|
||||
{"AP11_interior_black_push_buttons", "push_buttonsShape_tpAmbient.png", false},
|
||||
{"AP11_interior_bottom_boxes_03", "bottom_boxes_03_paint_01.png", false},
|
||||
{"AP11_interior_bottom_floor_tp", "bottom_floor_tpAmbient_paint_v002.png", false},
|
||||
{"AP11_interior_box_back_01", "box_back_01_paint_v001.png", false},
|
||||
{"AP11_interior_box_back_02", "box_back_02_paint_v001.png", false},
|
||||
{"AP11_interior_box_back_04", "box_back_04_paint_v001.png", false},
|
||||
{"AP11_interior_box_lft_lower_01", "box_lft_lower_01Shape_Diffuse_paint_v002.png", false},
|
||||
{"AP11_interior_box_lft_top", "box_lft_topShape_Diffuse_paint_v009.png", false},
|
||||
{"AP11_interior_box_mid_tp", "box_mid_tpDiffuse_paint_v001.png", false},
|
||||
{"AP11_interior_box_rt_top_02", "box_rt_top_02_paint_04.png", false},
|
||||
{"AP11_interior_brushed_blue_ano", "brushed_blue_ano_paint_01.png", false},
|
||||
{"AP11_interior_brushed_brass", "brushed_brass_paint_01.png", false},
|
||||
{"AP11_interior_brushed_grey_ano", "brushed_grey_ano_paint_02.png", false},
|
||||
{"AP11_interior_canvas_cover", "canvas_coverShape_tpAmbient_paint_01.png", false},
|
||||
{"AP11_interior_Channel_attachment", "Channel_attachment_Diffuse.png", false},
|
||||
{"AP11_interior_Channel_baseMetal", "Channel_baseMetal_Diffuse.png", false},
|
||||
{"AP11_interior_Channel_Material", "Channel_Material_Diffuse.png", false},
|
||||
{"AP11_interior_Channel_rsMaterial2", "Channel_rsMaterial2_Diffuse.png", false},
|
||||
{"AP11_interior_cloth_01", "cloth_01Shape_tpAmbient_paint_01.png", false},
|
||||
{"AP11_interior_coiled_hose", "coiled_hoseShape_tpAmbient.png", false},
|
||||
{"AP11_interior_control_panel_left_win_plates", "control_panel_left_win_platesShape_tpAmbient.png", false},
|
||||
{"AP11_interior_control_panel_rt_win_plates", "control_panel_rt_win_platesShape_tpAmbient.png", false},
|
||||
{"AP11_interior_copper_parts_main_cp", "copper_parts_main_cpShape_tpAmbient.png", false},
|
||||
{"AP11_interior_dials_main2", "dials_main2Shape_tpAmbient.png", false},
|
||||
{"AP11_interior_dials_t2", "dials_t2Shape_tpAmbient.png", false},
|
||||
{"AP11_interior_dial_fixes_01", "dial_fixes_01Shape_tpAmbient.png", false},
|
||||
{"AP11_interior_fire_ex_02", "fire_ex_02_paint_v001.png", false},
|
||||
{"AP11_interior_floor_panels_3", "floor_panels_3Shape_tpAmbient_paint_01.png", false},
|
||||
{"AP11_interior_floor_tile_tex_01", "floor_tile_tex_01.png", false},
|
||||
{"AP11_interior_grey", "gray.png", false},
|
||||
{"AP11_interior_handholds_cp", "handholds_cpShape_tpAmbient_paint_05.png", false},
|
||||
{"AP11_interior_hatch_release_0Shape5", "hatch_release_0Shape5_tpAmbient_paint_02.png", false},
|
||||
{"AP11_interior_headrests_02", "headrests_02Shape_tpAmbient_paint_01.png", false},
|
||||
{"AP11_interior_hoses_black_01", "hoses_black_01Shape_tpAmbient_paint_01.png", false},
|
||||
{"AP11_interior_hoses_white_0Shape1", "hoses_white_0Shape1_tpAmbient_paint_01.png", false},
|
||||
{"AP11_interior_josticks1", "joysticks1Shape_tpAmbient_paint_01.png", false},
|
||||
{"AP11_interior_joysticks_fabric1", "joysticks_fabric1_Shape_tpAmbient_paint_01.png", false},
|
||||
{"AP11_interior_joystick_poles_lft_05", "joystick_poles_lft_05_paint_v002.png", false},
|
||||
{"AP11_interior_joystick_poles_lft_long_05", "joystick_poles_lft_long_05_paint_v002.png", false},
|
||||
{"AP11_interior_joystick_poles_rt_05", "joystick_poles_rt_05_paint_v002.png", false},
|
||||
{"AP11_interior_latch_mechanisms_01", "latch_mechanisms_01Shape_tpAmbient.png", false},
|
||||
{"AP11_interior_lower_push_buttons", "lower_push_buttonsShape_tpAmbient.png", false},
|
||||
{"AP11_interior_lower_walls_back", "lower_walls_back_paint_04.png", false},
|
||||
{"AP11_interior_lower_walls_boxes_head", "lower_walls_boxes_headShape_tpAmbient_paint_v001.png", false},
|
||||
{"AP11_interior_main_cp_left_smth_03", "main_cp_left_0Shape3_tpAmbient_paint_02.png", false},
|
||||
{"AP11_interior_main_cp_mid_smth_02", "main_cp_mid_smth_02Shape_tpAmbient_paint_02.png", false},
|
||||
{"AP11_interior_main_cp_rt_smth", "main_cp_rt_smthShape_tpAmbient_paint_02.png", false},
|
||||
{"AP11_interior_main_cp_wheels", "main_cp_wheelsShape_tpAmbient.png", false},
|
||||
{"AP11_interior_metal_brackets_under_hatch", "metal_brackets_under_hatchShape_tpAmbient.png", false},
|
||||
{"AP11_interior_metal_tunnel_parts", "metal_tunnel_partsShape_tpAmbient_paint_01.png", false},
|
||||
{"AP11_interior_metal_window_parts", "metal_window_partsShape_tpAmbient_paint_01.png", false},
|
||||
{"AP11_interior_middle_walls_05", "middle_walls_05_tpAmbient_paint_02.png", false},
|
||||
{"AP11_interior_middle_walls_0Shape8", "middle_walls_0Shape8_tpAmbient_paint_01.png", false},
|
||||
{"AP11_interior_mid_tunnel_parts", "mid_tunnel_parts_03Shape_tpAmbient_paint_02.png", false},
|
||||
{"AP11_interior_new_switch_rails1", "new_switch_rails1Shape_tpAmbient.png", false},
|
||||
{"AP11_interior_nozzles_02", "nozzles_02Shape_tpAmbient_paint_01.png", false},
|
||||
{"AP11_interior_outlet_fabric3", "outlet_fabric3Shape_tpAmbient_paint_02.png", false},
|
||||
{"AP11_interior_pole_end_02", "pole_end_02.png", false},
|
||||
{"AP11_interior_pole_end_03", "pole_end_03.png", false},
|
||||
{"AP11_interior_pole_tex_03", "pole_tex_03.png", false},
|
||||
{"AP11_interior_pole_tex_04", "pole_tex_04.png", false},
|
||||
{"AP11_interior_pole_tex_05", "pole_tex_05.png", false},
|
||||
{"AP11_interior_pole_tex_lower_01", "pole_tex_lower_01.png", false},
|
||||
{"AP11_interior_pole_under_seat_paint_01", "pole_under_seat_paint_01.png", false},
|
||||
{"AP11_interior_pole_under_seat_square_bar", "pole_under_seat_square_bar_paint_01.png", false},
|
||||
{"AP11_interior_push_switches_lft1", "push_switches_lft1Shape_tpAmbient.png", false},
|
||||
{"AP11_interior_random_small_parts_01", "random_small_parts_01Shape_tpAmbient_paint_02.png", false},
|
||||
{"AP11_interior_red", "red.png", false},
|
||||
{"AP11_interior_reticle_wheel_tp", "reticle_wheel_tpAmbient_paint_01.png", false},
|
||||
{"AP11_interior_rivet_paint_v001", "rivet_paint_v001.png", false},
|
||||
{"AP11_interior_seats_fabric", "seats_fabric_paint_01.png", false},
|
||||
{"AP11_interior_seat_left_tp", "seat_left_tpAmbient_paint_v001.png", false},
|
||||
{"AP11_interior_seat_lights_left", "seat_lights_left_Shape_tpAmbient_paint_v001.png", false},
|
||||
{"AP11_interior_seat_lights_rt", "seat_lights_rt_Shape_tpAmbient_paint_v001.png", false},
|
||||
{"AP11_interior_seat_middle_tp", "seat_middle_tpAmbient_paint_v001.png", false},
|
||||
{"AP11_interior_seat_poles_0Shape1", "seat_poles_0Shape1_tpAmbient_paint_01.png", false},
|
||||
{"AP11_interior_seat_pole_mirror_0Shape1", "seat_pole_mirror_0Shape1_tpAmbient_paint_01.png", false},
|
||||
{"AP11_interior_seat_rt_tp", "seat_rt_tpAmbient_paint_v001.png", false},
|
||||
{"AP11_interior_sextant_0Shape2", "sextant_0Shape2_tpAmbient.png", false},
|
||||
{"AP11_interior_switch_covers_main_middle1", "switch_covers_main_middle1Shape_tpAmbient.png", false},
|
||||
{"AP11_interior_switch_rails_lft", "switch_rails_lftShape_tpAmbient.png", false},
|
||||
{"AP11_interior_tunnel_main_cylinder1", "switch_rails_lftShape_tpAmbient.png", false},
|
||||
{"AP11_interior_tunnel_switches_01", "tunnel_switches_01Shape_tpAmbient.png", false},
|
||||
{"AP11_interior_tunnel_wheelsShape", "tunnel_wheelsShape_tpAmbient.png", false},
|
||||
{"AP11_interior_walls_mid_left", "walls_mid_leftShape_tpAmbient_paint_01.png", false},
|
||||
{"AP11_interior_windows_front_0Shape4", "windows_front_0Shape4_tpAmbient_paint_01.png", false}
|
||||
{ "AP11_int_back_wall_left", "AP11_int_back_wall_left.png", false },
|
||||
{ "AP11_int_back_wall_right", "AP11_int_back_wall_right.png", false },
|
||||
{ "AP11_interior_back_wall_top_0Shape3", "back_wall_top_0Shape3_tpAmbient_paint_03.png", false },
|
||||
{ "AP11_interior_belt_buckles_02_L2", "belt_buckles_02_L2Shape_tpAmbient.png", false },
|
||||
{ "AP11_interior_belt_straps_02", "belt_straps_02Shape_tpAmbient_paint_01.png", false },
|
||||
{ "AP11_interior_black_push_buttons", "push_buttonsShape_tpAmbient.png", false },
|
||||
{ "AP11_interior_bottom_boxes_03", "bottom_boxes_03_paint_01.png", false },
|
||||
{ "AP11_interior_bottom_floor_tp", "bottom_floor_tpAmbient_paint_v002.png", false },
|
||||
{ "AP11_interior_box_back_01", "box_back_01_paint_v001.png", false },
|
||||
{ "AP11_interior_box_back_02", "box_back_02_paint_v001.png", false },
|
||||
{ "AP11_interior_box_back_04", "box_back_04_paint_v001.png", false },
|
||||
{ "AP11_interior_box_lft_lower_01", "box_lft_lower_01Shape_Diffuse_paint_v002.png", false },
|
||||
{ "AP11_interior_box_lft_top", "box_lft_topShape_Diffuse_paint_v009.png", false },
|
||||
{ "AP11_interior_box_mid_tp", "box_mid_tpDiffuse_paint_v001.png", false },
|
||||
{ "AP11_interior_box_rt_top_02", "box_rt_top_02_paint_04.png", false },
|
||||
{ "AP11_interior_brushed_blue_ano", "brushed_blue_ano_paint_01.png", false },
|
||||
{ "AP11_interior_brushed_brass", "brushed_brass_paint_01.png", false },
|
||||
{ "AP11_interior_brushed_grey_ano", "brushed_grey_ano_paint_02.png", false },
|
||||
{ "AP11_interior_canvas_cover", "canvas_coverShape_tpAmbient_paint_01.png", false },
|
||||
{ "AP11_interior_Channel_attachment", "Channel_attachment_Diffuse.png", false },
|
||||
{ "AP11_interior_Channel_baseMetal", "Channel_baseMetal_Diffuse.png", false },
|
||||
{ "AP11_interior_Channel_Material", "Channel_Material_Diffuse.png", false },
|
||||
{ "AP11_interior_Channel_rsMaterial2", "Channel_rsMaterial2_Diffuse.png", false },
|
||||
{ "AP11_interior_cloth_01", "cloth_01Shape_tpAmbient_paint_01.png", false },
|
||||
{ "AP11_interior_coiled_hose", "coiled_hoseShape_tpAmbient.png", false },
|
||||
{ "AP11_interior_control_panel_left_win_plates", "control_panel_left_win_platesShape_tpAmbient.png", false },
|
||||
{ "AP11_interior_control_panel_rt_win_plates", "control_panel_rt_win_platesShape_tpAmbient.png", false },
|
||||
{ "AP11_interior_copper_parts_main_cp", "copper_parts_main_cpShape_tpAmbient.png", false },
|
||||
{ "AP11_interior_dials_main2", "dials_main2Shape_tpAmbient.png", false },
|
||||
{ "AP11_interior_dials_t2", "dials_t2Shape_tpAmbient.png", false },
|
||||
{ "AP11_interior_dial_fixes_01", "dial_fixes_01Shape_tpAmbient.png", false },
|
||||
{ "AP11_interior_fire_ex_02", "fire_ex_02_paint_v001.png", false },
|
||||
{ "AP11_interior_floor_panels_3", "floor_panels_3Shape_tpAmbient_paint_01.png", false },
|
||||
{ "AP11_interior_floor_tile_tex_01", "floor_tile_tex_01.png", false },
|
||||
{ "AP11_interior_grey", "gray.png", false },
|
||||
{ "AP11_interior_handholds_cp", "handholds_cpShape_tpAmbient_paint_05.png", false },
|
||||
{ "AP11_interior_hatch_release_0Shape5", "hatch_release_0Shape5_tpAmbient_paint_02.png", false },
|
||||
{ "AP11_interior_headrests_02", "headrests_02Shape_tpAmbient_paint_01.png", false },
|
||||
{ "AP11_interior_hoses_black_01", "hoses_black_01Shape_tpAmbient_paint_01.png", false },
|
||||
{ "AP11_interior_hoses_white_0Shape1", "hoses_white_0Shape1_tpAmbient_paint_01.png", false },
|
||||
{ "AP11_interior_josticks1", "joysticks1Shape_tpAmbient_paint_01.png", false },
|
||||
{ "AP11_interior_joysticks_fabric1", "joysticks_fabric1_Shape_tpAmbient_paint_01.png", false },
|
||||
{ "AP11_interior_joystick_poles_lft_05", "joystick_poles_lft_05_paint_v002.png", false },
|
||||
{ "AP11_interior_joystick_poles_lft_long_05", "joystick_poles_lft_long_05_paint_v002.png", false },
|
||||
{ "AP11_interior_joystick_poles_rt_05", "joystick_poles_rt_05_paint_v002.png", false },
|
||||
{ "AP11_interior_latch_mechanisms_01", "latch_mechanisms_01Shape_tpAmbient.png", false },
|
||||
{ "AP11_interior_lower_push_buttons", "lower_push_buttonsShape_tpAmbient.png", false },
|
||||
{ "AP11_interior_lower_walls_back", "lower_walls_back_paint_04.png", false },
|
||||
{ "AP11_interior_lower_walls_boxes_head", "lower_walls_boxes_headShape_tpAmbient_paint_v001.png", false },
|
||||
{ "AP11_interior_main_cp_left_smth_03", "main_cp_left_0Shape3_tpAmbient_paint_02.png", false },
|
||||
{ "AP11_interior_main_cp_mid_smth_02", "main_cp_mid_smth_02Shape_tpAmbient_paint_02.png", false },
|
||||
{ "AP11_interior_main_cp_rt_smth", "main_cp_rt_smthShape_tpAmbient_paint_02.png", false },
|
||||
{ "AP11_interior_main_cp_wheels", "main_cp_wheelsShape_tpAmbient.png", false },
|
||||
{ "AP11_interior_metal_brackets_under_hatch", "metal_brackets_under_hatchShape_tpAmbient.png", false },
|
||||
{ "AP11_interior_metal_tunnel_parts", "metal_tunnel_partsShape_tpAmbient_paint_01.png", false },
|
||||
{ "AP11_interior_metal_window_parts", "metal_window_partsShape_tpAmbient_paint_01.png", false },
|
||||
{ "AP11_interior_middle_walls_05", "middle_walls_05_tpAmbient_paint_02.png", false },
|
||||
{ "AP11_interior_middle_walls_0Shape8", "middle_walls_0Shape8_tpAmbient_paint_01.png", false },
|
||||
{ "AP11_interior_mid_tunnel_parts", "mid_tunnel_parts_03Shape_tpAmbient_paint_02.png", false },
|
||||
{ "AP11_interior_new_switch_rails1", "new_switch_rails1Shape_tpAmbient.png", false },
|
||||
{ "AP11_interior_nozzles_02", "nozzles_02Shape_tpAmbient_paint_01.png", false },
|
||||
{ "AP11_interior_outlet_fabric3", "outlet_fabric3Shape_tpAmbient_paint_02.png", false },
|
||||
{ "AP11_interior_pole_end_02", "pole_end_02.png", false },
|
||||
{ "AP11_interior_pole_end_03", "pole_end_03.png", false },
|
||||
{ "AP11_interior_pole_tex_03", "pole_tex_03.png", false },
|
||||
{ "AP11_interior_pole_tex_04", "pole_tex_04.png", false },
|
||||
{ "AP11_interior_pole_tex_05", "pole_tex_05.png", false },
|
||||
{ "AP11_interior_pole_tex_lower_01", "pole_tex_lower_01.png", false },
|
||||
{ "AP11_interior_pole_under_seat_paint_01", "pole_under_seat_paint_01.png", false },
|
||||
{ "AP11_interior_pole_under_seat_square_bar", "pole_under_seat_square_bar_paint_01.png", false },
|
||||
{ "AP11_interior_push_switches_lft1", "push_switches_lft1Shape_tpAmbient.png", false },
|
||||
{ "AP11_interior_random_small_parts_01", "random_small_parts_01Shape_tpAmbient_paint_02.png", false },
|
||||
{ "AP11_interior_red", "red.png", false },
|
||||
{ "AP11_interior_reticle_wheel_tp", "reticle_wheel_tpAmbient_paint_01.png", false },
|
||||
{ "AP11_interior_rivet_paint_v001", "rivet_paint_v001.png", false },
|
||||
{ "AP11_interior_seats_fabric", "seats_fabric_paint_01.png", false },
|
||||
{ "AP11_interior_seat_left_tp", "seat_left_tpAmbient_paint_v001.png", false },
|
||||
{ "AP11_interior_seat_lights_left", "seat_lights_left_Shape_tpAmbient_paint_v001.png", false },
|
||||
{ "AP11_interior_seat_lights_rt", "seat_lights_rt_Shape_tpAmbient_paint_v001.png", false },
|
||||
{ "AP11_interior_seat_middle_tp", "seat_middle_tpAmbient_paint_v001.png", false },
|
||||
{ "AP11_interior_seat_poles_0Shape1", "seat_poles_0Shape1_tpAmbient_paint_01.png", false },
|
||||
{ "AP11_interior_seat_pole_mirror_0Shape1", "seat_pole_mirror_0Shape1_tpAmbient_paint_01.png", false },
|
||||
{ "AP11_interior_seat_rt_tp", "seat_rt_tpAmbient_paint_v001.png", false },
|
||||
{ "AP11_interior_sextant_0Shape2", "sextant_0Shape2_tpAmbient.png", false },
|
||||
{ "AP11_interior_switch_covers_main_middle1", "switch_covers_main_middle1Shape_tpAmbient.png", false },
|
||||
{ "AP11_interior_switch_rails_lft", "switch_rails_lftShape_tpAmbient.png", false },
|
||||
{ "AP11_interior_tunnel_main_cylinder1", "switch_rails_lftShape_tpAmbient.png", false },
|
||||
{ "AP11_interior_tunnel_switches_01", "tunnel_switches_01Shape_tpAmbient.png", false },
|
||||
{ "AP11_interior_tunnel_wheelsShape", "tunnel_wheelsShape_tpAmbient.png", false },
|
||||
{ "AP11_interior_walls_mid_left", "walls_mid_leftShape_tpAmbient_paint_01.png", false },
|
||||
{ "AP11_interior_windows_front_0Shape4", "windows_front_0Shape4_tpAmbient_paint_01.png", false }
|
||||
}
|
||||
|
||||
|
||||
|
||||
asset.export("registerCsm", function (asset, parentNodeIdentifier)
|
||||
asset.export("createCsmModel", function (parentNodeIdentifier)
|
||||
local parts = {}
|
||||
for i, info in ipairs(partsInfo) do
|
||||
parts[#parts + 1] = assetHelper.createModelPart(
|
||||
parts[#parts + 1] = asset_helper.createModelPart(
|
||||
parentNodeIdentifier,
|
||||
sunTransforms.SolarSystemBarycenter.Identifier,
|
||||
sun_transforms.SolarSystemBarycenter.Identifier,
|
||||
models,
|
||||
info[1],
|
||||
info[2],
|
||||
info[3]
|
||||
)
|
||||
end
|
||||
assetHelper.registerSceneGraphNodesAndExport(asset, parts)
|
||||
return parts
|
||||
end)
|
||||
|
||||
|
||||
|
||||
asset.export("registerCsmFull", function (asset, parentNodeIdentifier)
|
||||
asset.export("createCsmModelFull", function (parentNodeIdentifier)
|
||||
local parts = {}
|
||||
for i, info in ipairs(partsInfoFull) do
|
||||
parts[#parts + 1] = assetHelper.createModelPart(
|
||||
parts[#parts + 1] = asset_helper.createModelPart(
|
||||
parentNodeIdentifier,
|
||||
sunTransforms.SolarSystemBarycenter.Identifier,
|
||||
sun_transforms.SolarSystemBarycenter.Identifier,
|
||||
models,
|
||||
info[1],
|
||||
info[2],
|
||||
info[3]
|
||||
)
|
||||
end
|
||||
assetHelper.registerSceneGraphNodesAndExport(asset, parts)
|
||||
end)
|
||||
return parts
|
||||
end)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
--apollo_globebrowsing.asset
|
||||
|
||||
local moon_transforms = asset.require('scene/solarsystem/planets/earth/moon/moon')
|
||||
|
||||
local heightmaps = asset.syncedResource({
|
||||
Name = "Apollo Globebrowsing Heightmaps",
|
||||
@@ -30,8 +30,8 @@ local stations = asset.syncedResource({
|
||||
})
|
||||
|
||||
asset.onInitialize(function ()
|
||||
openspace.globebrowsing.addBlendingLayersFromDirectory(heightmaps, "Moon")
|
||||
openspace.globebrowsing.addBlendingLayersFromDirectory(basemaps, "Moon")
|
||||
openspace.globebrowsing.addBlendingLayersFromDirectory(naclighting, "Moon")
|
||||
openspace.globebrowsing.addBlendingLayersFromDirectory(stations, "Moon")
|
||||
openspace.globebrowsing.addBlendingLayersFromDirectory(heightmaps, moon_transforms.Moon.Identifier)
|
||||
openspace.globebrowsing.addBlendingLayersFromDirectory(basemaps, moon_transforms.Moon.Identifier)
|
||||
openspace.globebrowsing.addBlendingLayersFromDirectory(naclighting, moon_transforms.Moon.Identifier)
|
||||
openspace.globebrowsing.addBlendingLayersFromDirectory(stations, moon_transforms.Moon.Identifier)
|
||||
end)
|
||||
|
||||
@@ -3,11 +3,11 @@
|
||||
-- This asset exports a function to create an Apollo Lunar Excursion Module (LEM).
|
||||
-- Instead of hard-coding the scene graph node parent,
|
||||
-- client assets can decide which object that the LEM should be attached to.
|
||||
-- Usage example: registerLem(asset, Apollo11Lem.Idenfitier)
|
||||
-- Usage example: createLem(Apollo11Lem.Idenfitier)
|
||||
-- ...where Apollo11Lem is the scene graph node identifier to attach the LEM to.
|
||||
|
||||
local assetHelper = asset.require('util/asset_helper')
|
||||
local sunTransforms = asset.require('scene/solarsystem/sun/transforms')
|
||||
local asset_helper = asset.require('util/asset_helper')
|
||||
local sun_transforms = asset.require('scene/solarsystem/sun/transforms')
|
||||
|
||||
local models = asset.syncedResource({
|
||||
Name = "Apollo Models",
|
||||
@@ -35,17 +35,17 @@ local partsInfo = {
|
||||
}
|
||||
|
||||
|
||||
asset.export("registerLem", function (asset, parentNodeIdentifier)
|
||||
asset.export("createLem", function (parentNodeIdentifier)
|
||||
local parts = {}
|
||||
for i, info in ipairs(partsInfo) do
|
||||
parts[#parts + 1] = assetHelper.createModelPart(
|
||||
parts[#parts + 1] = asset_helper.createModelPart(
|
||||
parentNodeIdentifier,
|
||||
sunTransforms.SolarSystemBarycenter.Identifier,
|
||||
sun_transforms.SolarSystemBarycenter.Identifier,
|
||||
models,
|
||||
info[1],
|
||||
info[2],
|
||||
info[3]
|
||||
)
|
||||
end
|
||||
assetHelper.registerSceneGraphNodesAndExport(asset, parts)
|
||||
return parts
|
||||
end)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
-- The insignias are invisible by default, but can be enabled using shown or hidden using
|
||||
-- the exported functions `showInsignias(interpolationDuration)` and `hideInsignias(interpolationDuration)`.
|
||||
|
||||
local assetHelper = asset.require('util/asset_helper')
|
||||
local asset_helper = asset.require('util/asset_helper')
|
||||
|
||||
local insigniasPath = asset.syncedResource({
|
||||
Name = "Apollo Insignias",
|
||||
@@ -18,37 +18,37 @@ local landingData = {
|
||||
Name = "Apollo 11",
|
||||
Name = "Apollo 11",
|
||||
Texture = "apollo11.png",
|
||||
LunarModule = {0.67409, 23.47298, 0.0},
|
||||
LunarModule = { 0.67409, 23.47298, 0.0 }
|
||||
},
|
||||
{
|
||||
Identifier = "Apollo12",
|
||||
Name = "Apollo 12",
|
||||
Texture = "apollo12.png",
|
||||
LunarModule = {-3.01381, -23.41930, 0.0}
|
||||
LunarModule = { -3.01381, -23.41930, 0.0 }
|
||||
},
|
||||
{
|
||||
Identifier = "Apollo14",
|
||||
Name = "Apollo 14",
|
||||
Texture = "apollo14.png",
|
||||
LunarModule = {-3.64544, -17.47139, 0.0}
|
||||
LunarModule = { -3.64544, -17.47139, 0.0 }
|
||||
},
|
||||
{
|
||||
Identifier = "Apollo15",
|
||||
Name = "Apollo 15",
|
||||
Texture = "apollo15.png",
|
||||
LunarModule = {26.13224, 3.63400, 0.0}
|
||||
LunarModule = { 26.13224, 3.63400, 0.0 }
|
||||
},
|
||||
{
|
||||
Identifier = "Apollo16",
|
||||
Name = "Apollo 16",
|
||||
Texture = "apollo16.png",
|
||||
LunarModule = {-8.97341, 15.49859, 0.0}
|
||||
LunarModule = { -8.97341, 15.49859, 0.0 }
|
||||
},
|
||||
{
|
||||
Identifier = "Apollo17",
|
||||
Name = "Apollo 17",
|
||||
Texture = "apollo17.png",
|
||||
LunarModule = {20.18809, 30.77475, 0.0}
|
||||
LunarModule = { 20.18809, 30.77475, 0.0 }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -117,4 +117,4 @@ asset.export('hideInsignias', function (interpolationDuration)
|
||||
openspace.setPropertyValue("Scene.Apollo*Insignia.Renderable.Opacity", 0, interpolationDuration)
|
||||
end)
|
||||
|
||||
assetHelper.registerSceneGraphNodesAndExport(asset, nodes)
|
||||
asset_helper.registerSceneGraphNodesAndExport(asset, nodes)
|
||||
|
||||
@@ -61,7 +61,12 @@ local Voyager1 = {
|
||||
Rotation = {
|
||||
Type = "SpiceRotation",
|
||||
SourceFrame = "VG1_SC_BUS",
|
||||
DestinationFrame = "GALACTIC"
|
||||
DestinationFrame = "GALACTIC",
|
||||
TimeFrame = {
|
||||
Type = "TimeFrameInterval",
|
||||
Start = "1977-SEP-05 14:10:11.786",
|
||||
End = "2027-DEC-27"
|
||||
}
|
||||
}
|
||||
},
|
||||
GUI = {
|
||||
|
||||
@@ -64,7 +64,12 @@ local Voyager2 = {
|
||||
Rotation = {
|
||||
Type = "SpiceRotation",
|
||||
SourceFrame = "VG2_SC_BUS",
|
||||
DestinationFrame = "GALACTIC"
|
||||
DestinationFrame = "GALACTIC",
|
||||
TimeFrame = {
|
||||
Type = "TimeFrameInterval",
|
||||
Start = "1977-AUG-20 16:07:06.535",
|
||||
End = "2027-DEC-27"
|
||||
}
|
||||
}
|
||||
},
|
||||
GUI = {
|
||||
|
||||
@@ -22,3 +22,13 @@ asset.request('./planets/uranus/major_moons')
|
||||
|
||||
asset.request('./planets/neptune/neptune')
|
||||
asset.request('./planets/neptune/major_moons')
|
||||
|
||||
|
||||
asset.meta = {
|
||||
Name = "Planets",
|
||||
Version = "1.0",
|
||||
Description = [[ Collection of planets in the solar system ]],
|
||||
Author = "OpenSpace Team",
|
||||
URL = "http://openspaceproject.com",
|
||||
License = "MIT license"
|
||||
}
|
||||
|
||||
@@ -112,12 +112,12 @@ local Earth = {
|
||||
)
|
||||
},
|
||||
{
|
||||
Name = "BMNH [Utah]",
|
||||
Name = "BMNG [Utah]",
|
||||
Identifier = "BMNG_Utah",
|
||||
FilePath = mapServiceConfigsPath .. "/Utah/Bmng.wms"
|
||||
},
|
||||
{
|
||||
Name = "BMNH [Sweden]",
|
||||
Name = "BMNG [Sweden]",
|
||||
Identifier = "BMNG_Sweden",
|
||||
FilePath = mapServiceConfigsPath .. "/LiU/Bmng.wms"
|
||||
},
|
||||
@@ -329,3 +329,13 @@ local EarthLabel = {
|
||||
|
||||
|
||||
assetHelper.registerSceneGraphNodesAndExport(asset, { Earth, EarthLabel })
|
||||
|
||||
|
||||
asset.meta = {
|
||||
Name = "Earth",
|
||||
Version = "1.0",
|
||||
Description = [[ Earth is a special planet with special needs ]],
|
||||
Author = "OpenSpace Team",
|
||||
URL = "http://openspaceproject.com",
|
||||
License = "MIT license"
|
||||
}
|
||||
|
||||
@@ -100,12 +100,12 @@ local Moon = {
|
||||
},
|
||||
{
|
||||
Identifier = "Lola_Clr_Shade_Utah",
|
||||
Name = "Lola Clear Shade [Utah]",
|
||||
Name = "Lola Color Shade [Utah]",
|
||||
FilePath = mapServiceConfigs .. "/Utah/LolaClrShade.wms"
|
||||
},
|
||||
{
|
||||
Identifier = "Lola_Clr_Shade_Sweden",
|
||||
Name = "Lola Clear Shade [Sweden]",
|
||||
Name = "Lola Color Shade [Sweden]",
|
||||
FilePath = mapServiceConfigs .. "/LiU/Lola_Clr_Shade.wms"
|
||||
},
|
||||
{
|
||||
|
||||
@@ -10,7 +10,7 @@ local EarthBarycenter = {
|
||||
Transform = {
|
||||
Translation = {
|
||||
Type = "SpiceTranslation",
|
||||
Target = "EARTH",
|
||||
Target = "EARTH BARYCENTER",
|
||||
Observer = "SUN"
|
||||
}
|
||||
},
|
||||
@@ -21,10 +21,27 @@ local EarthBarycenter = {
|
||||
}
|
||||
}
|
||||
|
||||
local EarthCenter = {
|
||||
Identifier = "EarthCenter",
|
||||
Parent = EarthBarycenter.Identifier,
|
||||
Transform = {
|
||||
Translation = {
|
||||
Type = "SpiceTranslation",
|
||||
Target = "EARTH",
|
||||
Observer = "EARTH BARYCENTER"
|
||||
}
|
||||
},
|
||||
GUI = {
|
||||
Name = "Earth Center",
|
||||
Path = "/Solar System/Planets/Earth",
|
||||
Hidden = true
|
||||
}
|
||||
}
|
||||
|
||||
local EarthInertial = {
|
||||
-- The default reference frame for Earth-orbiting satellites
|
||||
Identifier = "EarthInertial",
|
||||
Parent = EarthBarycenter.Identifier,
|
||||
Parent = EarthCenter.Identifier,
|
||||
Transform = {
|
||||
Rotation = {
|
||||
Type = "SpiceRotation",
|
||||
@@ -41,7 +58,7 @@ local EarthInertial = {
|
||||
|
||||
local EarthIAU = {
|
||||
Identifier = "EarthIAU",
|
||||
Parent = EarthBarycenter.Identifier,
|
||||
Parent = EarthCenter.Identifier,
|
||||
Transform = {
|
||||
Rotation = {
|
||||
Type = "SpiceRotation",
|
||||
@@ -58,6 +75,7 @@ local EarthIAU = {
|
||||
|
||||
assetHelper.registerSceneGraphNodesAndExport(asset, {
|
||||
EarthBarycenter,
|
||||
EarthCenter,
|
||||
EarthInertial,
|
||||
EarthIAU
|
||||
})
|
||||
|
||||
@@ -82,3 +82,13 @@ end
|
||||
|
||||
|
||||
asset.export("setCefRoute", setCefRoute)
|
||||
|
||||
|
||||
asset.meta = {
|
||||
Name = "WebGUI",
|
||||
Version = "0.1",
|
||||
Description = [[ insert CEF rant ]],
|
||||
Author = "OpenSpace Team",
|
||||
URL = "http://openspaceproject.com",
|
||||
License = "MIT license"
|
||||
}
|
||||
|
||||
@@ -3,14 +3,12 @@
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<p>
|
||||
<a href="#{{urlify module}}" name="{{urlify module}}">
|
||||
<span class="documentation-key">{{module}}</span>
|
||||
</a>
|
||||
<p>{{name}}</p>
|
||||
<br />
|
||||
<p>{{attribution}}</p>
|
||||
<p>{{url}}</p>
|
||||
<p>{{licenseText}}</p>
|
||||
<h3>Asset - {{name}}</h3>
|
||||
<p>{{description}}</p>
|
||||
<p>Version - {{version}}</p>
|
||||
<p>Author - {{author}}</p>
|
||||
<p>Associated URL - <a href="{{url}}">{{url}}</a></p>
|
||||
<p>Filepath - {{path}}</p>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Submodule ext/ghoul updated: df1522a1fe...a634fc1515
@@ -28,6 +28,7 @@
|
||||
#include <openspace/util/resourcesynchronization.h>
|
||||
#include <openspace/util/synchronizationwatcher.h>
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
@@ -37,7 +38,7 @@ class AssetLoader;
|
||||
|
||||
class Asset : public std::enable_shared_from_this<Asset> {
|
||||
public:
|
||||
enum class State : unsigned int {
|
||||
enum class State {
|
||||
Unloaded,
|
||||
LoadingFailed,
|
||||
Loaded,
|
||||
@@ -48,8 +49,14 @@ public:
|
||||
InitializationFailed
|
||||
};
|
||||
|
||||
using StateChangeCallback = std::function<void(State)>;
|
||||
using CallbackHandle = size_t;
|
||||
struct MetaInformation {
|
||||
std::string name;
|
||||
std::string version;
|
||||
std::string description;
|
||||
std::string author;
|
||||
std::string url;
|
||||
std::string license;
|
||||
};
|
||||
|
||||
/**
|
||||
* Root asset constructor
|
||||
@@ -69,10 +76,9 @@ public:
|
||||
AssetLoader* loader() const;
|
||||
State state() const;
|
||||
|
||||
void addSynchronization(std::shared_ptr<ResourceSynchronization> synchronization);
|
||||
void addSynchronization(std::unique_ptr<ResourceSynchronization> synchronization);
|
||||
void clearSynchronizations();
|
||||
const std::vector<std::shared_ptr<ResourceSynchronization>>&
|
||||
ownSynchronizations() const;
|
||||
std::vector<ResourceSynchronization*> ownSynchronizations() const;
|
||||
|
||||
void syncStateChanged(ResourceSynchronization* sync,
|
||||
ResourceSynchronization::State state);
|
||||
@@ -92,12 +98,6 @@ public:
|
||||
* its own synchronizations and required assets' synchronizations could start.
|
||||
*/
|
||||
bool startSynchronizations();
|
||||
bool hasSyncingOrResolvedParent() const;
|
||||
bool isSynchronized() const;
|
||||
bool isSyncingOrResolved() const;
|
||||
bool cancelAllSynchronizations();
|
||||
bool cancelUnwantedSynchronizations();
|
||||
bool restartAllSynchronizations();
|
||||
float requiredSynchronizationProgress() const;
|
||||
float requestedSynchronizationProgress();
|
||||
|
||||
@@ -120,21 +120,16 @@ public:
|
||||
void request(std::shared_ptr<Asset> child);
|
||||
void unrequest(Asset* child);
|
||||
|
||||
const std::vector<std::shared_ptr<Asset>>& requestedAssets() const;
|
||||
std::vector<std::shared_ptr<Asset>> requestingAssets() const;
|
||||
const std::vector<std::shared_ptr<Asset>>& requiredAssets() const;
|
||||
std::vector<std::shared_ptr<Asset>> requiringAssets() const;
|
||||
std::vector<Asset*> requestedAssets() const;
|
||||
std::vector<Asset*> requestingAssets() const;
|
||||
std::vector<Asset*> requiredAssets() const;
|
||||
std::vector<Asset*> requiringAssets() const;
|
||||
|
||||
std::vector<std::shared_ptr<const Asset>> requiredSubTreeAssets() const;
|
||||
std::vector<std::shared_ptr<const Asset>> subTreeAssets() const;
|
||||
std::vector<std::shared_ptr<Asset>> childAssets() const;
|
||||
std::vector<std::shared_ptr<Asset>> parentAssets() const;
|
||||
std::vector<const Asset*> subTreeAssets() const;
|
||||
std::vector<Asset*> childAssets() const;
|
||||
|
||||
bool isRequired() const;
|
||||
bool isRequested() const;
|
||||
bool shouldBeInitialized() const;
|
||||
|
||||
std::string resolveLocalResource(std::string resourceName);
|
||||
void setMetaInformation(MetaInformation metaInformation);
|
||||
std::optional<MetaInformation> metaInformation() const;
|
||||
|
||||
private:
|
||||
void setState(State state);
|
||||
@@ -142,7 +137,14 @@ private:
|
||||
void requiredAssetChangedState(Asset::State childState);
|
||||
void requestedAssetChangedState(Asset* child, Asset::State childState);
|
||||
|
||||
bool isSynchronized() const;
|
||||
bool isSyncingOrResolved() const;
|
||||
bool isSyncResolveReady();
|
||||
bool hasSyncingOrResolvedParent() const;
|
||||
bool cancelAllSynchronizations();
|
||||
bool cancelUnwantedSynchronizations();
|
||||
|
||||
std::vector<const Asset*> requiredSubTreeAssets() const;
|
||||
|
||||
std::atomic<State> _state;
|
||||
AssetLoader* _loader;
|
||||
@@ -157,6 +159,8 @@ private:
|
||||
// Absolute path to asset file
|
||||
std::string _assetPath;
|
||||
|
||||
std::optional<MetaInformation> _metaInformation;
|
||||
|
||||
// Required assets
|
||||
std::vector<std::shared_ptr<Asset>> _requiredAssets;
|
||||
|
||||
|
||||
@@ -32,12 +32,9 @@ namespace openspace {
|
||||
class AssetListener {
|
||||
public:
|
||||
virtual ~AssetListener() = default;
|
||||
virtual void assetStateChanged(std::shared_ptr<Asset> asset, Asset::State state) = 0;
|
||||
virtual void assetRequested(std::shared_ptr<Asset> parent,
|
||||
std::shared_ptr<Asset> child) = 0;
|
||||
|
||||
virtual void assetUnrequested(std::shared_ptr<Asset> parent,
|
||||
std::shared_ptr<Asset> child) = 0;
|
||||
virtual void assetStateChanged(Asset* asset, Asset::State state) = 0;
|
||||
virtual void assetRequested(Asset* parent, std::shared_ptr<Asset> child) = 0;
|
||||
virtual void assetUnrequested(Asset* parent, std::shared_ptr<Asset> child) = 0;
|
||||
};
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
@@ -49,15 +49,13 @@ int request(lua_State* state);
|
||||
int exists(lua_State* state);
|
||||
int localResource(lua_State* state);
|
||||
int syncedResource(lua_State* state);
|
||||
int noOperation(lua_State* state);
|
||||
int exportAsset(lua_State* state);
|
||||
|
||||
} // namespace assetloader
|
||||
|
||||
class Asset;
|
||||
class AssetListener;
|
||||
class ResourceSynchronization;
|
||||
class SynchronizationWatcher;
|
||||
class AssetListener;
|
||||
|
||||
class AssetLoader {
|
||||
public:
|
||||
@@ -87,30 +85,26 @@ public:
|
||||
void untrackAsset(Asset* asset);
|
||||
|
||||
/**
|
||||
* Return the asset identified by the identifier,
|
||||
* if the asset is tracked. Otherwise return nullptr.
|
||||
*/
|
||||
* Return the asset identified by the identifier,
|
||||
* if the asset is tracked. Otherwise return nullptr.
|
||||
*/
|
||||
std::shared_ptr<Asset> has(const std::string& identifier) const;
|
||||
|
||||
/**
|
||||
* Return the lua state
|
||||
*/
|
||||
ghoul::lua::LuaState* luaState();
|
||||
/// Return the root asset
|
||||
const Asset& rootAsset() const;
|
||||
|
||||
/// Return the root asset
|
||||
Asset& rootAsset();
|
||||
|
||||
/**
|
||||
* Return the root asset
|
||||
* Return the asset root directory
|
||||
*/
|
||||
std::shared_ptr<Asset> rootAsset() const;
|
||||
|
||||
/**
|
||||
* Return the asset root directory
|
||||
*/
|
||||
const std::string& assetRootDirectory() const;
|
||||
|
||||
/**
|
||||
* Load an asset
|
||||
*/
|
||||
bool loadAsset(std::shared_ptr<Asset> asset);
|
||||
bool loadAsset(Asset* asset);
|
||||
|
||||
/**
|
||||
* Unload an asset
|
||||
@@ -157,30 +151,29 @@ public:
|
||||
/**
|
||||
* Notify listeners about asset state change
|
||||
*/
|
||||
void assetStateChanged(std::shared_ptr<Asset> asset, Asset::State state);
|
||||
void assetStateChanged(Asset* asset, Asset::State state);
|
||||
|
||||
/**
|
||||
* Notify listeners about new requests
|
||||
*/
|
||||
void assetRequested(std::shared_ptr<Asset> parent, std::shared_ptr<Asset> child);
|
||||
void assetRequested(Asset* parent, std::shared_ptr<Asset> child);
|
||||
|
||||
/**
|
||||
* Notify listeners about removed requests
|
||||
*/
|
||||
void assetUnrequested(std::shared_ptr<Asset> parent, std::shared_ptr<Asset> child);
|
||||
void assetUnrequested(Asset* parent, std::shared_ptr<Asset> child);
|
||||
|
||||
private:
|
||||
std::shared_ptr<Asset> require(const std::string& identifier);
|
||||
std::shared_ptr<Asset> request(const std::string& identifier);
|
||||
void unrequest(const std::string& identifier);
|
||||
|
||||
void setUpAssetLuaTable(Asset* asset);
|
||||
void tearDownAssetLuaTable(Asset* asset);
|
||||
|
||||
std::shared_ptr<Asset> getAsset(std::string name);
|
||||
std::shared_ptr<Asset> getAsset(const std::string& name);
|
||||
ghoul::filesystem::Directory currentDirectory() const;
|
||||
|
||||
void setCurrentAsset(std::shared_ptr<Asset> asset);
|
||||
void setCurrentAsset(Asset* asset);
|
||||
void addLuaDependencyTable(Asset* dependant, Asset* dependency);
|
||||
|
||||
// Lua functions
|
||||
@@ -195,7 +188,7 @@ private:
|
||||
int syncedResourceLua(Asset* asset);
|
||||
int exportAssetLua(Asset* asset);
|
||||
|
||||
// Friend c closures (callable from lua, and maps to lua functions above)
|
||||
// Friend C closures (callable from Lua, and maps to Lua functions above)
|
||||
friend int assetloader::onInitialize(lua_State* state);
|
||||
friend int assetloader::onDeinitialize(lua_State* state);
|
||||
friend int assetloader::onInitializeDependency(lua_State* state);
|
||||
@@ -209,7 +202,7 @@ private:
|
||||
|
||||
// Member variables
|
||||
std::shared_ptr<Asset> _rootAsset;
|
||||
std::shared_ptr<Asset> _currentAsset;
|
||||
Asset* _currentAsset = nullptr;
|
||||
std::unordered_map<std::string, std::weak_ptr<Asset>> _trackedAssets;
|
||||
SynchronizationWatcher* _synchronizationWatcher;
|
||||
std::string _assetRootDirectory;
|
||||
@@ -218,14 +211,14 @@ private:
|
||||
// State change listeners
|
||||
std::vector<AssetListener*> _assetListeners;
|
||||
|
||||
// References to lua values
|
||||
// References to Lua values
|
||||
std::unordered_map<Asset*, std::vector<int>> _onInitializationFunctionRefs;
|
||||
std::unordered_map<Asset*, std::vector<int>> _onDeinitializationFunctionRefs;
|
||||
std::unordered_map<Asset*, std::map<Asset*, std::vector<int>>>
|
||||
_onDependencyInitializationFunctionRefs;
|
||||
std::unordered_map<Asset*, std::map<Asset*, std::vector<int>>>
|
||||
_onDependencyDeinitializationFunctionRefs;
|
||||
int _assetsTableRef;
|
||||
int _assetsTableRef = 0;
|
||||
};
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
@@ -27,9 +27,12 @@
|
||||
|
||||
#include <openspace/scene/assetlistener.h>
|
||||
|
||||
#include <openspace/scene/assetloader.h>
|
||||
#include <ghoul/lua/ghoul_lua.h>
|
||||
#include <ghoul/lua/luastate.h>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
|
||||
namespace openspace {
|
||||
|
||||
@@ -41,18 +44,14 @@ class SynchronizationWatcher;
|
||||
|
||||
/**
|
||||
* Interface for managing assets.
|
||||
* The asset manager interface is only concerned with "top level" assets,
|
||||
* i.e. assets that are loaded using setTargetAssetState, and not their dependencies.
|
||||
* However, an asset is not considered synchronized before all its deps are
|
||||
* synchronized.
|
||||
* Also, setting a target state of an asset to Unloaded will only unload an asset
|
||||
* from the system if it is not a dependency of a loaded asset.
|
||||
* The asset manager interface is only concerned with "top level" assets, and not their
|
||||
* dependencies. However, an asset is not considered synchronized before all its deps are
|
||||
* synchronized. Also, setting a target state of an asset to Unloaded will only unload an
|
||||
* asset from the system if it is not a dependency of a loaded asset.
|
||||
*/
|
||||
|
||||
class AssetManager : AssetListener {
|
||||
public:
|
||||
AssetManager(std::unique_ptr<AssetLoader> loader,
|
||||
std::unique_ptr<SynchronizationWatcher> syncWatcher);
|
||||
AssetManager(ghoul::lua::LuaState* state, std::string assetRootDirectory);
|
||||
|
||||
virtual ~AssetManager() = default;
|
||||
|
||||
@@ -61,13 +60,12 @@ public:
|
||||
void add(const std::string& path);
|
||||
void remove(const std::string& path);
|
||||
void removeAll();
|
||||
std::shared_ptr<Asset> rootAsset();
|
||||
const Asset& rootAsset() const;
|
||||
Asset& rootAsset();
|
||||
|
||||
void assetStateChanged(std::shared_ptr<Asset> asset, Asset::State state) override;
|
||||
void assetRequested(std::shared_ptr<Asset> parent,
|
||||
std::shared_ptr<Asset> child) override;
|
||||
void assetUnrequested(std::shared_ptr<Asset> parent,
|
||||
std::shared_ptr<Asset> child) override;
|
||||
void assetStateChanged(Asset* asset, Asset::State state) override;
|
||||
void assetRequested(Asset* parent, std::shared_ptr<Asset> child) override;
|
||||
void assetUnrequested(Asset* parent, std::shared_ptr<Asset> child) override;
|
||||
|
||||
bool update();
|
||||
scripting::LuaLibrary luaLibrary();
|
||||
@@ -77,8 +75,8 @@ private:
|
||||
std::mutex _pendingInitializationsMutex;
|
||||
std::vector<std::shared_ptr<Asset>> _pendingInitializations;
|
||||
|
||||
std::unique_ptr<SynchronizationWatcher> _synchronizationWatcher;
|
||||
std::unique_ptr<AssetLoader> _assetLoader;
|
||||
SynchronizationWatcher _synchronizationWatcher;
|
||||
AssetLoader _assetLoader;
|
||||
};
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
@@ -28,7 +28,6 @@
|
||||
#include <openspace/properties/propertyowner.h>
|
||||
|
||||
#include <openspace/scene/scenegraphnode.h>
|
||||
#include <openspace/scene/scenelicense.h>
|
||||
#include <ghoul/misc/easing.h>
|
||||
#include <ghoul/misc/exception.h>
|
||||
#include <mutex>
|
||||
@@ -134,8 +133,6 @@ public:
|
||||
*/
|
||||
void unregisterNode(SceneGraphNode* node);
|
||||
|
||||
void addSceneLicense(SceneLicense license);
|
||||
|
||||
/**
|
||||
* Mark the node registry as dirty
|
||||
*/
|
||||
@@ -146,14 +143,6 @@ public:
|
||||
*/
|
||||
const std::vector<SceneGraphNode*>& allSceneGraphNodes() const;
|
||||
|
||||
/**
|
||||
* Generate JSON about the license information for the scenegraph nodes that are
|
||||
* contained in this scene
|
||||
* \param path The file path that will contain the documentation about the licenses
|
||||
* used in this scene
|
||||
*/
|
||||
std::string generateSceneLicenseDocumentationJson();
|
||||
|
||||
/**
|
||||
* Returns a map from identifier to scene graph node.
|
||||
*/
|
||||
@@ -261,8 +250,6 @@ private:
|
||||
|
||||
std::vector<InterestingTime> _interestingTimes;
|
||||
|
||||
std::vector<SceneLicense> _licenses;
|
||||
|
||||
std::mutex _programUpdateLock;
|
||||
std::set<ghoul::opengl::ProgramObject*> _programsToUpdate;
|
||||
std::vector<std::unique_ptr<ghoul::opengl::ProgramObject>> _programs;
|
||||
|
||||
@@ -1,56 +0,0 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
* Copyright (c) 2014-2020 *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
|
||||
* software and associated documentation files (the "Software"), to deal in the Software *
|
||||
* without restriction, including without limitation the rights to use, copy, modify, *
|
||||
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
|
||||
* permit persons to whom the Software is furnished to do so, subject to the following *
|
||||
* conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in all copies *
|
||||
* or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
|
||||
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#ifndef __OPENSPACE_CORE___SCENELICENSE___H__
|
||||
#define __OPENSPACE_CORE___SCENELICENSE___H__
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace ghoul { class Dictionary; }
|
||||
|
||||
namespace openspace {
|
||||
|
||||
namespace documentation { struct Documentation; }
|
||||
|
||||
struct SceneLicense {
|
||||
// module must not be empty
|
||||
SceneLicense(const ghoul::Dictionary& dictionary, std::string m);
|
||||
|
||||
std::string module;
|
||||
|
||||
std::string name;
|
||||
std::string attribution;
|
||||
std::string url;
|
||||
std::string licenseText;
|
||||
|
||||
static documentation::Documentation Documentation();
|
||||
};
|
||||
|
||||
void writeSceneLicenseDocumentation(const std::vector<SceneLicense>& licenses,
|
||||
const std::string& file, const std::string& type);
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
#endif // __OPENSPACE_CORE___SCENELICENSE___H__
|
||||
@@ -31,15 +31,10 @@
|
||||
|
||||
namespace openspace {
|
||||
|
||||
struct SceneLicense;
|
||||
|
||||
class SceneLicenseWriter : public DocumentationGenerator {
|
||||
public:
|
||||
SceneLicenseWriter(std::vector<SceneLicense> licenses);
|
||||
SceneLicenseWriter();
|
||||
std::string generateJson() const override;
|
||||
|
||||
private:
|
||||
const std::vector<SceneLicense>& _licenses;
|
||||
};
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
@@ -68,9 +68,9 @@ public:
|
||||
|
||||
State state() const;
|
||||
const std::string& name() const;
|
||||
bool isResolved();
|
||||
bool isRejected();
|
||||
bool isSyncing();
|
||||
bool isResolved() const;
|
||||
bool isRejected() const;
|
||||
bool isSyncing() const;
|
||||
CallbackHandle addStateChangeCallback(StateChangeCallback cb);
|
||||
void removeStateChangeCallback(CallbackHandle id);
|
||||
|
||||
|
||||
@@ -53,12 +53,6 @@ public:
|
||||
ResourceSynchronization::StateChangeCallback callback;
|
||||
};
|
||||
|
||||
/*using SyncStateChangeCallback =
|
||||
std::function<void(
|
||||
std::shared_ptr<ResourceSynchronization>,
|
||||
ResourceSynchronization::State
|
||||
)>;*/
|
||||
|
||||
WatchHandle watchSynchronization(
|
||||
std::shared_ptr<ResourceSynchronization> synchronization,
|
||||
ResourceSynchronization::StateChangeCallback callback
|
||||
@@ -69,7 +63,6 @@ public:
|
||||
void notify();
|
||||
|
||||
private:
|
||||
WatchHandle generateWatchHandle();
|
||||
std::mutex _mutex;
|
||||
std::unordered_map<WatchHandle, WatchData> _watchedSyncs;
|
||||
std::vector<NotificationData> _pendingNotifications;
|
||||
|
||||
@@ -262,6 +262,7 @@ RenderableModel::RenderableModel(const ghoul::Dictionary& dictionary)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
addPropertySubOwner(_lightSourcePropertyOwner);
|
||||
addPropertySubOwner(_geometry.get());
|
||||
|
||||
@@ -278,14 +279,13 @@ RenderableModel::RenderableModel(const ghoul::Dictionary& dictionary)
|
||||
addProperty(_rotationVec);
|
||||
|
||||
_rotationVec.onChange([this]() {
|
||||
glm::vec3 degreeVector = _rotationVec;
|
||||
glm::vec3 radianVector = glm::vec3(
|
||||
glm::radians(degreeVector.x),
|
||||
glm::radians(degreeVector.y),
|
||||
glm::radians(degreeVector.z)
|
||||
);
|
||||
_modelTransform = glm::mat4_cast(glm::quat(radianVector));
|
||||
_modelTransform = glm::mat4_cast(glm::quat(glm::radians(_rotationVec.value())));
|
||||
});
|
||||
|
||||
|
||||
if (dictionary.hasKey(RotationVecInfo.identifier)) {
|
||||
_rotationVec = dictionary.value<glm::vec3>(RotationVecInfo.identifier);
|
||||
}
|
||||
}
|
||||
|
||||
bool RenderableModel::isReady() const {
|
||||
|
||||
@@ -362,48 +362,49 @@ void RenderableSphere::render(const RenderData& data, RendererTasks&) {
|
||||
|
||||
float adjustedTransparency = _opacity;
|
||||
|
||||
if (_fadeInThreshold > -1.0) {
|
||||
const float logDistCamera = glm::log(static_cast<float>(
|
||||
glm::distance(data.camera.positionVec3(), data.modelTransform.translation)
|
||||
));
|
||||
const float startLogFadeDistance = glm::log(_size * _fadeInThreshold);
|
||||
const float stopLogFadeDistance = startLogFadeDistance + 1.f;
|
||||
if (!_disableFadeInDistance) {
|
||||
if (_fadeInThreshold > -1.0) {
|
||||
const float logDistCamera = glm::log(static_cast<float>(
|
||||
glm::distance(data.camera.positionVec3(), data.modelTransform.translation)
|
||||
));
|
||||
const float startLogFadeDistance = glm::log(_size * _fadeInThreshold);
|
||||
const float stopLogFadeDistance = startLogFadeDistance + 1.f;
|
||||
|
||||
if (logDistCamera > startLogFadeDistance && logDistCamera < stopLogFadeDistance) {
|
||||
const float fadeFactor = glm::clamp(
|
||||
(logDistCamera - startLogFadeDistance) /
|
||||
(stopLogFadeDistance - startLogFadeDistance),
|
||||
0.f,
|
||||
1.f
|
||||
);
|
||||
adjustedTransparency *= fadeFactor;
|
||||
if (logDistCamera > startLogFadeDistance && logDistCamera < stopLogFadeDistance) {
|
||||
const float fadeFactor = glm::clamp(
|
||||
(logDistCamera - startLogFadeDistance) /
|
||||
(stopLogFadeDistance - startLogFadeDistance),
|
||||
0.f,
|
||||
1.f
|
||||
);
|
||||
adjustedTransparency *= fadeFactor;
|
||||
}
|
||||
else if (logDistCamera <= startLogFadeDistance) {
|
||||
adjustedTransparency = 0.f;
|
||||
}
|
||||
}
|
||||
else if (logDistCamera <= startLogFadeDistance) {
|
||||
adjustedTransparency = 0.f;
|
||||
|
||||
if (_fadeOutThreshold > -1.0) {
|
||||
const float logDistCamera = glm::log(static_cast<float>(
|
||||
glm::distance(data.camera.positionVec3(), data.modelTransform.translation)
|
||||
));
|
||||
const float startLogFadeDistance = glm::log(_size * _fadeOutThreshold);
|
||||
const float stopLogFadeDistance = startLogFadeDistance + 1.f;
|
||||
|
||||
if (logDistCamera > startLogFadeDistance && logDistCamera < stopLogFadeDistance) {
|
||||
const float fadeFactor = glm::clamp(
|
||||
(logDistCamera - startLogFadeDistance) /
|
||||
(stopLogFadeDistance - startLogFadeDistance),
|
||||
0.f,
|
||||
1.f
|
||||
);
|
||||
adjustedTransparency *= (1.f - fadeFactor);
|
||||
}
|
||||
else if (logDistCamera >= stopLogFadeDistance) {
|
||||
adjustedTransparency = 0.f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (_fadeOutThreshold > -1.0) {
|
||||
const float logDistCamera = glm::log(static_cast<float>(
|
||||
glm::distance(data.camera.positionVec3(), data.modelTransform.translation)
|
||||
));
|
||||
const float startLogFadeDistance = glm::log(_size * _fadeOutThreshold);
|
||||
const float stopLogFadeDistance = startLogFadeDistance + 1.f;
|
||||
|
||||
if (logDistCamera > startLogFadeDistance && logDistCamera < stopLogFadeDistance) {
|
||||
const float fadeFactor = glm::clamp(
|
||||
(logDistCamera - startLogFadeDistance) /
|
||||
(stopLogFadeDistance - startLogFadeDistance),
|
||||
0.f,
|
||||
1.f
|
||||
);
|
||||
adjustedTransparency *= (1.f - fadeFactor);
|
||||
}
|
||||
else if (logDistCamera >= stopLogFadeDistance) {
|
||||
adjustedTransparency = 0.f;
|
||||
}
|
||||
}
|
||||
|
||||
// Performance wise
|
||||
if (adjustedTransparency < 0.01f) {
|
||||
return;
|
||||
|
||||
@@ -124,9 +124,11 @@ TimeFrameInterval::TimeFrameInterval(const ghoul::Dictionary& dictionary)
|
||||
addProperty(_hasEnd);
|
||||
addProperty(_end);
|
||||
|
||||
documentation::testSpecificationAndThrow(Documentation(),
|
||||
dictionary,
|
||||
"TimeFrameInterval");
|
||||
documentation::testSpecificationAndThrow(
|
||||
Documentation(),
|
||||
dictionary,
|
||||
"TimeFrameInterval"
|
||||
);
|
||||
|
||||
if (dictionary.hasValue<std::string>(StartInfo.identifier)) {
|
||||
_start = SpiceManager::ref().ephemerisTimeFromDate(
|
||||
|
||||
@@ -117,11 +117,6 @@ create_new_module(
|
||||
${HEADER_FILES} ${SOURCE_FILES} ${SHADER_FILES}
|
||||
)
|
||||
|
||||
option(OPENSPACE_MODULE_GLOBEBROWSING_INSTRUMENTATION "Instrumentation for GlobeBrowsing Performance" OFF)
|
||||
if (OPENSPACE_MODULE_GLOBEBROWSING_INSTRUMENTATION)
|
||||
target_compile_definitions(openspace-module-globebrowsing INTERFACE "OPENSPACE_MODULE_GLOBEBROWSING_INSTRUMENTATION")
|
||||
endif ()
|
||||
|
||||
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/gdal_data DESTINATION modules/globebrowsing)
|
||||
|
||||
if (WIN32)
|
||||
|
||||
@@ -106,14 +106,6 @@ namespace {
|
||||
"The maximum size of the MemoryAwareTileCache, on the CPU and GPU."
|
||||
};
|
||||
|
||||
#ifdef OPENSPACE_MODULE_GLOBEBROWSING_INSTRUMENTATION
|
||||
constexpr const openspace::properties::Property::PropertyInfo InstrumentationInfo = {
|
||||
"SaveInstrumentationInfo",
|
||||
"Save Instrumentation Info",
|
||||
"If enabled, the instrumentation data is saved to disk at the end of the frame."
|
||||
};
|
||||
#endif // OPENSPACE_MODULE_GLOBEBROWSING_INSTRUMENTATION
|
||||
|
||||
|
||||
openspace::GlobeBrowsingModule::Capabilities
|
||||
parseSubDatasets(char** subDatasets, int nSubdatasets)
|
||||
@@ -176,24 +168,12 @@ GlobeBrowsingModule::GlobeBrowsingModule()
|
||||
, _wmsCacheLocation(WMSCacheLocationInfo, "${BASE}/cache_gdal")
|
||||
, _wmsCacheSizeMB(WMSCacheSizeInfo, 1024)
|
||||
, _tileCacheSizeMB(TileCacheSizeInfo, 1024)
|
||||
#ifdef OPENSPACE_MODULE_GLOBEBROWSING_INSTRUMENTATION
|
||||
, _saveInstrumentation(InstrumentationInfo, false)
|
||||
#endif // OPENSPACE_MODULE_GLOBEBROWSING_INSTRUMENTATION
|
||||
{
|
||||
addProperty(_wmsCacheEnabled);
|
||||
addProperty(_offlineMode);
|
||||
addProperty(_wmsCacheLocation);
|
||||
addProperty(_wmsCacheSizeMB);
|
||||
addProperty(_tileCacheSizeMB);
|
||||
|
||||
#ifdef OPENSPACE_MODULE_GLOBEBROWSING_INSTRUMENTATION
|
||||
_saveInstrumentation.onChange([&]() {
|
||||
if (_saveInstrumentation) {
|
||||
_frameInfo.lastSavedFrame = global::renderEngine.frameNumber();
|
||||
}
|
||||
});
|
||||
addProperty(_saveInstrumentation);
|
||||
#endif // OPENSPACE_MODULE_GLOBEBROWSING_INSTRUMENTATION
|
||||
}
|
||||
|
||||
void GlobeBrowsingModule::internalInitialize(const ghoul::Dictionary& dict) {
|
||||
@@ -268,45 +248,6 @@ void GlobeBrowsingModule::internalInitialize(const ghoul::Dictionary& dict) {
|
||||
_tileCache->update();
|
||||
});
|
||||
|
||||
// Postdraw
|
||||
#ifdef OPENSPACE_MODULE_GLOBEBROWSING_INSTRUMENTATION
|
||||
global::callback::postDraw.emplace_back([&]() {
|
||||
ZoneScopedN("GlobeBrowsingModule")
|
||||
|
||||
// >= as we might have multiple frames per postDraw call (stereo rendering,
|
||||
// fisheye, etc)
|
||||
const uint16_t next = _frameInfo.lastSavedFrame + _frameInfo.saveEveryNthFrame;
|
||||
const bool shouldSave = _saveInstrumentation &&
|
||||
global::renderEngine.frameNumber() >= next;
|
||||
if (shouldSave) {
|
||||
using K = const globebrowsing::RenderableGlobe*;
|
||||
using V = std::vector<FrameInfo>;
|
||||
for (const std::pair<K, V>& i : _frameInfo.frames) {
|
||||
std::string filename = fmt::format(
|
||||
"_inst_globebrowsing_{}_{}_{}.txt",
|
||||
i.first->owner()->identifier(), // Owner of the renderable has a name
|
||||
_frameInfo.lastSavedFrame,
|
||||
_frameInfo.saveEveryNthFrame
|
||||
);
|
||||
std::ofstream file(absPath("${BIN}/" + filename));
|
||||
for (const FrameInfo& f : i.second) {
|
||||
std::string line = fmt::format(
|
||||
"{}\t{}\t{}\t{}",
|
||||
f.iFrame,
|
||||
f.nTilesRenderedLocal,
|
||||
f.nTilesRenderedGlobal,
|
||||
f.nTilesUploaded
|
||||
);
|
||||
file << line << '\n';
|
||||
}
|
||||
}
|
||||
|
||||
_frameInfo.frames.clear();
|
||||
_frameInfo.lastSavedFrame = global::renderEngine.frameNumber();
|
||||
}
|
||||
});
|
||||
#endif // OPENSPACE_MODULE_GLOBEBROWSING_INSTRUMENTATION
|
||||
|
||||
// Deinitialize
|
||||
global::callback::deinitialize.emplace_back([&]() {
|
||||
ZoneScopedN("GlobeBrowsingModule")
|
||||
@@ -834,27 +775,4 @@ uint64_t GlobeBrowsingModule::wmsCacheSize() const {
|
||||
return size * 1024 * 1024;
|
||||
}
|
||||
|
||||
#ifdef OPENSPACE_MODULE_GLOBEBROWSING_INSTRUMENTATION
|
||||
void GlobeBrowsingModule::addFrameInfo(globebrowsing::RenderableGlobe* globe,
|
||||
uint32_t nTilesRenderedLocal,
|
||||
uint32_t nTilesRenderedGlobal,
|
||||
uint32_t nTilesUploaded)
|
||||
{
|
||||
auto it = _frameInfo.frames.find(globe);
|
||||
if (it == _frameInfo.frames.end()) {
|
||||
_frameInfo.frames[globe] = std::vector<FrameInfo>();
|
||||
_frameInfo.frames[globe].reserve(_frameInfo.saveEveryNthFrame);
|
||||
}
|
||||
else {
|
||||
it->second.push_back({
|
||||
global::renderEngine.frameNumber(),
|
||||
nTilesRenderedLocal,
|
||||
nTilesRenderedGlobal,
|
||||
nTilesUploaded
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
#endif // OPENSPACE_MODULE_GLOBEBROWSING_INSTRUMENTATION
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
@@ -95,11 +95,6 @@ public:
|
||||
std::string wmsCacheLocation() const;
|
||||
uint64_t wmsCacheSize() const; // bytes
|
||||
|
||||
#ifdef OPENSPACE_MODULE_GLOBEBROWSING_INSTRUMENTATION
|
||||
void addFrameInfo(globebrowsing::RenderableGlobe* globe, uint32_t nTilesRenderedLocal,
|
||||
uint32_t nTilesRenderedGlobal, uint32_t nTilesUploaded);
|
||||
#endif // OPENSPACE_MODULE_GLOBEBROWSING_INSTRUMENTATION
|
||||
|
||||
protected:
|
||||
void internalInitialize(const ghoul::Dictionary&) override;
|
||||
|
||||
@@ -141,26 +136,6 @@ private:
|
||||
std::map<std::string, Capabilities> _capabilitiesMap;
|
||||
|
||||
std::multimap<std::string, UrlInfo> _urlList;
|
||||
|
||||
#ifdef OPENSPACE_MODULE_GLOBEBROWSING_INSTRUMENTATION
|
||||
struct FrameInfo {
|
||||
uint64_t iFrame = 0;
|
||||
uint32_t nTilesRenderedLocal = 0;
|
||||
uint32_t nTilesRenderedGlobal = 0;
|
||||
uint32_t nTilesUploaded = 0;
|
||||
};
|
||||
|
||||
struct {
|
||||
std::unordered_map<
|
||||
globebrowsing::RenderableGlobe*,
|
||||
std::vector<FrameInfo>
|
||||
> frames;
|
||||
|
||||
uint64_t lastSavedFrame = 0;
|
||||
const uint16_t saveEveryNthFrame = 2048;
|
||||
} _frameInfo;
|
||||
properties::BoolProperty _saveInstrumentation;
|
||||
#endif // OPENSPACE_MODULE_GLOBEBROWSING_INSTRUMENTATION
|
||||
};
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
@@ -50,13 +50,6 @@
|
||||
#include <numeric>
|
||||
#include <queue>
|
||||
|
||||
#ifdef OPENSPACE_MODULE_GLOBEBROWSING_INSTRUMENTATION
|
||||
#include <openspace/engine/moduleengine.h>
|
||||
#include <modules/globebrowsing/globebrowsingmodule.h>
|
||||
openspace::GlobeBrowsingModule* _module = nullptr;
|
||||
|
||||
#endif // OPENSPACE_MODULE_GLOBEBROWSING_INSTRUMENTATION
|
||||
|
||||
namespace {
|
||||
// Global flags to modify the RenderableGlobe
|
||||
constexpr const bool LimitLevelByAvailableData = true;
|
||||
@@ -709,10 +702,6 @@ RenderableGlobe::RenderableGlobe(const ghoul::Dictionary& dictionary)
|
||||
_generalProperties.shadowMapping = true;
|
||||
}
|
||||
_generalProperties.shadowMapping.onChange(notifyShaderRecompilation);
|
||||
|
||||
#ifdef OPENSPACE_MODULE_GLOBEBROWSING_INSTRUMENTATION
|
||||
_module = global::moduleEngine.module<GlobeBrowsingModule>();
|
||||
#endif // OPENSPACE_MODULE_GLOBEBROWSING_INSTRUMENTATION
|
||||
}
|
||||
|
||||
void RenderableGlobe::initializeGL() {
|
||||
@@ -921,11 +910,7 @@ void RenderableGlobe::update(const UpdateData& data) {
|
||||
_shadowComponent.update(data);
|
||||
}
|
||||
|
||||
#ifdef OPENSPACE_MODULE_GLOBEBROWSING_INSTRUMENTATION
|
||||
_nUploadedTiles = _layerManager.update();
|
||||
#else
|
||||
_layerManager.update();
|
||||
#endif // OPENSPACE_MODULE_GLOBEBROWSING_INSTRUMENTATION
|
||||
|
||||
if (_nLayersIsDirty) {
|
||||
std::array<LayerGroup*, LayerManager::NumLayerGroups> lgs =
|
||||
@@ -1237,15 +1222,6 @@ void RenderableGlobe::renderChunks(const RenderData& data, RendererTasks&,
|
||||
}
|
||||
_localRenderer.program->deactivate();
|
||||
|
||||
#ifdef OPENSPACE_MODULE_GLOBEBROWSING_INSTRUMENTATION
|
||||
_module->addFrameInfo(
|
||||
this,
|
||||
std::min(localCount, ChunkBufferSize),
|
||||
std::min(globalCount, ChunkBufferSize),
|
||||
_nUploadedTiles
|
||||
);
|
||||
#endif // OPENSPACE_MODULE_GLOBEBROWSING_INSTRUMENTATION
|
||||
|
||||
if (_debugProperties.showChunkBounds || _debugProperties.showChunkAABB) {
|
||||
for (int i = 0; i < std::min(globalCount, ChunkBufferSize); ++i) {
|
||||
debugRenderChunk(
|
||||
|
||||
@@ -297,10 +297,6 @@ private:
|
||||
// Labels
|
||||
GlobeLabelsComponent _globeLabelsComponent;
|
||||
ghoul::Dictionary _labelsDictionary;
|
||||
|
||||
#ifdef OPENSPACE_MODULE_GLOBEBROWSING_INSTRUMENTATION
|
||||
int _nUploadedTiles = 0;
|
||||
#endif // OPENSPACE_MODULE_GLOBEBROWSING_INSTRUMENTATION
|
||||
};
|
||||
|
||||
} // namespace openspace::globebrowsing
|
||||
|
||||
@@ -39,14 +39,14 @@ namespace {
|
||||
using State = openspace::Asset::State;
|
||||
|
||||
switch (state) {
|
||||
case State::Loaded: return "Loaded";
|
||||
case State::LoadingFailed: return "LoadingFailed";
|
||||
case State::Synchronizing: return "Synchronizing";
|
||||
case State::SyncRejected: return "SyncRejected";
|
||||
case State::SyncResolved: return "SyncResolved";
|
||||
case State::Initialized: return "Initialized";
|
||||
case State::InitializationFailed: return "InitializationFailed";
|
||||
default: return "Unknown";
|
||||
case State::Loaded: return "Loaded";
|
||||
case State::LoadingFailed: return "LoadingFailed";
|
||||
case State::Synchronizing: return "Synchronizing";
|
||||
case State::SyncRejected: return "SyncRejected";
|
||||
case State::SyncResolved: return "SyncResolved";
|
||||
case State::Initialized: return "Initialized";
|
||||
case State::InitializationFailed: return "InitializationFailed";
|
||||
default: return "Unknown";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,14 +54,14 @@ namespace {
|
||||
using State = openspace::ResourceSynchronization::State;
|
||||
|
||||
switch (state) {
|
||||
case State::Unsynced: return "Unsynced";
|
||||
case State::Syncing: return "Syncing";
|
||||
case State::Resolved: return "Resolved";
|
||||
case State::Rejected: return "Rejected";
|
||||
default: return "Unknown";
|
||||
case State::Unsynced: return "Unsynced";
|
||||
case State::Syncing: return "Syncing";
|
||||
case State::Resolved: return "Resolved";
|
||||
case State::Rejected: return "Rejected";
|
||||
default: return "Unknown";
|
||||
}
|
||||
}
|
||||
}
|
||||
} // namespace
|
||||
|
||||
namespace openspace::gui {
|
||||
|
||||
@@ -69,7 +69,6 @@ GuiAssetComponent::GuiAssetComponent()
|
||||
: GuiComponent("Assets")
|
||||
{}
|
||||
|
||||
|
||||
void GuiAssetComponent::render() {
|
||||
bool e = _isEnabled;
|
||||
ImGui::Begin("Assets", &e);
|
||||
@@ -79,7 +78,7 @@ void GuiAssetComponent::render() {
|
||||
|
||||
std::string rootPath;
|
||||
|
||||
for (const std::shared_ptr<Asset>& a : assetManager.rootAsset()->childAssets()) {
|
||||
for (Asset* a : assetManager.rootAsset().childAssets()) {
|
||||
renderTree(*a, rootPath);
|
||||
}
|
||||
|
||||
@@ -104,29 +103,29 @@ void GuiAssetComponent::renderTree(const Asset& asset, const std::string& relati
|
||||
assetText += " (" + std::to_string(prog) + "%)";
|
||||
}
|
||||
|
||||
const std::vector<std::shared_ptr<Asset>>& requested = asset.requestedAssets();
|
||||
const std::vector<std::shared_ptr<Asset>>& required = asset.requiredAssets();
|
||||
std::vector<Asset*> requested = asset.requestedAssets();
|
||||
std::vector<Asset*> required = asset.requiredAssets();
|
||||
|
||||
const std::vector<std::shared_ptr<ResourceSynchronization>>& resourceSyncs =
|
||||
const std::vector<ResourceSynchronization*>& resourceSyncs =
|
||||
asset.ownSynchronizations();
|
||||
|
||||
if (requested.empty() && required.empty() && resourceSyncs.empty()) {
|
||||
ImGui::Text("%s", assetText.c_str());
|
||||
}
|
||||
else if (ImGui::TreeNode(assetPath.c_str(), "%s", assetText.c_str())) {
|
||||
for (const std::shared_ptr<Asset>& child : required) {
|
||||
for (const Asset* child : required) {
|
||||
renderTree(*child, assetDirectory);
|
||||
}
|
||||
|
||||
if (!requested.empty() && ImGui::TreeNode("Requested assets")) {
|
||||
for (const std::shared_ptr<Asset>& child : requested) {
|
||||
for (const Asset* child : requested) {
|
||||
renderTree(*child, assetDirectory);
|
||||
}
|
||||
ImGui::TreePop();
|
||||
}
|
||||
|
||||
if (!resourceSyncs.empty() && ImGui::TreeNode("Resource Synchronizations")) {
|
||||
for (const std::shared_ptr<ResourceSynchronization>& sync : resourceSyncs) {
|
||||
for (ResourceSynchronization* sync : resourceSyncs) {
|
||||
std::string resourceText = sync->directory() +
|
||||
" " + syncStateToString(sync->state());
|
||||
if (sync->state() == ResourceSynchronization::State::Syncing) {
|
||||
|
||||
@@ -68,7 +68,7 @@ SpaceModule::SpaceModule()
|
||||
addProperty(_showSpiceExceptions);
|
||||
}
|
||||
|
||||
void SpaceModule::internalInitialize(const ghoul::Dictionary&) {
|
||||
void SpaceModule::internalInitialize(const ghoul::Dictionary& dictionary) {
|
||||
FactoryManager::ref().addFactory(
|
||||
std::make_unique<ghoul::TemplateFactory<planetgeometry::PlanetGeometry>>(),
|
||||
"PlanetGeometry"
|
||||
@@ -106,6 +106,10 @@ void SpaceModule::internalInitialize(const ghoul::Dictionary&) {
|
||||
auto fGeometry = FactoryManager::ref().factory<planetgeometry::PlanetGeometry>();
|
||||
ghoul_assert(fGeometry, "Planet geometry factory was not created");
|
||||
fGeometry->registerClass<planetgeometry::SimpleSphereGeometry>("SimpleSphere");
|
||||
|
||||
if (dictionary.hasKeyAndValue<bool>(SpiceExceptionInfo.identifier)) {
|
||||
_showSpiceExceptions = dictionary.value<bool>(SpiceExceptionInfo.identifier);
|
||||
}
|
||||
}
|
||||
|
||||
void SpaceModule::internalDeinitializeGL() {
|
||||
|
||||
@@ -29,7 +29,6 @@
|
||||
#include <openspace/documentation/verifier.h>
|
||||
#include <openspace/engine/moduleengine.h>
|
||||
#include <openspace/engine/globals.h>
|
||||
#include <openspace/scene/assetlistener.h>
|
||||
#include <openspace/scene/assetloader.h>
|
||||
#include <openspace/scripting/scriptengine.h>
|
||||
#include <openspace/util/openspacemodule.h>
|
||||
@@ -74,21 +73,6 @@ documentation::Documentation SyncAssetTask::documentation() {
|
||||
};
|
||||
}
|
||||
|
||||
class RequestListener : public AssetListener {
|
||||
public:
|
||||
virtual ~RequestListener() = default;
|
||||
void assetStateChanged(std::shared_ptr<Asset> asset, Asset::State state) override {
|
||||
if (state == Asset::State::LoadingFailed) {
|
||||
LERROR(fmt::format("Failed to load asset: {}", asset->id()));
|
||||
}
|
||||
if (state == Asset::State::SyncRejected) {
|
||||
LERROR(fmt::format("Failed to sync asset: {}", asset->id()));
|
||||
}
|
||||
}
|
||||
void assetRequested(std::shared_ptr<Asset>, std::shared_ptr<Asset>) override {};
|
||||
void assetUnrequested(std::shared_ptr<Asset>, std::shared_ptr<Asset>) override {};
|
||||
};
|
||||
|
||||
SyncAssetTask::SyncAssetTask(const ghoul::Dictionary& dictionary) {
|
||||
documentation::testSpecificationAndThrow(
|
||||
documentation(),
|
||||
@@ -125,18 +109,14 @@ void SyncAssetTask::perform(const Task::ProgressCallback& progressCallback) {
|
||||
|
||||
AssetLoader loader(&luaState, &watcher, "${ASSETS}");
|
||||
|
||||
RequestListener listener;
|
||||
loader.addAssetListener(&listener);
|
||||
|
||||
loader.add(_asset);
|
||||
loader.rootAsset()->startSynchronizations();
|
||||
loader.rootAsset().startSynchronizations();
|
||||
|
||||
std::vector<std::shared_ptr<const Asset>> allAssets =
|
||||
loader.rootAsset()->subTreeAssets();
|
||||
std::vector<const Asset*> allAssets = loader.rootAsset().subTreeAssets();
|
||||
|
||||
while (true) {
|
||||
bool inProgress = false;
|
||||
for (const std::shared_ptr<const Asset>& asset : allAssets) {
|
||||
for (const Asset* asset : allAssets) {
|
||||
Asset::State state = asset->state();
|
||||
if (state == Asset::State::Unloaded ||
|
||||
state == Asset::State::Loaded ||
|
||||
@@ -145,7 +125,7 @@ void SyncAssetTask::perform(const Task::ProgressCallback& progressCallback) {
|
||||
inProgress = true;
|
||||
}
|
||||
}
|
||||
progressCallback(loader.rootAsset()->requestedSynchronizationProgress());
|
||||
progressCallback(loader.rootAsset().requestedSynchronizationProgress());
|
||||
std::this_thread::sleep_for(ProgressPollInterval);
|
||||
watcher.notify();
|
||||
if (!inProgress) {
|
||||
|
||||
@@ -144,6 +144,9 @@ ModuleConfigurations = {
|
||||
-- GuiScale = 2.0,
|
||||
Enabled = true,
|
||||
Visible = true
|
||||
},
|
||||
Space = {
|
||||
ShowExceptions = false
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -157,7 +157,6 @@ set(OPENSPACE_SOURCE
|
||||
${OPENSPACE_BASE_DIR}/src/scene/scene.cpp
|
||||
${OPENSPACE_BASE_DIR}/src/scene/scene_lua.inl
|
||||
${OPENSPACE_BASE_DIR}/src/scene/sceneinitializer.cpp
|
||||
${OPENSPACE_BASE_DIR}/src/scene/scenelicense.cpp
|
||||
${OPENSPACE_BASE_DIR}/src/scene/scenelicensewriter.cpp
|
||||
${OPENSPACE_BASE_DIR}/src/scene/scenegraphnode.cpp
|
||||
${OPENSPACE_BASE_DIR}/src/scene/scenegraphnode_doc.inl
|
||||
@@ -346,7 +345,6 @@ set(OPENSPACE_HEADER
|
||||
${OPENSPACE_BASE_DIR}/include/openspace/scene/scale.h
|
||||
${OPENSPACE_BASE_DIR}/include/openspace/scene/scene.h
|
||||
${OPENSPACE_BASE_DIR}/include/openspace/scene/sceneinitializer.h
|
||||
${OPENSPACE_BASE_DIR}/include/openspace/scene/scenelicense.h
|
||||
${OPENSPACE_BASE_DIR}/include/openspace/scene/scenelicensewriter.h
|
||||
${OPENSPACE_BASE_DIR}/include/openspace/scene/scenegraphnode.h
|
||||
${OPENSPACE_BASE_DIR}/include/openspace/scene/timeframe.h
|
||||
|
||||
@@ -341,17 +341,9 @@ void OpenSpaceEngine::initialize() {
|
||||
}
|
||||
|
||||
// Set up asset loader
|
||||
std::unique_ptr<SynchronizationWatcher> w =
|
||||
std::make_unique<SynchronizationWatcher>();
|
||||
SynchronizationWatcher* rawWatcher = w.get();
|
||||
|
||||
global::openSpaceEngine._assetManager = std::make_unique<AssetManager>(
|
||||
std::make_unique<AssetLoader>(
|
||||
global::scriptEngine.luaState(),
|
||||
rawWatcher,
|
||||
FileSys.absPath("${ASSETS}")
|
||||
),
|
||||
std::move(w)
|
||||
global::scriptEngine.luaState(),
|
||||
FileSys.absPath("${ASSETS}")
|
||||
);
|
||||
|
||||
global::scriptEngine.addLibrary(global::openSpaceEngine._assetManager->luaLibrary());
|
||||
@@ -754,15 +746,13 @@ void OpenSpaceEngine::loadSingleAsset(const std::string& assetPath) {
|
||||
_loadingScreen->setPhase(LoadingScreen::Phase::Synchronization);
|
||||
_loadingScreen->postMessage("Synchronizing assets");
|
||||
|
||||
std::vector<std::shared_ptr<const Asset>> allAssets =
|
||||
_assetManager->rootAsset()->subTreeAssets();
|
||||
std::vector<const Asset*> allAssets = _assetManager->rootAsset().subTreeAssets();
|
||||
|
||||
std::unordered_set<std::shared_ptr<ResourceSynchronization>> resourceSyncs;
|
||||
for (const std::shared_ptr<const Asset>& a : allAssets) {
|
||||
std::vector<std::shared_ptr<ResourceSynchronization>> syncs =
|
||||
a->ownSynchronizations();
|
||||
std::unordered_set<ResourceSynchronization*> resourceSyncs;
|
||||
for (const Asset* a : allAssets) {
|
||||
std::vector<ResourceSynchronization*> syncs = a->ownSynchronizations();
|
||||
|
||||
for (const std::shared_ptr<ResourceSynchronization>& s : syncs) {
|
||||
for (ResourceSynchronization* s : syncs) {
|
||||
ZoneScopedN("Update resource synchronization")
|
||||
|
||||
if (s->state() == ResourceSynchronization::State::Syncing) {
|
||||
@@ -1030,7 +1020,7 @@ void OpenSpaceEngine::writeSceneDocumentation() {
|
||||
_documentationJson += "{\"name\":\"Scene License Information\",";
|
||||
_documentationJson += "\"identifier\":\"sceneLicense";
|
||||
_documentationJson += "\",\"data\":";
|
||||
_documentationJson += _scene->generateSceneLicenseDocumentationJson();
|
||||
_documentationJson += SceneLicenseWriter().generateJson();
|
||||
_documentationJson += "},";
|
||||
_documentationJson += "{\"name\":\"Scene Properties\",";
|
||||
_documentationJson += "\"identifier\":\"propertylist";// + _scene->jsonName();
|
||||
@@ -1045,8 +1035,7 @@ void OpenSpaceEngine::writeSceneDocumentation() {
|
||||
DocEng.addHandlebarTemplates(global::keybindingManager.templatesToRegister());
|
||||
//TODO this is in efficaiant, here i am just instaning the class to get
|
||||
//at a member variable which is staticly defined. How do i just get that
|
||||
const std::vector<SceneLicense> licenses;
|
||||
SceneLicenseWriter writer(licenses);
|
||||
SceneLicenseWriter writer;
|
||||
DocEng.addHandlebarTemplates(writer.templatesToRegister());
|
||||
DocEng.addHandlebarTemplates(global::rootPropertyOwner.templatesToRegister());
|
||||
|
||||
|
||||
@@ -517,7 +517,7 @@ void RenderEngine::updateScene() {
|
||||
const Time& integrateFromTime = global::timeManager.integrateFromTime();
|
||||
|
||||
_scene->update({
|
||||
{ glm::dvec3(0.0), glm::dmat3(1.0), glm::dvec3(1.0) },
|
||||
TransformData{ glm::dvec3(0.0), glm::dmat3(1.0), glm::dvec3(1.0) },
|
||||
currentTime,
|
||||
integrateFromTime,
|
||||
_doPerformanceMeasurements
|
||||
|
||||
@@ -33,19 +33,19 @@
|
||||
#include <algorithm>
|
||||
#include <unordered_set>
|
||||
|
||||
namespace {
|
||||
const constexpr char* _loggerCat = "Asset";
|
||||
namespace openspace {
|
||||
|
||||
float syncProgress(const std::vector<std::shared_ptr<const openspace::Asset>>& assets)
|
||||
{
|
||||
namespace {
|
||||
constexpr const char* _loggerCat = "Asset";
|
||||
|
||||
float syncProgress(const std::vector<const Asset*>& assets) {
|
||||
size_t nTotalBytes = 0;
|
||||
size_t nSyncedBytes = 0;
|
||||
|
||||
for (const std::shared_ptr<const openspace::Asset>& a : assets) {
|
||||
const std::vector<std::shared_ptr<openspace::ResourceSynchronization>>& s =
|
||||
a->ownSynchronizations();
|
||||
for (const Asset* a : assets) {
|
||||
std::vector<ResourceSynchronization*> s = a->ownSynchronizations();
|
||||
|
||||
for (const std::shared_ptr<openspace::ResourceSynchronization>& sync : s) {
|
||||
for (ResourceSynchronization* sync : s) {
|
||||
if (sync->nTotalBytesIsKnown()) {
|
||||
nTotalBytes += sync->nTotalBytes();
|
||||
nSyncedBytes += sync->nSynchronizedBytes();
|
||||
@@ -62,9 +62,8 @@ namespace {
|
||||
}
|
||||
return static_cast<float>(nSyncedBytes) / static_cast<float>(nTotalBytes);
|
||||
}
|
||||
}
|
||||
} // namespace
|
||||
|
||||
namespace openspace {
|
||||
|
||||
Asset::Asset(AssetLoader* loader, SynchronizationWatcher* watcher)
|
||||
: _state(State::SyncResolved)
|
||||
@@ -74,9 +73,7 @@ Asset::Asset(AssetLoader* loader, SynchronizationWatcher* watcher)
|
||||
, _assetName("Root Asset")
|
||||
{}
|
||||
|
||||
Asset::Asset(AssetLoader* loader, SynchronizationWatcher* watcher,
|
||||
std::string assetPath
|
||||
)
|
||||
Asset::Asset(AssetLoader* loader, SynchronizationWatcher* watcher, std::string assetPath)
|
||||
: _state(State::Unloaded)
|
||||
, _loader(loader)
|
||||
, _synchronizationWatcher(watcher)
|
||||
@@ -84,10 +81,12 @@ Asset::Asset(AssetLoader* loader, SynchronizationWatcher* watcher,
|
||||
, _assetPath(std::move(assetPath))
|
||||
{}
|
||||
|
||||
std::string Asset::resolveLocalResource(std::string resourceName) {
|
||||
std::string assetDir = assetDirectory();
|
||||
return assetDir + ghoul::filesystem::FileSystem::PathSeparator +
|
||||
std::move(resourceName);
|
||||
void Asset::setMetaInformation(MetaInformation metaInformation) {
|
||||
_metaInformation = std::move(metaInformation);
|
||||
}
|
||||
|
||||
std::optional<Asset::MetaInformation> Asset::metaInformation() const {
|
||||
return _metaInformation;
|
||||
}
|
||||
|
||||
Asset::State Asset::state() const {
|
||||
@@ -108,8 +107,7 @@ void Asset::setState(Asset::State state) {
|
||||
}
|
||||
_state = state;
|
||||
|
||||
std::shared_ptr<Asset> thisAsset = shared_from_this();
|
||||
_loader->assetStateChanged(thisAsset, state);
|
||||
_loader->assetStateChanged(this, state);
|
||||
|
||||
for (const std::weak_ptr<Asset>& requiringAsset : _requiringAssets) {
|
||||
if (std::shared_ptr<Asset> a = requiringAsset.lock()) {
|
||||
@@ -127,18 +125,17 @@ void Asset::setState(Asset::State state) {
|
||||
void Asset::requiredAssetChangedState(Asset::State childState) {
|
||||
if (!isLoaded()) {
|
||||
// Prohibit state change to SyncResolved if additional requirements
|
||||
// may still be added.
|
||||
// may still be added
|
||||
return;
|
||||
}
|
||||
if (isInitialized()) {
|
||||
// Do not do anything if this asset was already initialized.
|
||||
// This may happen if there are multiple requirement paths from
|
||||
// this asset to the same child, which causes this method to be
|
||||
// called more than once.
|
||||
// Do not do anything if this asset was already initialized. This may happen if
|
||||
// there are multiple requirement paths from this asset to the same child, which
|
||||
// causes this method to be called more than once
|
||||
return;
|
||||
}
|
||||
if (state() == State::InitializationFailed) {
|
||||
// Do not do anything if the asset failed to initialize.
|
||||
if (_state == State::InitializationFailed) {
|
||||
// Do not do anything if the asset failed to initialize
|
||||
return;
|
||||
}
|
||||
if (childState == State::SyncResolved) {
|
||||
@@ -153,21 +150,19 @@ void Asset::requiredAssetChangedState(Asset::State childState) {
|
||||
|
||||
void Asset::requestedAssetChangedState(Asset* child, Asset::State childState) {
|
||||
if (child->hasInitializedParent()) {
|
||||
if (childState == State::Loaded &&
|
||||
child->state() == State::Loaded)
|
||||
{
|
||||
if (childState == State::Loaded && child->state() == State::Loaded) {
|
||||
child->startSynchronizations();
|
||||
}
|
||||
if (childState == State::SyncResolved &&
|
||||
child->state() == State::SyncResolved)
|
||||
{
|
||||
if (childState == State::SyncResolved && child->state() == State::SyncResolved) {
|
||||
child->initialize();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Asset::addSynchronization(std::shared_ptr<ResourceSynchronization> synchronization) {
|
||||
_synchronizations.push_back(synchronization);
|
||||
void Asset::addSynchronization(std::unique_ptr<ResourceSynchronization> synchronization) {
|
||||
std::shared_ptr<ResourceSynchronization> sync = std::move(synchronization);
|
||||
|
||||
_synchronizations.push_back(sync);
|
||||
|
||||
// Set up callback for synchronization state change
|
||||
// The synchronization watcher will make sure that callbacks
|
||||
@@ -175,9 +170,9 @@ void Asset::addSynchronization(std::shared_ptr<ResourceSynchronization> synchron
|
||||
|
||||
SynchronizationWatcher::WatchHandle watch =
|
||||
_synchronizationWatcher->watchSynchronization(
|
||||
synchronization,
|
||||
[this, synchronization](ResourceSynchronization::State state) {
|
||||
syncStateChanged(synchronization.get(), state);
|
||||
sync,
|
||||
[this, sync](ResourceSynchronization::State state) {
|
||||
syncStateChanged(sync.get(), state);
|
||||
}
|
||||
);
|
||||
_syncWatches.push_back(watch);
|
||||
@@ -201,7 +196,7 @@ void Asset::syncStateChanged(ResourceSynchronization* sync,
|
||||
}
|
||||
else if (state == ResourceSynchronization::State::Rejected) {
|
||||
LERROR(fmt::format(
|
||||
"Failed to synchronize resource '{}'' in asset '{}'", sync->name(), id()
|
||||
"Failed to synchronize resource '{}' in asset '{}'", sync->name(), id()
|
||||
));
|
||||
|
||||
setState(State::SyncRejected);
|
||||
@@ -209,93 +204,84 @@ void Asset::syncStateChanged(ResourceSynchronization* sync,
|
||||
}
|
||||
|
||||
bool Asset::isSyncResolveReady() {
|
||||
std::vector<std::shared_ptr<Asset>> requiredAssets = this->requiredAssets();
|
||||
std::vector<Asset*> requiredAssets = this->requiredAssets();
|
||||
|
||||
auto unsynchronizedAsset = std::find_if(
|
||||
requiredAssets.begin(),
|
||||
requiredAssets.end(),
|
||||
[](std::shared_ptr<Asset>& a) {
|
||||
return !a->isSynchronized();
|
||||
}
|
||||
const auto unsynchronizedAsset = std::find_if(
|
||||
requiredAssets.cbegin(),
|
||||
requiredAssets.cend(),
|
||||
[](Asset* a) { return !a->isSynchronized(); }
|
||||
);
|
||||
|
||||
if (unsynchronizedAsset != requiredAssets.end()) {
|
||||
if (unsynchronizedAsset != requiredAssets.cend()) {
|
||||
// Not considered resolved if there is one or more unresolved children
|
||||
return false;
|
||||
}
|
||||
|
||||
const std::vector<std::shared_ptr<ResourceSynchronization>>& syncs =
|
||||
ownSynchronizations();
|
||||
|
||||
auto unresolvedOwnSynchronization = std::find_if(
|
||||
syncs.begin(),
|
||||
syncs.end(),
|
||||
[](const std::shared_ptr<ResourceSynchronization>& s) {
|
||||
return !s->isResolved();
|
||||
}
|
||||
const auto unresolvedOwnSynchronization = std::find_if(
|
||||
_synchronizations.cbegin(),
|
||||
_synchronizations.cend(),
|
||||
[](const std::shared_ptr<ResourceSynchronization>& s) { return !s->isResolved(); }
|
||||
);
|
||||
|
||||
// To be considered resolved, all own synchronizations need to be resolved
|
||||
return unresolvedOwnSynchronization == syncs.end();
|
||||
return unresolvedOwnSynchronization == _synchronizations.cend();
|
||||
}
|
||||
|
||||
const std::vector<std::shared_ptr<ResourceSynchronization>>&
|
||||
Asset::ownSynchronizations() const
|
||||
{
|
||||
return _synchronizations;
|
||||
std::vector<ResourceSynchronization*> Asset::ownSynchronizations() const {
|
||||
std::vector<ResourceSynchronization*> res;
|
||||
res.reserve(_synchronizations.size());
|
||||
std::transform(
|
||||
_synchronizations.begin(), _synchronizations.end(),
|
||||
std::back_inserter(res),
|
||||
std::mem_fn(&std::shared_ptr<ResourceSynchronization>::get)
|
||||
);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
std::vector<std::shared_ptr<const Asset>> Asset::subTreeAssets() const {
|
||||
std::unordered_set<std::shared_ptr<const Asset>> assets({ shared_from_this() });
|
||||
for (const std::shared_ptr<Asset>& c : childAssets()) {
|
||||
if (c.get() == this) {
|
||||
std::vector<const Asset*> Asset::subTreeAssets() const {
|
||||
std::unordered_set<const Asset*> assets({ this });
|
||||
for (Asset* c : childAssets()) {
|
||||
if (c == this) {
|
||||
throw ghoul::RuntimeError(fmt::format(
|
||||
"Detected cycle in asset inclusion for {} at {}", _assetName, _assetPath
|
||||
));
|
||||
}
|
||||
|
||||
const std::vector<std::shared_ptr<const Asset>>& subTree = c->subTreeAssets();
|
||||
std::vector<const Asset*> subTree = c->subTreeAssets();
|
||||
std::copy(subTree.begin(), subTree.end(), std::inserter(assets, assets.end()));
|
||||
}
|
||||
std::vector<std::shared_ptr<const Asset>> assetVector(assets.begin(), assets.end());
|
||||
std::vector<const Asset*> assetVector(assets.begin(), assets.end());
|
||||
return assetVector;
|
||||
}
|
||||
|
||||
std::vector<std::shared_ptr<const Asset>> Asset::requiredSubTreeAssets() const {
|
||||
std::unordered_set<std::shared_ptr<const Asset>> assets({ shared_from_this() });
|
||||
std::vector<const Asset*> Asset::requiredSubTreeAssets() const {
|
||||
std::unordered_set<const Asset*> assets({ this });
|
||||
for (const std::shared_ptr<Asset>& dep : _requiredAssets) {
|
||||
const std::vector<std::shared_ptr<const Asset>>& subTree =
|
||||
dep->requiredSubTreeAssets();
|
||||
|
||||
std::vector<const Asset*> subTree = dep->requiredSubTreeAssets();
|
||||
std::copy(subTree.begin(), subTree.end(), std::inserter(assets, assets.end()));
|
||||
}
|
||||
std::vector<std::shared_ptr<const Asset>> assetVector(assets.begin(), assets.end());
|
||||
std::vector<const Asset*> assetVector(assets.begin(), assets.end());
|
||||
return assetVector;
|
||||
}
|
||||
|
||||
bool Asset::isLoaded() const {
|
||||
State s = state();
|
||||
return s != State::Unloaded && s != State::LoadingFailed;
|
||||
return _state != State::Unloaded && _state != State::LoadingFailed;
|
||||
}
|
||||
|
||||
bool Asset::isSynchronized() const {
|
||||
State s = state();
|
||||
return s == State::SyncResolved ||
|
||||
s == State::Initialized ||
|
||||
s == State::InitializationFailed;
|
||||
return _state == State::SyncResolved || _state == State::Initialized ||
|
||||
_state == State::InitializationFailed;
|
||||
}
|
||||
|
||||
bool Asset::isSyncingOrResolved() const {
|
||||
State s = state();
|
||||
return s == State::Synchronizing ||
|
||||
s == State::SyncResolved ||
|
||||
s == State::Initialized ||
|
||||
s == State::InitializationFailed;
|
||||
return _state == State::Synchronizing || _state == State::SyncResolved ||
|
||||
_state == State::Initialized || _state == State::InitializationFailed;
|
||||
}
|
||||
|
||||
bool Asset::hasLoadedParent() {
|
||||
{
|
||||
std::vector<std::weak_ptr<Asset>>::iterator it = _requiringAssets.begin();
|
||||
auto it = _requiringAssets.begin();
|
||||
while (it != _requiringAssets.end()) {
|
||||
std::shared_ptr<Asset> parent = it->lock();
|
||||
if (!parent) {
|
||||
@@ -309,7 +295,7 @@ bool Asset::hasLoadedParent() {
|
||||
}
|
||||
}
|
||||
{
|
||||
std::vector<std::weak_ptr<Asset>>::iterator it = _requestingAssets.begin();
|
||||
auto it = _requestingAssets.begin();
|
||||
while (it != _requestingAssets.end()) {
|
||||
std::shared_ptr<Asset> parent = it->lock();
|
||||
if (!parent) {
|
||||
@@ -371,8 +357,7 @@ bool Asset::hasInitializedParent() const {
|
||||
}
|
||||
|
||||
bool Asset::isInitialized() const {
|
||||
State s = state();
|
||||
return s == State::Initialized;
|
||||
return _state == State::Initialized;
|
||||
}
|
||||
|
||||
bool Asset::startSynchronizations() {
|
||||
@@ -380,33 +365,33 @@ bool Asset::startSynchronizations() {
|
||||
LWARNING(fmt::format("Cannot start synchronizations of unloaded asset {}", id()));
|
||||
return false;
|
||||
}
|
||||
for (const std::shared_ptr<Asset>& child : requestedAssets()) {
|
||||
for (Asset* child : requestedAssets()) {
|
||||
child->startSynchronizations();
|
||||
}
|
||||
|
||||
// Do not attempt to resync if this is already done
|
||||
if (isSyncingOrResolved()) {
|
||||
return state() != State::SyncResolved;
|
||||
return _state != State::SyncResolved;
|
||||
}
|
||||
|
||||
setState(State::Synchronizing);
|
||||
|
||||
bool childFailed = false;
|
||||
|
||||
// Start synchronization of all children first.
|
||||
for (const std::shared_ptr<Asset>& child : requiredAssets()) {
|
||||
// Start synchronization of all children first
|
||||
for (Asset* child : requiredAssets()) {
|
||||
if (!child->startSynchronizations()) {
|
||||
childFailed = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Now synchronize its own synchronizations.
|
||||
for (const std::shared_ptr<ResourceSynchronization>& s : ownSynchronizations()) {
|
||||
// Now synchronize its own synchronizations
|
||||
for (const std::shared_ptr<ResourceSynchronization>& s : _synchronizations) {
|
||||
if (!s->isResolved()) {
|
||||
s->start();
|
||||
}
|
||||
}
|
||||
// If all syncs are resolved (or no syncs exist), mark as resolved.
|
||||
// If all syncs are resolved (or no syncs exist), mark as resolved
|
||||
if (!isInitialized() && isSyncResolveReady()) {
|
||||
setState(State::SyncResolved);
|
||||
}
|
||||
@@ -414,14 +399,14 @@ bool Asset::startSynchronizations() {
|
||||
}
|
||||
|
||||
bool Asset::cancelAllSynchronizations() {
|
||||
bool cancelledAnySync = false;
|
||||
for (const std::shared_ptr<Asset>& child : childAssets()) {
|
||||
const bool cancelled = child->cancelAllSynchronizations();
|
||||
if (cancelled) {
|
||||
cancelledAnySync = true;
|
||||
}
|
||||
}
|
||||
for (const std::shared_ptr<ResourceSynchronization>& s : ownSynchronizations()) {
|
||||
std::vector<Asset*> children = childAssets();
|
||||
bool cancelledAnySync = std::any_of(
|
||||
children.cbegin(),
|
||||
children.cend(),
|
||||
std::mem_fn(&Asset::cancelAllSynchronizations)
|
||||
);
|
||||
|
||||
for (const std::shared_ptr<ResourceSynchronization>& s : _synchronizations) {
|
||||
if (s->isSyncing()) {
|
||||
cancelledAnySync = true;
|
||||
s->cancel();
|
||||
@@ -438,14 +423,15 @@ bool Asset::cancelUnwantedSynchronizations() {
|
||||
if (hasSyncingOrResolvedParent()) {
|
||||
return false;
|
||||
}
|
||||
bool cancelledAnySync = false;
|
||||
for (const std::shared_ptr<Asset>& child : childAssets()) {
|
||||
bool cancelled = child->cancelUnwantedSynchronizations();
|
||||
if (cancelled) {
|
||||
cancelledAnySync = true;
|
||||
}
|
||||
}
|
||||
for (const std::shared_ptr<ResourceSynchronization>& s : ownSynchronizations()) {
|
||||
|
||||
const std::vector<Asset*>& children = childAssets();
|
||||
bool cancelledAnySync = std::any_of(
|
||||
children.begin(),
|
||||
children.end(),
|
||||
std::mem_fn(&Asset::cancelUnwantedSynchronizations)
|
||||
);
|
||||
|
||||
for (const std::shared_ptr<ResourceSynchronization>& s : _synchronizations) {
|
||||
if (s->isSyncing()) {
|
||||
cancelledAnySync = true;
|
||||
s->cancel();
|
||||
@@ -458,18 +444,13 @@ bool Asset::cancelUnwantedSynchronizations() {
|
||||
return cancelledAnySync;
|
||||
}
|
||||
|
||||
bool Asset::restartAllSynchronizations() {
|
||||
cancelAllSynchronizations();
|
||||
return startSynchronizations();
|
||||
}
|
||||
|
||||
float Asset::requiredSynchronizationProgress() const {
|
||||
const std::vector<std::shared_ptr<const Asset>>& assets = requiredSubTreeAssets();
|
||||
std::vector<const Asset*> assets = requiredSubTreeAssets();
|
||||
return syncProgress(assets);
|
||||
}
|
||||
|
||||
float Asset::requestedSynchronizationProgress() {
|
||||
const std::vector<std::shared_ptr<const Asset>>& assets = subTreeAssets();
|
||||
std::vector<const Asset*> assets = subTreeAssets();
|
||||
return syncProgress(assets);
|
||||
}
|
||||
|
||||
@@ -478,7 +459,7 @@ bool Asset::load() {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool loaded = loader()->loadAsset(shared_from_this());
|
||||
const bool loaded = loader()->loadAsset(this);
|
||||
setState(loaded ? State::Loaded : State::LoadingFailed);
|
||||
return loaded;
|
||||
}
|
||||
@@ -491,11 +472,11 @@ void Asset::unload() {
|
||||
setState(State::Unloaded);
|
||||
loader()->unloadAsset(this);
|
||||
|
||||
for (const std::shared_ptr<Asset>& child : requiredAssets()) {
|
||||
unrequire(child.get());
|
||||
for (Asset* child : requiredAssets()) {
|
||||
unrequire(child);
|
||||
}
|
||||
for (const std::shared_ptr<Asset>& child : requestedAssets()) {
|
||||
unrequest(child.get());
|
||||
for (Asset* child : requestedAssets()) {
|
||||
unrequest(child);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -537,12 +518,12 @@ bool Asset::initialize() {
|
||||
"Failed to initialize asset {}; {}: {}", id(), e.component, e.message
|
||||
));
|
||||
// TODO: rollback;
|
||||
setState(Asset::State::InitializationFailed);
|
||||
setState(State::InitializationFailed);
|
||||
return false;
|
||||
}
|
||||
|
||||
// 4. Update state
|
||||
setState(Asset::State::Initialized);
|
||||
setState(State::Initialized);
|
||||
|
||||
// 5. Call dependency lua onInitialize of this and requirements
|
||||
for (const std::shared_ptr<Asset>& child : _requiredAssets) {
|
||||
@@ -552,13 +533,10 @@ bool Asset::initialize() {
|
||||
catch (const ghoul::lua::LuaRuntimeException& e) {
|
||||
LERROR(fmt::format(
|
||||
"Failed to initialize required asset {} of {}; {}: {}",
|
||||
child->id(),
|
||||
id(),
|
||||
e.component,
|
||||
e.message
|
||||
child->id(), id(), e.component, e.message
|
||||
));
|
||||
// TODO: rollback;
|
||||
setState(Asset::State::InitializationFailed);
|
||||
setState(State::InitializationFailed);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -572,10 +550,7 @@ bool Asset::initialize() {
|
||||
catch (const ghoul::lua::LuaRuntimeException& e) {
|
||||
LERROR(fmt::format(
|
||||
"Failed to initialize requested asset {} of {}; {}: {}",
|
||||
child->id(),
|
||||
id(),
|
||||
e.component,
|
||||
e.message
|
||||
child->id(), id(), e.component, e.message
|
||||
));
|
||||
// TODO: rollback;
|
||||
}
|
||||
@@ -592,10 +567,7 @@ bool Asset::initialize() {
|
||||
catch (const ghoul::lua::LuaRuntimeException& e) {
|
||||
LERROR(fmt::format(
|
||||
"Failed to initialize required asset {} of {}; {}: {}",
|
||||
id(),
|
||||
p->id(),
|
||||
e.component,
|
||||
e.message
|
||||
id(), p->id(), e.component, e.message
|
||||
));
|
||||
// TODO: rollback;
|
||||
}
|
||||
@@ -678,7 +650,7 @@ void Asset::deinitialize() {
|
||||
}
|
||||
|
||||
// 2 and 1. Deinitialize unwanted requirements and requests
|
||||
for (const std::shared_ptr<Asset>& dependency : childAssets()) {
|
||||
for (Asset* dependency : childAssets()) {
|
||||
dependency->deinitializeIfUnwanted();
|
||||
}
|
||||
}
|
||||
@@ -709,13 +681,11 @@ AssetLoader* Asset::loader() const {
|
||||
|
||||
bool Asset::requires(const Asset* asset) const {
|
||||
const auto it = std::find_if(
|
||||
_requiredAssets.begin(),
|
||||
_requiredAssets.end(),
|
||||
[asset](std::shared_ptr<Asset> dep) {
|
||||
return dep.get() == asset;
|
||||
}
|
||||
_requiredAssets.cbegin(),
|
||||
_requiredAssets.cend(),
|
||||
[asset](const std::shared_ptr<Asset> dep) { return dep.get() == asset; }
|
||||
);
|
||||
return it != _requiredAssets.end();
|
||||
return it != _requiredAssets.cend();
|
||||
}
|
||||
|
||||
void Asset::require(std::shared_ptr<Asset> child) {
|
||||
@@ -723,12 +693,12 @@ void Asset::require(std::shared_ptr<Asset> child) {
|
||||
throw ghoul::RuntimeError("Cannot require child asset when already loaded");
|
||||
}
|
||||
|
||||
const auto it = std::find(_requiredAssets.begin(), _requiredAssets.end(), child);
|
||||
|
||||
if (it != _requiredAssets.end()) {
|
||||
const auto it = std::find(_requiredAssets.cbegin(), _requiredAssets.cend(), child);
|
||||
if (it != _requiredAssets.cend()) {
|
||||
// Do nothing if the requirement already exists.
|
||||
return;
|
||||
}
|
||||
|
||||
_requiredAssets.push_back(child);
|
||||
child->_requiringAssets.push_back(shared_from_this());
|
||||
|
||||
@@ -761,12 +731,12 @@ void Asset::unrequire(Asset* child) {
|
||||
}
|
||||
|
||||
const auto childIt = std::find_if(
|
||||
_requiredAssets.begin(),
|
||||
_requiredAssets.end(),
|
||||
_requiredAssets.cbegin(),
|
||||
_requiredAssets.cend(),
|
||||
[child](const std::shared_ptr<Asset>& asset) { return asset.get() == child; }
|
||||
);
|
||||
|
||||
if (childIt == _requiredAssets.end()) {
|
||||
if (childIt == _requiredAssets.cend()) {
|
||||
// Do nothing if the request node not exist.
|
||||
return;
|
||||
}
|
||||
@@ -774,14 +744,11 @@ void Asset::unrequire(Asset* child) {
|
||||
_requiredAssets.erase(childIt);
|
||||
|
||||
const auto parentIt = std::find_if(
|
||||
child->_requiringAssets.begin(),
|
||||
child->_requiringAssets.end(),
|
||||
[this](std::weak_ptr<Asset> a) {
|
||||
return a.lock().get() == this;
|
||||
}
|
||||
child->_requiringAssets.cbegin(),
|
||||
child->_requiringAssets.cend(),
|
||||
[this](const std::weak_ptr<Asset> a) { return a.lock().get() == this; }
|
||||
);
|
||||
|
||||
if (parentIt == child->_requiringAssets.end()) {
|
||||
if (parentIt == child->_requiringAssets.cend()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -793,12 +760,12 @@ void Asset::unrequire(Asset* child) {
|
||||
}
|
||||
|
||||
void Asset::request(std::shared_ptr<Asset> child) {
|
||||
const auto it = std::find(_requestedAssets.begin(), _requestedAssets.end(), child);
|
||||
|
||||
if (it != _requestedAssets.end()) {
|
||||
const auto it = std::find(_requestedAssets.cbegin(), _requestedAssets.cend(), child);
|
||||
if (it != _requestedAssets.cend()) {
|
||||
// Do nothing if the request already exists.
|
||||
return;
|
||||
}
|
||||
|
||||
_requestedAssets.push_back(child);
|
||||
child->_requestingAssets.push_back(shared_from_this());
|
||||
|
||||
@@ -817,12 +784,11 @@ void Asset::request(std::shared_ptr<Asset> child) {
|
||||
|
||||
void Asset::unrequest(Asset* child) {
|
||||
const auto childIt = std::find_if(
|
||||
_requestedAssets.begin(),
|
||||
_requestedAssets.end(),
|
||||
_requestedAssets.cbegin(),
|
||||
_requestedAssets.cend(),
|
||||
[child](const std::shared_ptr<Asset>& asset) { return asset.get() == child; }
|
||||
);
|
||||
|
||||
if (childIt == _requestedAssets.end()) {
|
||||
if (childIt == _requestedAssets.cend()) {
|
||||
// Do nothing if the request node not exist.
|
||||
return;
|
||||
}
|
||||
@@ -830,14 +796,11 @@ void Asset::unrequest(Asset* child) {
|
||||
_requestedAssets.erase(childIt);
|
||||
|
||||
const auto parentIt = std::find_if(
|
||||
child->_requestingAssets.begin(),
|
||||
child->_requestingAssets.end(),
|
||||
[this](std::weak_ptr<Asset> a) {
|
||||
return a.lock().get() == this;
|
||||
}
|
||||
child->_requestingAssets.cbegin(),
|
||||
child->_requestingAssets.cend(),
|
||||
[this](const std::weak_ptr<Asset> a) { return a.lock().get() == this; }
|
||||
);
|
||||
|
||||
if (parentIt == child->_requestingAssets.end()) {
|
||||
if (parentIt == child->_requestingAssets.cend()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -850,83 +813,64 @@ void Asset::unrequest(Asset* child) {
|
||||
|
||||
bool Asset::requests(Asset* asset) const {
|
||||
const auto it = std::find_if(
|
||||
_requestedAssets.begin(),
|
||||
_requestedAssets.end(),
|
||||
[asset](const std::shared_ptr<Asset>& dep) {
|
||||
return dep.get() == asset;
|
||||
}
|
||||
_requestedAssets.cbegin(),
|
||||
_requestedAssets.cend(),
|
||||
[asset](const std::shared_ptr<Asset>& dep) { return dep.get() == asset; }
|
||||
);
|
||||
return it != _requiredAssets.end();
|
||||
return it != _requiredAssets.cend();
|
||||
}
|
||||
|
||||
const std::vector<std::shared_ptr<Asset>>& Asset::requiredAssets() const {
|
||||
return _requiredAssets;
|
||||
std::vector<Asset*> Asset::requiredAssets() const {
|
||||
std::vector<Asset*> res;
|
||||
res.reserve(_requiredAssets.size());
|
||||
for (const std::shared_ptr<Asset>& a : _requiredAssets) {
|
||||
res.push_back(a.get());
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
std::vector<std::shared_ptr<Asset>> Asset::requiringAssets() const {
|
||||
std::vector<std::shared_ptr<Asset>> assets;
|
||||
assets.reserve(_requiringAssets.size());
|
||||
std::vector<Asset*> Asset::requiringAssets() const {
|
||||
std::vector<Asset*> res;
|
||||
res.reserve(_requiringAssets.size());
|
||||
for (const std::weak_ptr<Asset>& a : _requiringAssets) {
|
||||
std::shared_ptr<Asset> shared = a.lock();
|
||||
if (shared) {
|
||||
assets.push_back(shared);
|
||||
if (std::shared_ptr<Asset> shared = a.lock(); shared) {
|
||||
res.push_back(shared.get());
|
||||
}
|
||||
}
|
||||
return assets;
|
||||
return res;
|
||||
}
|
||||
|
||||
const std::vector<std::shared_ptr<Asset>>& Asset::requestedAssets() const {
|
||||
return _requestedAssets;
|
||||
std::vector<Asset*> Asset::requestedAssets() const {
|
||||
std::vector<Asset*> res;
|
||||
res.reserve(_requestedAssets.size());
|
||||
for (const std::shared_ptr<Asset>& a : _requestedAssets) {
|
||||
res.push_back(a.get());
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
std::vector<std::shared_ptr<Asset>> Asset::requestingAssets() const {
|
||||
std::vector<std::shared_ptr<Asset>> assets;
|
||||
assets.reserve(_requestingAssets.size());
|
||||
std::vector<Asset*> Asset::requestingAssets() const {
|
||||
std::vector<Asset*> res;
|
||||
res.reserve(_requestingAssets.size());
|
||||
for (const std::weak_ptr<Asset>& a : _requestingAssets) {
|
||||
std::shared_ptr<Asset> shared = a.lock();
|
||||
if (shared) {
|
||||
assets.push_back(shared);
|
||||
if (std::shared_ptr<Asset> shared = a.lock(); shared) {
|
||||
res.push_back(shared.get());
|
||||
}
|
||||
}
|
||||
return assets;
|
||||
return res;
|
||||
}
|
||||
|
||||
std::vector<std::shared_ptr<Asset>> Asset::childAssets() const {
|
||||
std::vector<std::shared_ptr<Asset>> children;
|
||||
std::vector<Asset*> Asset::childAssets() const {
|
||||
std::vector<Asset*> children;
|
||||
children.reserve(_requiredAssets.size() + _requestedAssets.size());
|
||||
children.insert(children.end(), _requiredAssets.begin(), _requiredAssets.end());
|
||||
children.insert(children.end(), _requestedAssets.begin(), _requestedAssets.end());
|
||||
|
||||
for (const std::shared_ptr<Asset>& a : _requiredAssets) {
|
||||
children.push_back(a.get());
|
||||
}
|
||||
for (const std::shared_ptr<Asset>& a : _requestedAssets) {
|
||||
children.push_back(a.get());
|
||||
}
|
||||
return children;
|
||||
}
|
||||
|
||||
std::vector<std::shared_ptr<Asset>> Asset::parentAssets() const {
|
||||
std::vector<std::shared_ptr<Asset>> parents;
|
||||
std::vector<std::shared_ptr<Asset>> requiring = requiringAssets();
|
||||
std::vector<std::shared_ptr<Asset>> requesting = requestingAssets();
|
||||
parents.reserve(requiring.size() + requesting.size());
|
||||
parents.insert(parents.end(), requiring.begin(), requiring.end());
|
||||
parents.insert(parents.end(), requesting.begin(), requesting.end());
|
||||
return parents;
|
||||
}
|
||||
|
||||
bool Asset::isRequired() const {
|
||||
return !_requiringAssets.empty();
|
||||
}
|
||||
|
||||
bool Asset::isRequested() const {
|
||||
return !_requestingAssets.empty();
|
||||
}
|
||||
|
||||
bool Asset::shouldBeInitialized() const {
|
||||
std::vector<std::shared_ptr<Asset>> parents = parentAssets();
|
||||
const auto initializedAsset = std::find_if(
|
||||
parents.begin(),
|
||||
parents.end(),
|
||||
[](const std::shared_ptr<Asset>& a) {
|
||||
return a->state() == State::Initialized;
|
||||
}
|
||||
);
|
||||
return initializedAsset != parents.end();
|
||||
}
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
@@ -33,9 +33,9 @@
|
||||
#include <ghoul/lua/luastate.h>
|
||||
#include <ghoul/lua/lua_helper.h>
|
||||
#include <ghoul/logging/logmanager.h>
|
||||
#include <ghoul/misc/assert.h>
|
||||
#include <ghoul/misc/defer.h>
|
||||
|
||||
|
||||
#include "assetloader_lua.inl"
|
||||
|
||||
namespace {
|
||||
@@ -55,6 +55,14 @@ namespace {
|
||||
constexpr const char* DirectoryConstantName = "directory";
|
||||
constexpr const char* FilePathConstantName = "filePath";
|
||||
|
||||
constexpr const char* MetaInformationKey = "meta";
|
||||
constexpr const char* MetaInformationName = "Name";
|
||||
constexpr const char* MetaInformationVersion = "Version";
|
||||
constexpr const char* MetaInformationDescription = "Description";
|
||||
constexpr const char* MetaInformationAuthor = "Author";
|
||||
constexpr const char* MetaInformationURL = "URL";
|
||||
constexpr const char* MetaInformationLicense = "License";
|
||||
|
||||
constexpr const char* ExportsTableName = "_exports";
|
||||
constexpr const char* AssetTableName = "_asset";
|
||||
constexpr const char* DependantsTableName = "_dependants";
|
||||
@@ -64,7 +72,7 @@ namespace {
|
||||
constexpr const char* AssetFileSuffix = "asset";
|
||||
constexpr const char* SceneFileSuffix = "scene";
|
||||
|
||||
enum class PathType : int {
|
||||
enum class PathType {
|
||||
RelativeToAsset = 0,
|
||||
RelativeToAssetRoot,
|
||||
Absolute
|
||||
@@ -85,7 +93,7 @@ namespace {
|
||||
}
|
||||
return PathType::RelativeToAssetRoot;
|
||||
}
|
||||
}
|
||||
} // namespace
|
||||
|
||||
namespace openspace {
|
||||
|
||||
@@ -97,9 +105,9 @@ AssetLoader::AssetLoader(ghoul::lua::LuaState* luaState,
|
||||
, _assetRootDirectory(std::move(assetRootDirectory))
|
||||
, _luaState(luaState)
|
||||
{
|
||||
setCurrentAsset(_rootAsset);
|
||||
setCurrentAsset(_rootAsset.get());
|
||||
|
||||
// Create _assets table.
|
||||
// Create _assets table
|
||||
lua_newtable(*_luaState);
|
||||
_assetsTableRef = luaL_ref(*_luaState, LUA_REGISTRYINDEX);
|
||||
}
|
||||
@@ -124,37 +132,35 @@ void AssetLoader::untrackAsset(Asset* asset) {
|
||||
}
|
||||
|
||||
void AssetLoader::setUpAssetLuaTable(Asset* asset) {
|
||||
/*
|
||||
Set up lua table:
|
||||
AssetInfo
|
||||
|- Exports (table<name, exported data>)
|
||||
|- Asset
|
||||
| |- localResource
|
||||
| |- syncedResource
|
||||
| |- require
|
||||
| |- request
|
||||
| |- exists
|
||||
| |- export
|
||||
| |- onInitialize
|
||||
| |- onDeinitialize
|
||||
| |- directory
|
||||
|- Dependants (table<dependant, Dependency dep>)
|
||||
// Set up lua table:
|
||||
// AssetInfo
|
||||
// |- Exports (table<name, exported data>)
|
||||
// |- Asset
|
||||
// | |- localResource
|
||||
// | |- syncedResource
|
||||
// | |- require
|
||||
// | |- request
|
||||
// | |- exists
|
||||
// | |- export
|
||||
// | |- onInitialize
|
||||
// | |- onDeinitialize
|
||||
// | |- directory
|
||||
// |- Dependants (table<dependant, Dependency dep>)
|
||||
//
|
||||
// where Dependency is a table:
|
||||
// Dependency
|
||||
// |- onInitialize
|
||||
// |- onDeinitialize
|
||||
|
||||
where Dependency is a table:
|
||||
Dependency
|
||||
|- onInitialize
|
||||
|- onDeinitialize
|
||||
*/
|
||||
|
||||
int top = lua_gettop(*_luaState);
|
||||
const int top = lua_gettop(*_luaState);
|
||||
|
||||
// Push the global table of AssetInfos to the lua stack.
|
||||
lua_rawgeti(*_luaState, LUA_REGISTRYINDEX, _assetsTableRef);
|
||||
int globalTableIndex = lua_gettop(*_luaState);
|
||||
const int globalTableIndex = lua_gettop(*_luaState);
|
||||
|
||||
// Create a AssetInfo table for the current asset.
|
||||
lua_newtable(*_luaState);
|
||||
int assetInfoTableIndex = lua_gettop(*_luaState);
|
||||
const int assetInfoTableIndex = lua_gettop(*_luaState);
|
||||
|
||||
// Register empty Exports table for the current asset.
|
||||
// (string => exported object)
|
||||
@@ -164,7 +170,7 @@ void AssetLoader::setUpAssetLuaTable(Asset* asset) {
|
||||
// Create Asset table
|
||||
// (string => lua functions)
|
||||
lua_newtable(*_luaState);
|
||||
int assetTableIndex = lua_gettop(*_luaState);
|
||||
const int assetTableIndex = lua_gettop(*_luaState);
|
||||
|
||||
// Register local resource function
|
||||
// string localResource(string path)
|
||||
@@ -191,7 +197,7 @@ void AssetLoader::setUpAssetLuaTable(Asset* asset) {
|
||||
lua_setfield(*_luaState, assetTableIndex, RequestFunctionName);
|
||||
|
||||
// Register exists function
|
||||
// bool exsists(string path)
|
||||
// bool exists(string path)
|
||||
lua_pushlightuserdata(*_luaState, asset);
|
||||
lua_pushcclosure(*_luaState, &assetloader::exists, 1);
|
||||
lua_setfield(*_luaState, assetTableIndex, ExistsFunctionName);
|
||||
@@ -239,10 +245,10 @@ void AssetLoader::setUpAssetLuaTable(Asset* asset) {
|
||||
}
|
||||
|
||||
void AssetLoader::tearDownAssetLuaTable(Asset* asset) {
|
||||
int top = lua_gettop(*_luaState);
|
||||
const int top = lua_gettop(*_luaState);
|
||||
// Push the global table of AssetInfos to the lua stack.
|
||||
lua_rawgeti(*_luaState, LUA_REGISTRYINDEX, _assetsTableRef);
|
||||
int globalTableIndex = lua_gettop(*_luaState);
|
||||
const int globalTableIndex = lua_gettop(*_luaState);
|
||||
|
||||
lua_pushnil(*_luaState);
|
||||
|
||||
@@ -251,9 +257,9 @@ void AssetLoader::tearDownAssetLuaTable(Asset* asset) {
|
||||
lua_settop(*_luaState, top);
|
||||
}
|
||||
|
||||
bool AssetLoader::loadAsset(std::shared_ptr<Asset> asset) {
|
||||
int top = lua_gettop(*_luaState);
|
||||
std::shared_ptr<Asset> parentAsset = _currentAsset;
|
||||
bool AssetLoader::loadAsset(Asset* asset) {
|
||||
const int top = lua_gettop(*_luaState);
|
||||
Asset* parentAsset = _currentAsset;
|
||||
|
||||
setCurrentAsset(asset);
|
||||
defer {
|
||||
@@ -270,7 +276,8 @@ bool AssetLoader::loadAsset(std::shared_ptr<Asset> asset) {
|
||||
|
||||
try {
|
||||
ghoul::lua::runScriptFile(*_luaState, asset->assetFilePath());
|
||||
} catch (const ghoul::lua::LuaRuntimeException& e) {
|
||||
}
|
||||
catch (const ghoul::lua::LuaRuntimeException& e) {
|
||||
LERROR(fmt::format(
|
||||
"Could not load asset '{}': {}", asset->assetFilePath(), e.message)
|
||||
);
|
||||
@@ -278,6 +285,35 @@ bool AssetLoader::loadAsset(std::shared_ptr<Asset> asset) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Extract meta information from the asset file if it was provided
|
||||
// 1. Load the asset table
|
||||
lua_getglobal(*_luaState, AssetGlobalVariableName);
|
||||
ghoul_assert(lua_istable(*_luaState, -1), "Expected 'asset' table");
|
||||
lua_getfield(*_luaState, -1, MetaInformationKey);
|
||||
if (!lua_isnil(*_luaState, -1)) {
|
||||
// The 'meta' object exist; quick sanity check that it is a table
|
||||
if (!lua_istable(*_luaState, -1)) {
|
||||
LWARNING(fmt::format(
|
||||
"When loading asset '{}', encountered a '{}' entry that was not a table",
|
||||
asset->assetFilePath(), MetaInformationKey
|
||||
));
|
||||
}
|
||||
else {
|
||||
// The 'meta' object exists and it is a table
|
||||
ghoul::Dictionary metaDict;
|
||||
ghoul::lua::luaDictionaryFromState(*_luaState, metaDict);
|
||||
|
||||
Asset::MetaInformation meta;
|
||||
metaDict.getValue(MetaInformationName, meta.name);
|
||||
metaDict.getValue(MetaInformationVersion, meta.version);
|
||||
metaDict.getValue(MetaInformationDescription, meta.description);
|
||||
metaDict.getValue(MetaInformationAuthor, meta.author);
|
||||
metaDict.getValue(MetaInformationURL, meta.url);
|
||||
metaDict.getValue(MetaInformationLicense, meta.license);
|
||||
asset->setMetaInformation(std::move(meta));
|
||||
}
|
||||
}
|
||||
|
||||
lua_settop(*_luaState, top);
|
||||
return true;
|
||||
}
|
||||
@@ -293,14 +329,18 @@ void AssetLoader::unloadAsset(Asset* asset) {
|
||||
}
|
||||
_onDeinitializationFunctionRefs[asset].clear();
|
||||
|
||||
for (const auto& it : _onDependencyInitializationFunctionRefs[asset]) {
|
||||
for (const std::pair<const Asset*, std::vector<int>>& it :
|
||||
_onDependencyInitializationFunctionRefs[asset])
|
||||
{
|
||||
for (int ref : it.second) {
|
||||
luaL_unref(*_luaState, LUA_REGISTRYINDEX, ref);
|
||||
}
|
||||
}
|
||||
_onDependencyInitializationFunctionRefs.erase(asset);
|
||||
|
||||
for (const auto& it : _onDependencyDeinitializationFunctionRefs[asset]) {
|
||||
for (const std::pair<Asset*, std::vector<int>>& it :
|
||||
_onDependencyDeinitializationFunctionRefs[asset])
|
||||
{
|
||||
for (int ref : it.second) {
|
||||
luaL_unref(*_luaState, LUA_REGISTRYINDEX, ref);
|
||||
}
|
||||
@@ -330,60 +370,54 @@ std::string AssetLoader::generateAssetPath(const std::string& baseDirectory,
|
||||
|
||||
// Construct the full path including the .asset extension
|
||||
std::string assetSuffix = std::string(".") + AssetFileSuffix;
|
||||
bool hasAssetSuffix =
|
||||
const bool hasAssetSuffix =
|
||||
(assetPath.size() > assetSuffix.size()) &&
|
||||
(assetPath.substr(assetPath.size() - assetSuffix.size()) == assetSuffix);
|
||||
std::string fullAssetPath =
|
||||
const std::string fullAssetPath =
|
||||
hasAssetSuffix ?
|
||||
prefix + assetPath :
|
||||
prefix + assetPath + assetSuffix;
|
||||
bool fullAssetPathExists = FileSys.fileExists(FileSys.absPath(fullAssetPath));
|
||||
|
||||
// Construct the full path including the .scene extension
|
||||
std::string sceneSuffix = std::string(".") + SceneFileSuffix;
|
||||
bool hasSceneSuffix =
|
||||
const std::string sceneSuffix = std::string(".") + SceneFileSuffix;
|
||||
const bool hasSceneSuffix =
|
||||
(assetPath.size() > sceneSuffix.size()) &&
|
||||
(assetPath.substr(assetPath.size() - sceneSuffix.size()) == sceneSuffix);
|
||||
std::string fullScenePath =
|
||||
const std::string fullScenePath =
|
||||
hasSceneSuffix ?
|
||||
prefix + assetPath :
|
||||
prefix + assetPath + sceneSuffix;
|
||||
bool fullScenePathExists = FileSys.fileExists(FileSys.absPath(fullScenePath));
|
||||
const bool fullScenePathExists = FileSys.fileExists(FileSys.absPath(fullScenePath));
|
||||
|
||||
if (fullAssetPathExists && fullScenePathExists) {
|
||||
LWARNING(
|
||||
fmt::format(
|
||||
"'{}' and '{}' file found with non-specific request '{}'. Loading '{}'. "
|
||||
"Explicitly add extension to suppress this warning.",
|
||||
fullAssetPath,
|
||||
fullScenePath,
|
||||
prefix + assetPath,
|
||||
fullAssetPath
|
||||
)
|
||||
);
|
||||
LWARNING(fmt::format(
|
||||
"'{}' and '{}' file found with non-specific request '{}'. Loading '{}'. "
|
||||
"Explicitly add extension to suppress this warning.",
|
||||
fullAssetPath, fullScenePath, prefix + assetPath, fullAssetPath
|
||||
));
|
||||
|
||||
return ghoul::filesystem::File(FileSys.absPath(fullAssetPath));
|
||||
return FileSys.absPath(fullAssetPath);
|
||||
}
|
||||
|
||||
if (fullScenePathExists) {
|
||||
return ghoul::filesystem::File(FileSys.absPath(fullScenePath));
|
||||
return FileSys.absPath(fullScenePath);
|
||||
}
|
||||
|
||||
// We don't check whether the file exists here as the error will be more
|
||||
// comprehensively logged by Lua either way
|
||||
return ghoul::filesystem::File(FileSys.absPath(fullAssetPath));
|
||||
return FileSys.absPath(fullAssetPath);
|
||||
}
|
||||
|
||||
std::shared_ptr<Asset> AssetLoader::getAsset(std::string name) {
|
||||
std::shared_ptr<Asset> AssetLoader::getAsset(const std::string& name) {
|
||||
ghoul::filesystem::Directory directory = currentDirectory();
|
||||
std::string path = generateAssetPath(directory, std::move(name));
|
||||
const std::string path = generateAssetPath(directory, name);
|
||||
|
||||
// Check if asset is already loaded.
|
||||
const auto it = _trackedAssets.find(path);
|
||||
|
||||
if (it != _trackedAssets.end()) {
|
||||
std::shared_ptr<Asset> a = it->second.lock();
|
||||
if (a != nullptr) {
|
||||
if (std::shared_ptr<Asset> a = it->second.lock(); a != nullptr) {
|
||||
return a;
|
||||
}
|
||||
}
|
||||
@@ -401,7 +435,7 @@ std::shared_ptr<Asset> AssetLoader::getAsset(std::string name) {
|
||||
int AssetLoader::onInitializeLua(Asset* asset) {
|
||||
ghoul::lua::checkArgumentsAndThrow(*_luaState, 1, "lua::onInitialize");
|
||||
|
||||
int referenceIndex = luaL_ref(*_luaState, LUA_REGISTRYINDEX);
|
||||
const int referenceIndex = luaL_ref(*_luaState, LUA_REGISTRYINDEX);
|
||||
_onInitializationFunctionRefs[asset].push_back(referenceIndex);
|
||||
|
||||
lua_settop(*_luaState, 0);
|
||||
@@ -411,7 +445,7 @@ int AssetLoader::onInitializeLua(Asset* asset) {
|
||||
int AssetLoader::onDeinitializeLua(Asset* asset) {
|
||||
ghoul::lua::checkArgumentsAndThrow(*_luaState, 1, "lua::onDeinitialize");
|
||||
|
||||
int referenceIndex = luaL_ref(*_luaState, LUA_REGISTRYINDEX);
|
||||
const int referenceIndex = luaL_ref(*_luaState, LUA_REGISTRYINDEX);
|
||||
_onDeinitializationFunctionRefs[asset].push_back(referenceIndex);
|
||||
|
||||
lua_settop(*_luaState, 0);
|
||||
@@ -421,9 +455,8 @@ int AssetLoader::onDeinitializeLua(Asset* asset) {
|
||||
int AssetLoader::onInitializeDependencyLua(Asset* dependant, Asset* dependency) {
|
||||
ghoul::lua::checkArgumentsAndThrow(*_luaState, 1, "lua::onInitializeDependency");
|
||||
|
||||
int referenceIndex = luaL_ref(*_luaState, LUA_REGISTRYINDEX);
|
||||
_onDependencyInitializationFunctionRefs[dependant][dependency]
|
||||
.push_back(referenceIndex);
|
||||
const int refIndex = luaL_ref(*_luaState, LUA_REGISTRYINDEX);
|
||||
_onDependencyInitializationFunctionRefs[dependant][dependency].push_back(refIndex);
|
||||
|
||||
lua_settop(*_luaState, 0);
|
||||
return 0;
|
||||
@@ -432,24 +465,16 @@ int AssetLoader::onInitializeDependencyLua(Asset* dependant, Asset* dependency)
|
||||
int AssetLoader::onDeinitializeDependencyLua(Asset* dependant, Asset* dependency) {
|
||||
ghoul::lua::checkArgumentsAndThrow(*_luaState, 1, "lua::onDeinitializeDependency");
|
||||
|
||||
int referenceIndex = luaL_ref(*_luaState, LUA_REGISTRYINDEX);
|
||||
_onDependencyDeinitializationFunctionRefs[dependant][dependency]
|
||||
.push_back(referenceIndex);
|
||||
const int refIndex = luaL_ref(*_luaState, LUA_REGISTRYINDEX);
|
||||
_onDependencyDeinitializationFunctionRefs[dependant][dependency].push_back(refIndex);
|
||||
|
||||
lua_settop(*_luaState, 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
std::shared_ptr<Asset> AssetLoader::require(const std::string& identifier) {
|
||||
std::shared_ptr<Asset> asset = getAsset(identifier);
|
||||
std::shared_ptr<Asset> dependant = _currentAsset;
|
||||
dependant->require(asset);
|
||||
return asset;
|
||||
}
|
||||
|
||||
std::shared_ptr<Asset> AssetLoader::request(const std::string& identifier) {
|
||||
std::shared_ptr<Asset> asset = getAsset(identifier);
|
||||
std::shared_ptr<Asset> parent = _currentAsset;
|
||||
Asset* parent = _currentAsset;
|
||||
parent->request(asset);
|
||||
assetRequested(parent, asset);
|
||||
return asset;
|
||||
@@ -457,7 +482,7 @@ std::shared_ptr<Asset> AssetLoader::request(const std::string& identifier) {
|
||||
|
||||
void AssetLoader::unrequest(const std::string& identifier) {
|
||||
std::shared_ptr<Asset> asset = has(identifier);
|
||||
std::shared_ptr<Asset> parent = _currentAsset;
|
||||
Asset* parent = _currentAsset;
|
||||
parent->unrequest(asset.get());
|
||||
assetUnrequested(parent, asset);
|
||||
}
|
||||
@@ -472,13 +497,12 @@ ghoul::filesystem::Directory AssetLoader::currentDirectory() const {
|
||||
}
|
||||
|
||||
std::shared_ptr<Asset> AssetLoader::add(const std::string& identifier) {
|
||||
setCurrentAsset(_rootAsset);
|
||||
setCurrentAsset(_rootAsset.get());
|
||||
return request(identifier);
|
||||
}
|
||||
|
||||
|
||||
void AssetLoader::remove(const std::string& identifier) {
|
||||
setCurrentAsset(_rootAsset);
|
||||
setCurrentAsset(_rootAsset.get());
|
||||
unrequest(identifier);
|
||||
}
|
||||
|
||||
@@ -493,12 +517,12 @@ std::shared_ptr<Asset> AssetLoader::has(const std::string& identifier) const {
|
||||
return it->second.lock();
|
||||
}
|
||||
|
||||
ghoul::lua::LuaState* AssetLoader::luaState() {
|
||||
return _luaState;
|
||||
const Asset& AssetLoader::rootAsset() const {
|
||||
return *_rootAsset;
|
||||
}
|
||||
|
||||
std::shared_ptr<Asset> AssetLoader::rootAsset() const {
|
||||
return _rootAsset;
|
||||
Asset& AssetLoader::rootAsset() {
|
||||
return *_rootAsset;
|
||||
}
|
||||
|
||||
const std::string& AssetLoader::assetRootDirectory() const {
|
||||
@@ -520,7 +544,7 @@ void AssetLoader::callOnInitialize(Asset* asset) {
|
||||
}
|
||||
|
||||
void AssetLoader::callOnDeinitialize(Asset * asset) {
|
||||
std::vector<int>& funs = _onDeinitializationFunctionRefs[asset];
|
||||
const std::vector<int>& funs = _onDeinitializationFunctionRefs[asset];
|
||||
for (auto it = funs.rbegin(); it != funs.rend(); it++) {
|
||||
lua_rawgeti(*_luaState, LUA_REGISTRYINDEX, *it);
|
||||
if (lua_pcall(*_luaState, 0, 0, 0) != LUA_OK) {
|
||||
@@ -553,7 +577,9 @@ void AssetLoader::callOnDependencyInitialize(Asset* asset, Asset* dependant) {
|
||||
}
|
||||
|
||||
void AssetLoader::callOnDependencyDeinitialize(Asset* asset, Asset* dependant) {
|
||||
std::vector<int>& funs = _onDependencyDeinitializationFunctionRefs[dependant][asset];
|
||||
const std::vector<int>& funs =
|
||||
_onDependencyDeinitializationFunctionRefs[dependant][asset];
|
||||
|
||||
for (auto it = funs.rbegin(); it != funs.rend(); it++) {
|
||||
lua_rawgeti(*_luaState, LUA_REGISTRYINDEX, *it);
|
||||
if (lua_pcall(*_luaState, 0, 0, 0) != LUA_OK) {
|
||||
@@ -571,14 +597,16 @@ void AssetLoader::callOnDependencyDeinitialize(Asset* asset, Asset* dependant) {
|
||||
int AssetLoader::localResourceLua(Asset* asset) {
|
||||
ghoul::lua::checkArgumentsAndThrow(*_luaState, 1, "lua::localResourceLua");
|
||||
|
||||
std::string resourceName = ghoul::lua::value<std::string>(
|
||||
std::string name = ghoul::lua::value<std::string>(
|
||||
*_luaState,
|
||||
1,
|
||||
ghoul::lua::PopValue::Yes
|
||||
);
|
||||
std::string resolved = asset->resolveLocalResource(resourceName);
|
||||
|
||||
lua_pushstring(*_luaState, resolved.c_str());
|
||||
const std::string resolvedName =
|
||||
asset->assetDirectory() + ghoul::filesystem::FileSystem::PathSeparator + name;
|
||||
|
||||
lua_pushstring(*_luaState, resolvedName.c_str());
|
||||
|
||||
ghoul_assert(lua_gettop(*_luaState) == 1, "Incorrect number of items left on stack");
|
||||
return 1;
|
||||
@@ -590,12 +618,12 @@ int AssetLoader::syncedResourceLua(Asset* asset) {
|
||||
ghoul::Dictionary d;
|
||||
ghoul::lua::luaDictionaryFromState(*_luaState, d);
|
||||
|
||||
std::shared_ptr<ResourceSynchronization> sync =
|
||||
std::unique_ptr<ResourceSynchronization> sync =
|
||||
ResourceSynchronization::createFromDictionary(d);
|
||||
|
||||
std::string absolutePath = sync->directory();
|
||||
const std::string absolutePath = sync->directory();
|
||||
|
||||
asset->addSynchronization(sync);
|
||||
asset->addSynchronization(std::move(sync));
|
||||
|
||||
lua_settop(*_luaState, 0);
|
||||
lua_pushstring(*_luaState, absolutePath.c_str());
|
||||
@@ -604,13 +632,13 @@ int AssetLoader::syncedResourceLua(Asset* asset) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
void AssetLoader::setCurrentAsset(std::shared_ptr<Asset> asset) {
|
||||
int top = lua_gettop(*_luaState);
|
||||
void AssetLoader::setCurrentAsset(Asset* asset) {
|
||||
const int top = lua_gettop(*_luaState);
|
||||
|
||||
_currentAsset = asset;
|
||||
// Set `asset` lua global to point to the current asset table
|
||||
|
||||
if (asset == _rootAsset) {
|
||||
if (asset == _rootAsset.get()) {
|
||||
lua_pushnil(*_luaState);
|
||||
lua_setglobal(*_luaState, AssetGlobalVariableName);
|
||||
lua_settop(*_luaState, top);
|
||||
@@ -631,7 +659,8 @@ int AssetLoader::requireLua(Asset* dependant) {
|
||||
std::string assetName = luaL_checkstring(*_luaState, 1);
|
||||
lua_settop(*_luaState, 0);
|
||||
|
||||
std::shared_ptr<Asset> dependency = require(assetName);
|
||||
std::shared_ptr<Asset> dependency = getAsset(assetName);
|
||||
_currentAsset->require(dependency);
|
||||
|
||||
if (!dependency) {
|
||||
return ghoul::lua::luaError(
|
||||
@@ -646,14 +675,14 @@ int AssetLoader::requireLua(Asset* dependant) {
|
||||
lua_rawgeti(*_luaState, LUA_REGISTRYINDEX, _assetsTableRef);
|
||||
lua_getfield(*_luaState, -1, dependency->id().c_str());
|
||||
lua_getfield(*_luaState, -1, ExportsTableName);
|
||||
int exportsTableIndex = lua_gettop(*_luaState);
|
||||
const int exportsTableIndex = lua_gettop(*_luaState);
|
||||
|
||||
// Get the dependency table
|
||||
lua_rawgeti(*_luaState, LUA_REGISTRYINDEX, _assetsTableRef);
|
||||
lua_getfield(*_luaState, -1, dependency->id().c_str());
|
||||
lua_getfield(*_luaState, -1, DependantsTableName);
|
||||
lua_getfield(*_luaState, -1, dependant->id().c_str());
|
||||
int dependencyTableIndex = lua_gettop(*_luaState);
|
||||
const int dependencyTableIndex = lua_gettop(*_luaState);
|
||||
|
||||
lua_pushvalue(*_luaState, exportsTableIndex);
|
||||
lua_pushvalue(*_luaState, dependencyTableIndex);
|
||||
@@ -669,7 +698,7 @@ int AssetLoader::requireLua(Asset* dependant) {
|
||||
int AssetLoader::requestLua(Asset* parent) {
|
||||
ghoul::lua::checkArgumentsAndThrow(*_luaState, 1, "lua::request");
|
||||
|
||||
std::string assetName = luaL_checkstring(*_luaState, 1);
|
||||
const std::string assetName = luaL_checkstring(*_luaState, 1);
|
||||
lua_settop(*_luaState, 0);
|
||||
|
||||
std::shared_ptr<Asset> child = request(assetName);
|
||||
@@ -681,7 +710,7 @@ int AssetLoader::requestLua(Asset* parent) {
|
||||
lua_getfield(*_luaState, -1, child->id().c_str());
|
||||
lua_getfield(*_luaState, -1, DependantsTableName);
|
||||
lua_getfield(*_luaState, -1, parent->id().c_str());
|
||||
int dependencyTableIndex = lua_gettop(*_luaState);
|
||||
const int dependencyTableIndex = lua_gettop(*_luaState);
|
||||
|
||||
lua_pushvalue(*_luaState, dependencyTableIndex);
|
||||
|
||||
@@ -695,10 +724,10 @@ int AssetLoader::requestLua(Asset* parent) {
|
||||
int AssetLoader::existsLua(Asset*) {
|
||||
ghoul::lua::checkArgumentsAndThrow(*_luaState, 1, "lua::exists");
|
||||
|
||||
std::string assetName = luaL_checkstring(*_luaState, 1);
|
||||
const std::string assetName = luaL_checkstring(*_luaState, 1);
|
||||
|
||||
ghoul::filesystem::Directory directory = currentDirectory();
|
||||
std::string path = generateAssetPath(directory, assetName);
|
||||
const ghoul::filesystem::Directory directory = currentDirectory();
|
||||
const std::string path = generateAssetPath(directory, assetName);
|
||||
|
||||
lua_settop(*_luaState, 0);
|
||||
lua_pushboolean(*_luaState, FileSys.fileExists(path));
|
||||
@@ -709,12 +738,12 @@ int AssetLoader::existsLua(Asset*) {
|
||||
int AssetLoader::exportAssetLua(Asset* asset) {
|
||||
ghoul::lua::checkArgumentsAndThrow(*_luaState, 2, "lua::exportAsset");
|
||||
|
||||
std::string exportName = luaL_checkstring(*_luaState, 1);
|
||||
const std::string exportName = luaL_checkstring(*_luaState, 1);
|
||||
|
||||
lua_rawgeti(*_luaState, LUA_REGISTRYINDEX, _assetsTableRef);
|
||||
lua_getfield(*_luaState, -1, asset->id().c_str());
|
||||
lua_getfield(*_luaState, -1, ExportsTableName);
|
||||
int exportsTableIndex = lua_gettop(*_luaState);
|
||||
const int exportsTableIndex = lua_gettop(*_luaState);
|
||||
|
||||
// push the second argument
|
||||
lua_pushvalue(*_luaState, 2);
|
||||
@@ -726,7 +755,7 @@ int AssetLoader::exportAssetLua(Asset* asset) {
|
||||
}
|
||||
|
||||
void AssetLoader::addLuaDependencyTable(Asset* dependant, Asset* dependency) {
|
||||
int top = lua_gettop(*_luaState);
|
||||
const int top = lua_gettop(*_luaState);
|
||||
|
||||
const std::string dependantId = dependant->id();
|
||||
const std::string dependencyId = dependency->id();
|
||||
@@ -765,13 +794,9 @@ void AssetLoader::addLuaDependencyTable(Asset* dependant, Asset* dependency) {
|
||||
}
|
||||
|
||||
void AssetLoader::addAssetListener(AssetListener* listener) {
|
||||
auto it = std::find(
|
||||
_assetListeners.begin(),
|
||||
_assetListeners.end(),
|
||||
listener
|
||||
);
|
||||
const auto it = std::find(_assetListeners.cbegin(), _assetListeners.cend(), listener);
|
||||
|
||||
if (it == _assetListeners.end()) {
|
||||
if (it == _assetListeners.cend()) {
|
||||
_assetListeners.push_back(listener);
|
||||
}
|
||||
}
|
||||
@@ -784,23 +809,19 @@ void AssetLoader::removeAssetListener(AssetListener* listener) {
|
||||
));
|
||||
}
|
||||
|
||||
void AssetLoader::assetStateChanged(std::shared_ptr<Asset> asset, Asset::State state) {
|
||||
void AssetLoader::assetStateChanged(Asset* asset, Asset::State state) {
|
||||
for (AssetListener* listener : _assetListeners) {
|
||||
listener->assetStateChanged(asset, state);
|
||||
}
|
||||
}
|
||||
|
||||
void AssetLoader::assetRequested(std::shared_ptr<Asset> parent,
|
||||
std::shared_ptr<Asset> child)
|
||||
{
|
||||
void AssetLoader::assetRequested(Asset* parent, std::shared_ptr<Asset> child) {
|
||||
for (AssetListener* listener : _assetListeners) {
|
||||
listener->assetRequested(parent, child);
|
||||
}
|
||||
}
|
||||
|
||||
void AssetLoader::assetUnrequested(std::shared_ptr<Asset> parent,
|
||||
std::shared_ptr<Asset> child)
|
||||
{
|
||||
void AssetLoader::assetUnrequested(Asset* parent, std::shared_ptr<Asset> child) {
|
||||
for (AssetListener* listener : _assetListeners) {
|
||||
listener->assetUnrequested(parent, child);
|
||||
}
|
||||
|
||||
@@ -108,10 +108,6 @@ int syncedResource(lua_State* state) {
|
||||
return asset->loader()->syncedResourceLua(asset);
|
||||
}
|
||||
|
||||
int noOperation(lua_State*) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int exportAsset(lua_State* state) {
|
||||
Asset* asset = reinterpret_cast<Asset*>(lua_touserdata(state, lua_upvalueindex(1)));
|
||||
return asset->loader()->exportAssetLua(asset);
|
||||
|
||||
@@ -36,23 +36,19 @@
|
||||
|
||||
namespace openspace {
|
||||
|
||||
AssetManager::AssetManager(std::unique_ptr<AssetLoader> loader,
|
||||
std::unique_ptr<SynchronizationWatcher> syncWatcher)
|
||||
: _synchronizationWatcher(std::move(syncWatcher))
|
||||
, _assetLoader(std::move(loader))
|
||||
AssetManager::AssetManager(ghoul::lua::LuaState* state, std::string assetRootDirectory)
|
||||
: _assetLoader(state, &_synchronizationWatcher, std::move(assetRootDirectory))
|
||||
{}
|
||||
|
||||
void AssetManager::initialize() {
|
||||
_assetLoader->addAssetListener(this);
|
||||
std::shared_ptr<Asset> rootAsset = _assetLoader->rootAsset();
|
||||
rootAsset->initialize();
|
||||
_assetLoader.addAssetListener(this);
|
||||
_assetLoader.rootAsset().initialize();
|
||||
}
|
||||
|
||||
void AssetManager::deinitialize() {
|
||||
_assetLoader->rootAsset()->deinitialize();
|
||||
_assetLoader->rootAsset()->unload();
|
||||
_assetLoader->removeAssetListener(this);
|
||||
_assetLoader = nullptr;
|
||||
_assetLoader.rootAsset().deinitialize();
|
||||
_assetLoader.rootAsset().unload();
|
||||
_assetLoader.removeAssetListener(this);
|
||||
}
|
||||
|
||||
bool AssetManager::update() {
|
||||
@@ -63,36 +59,36 @@ bool AssetManager::update() {
|
||||
const std::string& path = c.first;
|
||||
const bool add = c.second;
|
||||
if (add) {
|
||||
std::shared_ptr<Asset> asset = _assetLoader->add(path);
|
||||
_assetLoader.add(path);
|
||||
}
|
||||
}
|
||||
// Remove assets
|
||||
for (const std::pair<const std::string, bool>& c : _pendingStateChangeCommands) {
|
||||
const std::string& path = c.first;
|
||||
const bool remove = !c.second;
|
||||
if (remove && _assetLoader->has(path)) {
|
||||
_assetLoader->remove(path);
|
||||
if (remove && _assetLoader.has(path)) {
|
||||
_assetLoader.remove(path);
|
||||
}
|
||||
}
|
||||
_pendingStateChangeCommands.clear();
|
||||
|
||||
// Change state based on synchronizations
|
||||
_synchronizationWatcher->notify();
|
||||
_synchronizationWatcher.notify();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void AssetManager::assetStateChanged(std::shared_ptr<Asset>, Asset::State) {
|
||||
void AssetManager::assetStateChanged(Asset*, Asset::State) {
|
||||
// Potential todo: notify user about asset stage change
|
||||
//LINFO(asset->id() << " changed state to " << static_cast<int>(state));
|
||||
}
|
||||
|
||||
void AssetManager::assetRequested(std::shared_ptr<Asset>, std::shared_ptr<Asset>) {
|
||||
void AssetManager::assetRequested(Asset*, std::shared_ptr<Asset>) {
|
||||
// Potential todo: notify user about asset request
|
||||
//LINFO(parent->id() << " requested " << child->id());
|
||||
}
|
||||
|
||||
void AssetManager::assetUnrequested(std::shared_ptr<Asset>, std::shared_ptr<Asset>) {
|
||||
void AssetManager::assetUnrequested(Asset*, std::shared_ptr<Asset>) {
|
||||
// Potential todo: notify user about asset unrequest
|
||||
//LINFO(parent->id() << " unrequested " << child->id());
|
||||
}
|
||||
@@ -109,16 +105,17 @@ void AssetManager::removeAll() {
|
||||
ZoneScoped
|
||||
|
||||
_pendingStateChangeCommands.clear();
|
||||
std::vector<std::shared_ptr<Asset>> allAssets =
|
||||
_assetLoader->rootAsset()->requestedAssets();
|
||||
|
||||
for (const std::shared_ptr<Asset>& a : allAssets) {
|
||||
for (const Asset* a : _assetLoader.rootAsset().requestedAssets()) {
|
||||
_pendingStateChangeCommands[a->assetFilePath()] = false;
|
||||
}
|
||||
}
|
||||
|
||||
std::shared_ptr<Asset> AssetManager::rootAsset() {
|
||||
return _assetLoader->rootAsset();
|
||||
const Asset& AssetManager::rootAsset() const {
|
||||
return _assetLoader.rootAsset();
|
||||
}
|
||||
|
||||
Asset& AssetManager::rootAsset() {
|
||||
return _assetLoader.rootAsset();
|
||||
}
|
||||
|
||||
scripting::LuaLibrary AssetManager::luaLibrary() {
|
||||
@@ -144,4 +141,4 @@ scripting::LuaLibrary AssetManager::luaLibrary() {
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace openspace
|
||||
|
||||
@@ -146,10 +146,6 @@ void Scene::updateNodeRegistry() {
|
||||
_dirtyNodeRegistry = false;
|
||||
}
|
||||
|
||||
void Scene::addSceneLicense(SceneLicense license) {
|
||||
_licenses.push_back(std::move(license));
|
||||
}
|
||||
|
||||
void Scene::sortTopologically() {
|
||||
_topologicallySortedNodes.insert(
|
||||
_topologicallySortedNodes.end(),
|
||||
@@ -597,11 +593,6 @@ const std::vector<Scene::InterestingTime>& Scene::interestingTimes() const {
|
||||
return _interestingTimes;
|
||||
}
|
||||
|
||||
std::string Scene::generateSceneLicenseDocumentationJson() {
|
||||
SceneLicenseWriter writer(_licenses);
|
||||
return writer.generateJson();
|
||||
}
|
||||
|
||||
scripting::LuaLibrary Scene::luaLibrary() {
|
||||
return {
|
||||
"",
|
||||
|
||||
@@ -821,7 +821,7 @@ glm::dvec3 SceneGraphNode::calculateWorldPosition() const {
|
||||
const glm::dvec3 ws = _parent->worldScale();
|
||||
const glm::dvec3 p = position();
|
||||
|
||||
return wp + wrot * ws * p;
|
||||
return wp + wrot * (ws * p);
|
||||
}
|
||||
else {
|
||||
return position();
|
||||
|
||||
@@ -1,87 +0,0 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
* Copyright (c) 2014-2020 *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
|
||||
* software and associated documentation files (the "Software"), to deal in the Software *
|
||||
* without restriction, including without limitation the rights to use, copy, modify, *
|
||||
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
|
||||
* permit persons to whom the Software is furnished to do so, subject to the following *
|
||||
* conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in all copies *
|
||||
* or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
|
||||
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#include <openspace/scene/scenelicense.h>
|
||||
|
||||
#include <openspace/documentation/documentation.h>
|
||||
#include <openspace/documentation/verifier.h>
|
||||
|
||||
namespace {
|
||||
constexpr const char* LicenseKeyName = "Name";
|
||||
constexpr const char* LicenseKeyAttribution = "Attribution";
|
||||
constexpr const char* LicenseKeyUrl = "URL";
|
||||
constexpr const char* LicenseKeyLicenseText = "License";
|
||||
} // namespace
|
||||
|
||||
namespace openspace {
|
||||
|
||||
documentation::Documentation SceneLicense::Documentation() {
|
||||
using namespace documentation;
|
||||
|
||||
return {
|
||||
"License Information",
|
||||
"core_license",
|
||||
{
|
||||
{
|
||||
LicenseKeyName,
|
||||
new StringVerifier,
|
||||
Optional::No,
|
||||
"A short, descriptive name for the license employed for this node."
|
||||
},
|
||||
{
|
||||
LicenseKeyAttribution,
|
||||
new StringVerifier,
|
||||
Optional::No,
|
||||
"The organization that shall be attributed to the licensed content."
|
||||
},
|
||||
{
|
||||
LicenseKeyUrl,
|
||||
new StringVerifier,
|
||||
Optional::Yes,
|
||||
"The URL pointing to the original license."
|
||||
},
|
||||
{
|
||||
LicenseKeyLicenseText,
|
||||
new StringVerifier,
|
||||
Optional::No,
|
||||
"The full text of the license agreements."
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
SceneLicense::SceneLicense(const ghoul::Dictionary& dictionary, std::string m)
|
||||
: module(std::move(m))
|
||||
{
|
||||
ghoul_assert(!module.empty(), "Module name must not be empty");
|
||||
|
||||
documentation::testSpecificationAndThrow(Documentation(), dictionary, "SceneLicense");
|
||||
|
||||
name = dictionary.value<std::string>(LicenseKeyName);
|
||||
attribution = dictionary.value<std::string>(LicenseKeyAttribution);
|
||||
dictionary.getValue(LicenseKeyUrl, url);
|
||||
licenseText = dictionary.value<std::string>(LicenseKeyLicenseText);
|
||||
}
|
||||
|
||||
} // namespace openspace
|
||||
@@ -24,13 +24,17 @@
|
||||
|
||||
#include <openspace/scene/scenelicensewriter.h>
|
||||
|
||||
#include <openspace/scene/scenelicense.h>
|
||||
#include <openspace/engine/globals.h>
|
||||
#include <openspace/engine/openspaceengine.h>
|
||||
#include <openspace/scene/asset.h>
|
||||
#include <openspace/scene/assetmanager.h>
|
||||
|
||||
#include <ghoul/fmt.h>
|
||||
#include <sstream>
|
||||
|
||||
namespace openspace {
|
||||
|
||||
SceneLicenseWriter::SceneLicenseWriter(std::vector<SceneLicense> licenses)
|
||||
SceneLicenseWriter::SceneLicenseWriter()
|
||||
: DocumentationGenerator(
|
||||
"Scene Licenses",
|
||||
"sceneLicense",
|
||||
@@ -38,24 +42,49 @@ SceneLicenseWriter::SceneLicenseWriter(std::vector<SceneLicense> licenses)
|
||||
{ "sceneLicenseTemplate", "${WEB}/documentation/scenelicense.hbs" }
|
||||
}
|
||||
)
|
||||
, _licenses(std::move(licenses))
|
||||
{}
|
||||
|
||||
std::string SceneLicenseWriter::generateJson() const {
|
||||
std::stringstream json;
|
||||
json << "[";
|
||||
for (const SceneLicense& license : _licenses) {
|
||||
|
||||
std::vector<const Asset*> assets =
|
||||
global::openSpaceEngine.assetManager().rootAsset().subTreeAssets();
|
||||
|
||||
int metaTotal = 0;
|
||||
for (const Asset* asset : assets) {
|
||||
std::optional<Asset::MetaInformation> meta = asset->metaInformation();
|
||||
if (!meta.has_value()) {
|
||||
continue;
|
||||
}
|
||||
metaTotal++;
|
||||
}
|
||||
|
||||
int metaCount = 0;
|
||||
for (const Asset* asset : assets) {
|
||||
std::optional<Asset::MetaInformation> meta = asset->metaInformation();
|
||||
|
||||
if (!meta.has_value()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
constexpr const char* replStr = R"("{}": "{}", )";
|
||||
constexpr const char* replStr2 = R"("{}": "{}")";
|
||||
json << "{";
|
||||
json << fmt::format(replStr, "module", escapedJson(license.module));
|
||||
json << fmt::format(replStr, "name", escapedJson(license.name));
|
||||
json << fmt::format(replStr, "attribution", escapedJson(license.attribution));
|
||||
json << fmt::format(replStr, "url", escapedJson(license.url));
|
||||
json << fmt::format(replStr2, "licenseText", escapedJson(license.licenseText));
|
||||
//json << fmt::format(replStr, "module", escapedJson(license.module));
|
||||
json << fmt::format(replStr, "name", escapedJson(meta->name));
|
||||
json << fmt::format(replStr, "version", escapedJson(meta->version));
|
||||
json << fmt::format(replStr, "description", escapedJson(meta->description));
|
||||
//json << fmt::format(replStr, "attribution", escapedJson(license.attribution));
|
||||
json << fmt::format(replStr, "author", escapedJson(meta->author));
|
||||
json << fmt::format(replStr, "url", escapedJson(meta->url));
|
||||
//json << fmt::format(replStr2, "licenseText", escapedJson(license.licenseText));
|
||||
json << fmt::format(replStr, "license", escapedJson(meta->license));
|
||||
json << fmt::format(replStr2, "path", escapedJson(asset->assetFilePath()));
|
||||
json << "}";
|
||||
|
||||
if (&license != &(_licenses.back())) {
|
||||
metaCount++;
|
||||
if (metaCount != metaTotal) {
|
||||
json << ",";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -95,15 +95,15 @@ ResourceSynchronization::State ResourceSynchronization::state() const {
|
||||
return _state;
|
||||
}
|
||||
|
||||
bool ResourceSynchronization::isResolved() {
|
||||
bool ResourceSynchronization::isResolved() const {
|
||||
return _state == State::Resolved;
|
||||
}
|
||||
|
||||
bool ResourceSynchronization::isRejected() {
|
||||
bool ResourceSynchronization::isRejected() const {
|
||||
return _state == State::Rejected;
|
||||
}
|
||||
|
||||
bool ResourceSynchronization::isSyncing() {
|
||||
bool ResourceSynchronization::isSyncing() const {
|
||||
return _state == State::Syncing;
|
||||
}
|
||||
|
||||
|
||||
@@ -32,21 +32,16 @@ SynchronizationWatcher::WatchHandle SynchronizationWatcher::watchSynchronization
|
||||
std::shared_ptr<ResourceSynchronization> synchronization,
|
||||
ResourceSynchronization::StateChangeCallback callback)
|
||||
{
|
||||
std::lock_guard<std::mutex> guard(_mutex);
|
||||
std::lock_guard guard(_mutex);
|
||||
|
||||
WatchHandle watchHandle = generateWatchHandle();
|
||||
WatchHandle watchHandle = nextWatchHandle++;
|
||||
|
||||
ResourceSynchronization::CallbackHandle cbh = synchronization->addStateChangeCallback(
|
||||
[this, synchronization, watchHandle, cb = std::move(callback)]
|
||||
(ResourceSynchronization::State state)
|
||||
{
|
||||
std::lock_guard<std::mutex> g(_mutex);
|
||||
_pendingNotifications.push_back({
|
||||
synchronization,
|
||||
state,
|
||||
watchHandle,
|
||||
cb
|
||||
});
|
||||
_pendingNotifications.push_back({ synchronization, state, watchHandle, cb });
|
||||
}
|
||||
);
|
||||
|
||||
@@ -56,7 +51,7 @@ SynchronizationWatcher::WatchHandle SynchronizationWatcher::watchSynchronization
|
||||
}
|
||||
|
||||
void SynchronizationWatcher::unwatchSynchronization(WatchHandle watchHandle) {
|
||||
std::lock_guard<std::mutex> guard(_mutex);
|
||||
std::lock_guard guard(_mutex);
|
||||
|
||||
const auto it = _watchedSyncs.find(watchHandle);
|
||||
if (it == _watchedSyncs.end()) {
|
||||
@@ -84,7 +79,7 @@ void SynchronizationWatcher::unwatchSynchronization(WatchHandle watchHandle) {
|
||||
void SynchronizationWatcher::notify() {
|
||||
std::vector<NotificationData> notifications;
|
||||
{
|
||||
std::lock_guard<std::mutex> guard(_mutex);
|
||||
std::lock_guard guard(_mutex);
|
||||
notifications = _pendingNotifications;
|
||||
_pendingNotifications.clear();
|
||||
}
|
||||
@@ -98,8 +93,4 @@ void SynchronizationWatcher::notify() {
|
||||
}
|
||||
}
|
||||
|
||||
SynchronizationWatcher::WatchHandle SynchronizationWatcher::generateWatchHandle() {
|
||||
return nextWatchHandle++;
|
||||
}
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
Reference in New Issue
Block a user