Address PR comments

This commit is contained in:
Malin Ejdbo
2021-05-31 15:34:54 +02:00
parent ca071e06ae
commit 31b834dbb2
25 changed files with 757 additions and 760 deletions

View File

@@ -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 <br><br>
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 <br><br>
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.<br><br>
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.<br><br>
Downloading the Atlas:<br>
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.<br><br>
Downloading the Atlas:<br>
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.<br><br>
Modifying the Atlas:<br>
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.<br><br>
Modifying the Atlas:<br>
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.<br><br>
Distributing the Atlas:<br>
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.<br><br>
Distributing the Atlas:<br>
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.<br><br>
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.<br><br>
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.<br><br>
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.<br><br>
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.<br><br>
For more information, please visit http://www.haydenplanetarium.org/universe
]]
For more information, please visit http://www.haydenplanetarium.org/universe
]]
}

View File

@@ -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)

View File

@@ -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
})

View File

@@ -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
})

View File

@@ -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
})

View File

@@ -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
})

View File

@@ -1,8 +0,0 @@
local kernels = asset.syncedResource({
Name = "Lagrange Kernels",
Type = "HttpSynchronization",
Identifier = "earth_lagrange_kernels",
Version = 1
})
asset.export('kernels', kernels)

View File

@@ -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')

View File

@@ -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
})

View File

@@ -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
})

View File

@@ -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
})

View File

@@ -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
})

View File

@@ -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
})

View File

@@ -0,0 +1,8 @@
local kernels = asset.syncedResource({
Name = "Lagrange Kernels",
Type = "HttpSynchronization",
Identifier = "earth_lagrange_kernels",
Version = 1
})
asset.export('kernels', kernels)

View File

@@ -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')

View File

@@ -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)

View File

@@ -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"
},

View File

@@ -22,8 +22,6 @@
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
****************************************************************************************/
#define _USE_MATH_DEFINES
#include <modules/base/rendering/renderableprism.h>
#include <openspace/documentation/documentation.h>
@@ -35,7 +33,6 @@
#include <ghoul/logging/logmanager.h>
#include <ghoul/opengl/openglstatecache.h>
#include <ghoul/opengl/programobject.h>
#include <math.h>
#include <optional>
namespace {
@@ -82,15 +79,17 @@ namespace {
};
// Generate vertices around the unit circle on the XY-plane
void getUnitCircleVertices(std::vector<float>& vertices, int sectorCount) {
float sectorStep = 2 * M_PI / sectorCount;
float sectorAngle; // in radians
std::vector<float> unitCircleVertices(int sectorCount) {
std::vector<float> vertices;
vertices.reserve(2 * sectorCount);
float sectorStep = glm::two_pi<float>() / 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<Parameters>(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<float> unitVertices;
std::vector<float> unitVerticesLines;
unitVertices.reserve(2 * _nShapeSegments);
unitVerticesLines.reserve(2 * _nLines);
getUnitCircleVertices(unitVertices, _nShapeSegments);
getUnitCircleVertices(unitVerticesLines, _nLines);
std::vector<float> unitVertices = unitCircleVertices(_nShapeSegments);
std::vector<float> 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<uint8_t>::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

View File

@@ -25,10 +25,11 @@
#ifndef __OPENSPACE_MODULE_BASE___RENDERABLEPRISM___H__
#define __OPENSPACE_MODULE_BASE___RENDERABLEPRISM___H__
#include <openspace/rendering/renderable.h>
#include <openspace/properties/scalar/floatproperty.h>
#include <openspace/properties/scalar/intproperty.h>
#include <openspace/properties/vector/vec3property.h>
#include <openspace/rendering/renderable.h>
#include <ghoul/opengl/ghoul_gl.h>
#include <ghoul/opengl/uniformcache.h>
#include <ghoul/glm.h>
@@ -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<ghoul::opengl::ProgramObject> _shader;
const GLuint _locVertex = 0;
GLuint _vaoId = 0;
GLuint _vboId = 0;
GLuint _iboId = 0;

View File

@@ -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;
}

View File

@@ -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;
}

View File

@@ -55,7 +55,7 @@
#include <ghoul/io/texture/texturereadercmap.h>
#include <ghoul/io/model/modelreader.h>
#include <ghoul/io/model/modelreaderassimp.h>
#include <ghoul/io/model/modelreaderosmodel.h>
#include <ghoul/io/model/modelreaderbinary.h>
#include <ghoul/logging/logmanager.h>
#include <ghoul/misc/profiling.h>
#include <ghoul/misc/stringconversion.h>
@@ -483,7 +483,7 @@ void RenderEngine::initialize() {
);
ghoul::io::ModelReader::ref().addReader(
std::make_unique<ghoul::io::ModelReaderOSModel>()
std::make_unique<ghoul::io::ModelReaderBinary>()
);
_versionString = OPENSPACE_VERSION_STRING_FULL;

View File

@@ -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"
}
}
};

View File

@@ -912,8 +912,16 @@ int worldPosition(lua_State* L) {
ghoul::lua::checkArgumentsAndThrow(L, 1, "lua::worldPosition");
std::string identifier = ghoul::lua::value<std::string>(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<std::string>(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");