clean up, more codegen for volume renderable, moved heliosphere folder and reference frames

This commit is contained in:
ElonOlsson
2021-06-16 16:35:50 -04:00
parent f0c14910c8
commit bbd69ecf98
39 changed files with 160 additions and 560 deletions
@@ -8,35 +8,17 @@ local densityDirectory = asset.syncedResource({
Version = 1 Version = 1
}) })
--local mirrorVolumeMatrix = {
--1.0, 0.0, 0.0,
--0.0, 1.0, 0.0,
--0.0, 0.0, 1.0
-- -1.0, 0.0, 0.0,
-- 0.0, 1.0, 0.0,
-- 0.0, 0.0, -1.0
--0.0, 1.0, 0.0,
--1.0, 0.0, 0.0,
--0.0, 0.0, 1.0
--}
local sunRadius = 6.957E8 local sunRadius = 6.957E8
local densityVolume = { local densityVolume = {
Identifier = "MAS_MHD_density", Identifier = "MAS_MHD_density",
-- wrong Parent = sunTransforms.SolarSystemBarycenter.Identifier,
-- right
Parent = sunTransforms.SunIAU.Identifier, Parent = sunTransforms.SunIAU.Identifier,
-- wrong Parent = transforms.HNMReferenceFrame.Identifier,
Renderable = { Renderable = {
Type = "RenderableTimeVaryingVolume", Type = "RenderableTimeVaryingVolume",
StepSize = 0.004, StepSize = 0.004,
--Enabled = false, --Enabled = false,
Opacity = 0.3, Opacity = 0.3,
TransferFunction = asset.localResource("transferfunctions/mas_mhd_r_squared.txt"), --test1 TransferFunction = asset.localResource("transferfunctions/mas_mhd_r_squared.txt"),
SourceDirectory = densityDirectory, SourceDirectory = densityDirectory,
--LowerValueBound = 0, --LowerValueBound = 0,
--UpperValueBound = 1, --UpperValueBound = 1,
@@ -53,13 +35,10 @@ local densityVolume = {
}, },
Rotation = { Rotation = {
--Type = "StaticRotation", --LuaRotation --Type = "StaticRotation", --LuaRotation
--Rotation = mirrorVolumeMatrix
Type = "FixedRotation", Type = "FixedRotation",
XAxis = {-1.0, 0.0, 0.0}, XAxis = {-1.0, 0.0, 0.0},
YAxis = {0.0, 1.0, 0.0}, YAxis = {0.0, 1.0, 0.0},
ZAxis = {0.0, 0.0, -1.0} ZAxis = {0.0, 0.0, -1.0}
--Script = asset.localResource("kernels/carringtonRotation.lua")
} }
}, },
GUI = { GUI = {
@@ -74,7 +53,7 @@ asset.meta = {
Name = "Predictive Science Inc. Volume Rendering Bastille Day", Name = "Predictive Science Inc. Volume Rendering Bastille Day",
Version = "1.0", Version = "1.0",
Description = " Volumetric rendering for the bastille day CME event ", Description = " Volumetric rendering for the bastille day CME event ",
Author = "OpenSpace team", Author = "CCMC, OpenSpace team",
URL = "https://dx.doi.org/10.3847/1538-4357/aab36d", URL = "https://dx.doi.org/10.3847/1538-4357/aab36d",
License = "" License = ""
} }
@@ -1,5 +1,5 @@
local assetHelper = asset.require('util/asset_helper') local assetHelper = asset.require('util/asset_helper')
local sunTransforms = asset.require('scene/solarsystem/sun/transforms') local heliosphereTransforms = asset.require('scene/solarsystem/sun/transforms_heliosphere')
local transferFunctions = asset.localResource("transferfunctions") local transferFunctions = asset.localResource("transferfunctions")
@@ -18,7 +18,7 @@ local sunRadius = 6.957E8
-- Fieldlies from binaries -- Fieldlies from binaries
local fieldlines = { local fieldlines = {
Identifier = "MAS_MHD_Fieldlines", Identifier = "MAS_MHD_Fieldlines",
Parent = sunTransforms.HNMReferenceFrame.Identifier, Parent = heliosphereTransforms.HNMReferenceFrame.Identifier,
--wrong Parent = sunTransforms.SunIAU.Identifier, --wrong Parent = sunTransforms.SunIAU.Identifier,
Renderable = { Renderable = {
Type = "RenderableFieldlinesSequence", Type = "RenderableFieldlinesSequence",
@@ -1,21 +1,12 @@
local assetHelper = asset.require('util/asset_helper') local assetHelper = asset.require('util/asset_helper')
--local transforms = asset.require('./transforms') local heliosphereTransforms = asset.require('scene/solarsystem/sun/transforms_heliosphere')
local sunTransforms = asset.require('scene/solarsystem/sun/transforms')
local transferFunctions = asset.localResource("transferfunctions") local transferFunctions = asset.localResource("transferfunctions")
local fluxnodeColorTable = transferFunctions .. "/flux_nodes.txt" local fluxnodeColorTable = transferFunctions .. "/flux_nodes.txt"
local fluxnodeColorTableCMR = transferFunctions .. "/CMR.txt" local fluxnodeColorTableCMR = transferFunctions .. "/CMR.txt"
local fluxnodeColorTableEarth = transferFunctions .. "/flux_nodes_grey_scale.txt" local fluxnodeColorTableEarth = transferFunctions .. "/flux_nodes_grey_scale.txt"
local fluxnodeColorTableFlow = transferFunctions .. "/flux_nodes_flow.txt" local fluxnodeColorTableFlow = transferFunctions .. "/flux_nodes_flow.txt"
--local fluxnodeColorTableIlluminance = transferFunctions .. "/CMR_illuminance.txt"
--local fluxnodeColorTableIlluminance2 = transferFunctions .. "/CMR_illuminance2.txt"
--[[local fluxnodesDirectory = asset.syncedResource({
Name = "Bastille Day Flux nodes",
Type = "HttpSynchronization",
Identifier = "bastille_day_streamnodes",
Version = 10
})--]]
local fluxnodesBinaries = asset.syncedResource({ local fluxnodesBinaries = asset.syncedResource({
Name = "Bastille day Flux nodes binaries", Name = "Bastille day Flux nodes binaries",
Type = "HttpSynchronization", Type = "HttpSynchronization",
@@ -26,30 +17,22 @@ local fluxnodesBinaries = asset.syncedResource({
-- Fluxnodes from binaries -- Fluxnodes from binaries
local Fluxnodes = { local Fluxnodes = {
Identifier = "MAS_MHD_FluxNodes", Identifier = "MAS_MHD_FluxNodes",
Parent = sunTransforms.HNMReferenceFrame.Identifier, Parent = heliosphereTransforms.HNMReferenceFrame.Identifier,
--Parent = sunTransforms.SunIAU.Identifier,
--Parent = sunTransforms.SolarSystemBarycenter.Identifier,
--transforms.asset, referens to suntransforms.solarsystemBarycenter.identifier
Renderable = { Renderable = {
Type = "RenderableFluxNodes", Type = "RenderableFluxNodes",
--SourceFolder = fluxnodesDirectory, SourceFolder = fluxnodesBinaries,
BinarySourceFolder = fluxnodesBinaries, ColorTablePaths = {
-- LineWidth = 1.0; Standard = fluxnodeColorTable,
-- AlphaBlendlingEnabled = false, CMR = fluxnodeColorTableCMR,
-- InputFileType = "json", Earth = fluxnodeColorTableEarth,
ColorTablePaths = { -- keep order Flow = fluxnodeColorTableFlow,
fluxnodeColorTable,
fluxnodeColorTableCMR,
fluxnodeColorTableEarth,
fluxnodeColorTableFlow,
--fluxnodeColorTableIlluminance,
--fluxnodeColorTableIlluminance2,
}, },
LoadAtRuntime = true, LoadAtRuntime = true,
ScaleToMeters = 1.0, ScaleToMeters = 1.0,
SecondsBefore = 24*60*60, SecondsBefore = 24*60*60,
SecondsAfter = 24*60*60, SecondsAfter = 24*60*60,
--SimulationModel = "mas",
Enabled = false Enabled = false
}, },
GUI = { GUI = {
@@ -81,7 +64,6 @@ local Fluxnodes = {
assetHelper.registerSceneGraphNodesAndExport(asset, { Fluxnodes }) assetHelper.registerSceneGraphNodesAndExport(asset, { Fluxnodes })
asset.meta = { asset.meta = {
Name = "Predictive Science Inc. Flux nodes Bastille Day", Name = "Predictive Science Inc. Flux nodes Bastille Day",
Version = "1.0", Version = "1.0",
@@ -1,6 +1,6 @@
asset.require("spice/base") asset.require("spice/base")
local assetHelper = asset.require("util/asset_helper") local assetHelper = asset.require("util/asset_helper")
local transforms = asset.require('scene/solarsystem/sun/transforms') local transforms = asset.require('scene/solarsystem/sun/transforms_heliosphere')
--15 cmr emin01, 16 cmr emin03 --15 cmr emin01, 16 cmr emin03
local TexturesPathEquitorial = asset.syncedResource({ local TexturesPathEquitorial = asset.syncedResource({
Type = "HttpSynchronization", Type = "HttpSynchronization",
@@ -1,5 +1,5 @@
local assetHelper = asset.require('util/asset_helper') local assetHelper = asset.require('util/asset_helper')
local transforms = asset.require('../transforms') local transforms = asset.require('../../planets/earth/transforms_magnetosphere')
--local fieldlinesDirectory = "C:/Users/elono/Documents/OpenSpace/data/earthMagnetoSphere" --local fieldlinesDirectory = "C:/Users/elono/Documents/OpenSpace/data/earthMagnetoSphere"
local fieldlinesDirectory = asset.syncedResource({ local fieldlinesDirectory = asset.syncedResource({
@@ -9,8 +9,6 @@ local fieldlinesDirectory = asset.syncedResource({
Version = 1 Version = 1
}) })
local earthRadius = 6378137
-- Fieldlies from binaries -- Fieldlies from binaries
local earthMagnetosphere = { local earthMagnetosphere = {
Identifier = "Earths_Magnetosphere", Identifier = "Earths_Magnetosphere",
@@ -20,19 +18,12 @@ local earthMagnetosphere = {
Type = "RenderableFieldlinesSequence", Type = "RenderableFieldlinesSequence",
SourceFolder = fieldlinesDirectory, SourceFolder = fieldlinesDirectory,
-- FlowEnabled = false, -- FlowEnabled = false,
LineWidth = 2.0, LineWidth = 3.0,
AlphaBlendlingEnabled = false, AlphaBlendlingEnabled = false,
InputFileType = "osfls", -- openspace Field lines Sequence InputFileType = "osfls", -- openspace Field lines Sequence
--ColorTablePaths = {
-- masDensityColorTable, --maskingEnabled = true,
-- masVelocityColorTable, --MaskingRanges = {0.0, 0.0}, -- this seem to map it to an int =0 which correspond to the topology=closed (fieldlines)
--},
--ColorTableMinMax = {
-- { 0, 1000000 },
-- { 100, 2000 }
--},
MaskingEnabled = true,
MaskingRanges = {{0.0, 0.0}}, -- this seem to map it to an int =0 which correspond to the topology=closed (fieldlines)
LoadAtRuntime = true, LoadAtRuntime = true,
ScaleToMeters = 1.0, ScaleToMeters = 1.0,
SecondsBefore = 24*60*60*365*100, SecondsBefore = 24*60*60*365*100,
@@ -43,15 +34,9 @@ local earthMagnetosphere = {
} }
}, },
GUI = { GUI = {
Path = "/Solar System/Planets/Earth/Magnetosphere", Path = "/Solar System/Planets/Earth",
Name = "Magnetosphere" Name = "Magnetosphere"
}, },
--Transform = {
-- Scale = {
-- Type = "StaticScale",
-- Scale = earthRadius
-- }
--}
} }
assetHelper.registerSceneGraphNodesAndExport(asset, { earthMagnetosphere }) assetHelper.registerSceneGraphNodesAndExport(asset, { earthMagnetosphere })
@@ -60,7 +45,7 @@ asset.meta = {
Name = "", Name = "",
Version = "1.0", Version = "1.0",
Description = " Magnetic fieldlines for the bastille day CME event ", Description = " Magnetic fieldlines for the bastille day CME event ",
Author = "OpenSpace team", Author = "CCMC",
URL = "", URL = "",
License = "" License = ""
} }
@@ -1,74 +0,0 @@
local assetHelper = asset.require('util/asset_helper')
local sunTransforms = asset.require('scene/solarsystem/sun/transforms')
local transforms = asset.require('scene/solarsystem/planets/earth/transforms')
local transferFunctions = asset.localResource("../../../sun/heliosphere/bastille_day/transferfunctions")
local masVelocityColorTable = transferFunctions .. "/velocity_fieldlines.txt"
local masDensityColorTable = transferFunctions .. "/density_fieldlines.txt"
local fieldlinesDirectory = 'D:/data/2000_01_01_event/cdf'
local seedPointDirectory = 'D:/data/2000_01_01_event/seedpoints'
local earthRadius = 6378137
-- Fieldlies from binaries
local fieldlines = {
Identifier = "Earth_BATSRUS_Fieldlines",
Parent = transforms.GSMReferenceFrame.Identifier,
Renderable = {
Type = "RenderableFieldlinesSequence",
SourceFolder = fieldlinesDirectory,
SeedPointDirectory = seedPointDirectory,
TracingVariable = 'b',
--OutputFolder = "C:/Users/eolsson/Documents/openspace/data/20000101/osfls/",
-- FlowEnabled = false,
-- LineWidth = 1.0;
AlphaBlendlingEnabled = false,
--InputFileType = "osfls",
InputFileType = "CDF",
ColorTablePaths = {
masDensityColorTable,
masVelocityColorTable,
},
ColorTableRanges = {
{ 0, 10 },
{ 100, 2000 }
},
ExtraVariables = {
"rho",
"p",
"T"
},
ManualTimeOffset = -14400.0,
ScaleToMeters = 1.0,
SecondsBefore = 24*60*60,
SecondsAfter = 24*60*60,
SimulationModel = "batsrus",
Color = {
Uniform = {1.0, 0.0, 0.5, 1}
}
},
GUI = {
Path = "/Solar System/Planets/Earth/Magnetosphere",
Name = "Fieldlines 2000-01-01"
},
Transform = {
Scale = {
Type = "StaticScale",
Scale = 1
}
}
}
assetHelper.registerSceneGraphNodesAndExport(asset, { fieldlines })
asset.meta = {
Name = "CDF fieldlines files Bastille Day",
Version = "1.0",
Description = " Magnetic fieldlines",
Author = "OpenSpace team",
URL = "",
License = ""
}
@@ -2,8 +2,6 @@ local assetHelper = asset.require('util/asset_helper')
local transforms = asset.require('scene/solarsystem/sun/transforms') local transforms = asset.require('scene/solarsystem/sun/transforms')
asset.require("spice/base") asset.require("spice/base")
local GSMKernel = asset.localResource("./kernels/GSM.ti")
local EarthBarycenter = { local EarthBarycenter = {
Identifier = "EarthBarycenter", Identifier = "EarthBarycenter",
Parent = transforms.SolarSystemBarycenter.Identifier, Parent = transforms.SolarSystemBarycenter.Identifier,
@@ -73,30 +71,11 @@ local EarthIAU = {
} }
} }
local GSMReferenceFrame = {
Identifier = "GSMReferenceFrame",
Parent = EarthCenter.Identifier,
Transform = {
Rotation = {
Type = "SpiceRotation",
SourceFrame = "GSM", --Geocentric Solar Magnetospheric
DestinationFrame = "GALACTIC",
Kernels = GSMKernel
}
},
GUI = {
Name = "GSM Reference Frame",
Path = "/Solar System/Planets/Earth",
Hidden = true
}
}
assetHelper.registerSceneGraphNodesAndExport(asset, { assetHelper.registerSceneGraphNodesAndExport(asset, {
EarthBarycenter, EarthBarycenter,
EarthCenter, EarthCenter,
EarthInertial, EarthInertial,
EarthIAU, EarthIAU,
GSMReferenceFrame
}) })
@@ -104,9 +83,9 @@ asset.meta = {
Name = "Earth Transforms", Name = "Earth Transforms",
Version = "1.0", Version = "1.0",
Description = [[ Earth transforms: Earth Barycenter, Earth Center, Earth Inertial, Description = [[ Earth transforms: Earth Barycenter, Earth Center, Earth Inertial,
Earth IAU, GSMReferenceFrame. A scene graph node is created for each transform.]], Earth IAU. A scene graph node is created for each transform.]],
Author = "OpenSpace Team", Author = "OpenSpace Team",
URL = "http://openspaceproject.com", URL = "http://openspaceproject.com",
License = "MIT license", License = "MIT license",
Identifiers = {"EarthBarycenter", "EarthCenter", "EarthInertial", "EarthIAU", "GSMReferenceFrame"} Identifiers = {"EarthBarycenter", "EarthCenter", "EarthInertial", "EarthIAU"}
} }
@@ -0,0 +1,35 @@
local assetHelper = asset.require('util/asset_helper')
local transforms = asset.require('scene/solarsystem/planets/earth/transforms')
asset.require("spice/base")
local GSMKernel = asset.localResource("./kernels/GSM.ti")
local GSMReferenceFrame = {
Identifier = "GSMReferenceFrame",
Parent = transforms.EarthCenter.Identifier,
Transform = {
Rotation = {
Type = "SpiceRotation",
SourceFrame = "GSM", --Geocentric Solar Magnetospheric
DestinationFrame = "GALACTIC",
Kernels = GSMKernel
}
},
GUI = {
Name = "GSM Reference Frame",
Path = "/Solar System/Planets/Earth",
Hidden = true
}
}
assetHelper.registerSceneGraphNodesAndExport(asset, { GSMReferenceFrame })
asset.meta = {
Name = "Earth magnetosphere transforms",
Version = "1.0",
Description = [[ Earth transforms: GSMReferenceFrame. Geocentric Solar Magnetospheric]],
Author = "CCMC",
URL = "http://openspaceproject.com",
License = "MIT license",
Identifiers = {"GSMReferenceFrame"}
}
@@ -1,81 +0,0 @@
local assetHelper = asset.require('util/asset_helper')
local sunTransforms = asset.require('scene/solarsystem/sun/transforms')
local transforms = asset.require('scene/solarsystem/planets/earth/transforms')
local transferFunctions = asset.localResource("transferfunctions")
local masVelocityColorTable = transferFunctions .. "/velocity_fieldlines.txt"
local masDensityColorTable = transferFunctions .. "/density_fieldlines.txt"
local fieldlinesDirectory = 'D:/data/bastille_day/mas-filedlines/MAS_BastilleDay_mhd_field_lines/BastilleDay/mhd_field_lines/JSON'
local sunRadius = 6.957E8
-- Fieldlies from binaries
local fieldlines = {
Identifier = "MAS_MHD_Fieldlines",
Parent = sunTransforms.HNMReferenceFrame.Identifier,
-- wrong Parent = sunTransforms.SunIAU.Identifier,
Renderable = {
Type = "RenderableFieldlinesSequence",
SourceFolder = fieldlinesDirectory,
-- FlowEnabled = false,
-- LineWidth = 1.0;
AlphaBlendlingEnabled = false,
InputFileType = "json",
ColorTablePaths = {
masDensityColorTable,
masVelocityColorTable,
},
ColorTableMinMax = {
{ 0, 1000000 },
{ 100, 2000 }
},
LoadAtRuntime = true,
ScaleToMeters = 1.0,
SecondsBefore = 24*60*60,
SecondsAfter = 24*60*60,
SimulationModel = "enlil",
Color = {
Uniform = {1.0, 0.0, 0.5, 1}
}
},
GUI = {
Path = "/Solar System/Heliosphere",
Name = "MAS Fieldlines"
},
Transform = {
Scale = {
Type = "StaticScale",
Scale = sunRadius
},
--[[ Rotation = {
--This is a rotation matrix to go from Carrington longitude referens frame to HEEQ180
--which is what the renderables paretn transforms.HNMReferenceFrame.Identifier is
--refering to. At the referens time, MAS_seq = 0, 2000-07-14T08:33:37.105 the Carrington
--longitude was 309.3 degrees.
--Difference from HEEQ => 360-309.3=50.7
--(or 0-309.3 = -309.3 However this leads to the same rotation matrix in the end)
--Since OpenSpace supports HEEQ180 and not HEEQ, 180 was added or subtracted
-- => a1 = -129.3 and a2 = 230.7
--Rotation matrix: (cos a, -sin a, 0)(sin a, cos a, 0)(0, 0, 1) leads to the result.
Type = "FixedRotation",
XAxis = {-0.63338087262755016203262119192353, -0.77384020972650618518999944537717, 0.0},
YAxis = {0.77384020972650618518999944537717, -0.63338087262755016203262119192353, 0.0},
ZAxis = {0.0, 0.0, 1.0}
}
]]--
}
}
assetHelper.registerSceneGraphNodesAndExport(asset, { fieldlines })
asset.meta = {
Name = "Json fieldlines files Bastille Day",
Version = "1.0",
Description = " Magnetic fieldlines for the bastille day CME event ",
Author = "OpenSpace team",
URL = "",
License = ""
}
@@ -1,8 +0,0 @@
local TexturesPath = asset.syncedResource({
Type = "HttpSynchronization",
Name = "cutplanes_textures",
Identifier = "cutplanes_textures",
Version = 2
})
asset.export("TexturesPath", TexturesPath)
@@ -1,8 +0,0 @@
local TexturesPath = asset.syncedResource({
Type = "HttpSynchronization",
Name = "cutplanes_textures",
Identifier = "cutplanes_textures",
Version = 7
})
asset.export("TexturesPath", TexturesPath)
@@ -1,8 +0,0 @@
local TexturesPath = asset.syncedResource({
Type = "HttpSynchronization",
Name = "cutplanes_textures",
Identifier = "cutplanes_textures",
Version = 10
})
asset.export("TexturesPath", TexturesPath)
@@ -1,8 +0,0 @@
local TexturesPath = asset.syncedResource({
Type = "HttpSynchronization",
Name = "cutplanes_textures",
Identifier = "cutplanes_textures",
Version = 9
})
asset.export("TexturesPath", TexturesPath)
@@ -1,8 +0,0 @@
local TexturesPath = asset.syncedResource({
Type = "HttpSynchronization",
Name = "cutplanes_textures",
Identifier = "cutplanes_textures",
Version = 8
})
asset.export("TexturesPath", TexturesPath)
@@ -1,93 +0,0 @@
asset.info = {
Name = "Predictive Science Inc. Stream nodes Bastille Days",
Version = "1.0",
Description = " Stream nodes for the bastille day CME events ",
Author = "Christian Adamsson, Emilie Ho",
URL = "https://dx.doi.org/10.3847/1538-4357/aab36d",
License = ""
}
asset.require("spice/base")
local assetHelper = asset.require("util/asset_helper")
-- local textures = asset.require('./cutplanes_textures_sphere').TexturesPath
-- local textures_venussphere = asset.require('./cutplanes_textures_sphere_venus').TexturesPath
-- local textures_mercurysphere = asset.require('./cutplanes_textures_sphere_mercury').TexturesPath
-- local textures_coronasphere = asset.require('./cutplanes_textures_sphere_corona').TexturesPath
local transforms = asset.require("./transforms")
local default_opacity = 0.99
--textureversion 1 has purple for low flux, 2 has transparent. 3 for new, 4 for emin01 -2 - 4, 5 for emin01 -2 -4.5, 6 for emin03 cmr -2 -4.5. 7 with -2 - 4 cmr emin03. 8 emin01 transparent, 9 emin03 transparent
local textureversion = 1
local TexturesPathEarth = asset.syncedResource({
Type = "HttpSynchronization",
Name = "sphereslice_earth_textures",
Identifier = "sphereslice_earth_textures",
Version = textureversion
})
local TexturesPathMercury = asset.syncedResource({
Type = "HttpSynchronization",
Name = "sphereslice_mercury_textures",
Identifier = "sphereslice_mercury_textures",
Version = textureversion
})
local TexturesPathVenus = asset.syncedResource({
Type = "HttpSynchronization",
Name = "sphereslice_venus_textures",
Identifier = "sphereslice_venus_textures",
Version = textureversion
})
local Cutplane_sphere_earth = {
Identifier = "Cutplane_sphere",
Parent = transforms.SunIAU.Identifier,
Renderable = {
Type = "RenderableTimeVaryingSphere",
Size = 1.571*10^11,
Enabled = false,
Texture = TexturesPathEarth,
--BlendMode = "Additive",
Opacity = default_opacity,
Segments = 132
},
GUI = {
Name = "Sphere Slice Earth",
Path = "/Solar System/Heliosphere"
},
};
local Cutplane_sphere_venus = {
Identifier = "Cutplane_sphere_venus",
Parent = transforms.SunIAU.Identifier,
Renderable = {
Type = "RenderableTimeVaryingSphere",
Size = 107710467 * 10^3,
Enabled = false,
Texture = TexturesPathVenus,
--BlendMode = "Additive",
Opacity = default_opacity,
Segments = 132
},
GUI = {
Name = "Sphere Slice Venus",
Path = "/Solar System/Heliosphere"
},
};
local Cutplane_sphere_mercury = {
Identifier = "Cutplane_sphere_mercury",
Parent = transforms.SunIAU.Identifier,
Renderable = {
Type = "RenderableTimeVaryingSphere",
Size = 56847190 * 10^3,
Enabled = false,
Texture = TexturesPathMercury,
--BlendMode = "Additive",
Opacity = default_opacity,
Segments = 132
},
GUI = {
Name = "Sphere Slice Mercury",
Path = "/Solar System/Heliosphere"
},
};
assetHelper.registerSceneGraphNodesAndExport(asset, { Cutplane_sphere_earth, Cutplane_sphere_venus, Cutplane_sphere_mercury})
@@ -1,8 +0,0 @@
local TexturesPath = asset.syncedResource({
Type = "HttpSynchronization",
Name = "Streamnodes textures",
Identifier = "streamnodes_legend",
Version = 4
})
asset.export("TexturesPath", TexturesPath)
@@ -1,45 +0,0 @@
local assetHelper = asset.require('util/asset_helper')
local sunTransforms = asset.require('scene/solarsystem/sun/transforms')
local earthTransforms = asset.require('scene/solarsystem/planets/earth/transforms')
local HNMKernel = asset.localResource("../../kernels/HNM.tf")
local GSMKernel = asset.localResource("../../kernels/GSM.ti")
local HNMReferenceFrame = {
Identifier = "HNMReferenceFrame",
Parent = sunTransforms.SolarSystemBarycenter.Identifier,
Transform = {
Rotation = {
Type = "SpiceRotation",
SourceFrame = "HEEQ180",
DestinationFrame = "GALACTIC",
Kernels = HNMKernel
}
},
GUI = {
Name = "HNM Reference Frame",
Path = "/Solar System/Sun",
Hidden = true
}
}
local GSMReferenceFrame = {
Identifier = "GSMReferenceFrame",
Parent = earthTransforms.EarthBarycenter.Identifier,
Transform = {
Rotation = {
Type = "SpiceRotation",
SourceFrame = "GSM", --Geocentric Solar Magnetospheric
DestinationFrame = "GALACTIC",
Kernels = GSMKernel
}
},
GUI = {
Name = "GSM Reference Frame",
Path = "/Solar System/Planets/Earth",
Hidden = true
}
}
local objects = { HNMReferenceFrame, GSMReferenceFrame }
assetHelper.registerSceneGraphNodesAndExport(asset, objects)
@@ -1,9 +1,6 @@
local assetHelper = asset.require("util/asset_helper") local assetHelper = asset.require("util/asset_helper")
--local earthTransforms = asset.require('scene/solarsystem/planets/earth/transforms')
asset.require("spice/base") asset.require("spice/base")
local HNMKernel = asset.localResource("./kernels/HNM.tf")
-- Barycenter of the solar system, expressed in the Galactic frame -- Barycenter of the solar system, expressed in the Galactic frame
local SolarSystemBarycenter = { local SolarSystemBarycenter = {
Identifier = "SolarSystemBarycenter", Identifier = "SolarSystemBarycenter",
@@ -68,33 +65,16 @@ local SunECLIPJ2000 = {
} }
} }
local HNMReferenceFrame = { assetHelper.registerSceneGraphNodesAndExport(asset, { SolarSystemBarycenter, SunIAU, SunECLIPJ2000 })
Identifier = "HNMReferenceFrame",
Parent = SolarSystemBarycenter.Identifier,
Transform = {
Rotation = {
Type = "SpiceRotation",
SourceFrame = "HEEQ180",
DestinationFrame = "GALACTIC",
Kernels = HNMKernel
}
},
GUI = {
Name = "HNM Reference Frame",
Path = "/Solar System/Sun",
Hidden = true
}
}
assetHelper.registerSceneGraphNodesAndExport(asset, { SolarSystemBarycenter, SunIAU, SunECLIPJ2000, HNMReferenceFrame })
asset.meta = { asset.meta = {
Name = "Sun Transforms", Name = "Sun Transforms",
Version = "1.0", Version = "1.0",
Description = [[ Sun transforms: Solar System Barycenter, SUN IAU, SUN J2000 and HNM]], Description = [[ Sun transforms: Solar System Barycenter, SUN IAU and
SUN J2000]],
Author = "OpenSpace Team", Author = "OpenSpace Team",
URL = "http://openspaceproject.com", URL = "http://openspaceproject.com",
License = "MIT license", License = "MIT license",
Identifiers = {"SolarSystemBarycenter", "SunIAU", "SunECLIPJ2000", "HNMReferenceFrame"} Identifiers = {"SolarSystemBarycenter", "SunIAU", "SunECLIPJ2000"}
} }
@@ -0,0 +1,35 @@
local assetHelper = asset.require("util/asset_helper")
local sunTransforms = asset.require('scene/solarsystem/sun/transforms')
asset.require("spice/base")
local HNMKernel = asset.localResource("./kernels/HNM.tf")
local HNMReferenceFrame = {
Identifier = "HNMReferenceFrame",
Parent = sunTransforms.SolarSystemBarycenter.Identifier,
Transform = {
Rotation = {
Type = "SpiceRotation",
SourceFrame = "HEEQ180",
DestinationFrame = "GALACTIC",
Kernels = HNMKernel
}
},
GUI = {
Name = "HNM Reference Frame",
Path = "/Solar System/Sun",
Hidden = true
}
}
assetHelper.registerSceneGraphNodesAndExport(asset, { HNMReferenceFrame })
asset.meta = {
Name = "Sun Transform, HNM",
Version = "1.0",
Description = [[ Sun transform: HNM]],
Author = "CCMC",
URL = "http://openspaceproject.com",
License = "MIT license",
Identifiers = {"HNMReferenceFrame"}
}
+14 -22
View File
@@ -1,19 +1,19 @@
{ {
"assets": [ "assets": [
"base", "base",
"util/default_dashboard", "dashboard/default_dashboard",
"scene/solarsystem/sun/sun_textures", "scene/solarsystem/sun/sun_textures",
"scene/solarsystem/sun/EUV_layer", "scene/solarsystem/sun/EUV_layer",
"scene/solarsystem/sun/heliosphere/bastille_day/bastille_day_sun_textures", "scene/solarsystem/heliosphere/bastille_day/bastille_day_sun_textures",
"scene/solarsystem/sun/heliosphere/bastille_day/density_volume", "scene/solarsystem/heliosphere/bastille_day/density_volume",
"scene/solarsystem/sun/heliosphere/bastille_day/fieldlines", "scene/solarsystem/heliosphere/bastille_day/fieldlines",
"scene/solarsystem/sun/heliosphere/bastille_day/focuspoint", "scene/solarsystem/heliosphere/bastille_day/focuspoint",
"scene/solarsystem/sun/heliosphere/bastille_day/lightindicator", "scene/solarsystem/heliosphere/bastille_day/lightindicator",
"scene/solarsystem/sun/heliosphere/bastille_day/magnetogram", "scene/solarsystem/heliosphere/bastille_day/magnetogram",
"scene/solarsystem/sun/heliosphere/bastille_day/magnetogram_textures", "scene/solarsystem/heliosphere/bastille_day/magnetogram_textures",
"scene/solarsystem/sun/heliosphere/bastille_day/fluxnodes", "scene/solarsystem/heliosphere/bastille_day/fluxnodes",
"scene/solarsystem/sun/heliosphere/bastille_day/fluxnodescutplane", "scene/solarsystem/heliosphere/bastille_day/fluxnodescutplane",
"scene/solarsystem/sun/heliosphere/bastille_day/fluxnodeslegend", "scene/solarsystem/heliosphere/bastille_day/fluxnodeslegend",
"scene/solarsystem/planets/earth/earth", "scene/solarsystem/planets/earth/earth",
"scene/solarsystem/planets/earth/magnetosphere", "scene/solarsystem/planets/earth/magnetosphere",
"scene/solarsystem/planets/earth/satellites/satellites", "scene/solarsystem/planets/earth/satellites/satellites",
@@ -225,14 +225,6 @@
"name": "Starts from 10:03, delta time 15 min/ second", "name": "Starts from 10:03, delta time 15 min/ second",
"script": "openspace.scriptScheduler.clear();openspace.time.setDeltaTime(900);openspace.time.setTime('2000-JUL-14 10:03:00.00');StarttimescriptSlowLoop = \"openspace.time.setTime('2000 JUL 14 10:03:00')\";openspace.scriptScheduler.loadScheduledScript('2000 JUL 14 12:00:00', StarttimescriptSlowLoop);" "script": "openspace.scriptScheduler.clear();openspace.time.setDeltaTime(900);openspace.time.setTime('2000-JUL-14 10:03:00.00');StarttimescriptSlowLoop = \"openspace.time.setTime('2000 JUL 14 10:03:00')\";openspace.scriptScheduler.loadScheduledScript('2000 JUL 14 12:00:00', StarttimescriptSlowLoop);"
}, },
{
"documentation": "Fast loop: Starts from 10:03 and sets delta time to 15 min/ second (900 seconds/ second)",
"gui_path": "/CCMC/Nodes",
"is_local": false,
"key": "SHIFT+V",
"name": "Starts from 10:03, delta time 15 min/ second",
"script": "openspace.scriptScheduler.clear();openspace.time.setDeltaTime(900);openspace.time.setTime('2000-JUL-14 10:03:00.00');StarttimescriptSlowLoop = \"openspace.time.setTime('2000 JUL 14 10:03:00')\";openspace.scriptScheduler.loadScheduledScript('2000 JUL 14 12:00:00', StarttimescriptSlowLoop);"
},
{ {
"documentation": "Turn on sun glare, reset field line line width, change layer on the Sun to Orange", "documentation": "Turn on sun glare, reset field line line width, change layer on the Sun to Orange",
"gui_path": "/CCMC/Nodes", "gui_path": "/CCMC/Nodes",
@@ -259,10 +251,10 @@
"ISS" "ISS"
], ],
"meta": { "meta": {
"author": "OpenSpace Team", "author": "CCMC",
"description": "Default OpenSpace Profile. Adds Earth satellites not contained in other profiles.", "description": "This profile is showing the Coronal mass ejection of the bastille day 2000-07-14. The profile is data heavy and will require a powerful GPU.",
"license": "MIT License", "license": "MIT License",
"name": "Default", "name": "Bastille day",
"url": "https://www.openspaceproject.com", "url": "https://www.openspaceproject.com",
"version": "1.0" "version": "1.0"
}, },
+23 -21
View File
@@ -59,14 +59,14 @@ namespace {
constexpr int8_t CurrentCacheVersion = 2; constexpr int8_t CurrentCacheVersion = 2;
//streamColor, nodeSize, nodeSizeLargerFlux, thresholdFlux, //streamColor, nodeSize, nodeSizeLargerFlux, thresholdFlux,
constexpr const std::array<const char*, 27> UniformNames = { constexpr const std::array<const char*, 26> UniformNames = {
"streamColor", "nodeSize", "nodeSizeLargerFlux", "thresholdFlux", "colorMode", "streamColor", "nodeSize", "nodeSizeLargerFlux", "thresholdFlux", "colorMode",
"filterLower", "filterUpper", "scalingMode", "colorTableRange", "domainLimZ", "filterLower", "filterUpper", "scalingMode", "colorTableRange", "domainLimZ",
"nodeSkip", "nodeSkipDefault", "nodeSkipEarth", "nodeSkipMethod", "nodeSkip", "nodeSkipDefault", "nodeSkipEarth", "nodeSkipMethod",
"nodeSkipFluxThreshold", "nodeSkipRadiusThreshold", "fluxColorAlpha", "nodeSkipFluxThreshold", "nodeSkipRadiusThreshold", "fluxColorAlpha",
"fluxColorAlphaIlluminance", "earthPos", "distanceThreshold", "fluxColorAlphaIlluminance", "earthPos", "distanceThreshold",
"enhanceMethod", "flowColor", "usingParticles", "enhanceMethod", "flowColor", "usingParticles",
"usingInterestingStreams","particleSize", "particleSpacing", "particleSpeed" "particleSize", "particleSpacing", "particleSpeed"
}; };
constexpr const std::array<const char*, 14> UniformNames2 = { constexpr const std::array<const char*, 14> UniformNames2 = {
"time", "flowColoring", "maxNodeDistanceSize", "usingCameraPerspective", "time", "flowColoring", "maxNodeDistanceSize", "usingCameraPerspective",
@@ -336,9 +336,16 @@ namespace {
struct [[codegen::Dictionary(RenderableFluxNodes)]] Parameters { struct [[codegen::Dictionary(RenderableFluxNodes)]] Parameters {
// path to source folder with the 3 binary files in it // path to source folder with the 3 binary files in it
std::string binarySourceFolder; std::string sourceFolder;
//
struct TransferFunctions {
std::string standard;
std::string flow;
std::string earth;
std::string cmr [[codegen::key("CMR")]];
};
// [[codegen::verbatim(ColorTablePathInfo.description)]] // [[codegen::verbatim(ColorTablePathInfo.description)]]
std::optional<std::vector<std::string>> colorTablePaths; TransferFunctions colorTablePaths;
// [[codegen::verbatim(LineWidthInfo.description)]] // [[codegen::verbatim(LineWidthInfo.description)]]
//float lineWidth; //float lineWidth;
// [[codegen::verbatim(GoesEnergyBinsInfo.description)]] // [[codegen::verbatim(GoesEnergyBinsInfo.description)]]
@@ -435,20 +442,18 @@ RenderableFluxNodes::RenderableFluxNodes(const ghoul::Dictionary& dictionary)
const Parameters p = codegen::bake<Parameters>(dictionary); const Parameters p = codegen::bake<Parameters>(dictionary);
_transferFunction =
std::make_unique<TransferFunction>(p.colorTablePaths.standard);
_transferFunctionCMR =
std::make_unique<TransferFunction>(p.colorTablePaths.cmr);
_transferFunctionEarth =
std::make_unique<TransferFunction>(p.colorTablePaths.earth);
_transferFunctionFlow =
std::make_unique<TransferFunction>(p.colorTablePaths.flow);
_pColorTablePath = p.colorTablePaths.standard;
if (p.colorTablePaths.has_value()) { _binarySourceFolderPath = p.sourceFolder;
_colorTablePaths = p.colorTablePaths.value_or(_colorTablePaths);
_transferFunction = std::make_unique<TransferFunction>(_colorTablePaths[0]);
_transferFunctionCMR =
std::make_unique<TransferFunction>(absPath(_colorTablePaths[1]).string());
_transferFunctionEarth =
std::make_unique<TransferFunction>(absPath(_colorTablePaths[2]).string());
_transferFunctionFlow =
std::make_unique<TransferFunction>(absPath(_colorTablePaths[3]).string());
}
_pColorTablePath = _colorTablePaths[0];
_binarySourceFolderPath = p.binarySourceFolder;
if (std::filesystem::is_directory(_binarySourceFolderPath)) { if (std::filesystem::is_directory(_binarySourceFolderPath)) {
// Extract all file paths from the provided folder // Extract all file paths from the provided folder
_binarySourceFiles.clear(); _binarySourceFiles.clear();
@@ -507,7 +512,7 @@ RenderableFluxNodes::RenderableFluxNodes(const ghoul::Dictionary& dictionary)
_pGoesEnergyBins.setValue(p.energyBin.value()); _pGoesEnergyBins.setValue(p.energyBin.value());
} }
else { // default int 1 == Emin03 == MeV>100 else { // default int 1 == Emin03 == MeV>100
LWARNING("Assuming default value 1, meaning Emin03"); LINFO("Assuming default value 1, meaning Emin03");
_pGoesEnergyBins.setValue(1); _pGoesEnergyBins.setValue(1);
} }
} }
@@ -555,7 +560,6 @@ void RenderableFluxNodes::definePropertyCallbackFunctions() {
_pColorTablePath.onChange([this] { _pColorTablePath.onChange([this] {
_transferFunction->setPath(_pColorTablePath); _transferFunction->setPath(_pColorTablePath);
_colorTablePaths[0] = _pColorTablePath;
}); });
_pGoesEnergyBins.onChange([this] { _pGoesEnergyBins.onChange([this] {
@@ -889,8 +893,6 @@ void RenderableFluxNodes::render(const RenderData& data, RendererTasks&) {
_shaderProgram->setUniform(_uniformCache.enhanceMethod, _pEnhancemethod); _shaderProgram->setUniform(_uniformCache.enhanceMethod, _pEnhancemethod);
_shaderProgram->setUniform(_uniformCache.flowColor, _pFlowColor); _shaderProgram->setUniform(_uniformCache.flowColor, _pFlowColor);
_shaderProgram->setUniform(_uniformCache.usingParticles, _pFlowEnabled); _shaderProgram->setUniform(_uniformCache.usingParticles, _pFlowEnabled);
_shaderProgram->setUniform(_uniformCache.usingInterestingStreams,
_pInterestingStreamsEnabled);
_shaderProgram->setUniform(_uniformCache.particleSize, _pFlowParticleSize); _shaderProgram->setUniform(_uniformCache.particleSize, _pFlowParticleSize);
_shaderProgram->setUniform(_uniformCache.particleSpacing, _pFlowParticleSpacing); _shaderProgram->setUniform(_uniformCache.particleSpacing, _pFlowParticleSpacing);
_shaderProgram->setUniform(_uniformCache.particleSpeed, _pFlowSpeed); _shaderProgram->setUniform(_uniformCache.particleSpeed, _pFlowSpeed);
@@ -92,7 +92,7 @@ private:
nodeSkipDefault, nodeSkipEarth, nodeSkipMethod, nodeSkipFluxThreshold, nodeSkipDefault, nodeSkipEarth, nodeSkipMethod, nodeSkipFluxThreshold,
nodeSkipRadiusThreshold, fluxColorAlpha, fluxColorAlphaIlluminance, earthPos, nodeSkipRadiusThreshold, fluxColorAlpha, fluxColorAlphaIlluminance, earthPos,
distanceThreshold, enhanceMethod, flowColor, usingParticles, distanceThreshold, enhanceMethod, flowColor, usingParticles,
usingInterestingStreams, particleSize, particleSpacing, particleSpeed) particleSize, particleSpacing, particleSpeed)
_uniformCache; _uniformCache;
UniformCache(time, flowColoring, maxNodeDistanceSize, usingCameraPerspective, UniformCache(time, flowColoring, maxNodeDistanceSize, usingCameraPerspective,
drawCircles, drawHollow, useGaussian, usingRadiusPerspective, drawCircles, drawHollow, useGaussian, usingRadiusPerspective,
@@ -138,8 +138,6 @@ private:
std::unique_ptr<TransferFunction> _transferFunctionFlow; std::unique_ptr<TransferFunction> _transferFunctionFlow;
// ------------------------------------ VECTORS ----------------------------------- // // ------------------------------------ VECTORS ----------------------------------- //
// Paths to color tables. One for each 'ColorFlux'
std::vector<std::string> _colorTablePaths;
// Contains the _triggerTimes for all streams in the sequence // Contains the _triggerTimes for all streams in the sequence
std::vector<double> _startTimes; std::vector<double> _startTimes;
// Contains vertexPositions // Contains vertexPositions
+15 -34
View File
@@ -75,17 +75,10 @@ uniform float distanceThreshold;
uniform int enhanceMethod; uniform int enhanceMethod;
uniform double time; uniform double time;
//uniform float interestingStreams[4];
// Speicific uniforms for cameraperspective // Speicific uniforms for cameraperspective
//uniform float scaleFactor;
//uniform float minNodeDistanceSize;
uniform float maxNodeDistanceSize; uniform float maxNodeDistanceSize;
uniform float nodeDistanceThreshold; uniform float nodeDistanceThreshold;
//uniform mat4 cameraViewProjectionMatrix;
//uniform dmat4 modelMatrix;
uniform vec3 cameraPos; uniform vec3 cameraPos;
//uniform vec2 screenSize; //uniform vec2 screenSize;
uniform bool usingCameraPerspective; uniform bool usingCameraPerspective;
@@ -95,21 +88,18 @@ uniform float perspectiveDistanceFactor;
uniform float maxNodeSize; uniform float maxNodeSize;
uniform float minNodeSize; uniform float minNodeSize;
uniform bool usingPulse; uniform bool usingPulse;
// Inputs // Inputs
// Should be provided in meters // Should be provided in meters VaPosition
layout(location = 0) in vec3 in_position; layout(location = 0) in vec3 in_position;
// The extra value used to color lines. Location must correspond to _VA_COLOR in // The extra value used to color lines. Location must correspond to VaColor in
// renderablefieldlinessequence.h // renderablefluxnodes.h
layout(location = 1) in float fluxValue; layout(location = 1) in float fluxValue;
// The extra value used to mask out parts of lines. Location must correspond to // The extra value used to mask out parts of lines. Location must correspond to
// _VA_MASKING in renderablefieldlinessequence.h // VaFiltering in renderablefluxnodes.h
layout(location = 2) layout(location = 2) in float rValue;
in float rValue;
//layout(location = 5)
//in vec2 arrow;
// These should correspond to the enum 'ColorMode' in renderablefluxnodes.cpp // These should correspond to the enum 'ColorMode' in renderablefluxnodes.cpp
const int colorByFluxValue = 0; const int colorByFluxValue = 0;
@@ -138,7 +128,6 @@ varying out float camera_IsCloseEnough;
varying out float vs_closeToEarth; varying out float vs_closeToEarth;
varying out double vs_time; varying out double vs_time;
varying out vec3 vs_camerapos; varying out vec3 vs_camerapos;
//out vec4 vs_gPosition;
vec4 getTransferFunctionColor(sampler1D InColorTable) { vec4 getTransferFunctionColor(sampler1D InColorTable) {
// Remap the color scalar to a [0,1] range // Remap the color scalar to a [0,1] range
@@ -203,8 +192,7 @@ return false;
//function for showing nodes different depending on distance to earth //function for showing nodes different depending on distance to earth
void DecidehowtoshowClosetoEarth(){ void DecidehowtoshowClosetoEarth(){
// SizeScaling // SizeScaling
if(enhanceMethod == sizeScaling){ if(enhanceMethod == sizeScaling || enhanceMethod == illuminance){
// vec4 fluxColor = getTransferFunctionColor(colorTable);
vec4 fluxColor = getTransferFunctionColor(colorTableCMR); vec4 fluxColor = getTransferFunctionColor(colorTableCMR);
vs_color = vec4(fluxColor.xyz, fluxColor.a); vs_color = vec4(fluxColor.xyz, fluxColor.a);
} }
@@ -224,11 +212,6 @@ void DecidehowtoshowClosetoEarth(){
} }
gl_PointSize = tempR2 * tempR2 * tempR2 * gl_PointSize * 5; gl_PointSize = tempR2 * tempR2 * tempR2 * gl_PointSize * 5;
} }
// Illuminance
if(enhanceMethod == illuminance){
vec4 fluxColor1 = getTransferFunctionColor(colorTableCMR);
vs_color = vec4(fluxColor1.xyz, fluxColor1.a);
}
} }
void CheckdistanceMethod() { void CheckdistanceMethod() {
@@ -238,15 +221,13 @@ void CheckdistanceMethod() {
vs_closeToEarth = 0; vs_closeToEarth = 0;
//if(distancevec < maxdist){ if(distancevec < AUtoMeter * distanceThreshold && usingPulse){
if(distancevec < AUtoMeter * distanceThreshold && usingPulse){ vs_closeToEarth = 1;
vs_closeToEarth = 1; gl_PointSize = gl_PointSize * 5;
gl_PointSize = gl_PointSize * 5; vec4 fluxColor = getTransferFunctionColor(colorTable);
vec4 fluxColor = getTransferFunctionColor(colorTable); vs_color = vec4(fluxColor.xyz, fluxColorAlpha);
vs_color = vec4(fluxColor.xyz, fluxColorAlpha); }
//vs_color = vec4(streamColor.xyz, fluxColorAlpha); // HÄR
}
//}
if(enhanceMethod == colorTables || enhanceMethod == sizeAndColor){ if(enhanceMethod == colorTables || enhanceMethod == sizeAndColor){
vec4 fluxColor2 = getTransferFunctionColor(colorTableEarth); vec4 fluxColor2 = getTransferFunctionColor(colorTableEarth);
vs_color = vec4(fluxColor2.xyz, fluxColorAlpha); vs_color = vec4(fluxColor2.xyz, fluxColorAlpha);
@@ -381,5 +362,5 @@ void main() {
gl_Position = vec4(positionClipSpace.xy, 0, positionClipSpace.w); gl_Position = vec4(positionClipSpace.xy, 0, positionClipSpace.w);
vs_depth = gl_Position.w; vs_depth = gl_Position.w;
} }
@@ -50,11 +50,6 @@
namespace { namespace {
constexpr const char* _loggerCat = "RenderableTimeVaryingVolume"; constexpr const char* _loggerCat = "RenderableTimeVaryingVolume";
const char* KeyStepSize = "StepSize";
const char* KeyGridType = "GridType";
const char* KeyOpacity = "Opacity";
const char* KeyTransferFunction = "TransferFunction";
const float SecondsInOneDay = 60 * 60 * 24; const float SecondsInOneDay = 60 * 60 * 24;
constexpr const float VolumeMaxOpacity = 500; constexpr const float VolumeMaxOpacity = 500;
@@ -151,6 +146,9 @@ namespace {
std::optional<float> opacity; std::optional<float> opacity;
std::optional<double> stepSize;
std::optional<std::string> gridType;
std::optional<ghoul::Dictionary> clipPlanes; std::optional<ghoul::Dictionary> clipPlanes;
}; };
@@ -197,13 +195,10 @@ RenderableTimeVaryingVolume::RenderableTimeVaryingVolume(
}); });
_gridType = static_cast<int>(volume::VolumeGridType::Cartesian); _gridType = static_cast<int>(volume::VolumeGridType::Cartesian);
if (dictionary.hasValue<double>(KeyStepSize)) { _stepSize = p.stepSize.value_or(_stepSize);
_stepSize = static_cast<float>(dictionary.value<double>(KeyStepSize));
}
if (dictionary.hasValue<double>(KeyOpacity)) { if (p.opacity.has_value()) {
_opacity = static_cast<float>(dictionary.value<double>(KeyOpacity) _opacity = *p.opacity * VolumeMaxOpacity;
* VolumeMaxOpacity);
} }
_secondsBefore = p.secondsBefore.value_or(_secondsBefore); _secondsBefore = p.secondsBefore.value_or(_secondsBefore);
@@ -214,10 +209,8 @@ RenderableTimeVaryingVolume::RenderableTimeVaryingVolume(
_clipPlanes->setIdentifier("clipPlanes"); _clipPlanes->setIdentifier("clipPlanes");
_clipPlanes->setGuiName("Clip Planes"); _clipPlanes->setGuiName("Clip Planes");
if (dictionary.hasValue<std::string>(KeyGridType)) { if (p.gridType.has_value()) {
VolumeGridType gridType = volume::parseGridType( VolumeGridType gridType = volume::parseGridType(*p.gridType);
dictionary.value<std::string>(KeyGridType)
);
_gridType = static_cast<std::underlying_type_t<VolumeGridType>>(gridType); _gridType = static_cast<std::underlying_type_t<VolumeGridType>>(gridType);
} }