From 31b834dbb261834e8b23b65715aa691aaab28ee1 Mon Sep 17 00:00:00 2001 From: Malin Ejdbo Date: Mon, 31 May 2021 15:34:54 +0200 Subject: [PATCH] Address PR comments --- data/assets/scene/digitaluniverse/hdf.asset | 124 ++--- .../solarsystem/missions/jwst/HUDFImage.asset | 98 ++-- .../scene/solarsystem/missions/jwst/L1.asset | 59 --- .../scene/solarsystem/missions/jwst/L2.asset | 128 ----- .../scene/solarsystem/missions/jwst/L4.asset | 59 --- .../scene/solarsystem/missions/jwst/L5.asset | 59 --- .../missions/jwst/Lagrange_kernels.asset | 8 - .../missions/jwst/Lagrange_points.asset | 3 - .../solarsystem/missions/jwst/jwst.asset | 501 +++++++++--------- .../planets/earth/lagrange_points/L1.asset | 60 +++ .../planets/earth/lagrange_points/L2.asset | 129 +++++ .../planets/earth/lagrange_points/L4.asset | 60 +++ .../planets/earth/lagrange_points/L5.asset | 60 +++ .../lagrange_points/lagrange_kernels.asset | 8 + .../lagrange_points/lagrange_points.asset | 4 + data/assets/util/circle.asset | 8 +- data/profiles/jwst.profile | 12 +- ext/ghoul | 2 +- modules/base/rendering/renderableprism.cpp | 80 ++- modules/base/rendering/renderableprism.h | 6 +- modules/base/shaders/prism_fs.glsl | 10 +- modules/base/shaders/prism_vs.glsl | 11 +- src/rendering/renderengine.cpp | 4 +- src/scene/scene.cpp | 4 +- src/scene/scene_lua.inl | 20 +- 25 files changed, 757 insertions(+), 760 deletions(-) delete mode 100644 data/assets/scene/solarsystem/missions/jwst/L1.asset delete mode 100644 data/assets/scene/solarsystem/missions/jwst/L2.asset delete mode 100644 data/assets/scene/solarsystem/missions/jwst/L4.asset delete mode 100644 data/assets/scene/solarsystem/missions/jwst/L5.asset delete mode 100644 data/assets/scene/solarsystem/missions/jwst/Lagrange_kernels.asset delete mode 100644 data/assets/scene/solarsystem/missions/jwst/Lagrange_points.asset create mode 100644 data/assets/scene/solarsystem/planets/earth/lagrange_points/L1.asset create mode 100644 data/assets/scene/solarsystem/planets/earth/lagrange_points/L2.asset create mode 100644 data/assets/scene/solarsystem/planets/earth/lagrange_points/L4.asset create mode 100644 data/assets/scene/solarsystem/planets/earth/lagrange_points/L5.asset create mode 100644 data/assets/scene/solarsystem/planets/earth/lagrange_points/lagrange_kernels.asset create mode 100644 data/assets/scene/solarsystem/planets/earth/lagrange_points/lagrange_points.asset diff --git a/data/assets/scene/digitaluniverse/hdf.asset b/data/assets/scene/digitaluniverse/hdf.asset index 13a47abc37..51e30e3dfd 100644 --- a/data/assets/scene/digitaluniverse/hdf.asset +++ b/data/assets/scene/digitaluniverse/hdf.asset @@ -2,83 +2,83 @@ local assetHelper = asset.require('util/asset_helper') local circle = asset.require('util/circle').circle local HUDFSpeck = asset.syncedResource({ - Name = "HUDF Speck", - Type = "HttpSynchronization", - Identifier = "digitaluniverse_hudf_speck", - Version = 1 + Name = "HUDF Speck", + Type = "HttpSynchronization", + Identifier = "digitaluniverse_hudf_speck", + Version = 1 }) local ColorMap = asset.syncedResource({ - Name = "HUDF color map", - Type = "HttpSynchronization", - Identifier = "digitaluniverse_hudf_textures", - Version = 1 + Name = "HUDF color map", + Type = "HttpSynchronization", + Identifier = "digitaluniverse_hudf_textures", + Version = 1 }) local object = { - Identifier = "HubbleDeepField", - Renderable = { - Type = "RenderableBillboardsCloud", - Enabled = false, - Color = { 1.0, 1.0, 1.0 }, - Opacity = 1.0, - File = HUDFSpeck .. "/hudf.speck", - Texture = circle .. "/circle.png", - ColorMap = ColorMap .. "/hudf.cmap", - ColorOption = { "redshift", "proximity" }, - ColorRange = { { 0.0, 0.075 }, { 1.0, 25.0 } }, - Unit = "Mpc", - ScaleFactor = 520.0, - BillboardMaxSize = 4.7, - EnablePixelSizeControl = true - }, - GUI = { - Name = "Hubble Deep Field", - Path = "/Universe/Galaxies", - Description = [[ - Hubble Ultra Deep Field galaxy survey

- Data Reference: Hubble Ultra Deep Field 2012 program (Ellis+, Koekemoer+, 2013) - ]], - } + Identifier = "HubbleDeepField", + Renderable = { + Type = "RenderableBillboardsCloud", + Enabled = false, + Color = { 1.0, 1.0, 1.0 }, + Opacity = 1.0, + File = HUDFSpeck .. "/hudf.speck", + Texture = circle .. "/circle.png", + ColorMap = ColorMap .. "/hudf.cmap", + ColorOption = { "redshift", "proximity" }, + ColorRange = { { 0.0, 0.075 }, { 1.0, 25.0 } }, + Unit = "Mpc", + ScaleFactor = 520.0, + BillboardMaxSize = 4.7, + EnablePixelSizeControl = true + }, + GUI = { + Name = "Hubble Deep Field", + Path = "/Universe/Galaxies", + Description = [[ + Hubble Ultra Deep Field galaxy survey

+ Data Reference: Hubble Ultra Deep Field 2012 program (Ellis+, Koekemoer+, 2013) + ]], + } } assetHelper.registerSceneGraphNodesAndExport(asset, { object }) asset.meta = { - Name = "Hubble Ultra Deep Field", - Version = "1.1", - Description = "Hubble Ultra Deep Field galaxy survey", - Author = "Frank Summers (STScI), Brian Abbott (AMNH)", - Identifiers = {"HubbleDeepField"}, - URL = "http://www.haydenplanetarium.org/universe", - License = [[ - Copyright © American Museum of Natural History. All rights reserved.

+ Name = "Hubble Ultra Deep Field", + Version = "1.1", + Description = "Hubble Ultra Deep Field galaxy survey", + Author = "Frank Summers (STScI), Brian Abbott (AMNH)", + Identifiers = {"HubbleDeepField"}, + URL = "http://www.haydenplanetarium.org/universe", + License = [[ + Copyright (c) American Museum of Natural History. All rights reserved.

- Downloading the Atlas:
- AMNH offers the Atlas free of charge via our website, http://www.haydenplanetarium.org/. - The User is free to download and/or duplicate verbatim copies of the Atlas provided this - license and copyright information accompany the Atlas.

+ Downloading the Atlas:
+ AMNH offers the Atlas free of charge via our website, http://www.haydenplanetarium.org/. + The User is free to download and/or duplicate verbatim copies of the Atlas provided this + license and copyright information accompany the Atlas.

- Modifying the Atlas:
- The user is free to modify the Atlas by either adding data or altering existing data, - provided it is for personal use only. Once the user modifies the Atlas, it is no longer - part of AMNH's Atlas and cannot be used publicly alongside or within the Atlas without - written permission from AMNH.

+ Modifying the Atlas:
+ The user is free to modify the Atlas by either adding data or altering existing data, + provided it is for personal use only. Once the user modifies the Atlas, it is no longer + part of AMNH's Atlas and cannot be used publicly alongside or within the Atlas without + written permission from AMNH.

- Distributing the Atlas:
- The user is forbidden to distribute and use the Atlas for profit, as part of a software - and/or production system that will subsequently be redistributed, or for public consumption - (via print, electronic media, or broadcast/produced pieces) without written permission - from AMNH.

+ Distributing the Atlas:
+ The user is forbidden to distribute and use the Atlas for profit, as part of a software + and/or production system that will subsequently be redistributed, or for public consumption + (via print, electronic media, or broadcast/produced pieces) without written permission + from AMNH.

- Neither the names of American Museum of Natural History and Hayden Planetarium nor the names - of their contributors may be used to endorse or promote products derived from this Atlas - without specific, prior written permission.

+ Neither the names of American Museum of Natural History and Hayden Planetarium nor the names + of their contributors may be used to endorse or promote products derived from this Atlas + without specific, prior written permission.

- The Atlas is free but is offered WITHOUT ANY WARRANTY of any kind. We provide the Atlas as - is and take no responsibility for any damage resulting from the use of this Atlas. The entire - risk as to the quality and performance of this product is with the user.

+ The Atlas is free but is offered WITHOUT ANY WARRANTY of any kind. We provide the Atlas as + is and take no responsibility for any damage resulting from the use of this Atlas. The entire + risk as to the quality and performance of this product is with the user.

- For more information, please visit http://www.haydenplanetarium.org/universe - ]] + For more information, please visit http://www.haydenplanetarium.org/universe + ]] } diff --git a/data/assets/scene/solarsystem/missions/jwst/HUDFImage.asset b/data/assets/scene/solarsystem/missions/jwst/HUDFImage.asset index 10128c9d56..7f45814a94 100644 --- a/data/assets/scene/solarsystem/missions/jwst/HUDFImage.asset +++ b/data/assets/scene/solarsystem/missions/jwst/HUDFImage.asset @@ -4,10 +4,10 @@ local jwstTransforms = asset.require('scene/solarsystem/missions/jwst/jwst') local sunTransforms = asset.require('scene/solarsystem/sun/transforms') local image = asset.syncedResource({ - Name = "HUDF image", - Type = "HttpSynchronization", - Identifier = "hudf_image", - Version = 1 + Name = "HUDF image", + Type = "HttpSynchronization", + Identifier = "hudf_image", + Version = 1 }) local DISTANCE = 9.2E15; @@ -16,64 +16,62 @@ local DISTANCE = 9.2E15; -- dec = -27d47m29.37s -- distance = 9.2E15 m (set to size of view sphere) local HUDFPosition = { - Identifier = "HUDFPosition", - Parent = transforms.EarthInertial.Identifier, - Transform = { - Translation = { - Type = "StaticTranslation", - Position = { - 0.53039024 * DISTANCE, - 0.70802069 * DISTANCE, - -0.46625412 * DISTANCE - } - } - }, - GUI = { - Name = "Hubble Ultra Deep field", - Path = "/Solar System/Missions/JWST", - Hidden = true + Identifier = "HUDFPosition", + Parent = transforms.EarthInertial.Identifier, + Transform = { + Translation = { + Type = "StaticTranslation", + Position = { + 0.53039024 * DISTANCE, + 0.70802069 * DISTANCE, + -0.46625412 * DISTANCE + } } + }, + GUI = { + Name = "Hubble Ultra Deep field", + Path = "/Solar System/Missions/JWST", + Hidden = true + } } local HUDFImage = { - Identifier = "HUDFImage", - Enabled = false, - Type = "ScreenSpaceImageLocal", - Name = "Hubble Ultra Deep field", - UseRadiusAzimuthElevation = true, - FaceCamera = false, - RadiusAzimuthElevation = { - 200.0, 0.5, 0.15 - }, - UsePerspectiveProjection = false, - Opacity = 1.0, - TexturePath = image .. "/Hubble_ultra_deep_field.jpg", - Tag = { "hudf" }, + Identifier = "HUDFImage", + Enabled = false, + Type = "ScreenSpaceImageLocal", + Name = "Hubble Ultra Deep field", + UseRadiusAzimuthElevation = true, + FaceCamera = false, + RadiusAzimuthElevation = { 200.0, 0.5, 0.15 }, + UsePerspectiveProjection = false, + Opacity = 1.0, + TexturePath = image .. "/Hubble_ultra_deep_field.jpg", + Tag = { "mission_jwst_hudf" }, } local HUDFJWSTLine = { - Identifier = "HUDFJWSTLine", - Parent = sunTransforms.SolarSystemBarycenter.Identifier, - Renderable = { - Enabled = false, - Type = "RenderableNodeLine", - StartNode = HUDFPosition.Identifier, - EndNode = jwstTransforms.JWSTPosition.Identifier, - Color = { 0.5, 0.5, 0.5 }, - LineWidth = 2 - }, - Tag = { "hudf" }, - GUI = { - Name = "JWST to HUDF Line", - Path = "/Solar System/Missions/JWST", - } + Identifier = "HUDFJWSTLine", + Parent = sunTransforms.SolarSystemBarycenter.Identifier, + Renderable = { + Enabled = false, + Type = "RenderableNodeLine", + StartNode = HUDFPosition.Identifier, + EndNode = jwstTransforms.JWSTPosition.Identifier, + Color = { 0.5, 0.5, 0.5 }, + LineWidth = 2 + }, + Tag = { "mission_jwst_hudf" }, + GUI = { + Name = "JWST to HUDF Line", + Path = "/Solar System/Missions/JWST", + } } assetHelper.registerSceneGraphNodesAndExport(asset, { HUDFPosition, HUDFImage, HUDFJWSTLine }) asset.onInitialize(function() - openspace.addScreenSpaceRenderable(HUDFImage) + openspace.addScreenSpaceRenderable(HUDFImage) end) asset.onDeinitialize(function() - openspace.removeScreenSpaceRenderable(HUDFImage.Identifier) + openspace.removeScreenSpaceRenderable(HUDFImage.Identifier) end) diff --git a/data/assets/scene/solarsystem/missions/jwst/L1.asset b/data/assets/scene/solarsystem/missions/jwst/L1.asset deleted file mode 100644 index 4c9936a3b0..0000000000 --- a/data/assets/scene/solarsystem/missions/jwst/L1.asset +++ /dev/null @@ -1,59 +0,0 @@ -local assetHelper = asset.require('util/asset_helper') -local transforms = asset.require('scene/solarsystem/sun/transforms') -local circle = asset.require('util/circle').circle -local kernels = asset.require('scene/solarsystem/missions/jwst/Lagrange_kernels').kernels - -local L1 = { - Identifier = "L1", - Parent = transforms.SolarSystemBarycenter.Identifier, - Renderable = { - Enabled = false, - Type = "RenderablePlaneImageLocal", - RenderableType = "Opaque", - Billboard = true, - Size = 700E5, - Texture = circle .. "/circle.png", - BlendMode = "Additive" - }, - Transform = { - Translation = { - Type = "SpiceTranslation", - Target = "391", -- L1 - Observer = "SUN", - Kernels = kernels .. "/L1_de431.bsp" - } - }, - Tag = { "lagrange_points" }, - GUI = { - Name = "L1", - Path = "/Solar System/Missions/JWST/Lagrange points", - } -} - -local L1Label = { - Identifier = "L1Label", - Parent = L1.Identifier, - Renderable = { - Enabled = false, - Type = "RenderableLabels", - LabelText = "L1", - FontSize = 20, - LabelSize = 7.5, - LabelMaxSize = 100.0, - LabelMinSize = 1.0, - LabelOrientationOption = "Camera View Direction", - BlendMode = "Normal", - EnableFading = false - }, - Tag = { "lagrange_points" }, - GUI = { - Name = "L1 Label", - Path = "/Solar System/Missions/JWST/Lagrange points", - Description = "Main label for L1" - } -} - -assetHelper.registerSceneGraphNodesAndExport(asset, { - L1, - L1Label -}) diff --git a/data/assets/scene/solarsystem/missions/jwst/L2.asset b/data/assets/scene/solarsystem/missions/jwst/L2.asset deleted file mode 100644 index d3b3440a88..0000000000 --- a/data/assets/scene/solarsystem/missions/jwst/L2.asset +++ /dev/null @@ -1,128 +0,0 @@ -local assetHelper = asset.require('util/asset_helper') -local transforms = asset.require('scene/solarsystem/sun/transforms') -local circle = asset.require('util/circle').circle -local kernels = asset.require('scene/solarsystem/missions/jwst/Lagrange_kernels').kernels - -local L2 = { - Identifier = "L2", - Parent = transforms.SolarSystemBarycenter.Identifier, - Renderable = { - Type = "RenderablePlaneImageLocal", - RenderableType = "Opaque", - Billboard = true, - Size = 400E4, - Texture = circle .. "/circle.png", - BlendMode = "Additive" - }, - Transform = { - Translation = { - Type = "SpiceTranslation", - Target = "392", -- L2 - Observer = "SUN", - Kernels = kernels .. "/L2_de431.bsp" - } - }, - Tag = { "L2" }, - GUI = { - Name = "L2", - Path = "/Solar System/Missions/JWST/Lagrange points", - } -} - -local L2Large = { - Identifier = "L2Large", - Parent = transforms.SolarSystemBarycenter.Identifier, - Renderable = { - Enabled = false, - Type = "RenderablePlaneImageLocal", - RenderableType = "Opaque", - Billboard = true, - Size = 700E5, - Texture = circle .. "/circle.png", - BlendMode = "Additive" - }, - Transform = { - Translation = { - Type = "SpiceTranslation", - Target = "392", -- L2 - Observer = "SUN", - Kernels = kernels .. "/L2_de431.bsp" - } - }, - Tag = { "lagrange_points" }, - GUI = { - Name = "Large L2", - Path = "/Solar System/Missions/JWST/Lagrange points", - } -} - -local L2Label = { - Identifier = "L2Label", - Parent = L2.Identifier, - Renderable = { - Enabled = true, - Type = "RenderableLabels", - LabelText = "L2", - FontSize = 14.0, - LabelSize = 6.4, - LabelMaxSize = 100.0, - LabelMinSize = 1.0, - LabelOrientationOption = "Camera View Direction", - BlendMode = "Normal", - EnableFading = false - }, - Tag = { "L2" }, - GUI = { - Name = "L2 Label", - Path = "/Solar System/Missions/JWST/Lagrange points", - Description = "Main label for L2" - } -} - -local L2LargeLabel = { - Identifier = "L2LargeLabel", - Parent = L2.Identifier, - Renderable = { - Enabled = false, - Type = "RenderableLabels", - LabelText = "L2", - FontSize = 20, - LabelSize = 7.5, - LabelMaxSize = 100.0, - LabelMinSize = 1.0, - LabelOrientationOption = "Camera View Direction", - BlendMode = "Normal", - EnableFading = false - }, - Tag = { "lagrange_points" }, - GUI = { - Name = "Large L2 Label", - Path = "/Solar System/Missions/JWST/Lagrange points", - Description = "Large label for L2" - } -} - -local L2SunLine = { - Identifier = "L2SunLine", - Parent = transforms.SolarSystemBarycenter.Identifier, - Renderable = { - Type = "RenderableNodeLine", - StartNode = "Sun", - EndNode = "L2", - Color = { 0.5, 0.5, 0.5 }, - LineWidth = 2 - }, - Tag = { "L2" }, - GUI = { - Name = "Earth to L2 Line", - Path = "/Solar System/Missions/JWST/Lagrange points", - } -} - -assetHelper.registerSceneGraphNodesAndExport(asset, { - L2, - L2Large, - L2SunLine, - L2Label, - L2LargeLabel -}) diff --git a/data/assets/scene/solarsystem/missions/jwst/L4.asset b/data/assets/scene/solarsystem/missions/jwst/L4.asset deleted file mode 100644 index c7505033a7..0000000000 --- a/data/assets/scene/solarsystem/missions/jwst/L4.asset +++ /dev/null @@ -1,59 +0,0 @@ -local assetHelper = asset.require('util/asset_helper') -local transforms = asset.require('scene/solarsystem/sun/transforms') -local circle = asset.require('util/circle').circle -local kernels = asset.require('scene/solarsystem/missions/jwst/Lagrange_kernels').kernels - -local L4 = { - Identifier = "L4", - Parent = transforms.SolarSystemBarycenter.Identifier, - Renderable = { - Enabled = false, - Type = "RenderablePlaneImageLocal", - RenderableType = "Opaque", - Billboard = true, - Size = 800E6, - Texture = circle .. "/circle.png", - BlendMode = "Additive" - }, - Transform = { - Translation = { - Type = "SpiceTranslation", - Target = "394", -- L4 - Observer = "SUN", - Kernels = kernels .. "/L4_de431.bsp" - } - }, - Tag = { "lagrange_points" }, - GUI = { - Name = "L4", - Path = "/Solar System/Missions/JWST/Lagrange points", - } -} - -local L4Label = { - Identifier = "L4Label", - Parent = L4.Identifier, - Renderable = { - Enabled = false, - Type = "RenderableLabels", - LabelText = "L4", - FontSize = 20, - LabelSize = 8.5, - LabelMaxSize = 100.0, - LabelMinSize = 1.0, - LabelOrientationOption = "Camera View Direction", - BlendMode = "Normal", - EnableFading = false - }, - Tag = { "lagrange_points" }, - GUI = { - Name = "L4 Label", - Path = "/Solar System/Missions/JWST/Lagrange points", - Description = "Main label for L4" - } -} - -assetHelper.registerSceneGraphNodesAndExport(asset, { - L4, - L4Label -}) diff --git a/data/assets/scene/solarsystem/missions/jwst/L5.asset b/data/assets/scene/solarsystem/missions/jwst/L5.asset deleted file mode 100644 index 021b95eafa..0000000000 --- a/data/assets/scene/solarsystem/missions/jwst/L5.asset +++ /dev/null @@ -1,59 +0,0 @@ -local assetHelper = asset.require('util/asset_helper') -local transforms = asset.require('scene/solarsystem/sun/transforms') -local circle = asset.require('util/circle').circle -local kernels = asset.require('scene/solarsystem/missions/jwst/Lagrange_kernels').kernels - -local L5 = { - Identifier = "L5", - Parent = transforms.SolarSystemBarycenter.Identifier, - Renderable = { - Enabled = false, - Type = "RenderablePlaneImageLocal", - RenderableType = "Opaque", - Billboard = true, - Size = 800E6, - Texture = circle .. "/circle.png", - BlendMode = "Additive" - }, - Transform = { - Translation = { - Type = "SpiceTranslation", - Target = "395", -- L5 - Observer = "SUN", - Kernels = kernels .. "/L5_de431.bsp" - } - }, - Tag = { "lagrange_points" }, - GUI = { - Name = "L5", - Path = "/Solar System/Missions/JWST/Lagrange points", - } -} - -local L5Label = { - Identifier = "L5Label", - Parent = L5.Identifier, - Renderable = { - Enabled = false, - Type = "RenderableLabels", - LabelText = "L5", - FontSize = 20, - LabelSize = 8.5, - LabelMaxSize = 100.0, - LabelMinSize = 1.0, - LabelOrientationOption = "Camera View Direction", - BlendMode = "Normal", - EnableFading = false - }, - Tag = { "lagrange_points" }, - GUI = { - Name = "L5 Label", - Path = "/Solar System/Missions/JWST/Lagrange points", - Description = "Main label for L5" - } -} - -assetHelper.registerSceneGraphNodesAndExport(asset, { - L5, - L5Label -}) diff --git a/data/assets/scene/solarsystem/missions/jwst/Lagrange_kernels.asset b/data/assets/scene/solarsystem/missions/jwst/Lagrange_kernels.asset deleted file mode 100644 index a1480cacef..0000000000 --- a/data/assets/scene/solarsystem/missions/jwst/Lagrange_kernels.asset +++ /dev/null @@ -1,8 +0,0 @@ -local kernels = asset.syncedResource({ - Name = "Lagrange Kernels", - Type = "HttpSynchronization", - Identifier = "earth_lagrange_kernels", - Version = 1 -}) - -asset.export('kernels', kernels) diff --git a/data/assets/scene/solarsystem/missions/jwst/Lagrange_points.asset b/data/assets/scene/solarsystem/missions/jwst/Lagrange_points.asset deleted file mode 100644 index 0f32996cbb..0000000000 --- a/data/assets/scene/solarsystem/missions/jwst/Lagrange_points.asset +++ /dev/null @@ -1,3 +0,0 @@ -asset.require('scene/solarsystem/missions/jwst/L1') -asset.require('scene/solarsystem/missions/jwst/L4') -asset.require('scene/solarsystem/missions/jwst/L5') diff --git a/data/assets/scene/solarsystem/missions/jwst/jwst.asset b/data/assets/scene/solarsystem/missions/jwst/jwst.asset index 85e4c94d31..7c4f338e32 100644 --- a/data/assets/scene/solarsystem/missions/jwst/jwst.asset +++ b/data/assets/scene/solarsystem/missions/jwst/jwst.asset @@ -1,315 +1,304 @@ local assetHelper = asset.require('util/asset_helper') local sunTransforms = asset.require('scene/solarsystem/sun/transforms') -asset.require("spice/base") -asset.require('scene/solarsystem/missions/jwst/Lagrange_points') -local transforms = asset.require('scene/solarsystem/missions/jwst/L2') +asset.require('spice/base') +asset.require('scene/solarsystem/planets/earth/lagrange_points/lagrange_points') +local transforms = asset.require('scene/solarsystem/planets/earth/lagrange_points/L2') local JWSTKernel = asset.syncedResource({ - Name = "JWST Kernel", - Type = "HttpSynchronization", - Identifier = "jwst_kernels", - Version = 1 + Name = "JWST Kernel", + Type = "HttpSynchronization", + Identifier = "jwst_kernels", + Version = 1 }) local JWSTHorizons = asset.syncedResource({ - Name = "JWST Horizons", - Type = "HttpSynchronization", - Identifier = "jwst_horizons", - Version = 1 + Name = "JWST Horizons", + Type = "HttpSynchronization", + Identifier = "jwst_horizons", + Version = 1 }) local model = asset.syncedResource({ - Name = "JWST Model", - Type = "HttpSynchronization", - Identifier = "jwst_model", - Version = 1 + Name = "JWST Model", + Type = "HttpSynchronization", + Identifier = "jwst_model", + Version = 1 }) local band = asset.syncedResource({ - Name = "JWST band texture", - Type = "HttpSynchronization", - Identifier = "jwst_band_texture", - Version = 1 + Name = "JWST band texture", + Type = "HttpSynchronization", + Identifier = "jwst_band_texture", + Version = 1 }) local JWSTPosition = { - Identifier = "JWSTPosition", - Parent = transforms.L2.Identifier, - Transform = { - Translation = { - Type = "SpiceTranslation", - Target = "JWST", - Observer = "392", -- L2 - Kernels = JWSTKernel .. "/jwst_horizons_20200101_20240101_v01.bsp" - }, + Identifier = "JWSTPosition", + Parent = transforms.L2.Identifier, + Transform = { + Translation = { + Type = "SpiceTranslation", + Target = "JWST", + Observer = "392", -- L2 + Kernels = JWSTKernel .. "/jwst_horizons_20200101_20240101_v01.bsp" }, - GUI = { - Name = "JWST Position", - Path = "/Solar System/Missions/JWST", - Hidden = true, - } + }, + GUI = { + Name = "JWST Position", + Path = "/Solar System/Missions/JWST", + Hidden = true, + } } local JWSTRotation = { - Identifier = "JWSTRotation", - Parent = JWSTPosition.Identifier, - Transform = { - Rotation = { - Type = "FixedRotation", - Attached = "JWSTRotation", - XAxis = { 1, 0, 0 }, - XAxisOrthogonal = true, - YAxisInvert = true, - YAxis = sunTransforms.SolarSystemBarycenter.Identifier - } - }, - GUI = { - Name = "JWST Rotation", - Path = "/Solar System/Missions/JWST", - Hidden = true, + Identifier = "JWSTRotation", + Parent = JWSTPosition.Identifier, + Transform = { + Rotation = { + Type = "FixedRotation", + Attached = "JWSTRotation", + XAxis = { 1, 0, 0 }, + XAxisOrthogonal = true, + YAxisInvert = true, + YAxis = sunTransforms.SolarSystemBarycenter.Identifier } + }, + GUI = { + Name = "JWST Rotation", + Path = "/Solar System/Missions/JWST", + Hidden = true, + } } local JWSTBand = { - Identifier = "JWSTBand", - Parent = JWSTPosition.Identifier, - Transform = { - Rotation = { - Type = "FixedRotation", - Attached = "JWSTBand", - XAxis = { 1, 0, 0 }, - XAxisOrthogonal = true, - ZAxis = sunTransforms.SolarSystemBarycenter.Identifier - } - }, - Renderable = { - Enabled = false, - Type = "RenderableSphere", - Texture = band .. "/JWST-band.png", - Size = 9.2E15, - Segments = 50, - DisableFadeInOut = true, - Orientation = "Inside", - Opacity = 0.05, - UseAdditiveBlending = true, - }, - Tag = { "fov" }, - GUI = { - Name = "JWST View Band", - Path = "/Solar System/Missions/JWST", - Hidden = true, + Identifier = "JWSTBand", + Parent = JWSTPosition.Identifier, + Transform = { + Rotation = { + Type = "FixedRotation", + Attached = "JWSTBand", + XAxis = { 1, 0, 0 }, + XAxisOrthogonal = true, + ZAxis = sunTransforms.SolarSystemBarycenter.Identifier } + }, + Renderable = { + Enabled = false, + Type = "RenderableSphere", + Texture = band .. "/JWST-band.png", + Size = 9.2E15, + Segments = 50, + DisableFadeInOut = true, + Orientation = "Inside", + Opacity = 0.05, + UseAdditiveBlending = true, + }, + Tag = { "mission_jwst_fov" }, + GUI = { + Name = "JWST View Band", + Path = "/Solar System/Missions/JWST" + } } local JWSTModel = { - Identifier = "JWSTModel", - Parent = JWSTRotation.Identifier, - TimeFrame = { - Type = "TimeFrameInterval", - Start = "2020 JAN 01", - End = "2024 JAN 01" + Identifier = "JWSTModel", + Parent = JWSTRotation.Identifier, + TimeFrame = { + Type = "TimeFrameInterval", + Start = "2020 JAN 01", + End = "2024 JAN 01" + }, + Renderable = { + Type = "RenderableModel", + GeometryFile = model .. "/JWSTFBX.osmodel", + ModelScale = "Foot", + InvertModelScale = true, + EnableAnimation = true, + --TODO: Update theese when the new animation is finished + AnimationStartTime = "2018 10 01 15:00:00", + AnimationMode = "Once", + LightSources = { + { + Type = "SceneGraphLightSource", + Identifier = "Sun", + Node = sunTransforms.SolarSystemBarycenter.Identifier, + Intensity = 1.0 + } }, - Transform = { - Rotation = { - Type = "StaticRotation", - Rotation = { - 0, 0, 0 - } - } - }, - Renderable = { - Type = "RenderableModel", - GeometryFile = model .. "/JWSTFBX.osmodel", - ModelScale = "Foot", - InvertModelScale = true, - EnableAnimation = true, - AnimationStartTime = "2018 10 01 15:00:00", --TODO: Update theese when the new animation is finished - AnimationMode = "Once", - LightSources = { - { - Type = "SceneGraphLightSource", - Identifier = "Sun", - Node = sunTransforms.SolarSystemBarycenter.Identifier, - Intensity = 1.0 - } - }, - PerformShading = true, - DisableFaceCulling = true - }, - GUI = { - Name = "James Webb Space Telescope", - Path = "/Solar System/Missions/JWST", - } + PerformShading = true, + DisableFaceCulling = true + }, + GUI = { + Name = "James Webb Space Telescope", + Path = "/Solar System/Missions/JWST", + } } local JWSTTrail = { - Identifier = "JWSTTrail", - Parent = transforms.L2.Identifier, - Renderable = { - Type = "RenderableTrailOrbit", - Translation = { - Type = "SpiceTranslation", - Target = "JWST", - Observer = "392", -- L2 - Kernels = JWSTKernel .. "/jwst_horizons_20200101_20240101_v01.bsp" - }, - Color = { 0.9, 0.9, 0.0 }, - Period = 91.3105, - Resolution = 100 + Identifier = "JWSTTrail", + Parent = transforms.L2.Identifier, + Renderable = { + Type = "RenderableTrailOrbit", + Translation = { + Type = "SpiceTranslation", + Target = "JWST", + Observer = "392", -- L2 + Kernels = JWSTKernel .. "/jwst_horizons_20200101_20240101_v01.bsp" }, - GUI = { - Name = "JWST Trail", - Path = "/Solar System/Missions/JWST" - } + Color = { 0.9, 0.9, 0.0 }, + Period = 91.3105, + Resolution = 100 + }, + GUI = { + Name = "JWST Trail", + Path = "/Solar System/Missions/JWST" + } } local JWSTSunTrail = { - Identifier = "JWSTSunTrail", - Parent = sunTransforms.SolarSystemBarycenter.Identifier, - Renderable = { - Enabled = false, - Type = "RenderableTrailOrbit", - Translation = { - Type = "SpiceTranslation", - Target = "JWST", - Observer = "SUN", - Kernels = JWSTKernel .. "/jwst_horizons_20200101_20240101_v01.bsp" - }, - Color = { 0.0, 0.9, 0.9 }, - Period = 365.242, - Resolution = 1000 + Identifier = "JWSTSunTrail", + Parent = sunTransforms.SolarSystemBarycenter.Identifier, + Renderable = { + Enabled = false, + Type = "RenderableTrailOrbit", + Translation = { + Type = "SpiceTranslation", + Target = "JWST", + Observer = "SUN", + Kernels = JWSTKernel .. "/jwst_horizons_20200101_20240101_v01.bsp" }, - GUI = { - Name = "JWST Sun Trail", - Path = "/Solar System/Missions/JWST" - } + Color = { 0.0, 0.9, 0.9 }, + Period = 365.242, + Resolution = 1000 + }, + GUI = { + Name = "JWST Sun Trail", + Path = "/Solar System/Missions/JWST" + } } local JWSTFov = { - Identifier = "JWSTFov", - Parent = JWSTModel.Identifier, - Renderable = { - Enabled = false, - Type = "RenderablePrism", - Segments = 6, - Lines = 3, - Radius = 3.25, - LineWidth = 1.0, - Color = { - 1.0, 1.0, 1.0 - }, - Length = 9.2E15 + Identifier = "JWSTFov", + Parent = JWSTModel.Identifier, + Renderable = { + Enabled = false, + Type = "RenderablePrism", + Segments = 6, + Lines = 3, + Radius = 3.25, + LineWidth = 1.0, + Color = { 1.0, 1.0, 1.0 }, + Length = 9.2E15 + }, + Transform = { + Rotation = { + Type = "StaticRotation", + Rotation = { 0, 0, math.rad(30) } }, - Transform = { - Rotation = { - Type = "StaticRotation", - Rotation = { - 0, 0, 0.523598776 -- 30 deg around Z-axis in radians - } - }, - }, - Tag = { "fov" }, - GUI = { - Name = "JWST Field of View", - Path = "/Solar System/Missions/JWST", - } + }, + Tag = { "mission_jwst_fov" }, + GUI = { + Name = "JWST Field of View", + Path = "/Solar System/Missions/JWST", + } } -- Launch local JWSTLaunchPosition = { - Identifier = "JWSTLaunchPosition", - Parent = transforms.L2.Identifier, - Transform = { - Translation = { - Type = "HorizonsTranslation", - HorizonsTextFile = JWSTHorizons .. "/horizons_jwst_launch.dat", - }, + Identifier = "JWSTLaunchPosition", + Parent = transforms.L2.Identifier, + Transform = { + Translation = { + Type = "HorizonsTranslation", + HorizonsTextFile = JWSTHorizons .. "/horizons_jwst_launch.dat", }, - GUI = { - Name = "JWST Launch Position", - Path = "/Solar System/Missions/JWST", - Hidden = true, - } + }, + GUI = { + Name = "JWST Launch Position", + Path = "/Solar System/Missions/JWST", + Hidden = true, + } } local JWSTLaunchModel = { - Identifier = "JWSTLaunchModel", - Parent = JWSTLaunchPosition.Identifier, - TimeFrame = { - Type = "TimeFrameInterval", - Start = "2018 OCT 01 13:18", - End = "2019 OCT 01" - }, - Transform = { - Rotation = { - Type = "FixedRotation", - Attached = "JWSTRotation", - XAxis = { 1, 0, 0 }, - XAxisOrthogonal = true, - YAxisInvert = true, - YAxis = sunTransforms.SolarSystemBarycenter.Identifier - } - }, - Renderable = { - Type = "RenderableModel", - GeometryFile = model .. "/JWSTFBX.osmodel", - ModelScale = "Foot", - InvertModelScale = true, - EnableAnimation = true, - AnimationStartTime = "2018 10 01 15:00:00", --TODO: Update theese when the new animation is finished - AnimationMode = "Once", - LightSources = { - { - Type = "SceneGraphLightSource", - Identifier = "Sun", - Node = sunTransforms.SolarSystemBarycenter.Identifier, - Intensity = 1.0 - } - }, - PerformShading = true, - DisableFaceCulling = true - }, - GUI = { - Name = "JWST Launch Model", - Path = "/Solar System/Missions/JWST", + Identifier = "JWSTLaunchModel", + Parent = JWSTLaunchPosition.Identifier, + TimeFrame = { + Type = "TimeFrameInterval", + Start = "2018 OCT 01 13:18:00", + End = "2019 OCT 01" + }, + Transform = { + Rotation = { + Type = "FixedRotation", + Attached = "JWSTRotation", + XAxis = { 1, 0, 0 }, + XAxisOrthogonal = true, + YAxisInvert = true, + YAxis = sunTransforms.SolarSystemBarycenter.Identifier } + }, + Renderable = { + Type = "RenderableModel", + GeometryFile = model .. "/JWSTFBX.osmodel", + ModelScale = "Foot", + InvertModelScale = true, + EnableAnimation = true, + --TODO: Update theese when the new animation is finished + AnimationStartTime = "2018 10 01 15:00:00", + AnimationMode = "Once", + LightSources = { + { + Type = "SceneGraphLightSource", + Identifier = "Sun", + Node = sunTransforms.SolarSystemBarycenter.Identifier, + Intensity = 1.0 + } + }, + PerformShading = true, + DisableFaceCulling = true + }, + GUI = { + Name = "JWST Launch Model", + Path = "/Solar System/Missions/JWST", + } } local JWSTLaunchTrail = { - Identifier = "JWSTLaunchTrail", - Parent = transforms.L2.Identifier, - TimeFrame = { - Type = "TimeFrameInterval", - Start = "2018 OCT 01 13:18", - End = "2019 OCT 01" + Identifier = "JWSTLaunchTrail", + Parent = transforms.L2.Identifier, + TimeFrame = { + Type = "TimeFrameInterval", + Start = "2018 OCT 01 13:18:00", + End = "2019 OCT 01" + }, + Renderable = { + Type = "RenderableTrailTrajectory", + Translation = { + Type = "HorizonsTranslation", + HorizonsTextFile = JWSTHorizons .. "/horizons_jwst_launch.dat", }, - Renderable = { - Type = "RenderableTrailTrajectory", - Translation = { - Type = "HorizonsTranslation", - HorizonsTextFile = JWSTHorizons .. "/horizons_jwst_launch.dat", - }, - Color = { 0.9, 0.9, 0.0 }, - StartTime = "2018 OCT 01 13:18", - EndTime = "2019 OCT 01", - SampleInterval = 600 - }, - GUI = { - Name = "JWST Launch Trail", - Path = "/Solar System/Missions/JWST" - } + Color = { 0.9, 0.9, 0.0 }, + StartTime = "2018 OCT 01 13:18:00", + EndTime = "2019 OCT 01", + SampleInterval = 600 + }, + GUI = { + Name = "JWST Launch Trail", + Path = "/Solar System/Missions/JWST" + } } assetHelper.registerSceneGraphNodesAndExport(asset, { - JWSTTrail, - JWSTSunTrail, - JWSTLaunchTrail, - JWSTPosition, - JWSTLaunchPosition, - JWSTRotation, - JWSTBand, - JWSTModel, - JWSTLaunchModel, - JWSTFov + JWSTTrail, + JWSTSunTrail, + JWSTLaunchTrail, + JWSTPosition, + JWSTLaunchPosition, + JWSTRotation, + JWSTBand, + JWSTModel, + JWSTLaunchModel, + JWSTFov }) diff --git a/data/assets/scene/solarsystem/planets/earth/lagrange_points/L1.asset b/data/assets/scene/solarsystem/planets/earth/lagrange_points/L1.asset new file mode 100644 index 0000000000..c1364dff39 --- /dev/null +++ b/data/assets/scene/solarsystem/planets/earth/lagrange_points/L1.asset @@ -0,0 +1,60 @@ +local assetHelper = asset.require('util/asset_helper') +local transforms = asset.require('scene/solarsystem/sun/transforms') +local circle = asset.require('util/circle').circle +local kernels = asset.require('scene/solarsystem/planets/earth/lagrange_points/lagrange_kernels').kernels +asset.require('spice/base') + +local L1 = { + Identifier = "L1", + Parent = transforms.SolarSystemBarycenter.Identifier, + Renderable = { + Enabled = false, + Type = "RenderablePlaneImageLocal", + RenderableType = "Opaque", + Billboard = true, + Size = 700E5, + Texture = circle .. "/circle.png", + BlendMode = "Additive" + }, + Transform = { + Translation = { + Type = "SpiceTranslation", + Target = "391", -- L1 + Observer = "SUN", + Kernels = kernels .. "/L1_de431.bsp" + } + }, + Tag = { "lagrange_points_earth" , "lagrange_points_earth_l1" }, + GUI = { + Name = "L1", + Path = "/Solar System/Planets/Earth/Lagrange points", + } +} + +local L1Label = { + Identifier = "L1Label", + Parent = L1.Identifier, + Renderable = { + Enabled = false, + Type = "RenderableLabels", + LabelText = "L1", + FontSize = 20, + LabelSize = 7.5, + LabelMaxSize = 100.0, + LabelMinSize = 1.0, + LabelOrientationOption = "Camera View Direction", + BlendMode = "Normal", + EnableFading = false + }, + Tag = { "lagrange_points_earth", "lagrange_points_earth_l1" }, + GUI = { + Name = "L1 Label", + Path = "/Solar System/Planets/Earth/Lagrange points", + Description = "Main label for L1" + } +} + +assetHelper.registerSceneGraphNodesAndExport(asset, { + L1, + L1Label +}) diff --git a/data/assets/scene/solarsystem/planets/earth/lagrange_points/L2.asset b/data/assets/scene/solarsystem/planets/earth/lagrange_points/L2.asset new file mode 100644 index 0000000000..da5e3fef49 --- /dev/null +++ b/data/assets/scene/solarsystem/planets/earth/lagrange_points/L2.asset @@ -0,0 +1,129 @@ +local assetHelper = asset.require('util/asset_helper') +local transforms = asset.require('scene/solarsystem/sun/transforms') +local circle = asset.require('util/circle').circle +local kernels = asset.require('scene/solarsystem/planets/earth/lagrange_points/lagrange_kernels').kernels +asset.require('spice/base') + +local L2Small = { + Identifier = "L2Small", + Parent = transforms.SolarSystemBarycenter.Identifier, + Renderable = { + Type = "RenderablePlaneImageLocal", + RenderableType = "Opaque", + Billboard = true, + Size = 400E4, + Texture = circle .. "/circle.png", + BlendMode = "Additive" + }, + Transform = { + Translation = { + Type = "SpiceTranslation", + Target = "392", -- L2 + Observer = "SUN", + Kernels = kernels .. "/L2_de431.bsp" + } + }, + Tag = { "lagrange_points_earth_l2_small" }, + GUI = { + Name = "Small L2", + Path = "/Solar System/Planets/Earth/Lagrange points", + } +} + +local L2 = { + Identifier = "L2", + Parent = transforms.SolarSystemBarycenter.Identifier, + Renderable = { + Enabled = false, + Type = "RenderablePlaneImageLocal", + RenderableType = "Opaque", + Billboard = true, + Size = 700E5, + Texture = circle .. "/circle.png", + BlendMode = "Additive" + }, + Transform = { + Translation = { + Type = "SpiceTranslation", + Target = "392", -- L2 + Observer = "SUN", + Kernels = kernels .. "/L2_de431.bsp" + } + }, + Tag = { "lagrange_points_earth", "lagrange_points_earth_l2" }, + GUI = { + Name = "L2", + Path = "/Solar System/Planets/Earth/Lagrange points", + } +} + +local L2SmallLabel = { + Identifier = "L2SmallLabel", + Parent = L2.Identifier, + Renderable = { + Enabled = true, + Type = "RenderableLabels", + LabelText = "L2", + FontSize = 14.0, + LabelSize = 6.4, + LabelMaxSize = 100.0, + LabelMinSize = 1.0, + LabelOrientationOption = "Camera View Direction", + BlendMode = "Normal", + EnableFading = false + }, + Tag = { "lagrange_points_earth_l2_small" }, + GUI = { + Name = "Small L2 Label", + Path = "/Solar System/Planets/Earth/Lagrange points", + Description = "Small label for L2" + } +} + +local L2Label = { + Identifier = "L2Label", + Parent = L2.Identifier, + Renderable = { + Enabled = false, + Type = "RenderableLabels", + LabelText = "L2", + FontSize = 20, + LabelSize = 7.5, + LabelMaxSize = 100.0, + LabelMinSize = 1.0, + LabelOrientationOption = "Camera View Direction", + BlendMode = "Normal", + EnableFading = false + }, + Tag = { "lagrange_points_earth", "lagrange_points_earth_l2" }, + GUI = { + Name = "L2 Label", + Path = "/Solar System/Planets/Earth/Lagrange points", + Description = "Main label for L2" + } +} + +local L2SunLine = { + Identifier = "L2SunLine", + Parent = transforms.SolarSystemBarycenter.Identifier, + Renderable = { + Type = "RenderableNodeLine", + StartNode = "Sun", + EndNode = "L2Small", + Color = { 0.5, 0.5, 0.5 }, + LineWidth = 2 + }, + Tag = { "lagrange_points_earth_l2_small" }, + GUI = { + Name = "Sun to L2 Line", + Path = "/Solar System/Planets/Earth/Lagrange points", + } +} + +assetHelper.registerSceneGraphNodesAndExport(asset, { + L2Small, + L2, + L2SunLine, + L2SmallLabel, + L2Label +}) diff --git a/data/assets/scene/solarsystem/planets/earth/lagrange_points/L4.asset b/data/assets/scene/solarsystem/planets/earth/lagrange_points/L4.asset new file mode 100644 index 0000000000..6bcaaa9d4e --- /dev/null +++ b/data/assets/scene/solarsystem/planets/earth/lagrange_points/L4.asset @@ -0,0 +1,60 @@ +local assetHelper = asset.require('util/asset_helper') +local transforms = asset.require('scene/solarsystem/sun/transforms') +local circle = asset.require('util/circle').circle +local kernels = asset.require('scene/solarsystem/planets/earth/lagrange_points/lagrange_kernels').kernels +asset.require('spice/base') + +local L4 = { + Identifier = "L4", + Parent = transforms.SolarSystemBarycenter.Identifier, + Renderable = { + Enabled = false, + Type = "RenderablePlaneImageLocal", + RenderableType = "Opaque", + Billboard = true, + Size = 800E6, + Texture = circle .. "/circle.png", + BlendMode = "Additive" + }, + Transform = { + Translation = { + Type = "SpiceTranslation", + Target = "394", -- L4 + Observer = "SUN", + Kernels = kernels .. "/L4_de431.bsp" + } + }, + Tag = { "lagrange_points_earth", "lagrange_points_earth_l4" }, + GUI = { + Name = "L4", + Path = "/Solar System/Planets/Earth/Lagrange points", + } +} + +local L4Label = { + Identifier = "L4Label", + Parent = L4.Identifier, + Renderable = { + Enabled = false, + Type = "RenderableLabels", + LabelText = "L4", + FontSize = 20, + LabelSize = 8.5, + LabelMaxSize = 100.0, + LabelMinSize = 1.0, + LabelOrientationOption = "Camera View Direction", + BlendMode = "Normal", + EnableFading = false + }, + Tag = { "lagrange_points_earth", "lagrange_points_earth_l4" }, + GUI = { + Name = "L4 Label", + Path = "/Solar System/Planets/Earth/Lagrange points", + Description = "Main label for L4" + } +} + +assetHelper.registerSceneGraphNodesAndExport(asset, { + L4, + L4Label +}) diff --git a/data/assets/scene/solarsystem/planets/earth/lagrange_points/L5.asset b/data/assets/scene/solarsystem/planets/earth/lagrange_points/L5.asset new file mode 100644 index 0000000000..3a17412737 --- /dev/null +++ b/data/assets/scene/solarsystem/planets/earth/lagrange_points/L5.asset @@ -0,0 +1,60 @@ +local assetHelper = asset.require('util/asset_helper') +local transforms = asset.require('scene/solarsystem/sun/transforms') +local circle = asset.require('util/circle').circle +local kernels = asset.require('scene/solarsystem/planets/earth/lagrange_points/lagrange_kernels').kernels +asset.require('spice/base') + +local L5 = { + Identifier = "L5", + Parent = transforms.SolarSystemBarycenter.Identifier, + Renderable = { + Enabled = false, + Type = "RenderablePlaneImageLocal", + RenderableType = "Opaque", + Billboard = true, + Size = 800E6, + Texture = circle .. "/circle.png", + BlendMode = "Additive" + }, + Transform = { + Translation = { + Type = "SpiceTranslation", + Target = "395", -- L5 + Observer = "SUN", + Kernels = kernels .. "/L5_de431.bsp" + } + }, + Tag = { "lagrange_points_earth", "lagrange_points_earth_l5" }, + GUI = { + Name = "L5", + Path = "/Solar System/Planets/Earth/Lagrange points", + } +} + +local L5Label = { + Identifier = "L5Label", + Parent = L5.Identifier, + Renderable = { + Enabled = false, + Type = "RenderableLabels", + LabelText = "L5", + FontSize = 20, + LabelSize = 8.5, + LabelMaxSize = 100.0, + LabelMinSize = 1.0, + LabelOrientationOption = "Camera View Direction", + BlendMode = "Normal", + EnableFading = false + }, + Tag = { "lagrange_points_earth", "lagrange_points_earth_l5" }, + GUI = { + Name = "L5 Label", + Path = "/Solar System/Planets/Earth/Lagrange points", + Description = "Main label for L5" + } +} + +assetHelper.registerSceneGraphNodesAndExport(asset, { + L5, + L5Label +}) diff --git a/data/assets/scene/solarsystem/planets/earth/lagrange_points/lagrange_kernels.asset b/data/assets/scene/solarsystem/planets/earth/lagrange_points/lagrange_kernels.asset new file mode 100644 index 0000000000..b78370a3a8 --- /dev/null +++ b/data/assets/scene/solarsystem/planets/earth/lagrange_points/lagrange_kernels.asset @@ -0,0 +1,8 @@ +local kernels = asset.syncedResource({ + Name = "Lagrange Kernels", + Type = "HttpSynchronization", + Identifier = "earth_lagrange_kernels", + Version = 1 +}) + +asset.export('kernels', kernels) diff --git a/data/assets/scene/solarsystem/planets/earth/lagrange_points/lagrange_points.asset b/data/assets/scene/solarsystem/planets/earth/lagrange_points/lagrange_points.asset new file mode 100644 index 0000000000..8c4d507ca0 --- /dev/null +++ b/data/assets/scene/solarsystem/planets/earth/lagrange_points/lagrange_points.asset @@ -0,0 +1,4 @@ +asset.require('scene/solarsystem/planets/earth/lagrange_points/L1') +asset.require('scene/solarsystem/planets/earth/lagrange_points/L2') +asset.require('scene/solarsystem/planets/earth/lagrange_points/L4') +asset.require('scene/solarsystem/planets/earth/lagrange_points/L5') diff --git a/data/assets/util/circle.asset b/data/assets/util/circle.asset index f9bddb254f..4717b87883 100644 --- a/data/assets/util/circle.asset +++ b/data/assets/util/circle.asset @@ -1,8 +1,8 @@ local circle = asset.syncedResource({ - Name = "Circle", - Type = "HttpSynchronization", - Identifier = "circle_image", - Version = 1 + Name = "Circle", + Type = "HttpSynchronization", + Identifier = "circle_image", + Version = 1 }) asset.export('circle', circle) diff --git a/data/profiles/jwst.profile b/data/profiles/jwst.profile index eee66c1fe8..d273706c84 100644 --- a/data/profiles/jwst.profile +++ b/data/profiles/jwst.profile @@ -51,7 +51,7 @@ "is_local": false, "key": "P", "name": "Toggle Lagrangian points", - "script": "local list = openspace.getProperty('{lagrange_points}.Renderable.Enabled'); for _,v in pairs(list) do openspace.setPropertyValueSingle(v, not openspace.getPropertyValue(v)) end" + "script": "local list = openspace.getProperty('{lagrange_points_earth}.Renderable.Enabled'); for _,v in pairs(list) do openspace.setPropertyValueSingle(v, not openspace.getPropertyValue(v)) end" }, { "documentation": "Toggle Hubble Ultra Deep Field image and line towards its coordinate", @@ -59,7 +59,7 @@ "is_local": false, "key": "U", "name": "Toggle Hubble Ultra Deep Field", - "script": "local list = openspace.getProperty('{hudf}.*.Enabled'); for _,v in pairs(list) do openspace.setPropertyValueSingle(v, not openspace.getPropertyValue(v)) end" + "script": "local list = openspace.getProperty('{mission_jwst_hudf}.*.Enabled'); for _,v in pairs(list) do openspace.setPropertyValueSingle(v, not openspace.getPropertyValue(v)) end" }, { "documentation": "Toggle L2 label, point and line", @@ -67,7 +67,7 @@ "is_local": false, "key": "O", "name": "Toggle L2", - "script": "local list = openspace.getProperty('{L2}.*.Enabled'); for _,v in pairs(list) do openspace.setPropertyValueSingle(v, not openspace.getPropertyValue(v)) end" + "script": "local list = openspace.getProperty('{lagrange_points_earth_l2_small}.*.Enabled'); for _,v in pairs(list) do openspace.setPropertyValueSingle(v, not openspace.getPropertyValue(v)) end" }, { "documentation": "Toggle James Webb Space Telecope field of view and view band", @@ -75,7 +75,7 @@ "is_local": false, "key": "V", "name": "Toggle JWST field of view and view band", - "script": "local list = openspace.getProperty('{fov}.*.Enabled'); for _,v in pairs(list) do openspace.setPropertyValueSingle(v, not openspace.getPropertyValue(v)) end" + "script": "local list = openspace.getProperty('{mission_jwst_fov}.*.Enabled'); for _,v in pairs(list) do openspace.setPropertyValueSingle(v, not openspace.getPropertyValue(v)) end" } ], "mark_nodes": [ @@ -88,9 +88,9 @@ ], "meta": { "author": "OpenSpace Team", - "description": "James Webb Space Telecope Profile. Adds the James Webb Space Telecope model with an estimated trajectery.", + "description": "James Webb Space Telescope Profile. Adds the James Webb Space Telescope model with an estimated trajectery.", "license": "MIT License", - "name": "JWST", + "name": "James Webb Space Telescope", "url": "https://www.openspaceproject.com", "version": "1.0" }, diff --git a/ext/ghoul b/ext/ghoul index c09f4fe759..e13db04716 160000 --- a/ext/ghoul +++ b/ext/ghoul @@ -1 +1 @@ -Subproject commit c09f4fe75994f803ea2d496864d984b6b91ff2e4 +Subproject commit e13db04716a00f698d01064e9cda623488bc38cb diff --git a/modules/base/rendering/renderableprism.cpp b/modules/base/rendering/renderableprism.cpp index 08da527d2e..8f7633f222 100644 --- a/modules/base/rendering/renderableprism.cpp +++ b/modules/base/rendering/renderableprism.cpp @@ -22,8 +22,6 @@ * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * ****************************************************************************************/ -#define _USE_MATH_DEFINES - #include #include @@ -35,7 +33,6 @@ #include #include #include -#include #include namespace { @@ -82,15 +79,17 @@ namespace { }; // Generate vertices around the unit circle on the XY-plane - void getUnitCircleVertices(std::vector& vertices, int sectorCount) { - float sectorStep = 2 * M_PI / sectorCount; - float sectorAngle; // in radians + std::vector unitCircleVertices(int sectorCount) { + std::vector vertices; + vertices.reserve(2 * sectorCount); + float sectorStep = glm::two_pi() / sectorCount; for (int i = 0; i < sectorCount; ++i) { - sectorAngle = i * sectorStep; + float sectorAngle = i * sectorStep; vertices.push_back(cos(sectorAngle)); // x vertices.push_back(sin(sectorAngle)); // y } + return vertices; } struct [[codegen::Dictionary(RenderablePrism)]] Parameters { @@ -133,28 +132,31 @@ RenderablePrism::RenderablePrism(const ghoul::Dictionary& dictionary) { const Parameters p = codegen::bake(dictionary); - _radius.setViewOption(properties::Property::ViewOptions::Logarithmic); - _lineColor.setViewOption(properties::Property::ViewOptions::Color); - _length.setViewOption(properties::Property::ViewOptions::Logarithmic); - _nShapeSegments.onChange([&]() { _prismIsDirty = true; }); - _nLines.onChange([&]() { _prismIsDirty = true; }); - _radius.onChange([&]() { _prismIsDirty = true; }); - _length.onChange([&]() { _prismIsDirty = true; }); - _nShapeSegments = p.segments; - _nLines = p.lines.value_or(_nShapeSegments); - _radius = p.radius.value_or(_radius); - _lineWidth = p.lineWidth.value_or(_lineWidth); - _lineColor = p.color.value_or(_lineColor); - _length = p.length.value_or(_length); - addProperty(_nShapeSegments); + + _nLines.onChange([&]() { _prismIsDirty = true; }); + _nLines = p.lines.value_or(_nShapeSegments); addProperty(_nLines); + + _radius.setViewOption(properties::Property::ViewOptions::Logarithmic); + _radius.onChange([&]() { _prismIsDirty = true; }); + _radius = p.radius.value_or(_radius); addProperty(_radius); + + _lineWidth = p.lineWidth.value_or(_lineWidth); addProperty(_lineWidth); + + _lineColor.setViewOption(properties::Property::ViewOptions::Color); + _lineColor = p.color.value_or(_lineColor); addProperty(_lineColor); + + _length.setViewOption(properties::Property::ViewOptions::Logarithmic); + _length.onChange([&]() { _prismIsDirty = true; }); + _length = p.length.value_or(_length); addProperty(_length); + addProperty(_opacity); } @@ -167,7 +169,11 @@ void RenderablePrism::initialize() { } void RenderablePrism::initializeGL() { - initializeShader(); + _shader = global::renderEngine->buildRenderProgram( + "PrismProgram", + absPath("${MODULE_BASE}/shaders/prism_vs.glsl"), + absPath("${MODULE_BASE}/shaders/prism_fs.glsl") + ); ghoul::opengl::updateUniformLocations(*_shader, _uniformCache, UniformNames); glGenVertexArrays(1, &_vaoId); @@ -178,8 +184,8 @@ void RenderablePrism::initializeGL() { updateBufferData(); - glEnableVertexAttribArray(_locVertex); - glVertexAttribPointer(_locVertex, 3, GL_FLOAT, GL_FALSE, 3 * sizeof(float), nullptr); + glEnableVertexAttribArray(0); + glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 3 * sizeof(float), nullptr); glBindVertexArray(0); } @@ -202,12 +208,8 @@ void RenderablePrism::updateVertexData() { _indexArray.clear(); // Get unit circle vertices on the XY-plane - std::vector unitVertices; - std::vector unitVerticesLines; - unitVertices.reserve(2 * _nShapeSegments); - unitVerticesLines.reserve(2 * _nLines); - getUnitCircleVertices(unitVertices, _nShapeSegments); - getUnitCircleVertices(unitVerticesLines, _nLines); + std::vector unitVertices = unitCircleVertices(_nShapeSegments); + std::vector unitVerticesLines = unitCircleVertices(_nLines); // Put base and top shape vertices into array for (int i = 0; i < 2; ++i) { @@ -223,7 +225,7 @@ void RenderablePrism::updateVertexData() { } } - // Put the vertices for the connecting lines into array + // Put the vertices for the connecting lines into array if (_nLines == 1) { // In the case of just one line then connect the center points instead // Center for base shape @@ -254,6 +256,7 @@ void RenderablePrism::updateVertexData() { } // Indices for Base shape + ghoul_assert(_nShapeSegments.value <= std::numeric_limit::max(), "Too many shape segments") for (uint8_t i = 0; i < _nShapeSegments; ++i) { _indexArray.push_back(i); } @@ -329,7 +332,7 @@ void RenderablePrism::render(const RenderData& data, RendererTasks&) { void RenderablePrism::update(const UpdateData&) { if (_shader->isDirty()) { _shader->rebuildFromFile(); - updateUniformLocations(); + ghoul::opengl::updateUniformLocations(*_shader, _uniformCache, UniformNames); } if (_prismIsDirty) { updateVertexData(); @@ -338,17 +341,4 @@ void RenderablePrism::update(const UpdateData&) { } } -void RenderablePrism::initializeShader() { - _shader = global::renderEngine->buildRenderProgram( - "PrismProgram", - absPath("${MODULE_BASE}/shaders/prism_vs.glsl"), - absPath("${MODULE_BASE}/shaders/prism_fs.glsl") - ); - updateUniformLocations(); -} - -void RenderablePrism::updateUniformLocations() { - ghoul::opengl::updateUniformLocations(*_shader, _uniformCache, UniformNames); -} - } // namespace openspace diff --git a/modules/base/rendering/renderableprism.h b/modules/base/rendering/renderableprism.h index 913f7ee3cf..3acfb6953f 100644 --- a/modules/base/rendering/renderableprism.h +++ b/modules/base/rendering/renderableprism.h @@ -25,10 +25,11 @@ #ifndef __OPENSPACE_MODULE_BASE___RENDERABLEPRISM___H__ #define __OPENSPACE_MODULE_BASE___RENDERABLEPRISM___H__ +#include + #include #include #include -#include #include #include #include @@ -55,10 +56,8 @@ public: static documentation::Documentation Documentation(); private: - void initializeShader(); void updateVertexData(); void updateBufferData(); - void updateUniformLocations(); // Properties properties::IntProperty _nShapeSegments; @@ -70,7 +69,6 @@ private: UniformCache(modelViewProjection, color) _uniformCache; std::unique_ptr _shader; - const GLuint _locVertex = 0; GLuint _vaoId = 0; GLuint _vboId = 0; GLuint _iboId = 0; diff --git a/modules/base/shaders/prism_fs.glsl b/modules/base/shaders/prism_fs.glsl index 689862a5aa..e659f56f6a 100644 --- a/modules/base/shaders/prism_fs.glsl +++ b/modules/base/shaders/prism_fs.glsl @@ -24,13 +24,13 @@ #include "fragment.glsl" -in vec4 vs_positionScreenSpace; +in float vs_depth; uniform vec4 vs_color; Fragment getFragment() { - Fragment frag; - frag.color = vs_color; - frag.depth = vs_positionScreenSpace.w; - return frag; + Fragment frag; + frag.color = vs_color; + frag.depth = vs_depth; + return frag; } diff --git a/modules/base/shaders/prism_vs.glsl b/modules/base/shaders/prism_vs.glsl index 99dce430e1..bb8d4f68b0 100644 --- a/modules/base/shaders/prism_vs.glsl +++ b/modules/base/shaders/prism_vs.glsl @@ -28,13 +28,14 @@ layout (location = 0) in vec3 in_position; -out vec4 vs_positionScreenSpace; +out float vs_depth; uniform mat4 modelViewProjectionTransform; void main() { - vec4 position = vec4(in_position, 1); - vec4 positionClipSpace = modelViewProjectionTransform * position; - vs_positionScreenSpace = z_normalization(positionClipSpace); - gl_Position = vs_positionScreenSpace; + vec4 position = vec4(in_position, 1.0); + vec4 positionClipSpace = modelViewProjectionTransform * position; + vec4 positionScreenSpace = z_normalization(positionClipSpace); + gl_Position = positionScreenSpace; + vs_depth = positionScreenSpace.w; } diff --git a/src/rendering/renderengine.cpp b/src/rendering/renderengine.cpp index 2cc1222006..50ad440364 100644 --- a/src/rendering/renderengine.cpp +++ b/src/rendering/renderengine.cpp @@ -55,7 +55,7 @@ #include #include #include -#include +#include #include #include #include @@ -483,7 +483,7 @@ void RenderEngine::initialize() { ); ghoul::io::ModelReader::ref().addReader( - std::make_unique() + std::make_unique() ); _versionString = OPENSPACE_VERSION_STRING_FULL; diff --git a/src/scene/scene.cpp b/src/scene/scene.cpp index ff49ef23cf..d39208d1a1 100644 --- a/src/scene/scene.cpp +++ b/src/scene/scene.cpp @@ -723,14 +723,14 @@ scripting::LuaLibrary Scene::luaLibrary() { &luascriptfunctions::worldPosition, {}, "string", - "Returns the worldPosition of the scene graph node with the given string as identifier" + "Returns the world position of the scene graph node with the given string as identifier" }, { "worldRotation", & luascriptfunctions::worldRotation, {}, "string", - "Returns the worldRotation of the scene graph node with the given string as identifier" + "Returns the world rotation matrix of the scene graph node with the given string as identifier" } } }; diff --git a/src/scene/scene_lua.inl b/src/scene/scene_lua.inl index 3eda96cfdb..cb1d33fd52 100644 --- a/src/scene/scene_lua.inl +++ b/src/scene/scene_lua.inl @@ -912,8 +912,16 @@ int worldPosition(lua_State* L) { ghoul::lua::checkArgumentsAndThrow(L, 1, "lua::worldPosition"); std::string identifier = ghoul::lua::value(L, 1, ghoul::lua::PopValue::Yes); + SceneGraphNode* node = sceneGraphNode(identifier); - glm::dvec3 pos = global::renderEngine->scene()->sceneGraphNode(identifier)->worldPosition(); + if (!node) { + return ghoul::lua::luaError( + L, + fmt::format("Did not find a match for identifier: {} ", identifier) + ); + } + + glm::dvec3 pos = node->worldPosition(); ghoul::lua::push(L, pos); ghoul_assert(lua_gettop(L) == 1, "Incorrect number of items left on stack"); @@ -924,8 +932,16 @@ int worldRotation(lua_State* L) { ghoul::lua::checkArgumentsAndThrow(L, 1, "lua::worldRotation"); std::string identifier = ghoul::lua::value(L, 1, ghoul::lua::PopValue::Yes); + SceneGraphNode* node = sceneGraphNode(identifier); - glm::dmat3 rot = global::renderEngine->scene()->sceneGraphNode(identifier)->worldRotationMatrix(); + if (!node) { + return ghoul::lua::luaError( + L, + fmt::format("Did not find a match for identifier: {} ", identifier) + ); + } + + glm::dmat3 rot = node->worldRotationMatrix(); ghoul::lua::push(L, rot); ghoul_assert(lua_gettop(L) == 1, "Incorrect number of items left on stack");