mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-01-06 03:29:44 -06:00
Feature/2012 fieldlines (#2042)
* Added 2012 July solar storm event assets + renderer improvement * solving unzipping issues * flow properties added
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
asset.require("./sun_earth_2012_fieldlines_enlil")
|
||||
asset.require("./sun_earth_2012_fieldlines_batsrus")
|
||||
asset.require("./sun_earth_2012_fieldlines_pfss")
|
||||
@@ -0,0 +1,153 @@
|
||||
local transforms = asset.require('scene/solarsystem/planets/earth/magnetosphere/transforms_magnetosphere.asset')
|
||||
|
||||
-- Specifying transfer functions
|
||||
local transferFunctions = asset.syncedResource({
|
||||
Name = "Fieldlines Transfer Functions",
|
||||
Type = "HttpSynchronization",
|
||||
Identifier = "sun_earth_event_july_2012-fieldlines_transferfunctions",
|
||||
Version = 1
|
||||
})
|
||||
|
||||
-- Specifying transfer functions
|
||||
local fieldlineData = asset.syncedResource({
|
||||
Name = "Fieldlines Data",
|
||||
Type = "HttpSynchronization",
|
||||
Identifier = "sun_earth_event_july_2012-batsrus",
|
||||
Version = 1
|
||||
})
|
||||
|
||||
local batsrusTemperatureColorTable = transferFunctions .. "batsrus_temperature.txt"
|
||||
local batsrusDensityColorTable = transferFunctions .. "batsrus_density.txt"
|
||||
local batsrusCurrentColorTable = transferFunctions .. "batsrus_current2.txt"
|
||||
local batsrusVelocityColorTable = transferFunctions .. "batsrus_velocity.txt"
|
||||
local batsrusTopologyColorTable = transferFunctions .. "batsrus_topology.txt"
|
||||
|
||||
local unzippedDataDestination = {
|
||||
openClosed = fieldlineData .. "magnetic_fieldlines-open_closed",
|
||||
velocityFlow = fieldlineData .. "velocity_flowlines-upstream",
|
||||
asherStatic = fieldlineData .. "ashers_static_seeds"
|
||||
}
|
||||
|
||||
local colorRanges = {
|
||||
{ 0, 100000000 },
|
||||
{ 0, 60 },
|
||||
{ -0.015, 0.015 },
|
||||
{ 150, 900 },
|
||||
{ 0, 3 },
|
||||
}
|
||||
----------------------LUTZ's JULY TRACES-------------------------
|
||||
local BatsrusJ12OpenClosed = {
|
||||
Identifier = "FL_BATSRUS_J12_OpenClosed",
|
||||
Parent = transforms.GSMReferenceFrame.Identifier,
|
||||
Renderable = {
|
||||
Type = "RenderableFieldlinesSequence",
|
||||
SourceFolder = unzippedDataDestination.openClosed,
|
||||
InputFileType = "Osfls",
|
||||
Color = { 0.7, 0.4, 0.0, 0.6 }, -- Default color
|
||||
ColorMethod = "By Quantity", -- Color by Quantity
|
||||
ColorQuantity = 0, -- Temperature
|
||||
ColorTablePaths = {
|
||||
batsrusTemperatureColorTable,
|
||||
batsrusDensityColorTable,
|
||||
batsrusCurrentColorTable,
|
||||
batsrusVelocityColorTable,
|
||||
batsrusTopologyColorTable,
|
||||
},
|
||||
ColorTableRanges = colorRanges,
|
||||
MaskingEnabled = true,
|
||||
MaskingQuantity = 4, -- Topology
|
||||
MaskingRanges = { {2.5, 3.0} }, -- Corresponds to closed fieldlines only
|
||||
LoadAtRuntime = true
|
||||
},
|
||||
GUI = {
|
||||
Name = "Fieldlines BATSRUS J12 Open/Closed",
|
||||
Path = "/Solar System/Heliosphere"
|
||||
}
|
||||
}
|
||||
|
||||
--------------------- VELOCITY FLOWLINES ------------------------
|
||||
local BatsrusJ12FlowLines = {
|
||||
Identifier = "FL_BATSRUS_J12_FlowLines",
|
||||
Parent = transforms.GSMReferenceFrame.Identifier,
|
||||
Renderable = {
|
||||
Type = "RenderableFieldlinesSequence",
|
||||
SourceFolder = unzippedDataDestination.velocityFlow,
|
||||
InputFileType = "Osfls",
|
||||
ColorMethod = "By Quantity", -- Color by Quantity
|
||||
ColorQuantity = 3, -- Velocity
|
||||
Color = { 0.7, 0.4, 0.0, 0.12 }, -- Default color
|
||||
ColorTablePaths = {
|
||||
batsrusTemperatureColorTable,
|
||||
batsrusDensityColorTable,
|
||||
batsrusCurrentColorTable,
|
||||
batsrusVelocityColorTable,
|
||||
batsrusTopologyColorTable,
|
||||
},
|
||||
ColorTableRanges = colorRanges,
|
||||
LoadAtRuntime = true
|
||||
},
|
||||
GUI = {
|
||||
Name = "Fieldlines BATSRUS J12 Flowlines",
|
||||
Path = "/Solar System/Heliosphere"
|
||||
}
|
||||
}
|
||||
|
||||
--------------------- Ashers seedpoints ------------------------
|
||||
local BatsrusAsherStaticSeedsFlowLines = {
|
||||
Identifier = "FL_BATSRUS_ASHER_STATIC_SSEDS_FlowLines",
|
||||
Parent = transforms.GSMReferenceFrame.Identifier,
|
||||
Renderable = {
|
||||
Type = "RenderableFieldlinesSequence",
|
||||
SourceFolder = unzippedDataDestination.asherStatic,
|
||||
Enabled = false,
|
||||
InputFileType = "Osfls",
|
||||
ColorTablePaths = {
|
||||
batsrusTemperatureColorTable,
|
||||
batsrusDensityColorTable,
|
||||
batsrusCurrentColorTable,
|
||||
batsrusVelocityColorTable,
|
||||
batsrusTopologyColorTable,
|
||||
},
|
||||
ColorTableRanges = colorRanges,
|
||||
LoadAtRuntime = true
|
||||
},
|
||||
GUI = {
|
||||
Name = "Fieldlines BATSRUS Asher Static",
|
||||
Path = "/Solar System/Heliosphere"
|
||||
}
|
||||
}
|
||||
|
||||
asset.onInitialize(function ()
|
||||
if not openspace.directoryExists(unzippedDataDestination.openClosed) then
|
||||
openspace.printInfo("Extracting " .. "Fieldlines from Batsrus model of 2012 event")
|
||||
openspace.unzipFile(fieldlineData .. "magnetic_fieldlines-open_closed.zip", unzippedDataDestination.openClosed, true)
|
||||
end
|
||||
if not openspace.directoryExists(unzippedDataDestination.velocityFlow) then
|
||||
openspace.printInfo("Extracting " .. "Fieldlines from Batsrus model of 2012 event")
|
||||
openspace.unzipFile(fieldlineData .. "velocity_flowlines-upstream.zip", unzippedDataDestination.velocityFlow, true)
|
||||
end
|
||||
if not openspace.directoryExists(unzippedDataDestination.asherStatic) then
|
||||
openspace.printInfo("Extracting " .. "Fieldlines from Batsrus model of 2012 event")
|
||||
openspace.unzipFile(fieldlineData .. "ashers_static_seeds.zip", unzippedDataDestination.asherStatic, true)
|
||||
end
|
||||
|
||||
openspace.addSceneGraphNode(BatsrusJ12OpenClosed)
|
||||
openspace.addSceneGraphNode(BatsrusJ12FlowLines)
|
||||
openspace.addSceneGraphNode(BatsrusAsherStaticSeedsFlowLines)
|
||||
|
||||
end)
|
||||
|
||||
asset.onDeinitialize(function ()
|
||||
openspace.removeSceneGraphNode(BatsrusAsherStaticSeedsFlowLines)
|
||||
openspace.removeSceneGraphNode(BatsrusJ12FlowLines)
|
||||
openspace.removeSceneGraphNode(BatsrusJ12OpenClosed)
|
||||
end)
|
||||
|
||||
asset.meta = {
|
||||
Name = "Fieldlines from Batsrus model of 2012 event",
|
||||
Version = "1.0",
|
||||
Description = "Magnetic fieldlines from Batsrus model for a 2012 CME event",
|
||||
Author = "CCMC",
|
||||
URL = "",
|
||||
License = "CC-BY"
|
||||
}
|
||||
@@ -0,0 +1,228 @@
|
||||
local transforms = asset.require('scene/solarsystem/sun/transforms_heliosphere.asset')
|
||||
|
||||
local transferFunctions = asset.syncedResource({
|
||||
Name = "Fieldlines Transfer Functions",
|
||||
Type = "HttpSynchronization",
|
||||
Identifier = "sun_earth_event_july_2012-fieldlines_transferfunctions",
|
||||
Version = 1
|
||||
})
|
||||
|
||||
local fieldlineData = asset.syncedResource({
|
||||
Name = "Fieldlines Data",
|
||||
Type = "HttpSynchronization",
|
||||
Identifier = "sun_earth_event_july_2012-enlil",
|
||||
Version = 1
|
||||
})
|
||||
|
||||
local enlilDensityColorTable = transferFunctions .. "enlil_density.txt"
|
||||
local enlilVelocityColorTable = transferFunctions .. "kroyw.txt"
|
||||
|
||||
local unzippedDataDestination = {
|
||||
EqPlane011AU1 = fieldlineData .. "011AU_eq_plane_1/",
|
||||
EqPlane011AU2 = fieldlineData .. "011AU_eq_plane_2/",
|
||||
Lat4011AU1 = fieldlineData .. "011AU_lat4_1/",
|
||||
Lat4011AU2 = fieldlineData .. "011AU_lat4_2/",
|
||||
Earth = fieldlineData .. "earth/",
|
||||
StereoA = fieldlineData .. "stereoa/"
|
||||
}
|
||||
|
||||
local colorRanges = {
|
||||
{ 0, 1000000 },
|
||||
{ 100, 2000 }
|
||||
}
|
||||
|
||||
local ENLILSliceEqPlane11AU1 = {
|
||||
Identifier = "FL_ENLIL_slice_eqPlane_011AU_1",
|
||||
Parent = transforms.HEEQ180ReferenceFrame.Identifier,
|
||||
Renderable = {
|
||||
Type = "RenderableFieldlinesSequence",
|
||||
SourceFolder = unzippedDataDestination.EqPlane011AU1,
|
||||
InputFileType = "Osfls",
|
||||
|
||||
Color = { 0.4, 0.15, 0.4, 0.6 },
|
||||
ColorMethod = "By Quantity", -- Color by Quantity
|
||||
ColorQuantity = 1, -- Velocity
|
||||
ColorTablePaths = {
|
||||
enlilDensityColorTable,
|
||||
enlilVelocityColorTable,
|
||||
},
|
||||
ColorTableRanges = colorRanges,
|
||||
LoadAtRuntime = true
|
||||
},
|
||||
GUI = {
|
||||
Name = "Fieldlines ENLIL Slice Equatorial Plane 0.11 AU 1",
|
||||
Path = "/Solar System/Heliosphere"
|
||||
}
|
||||
}
|
||||
|
||||
local ENLILSliceEqPlane11AU2 = {
|
||||
Identifier = "FL_ENLIL_slice_eqPlane_011AU_2",
|
||||
Parent = transforms.HEEQ180ReferenceFrame.Identifier,
|
||||
Renderable = {
|
||||
Type = "RenderableFieldlinesSequence",
|
||||
SourceFolder = unzippedDataDestination.EqPlane011AU2,
|
||||
InputFileType = "Osfls",
|
||||
|
||||
Color = { 0.4, 0.15, 0.4, 0.6 },
|
||||
ColorMethod = "By Quantity", -- Color by Quantity
|
||||
ColorQuantity = 1, -- Velocity
|
||||
ColorTablePaths = {
|
||||
enlilDensityColorTable,
|
||||
enlilVelocityColorTable,
|
||||
},
|
||||
ColorTableRanges = colorRanges,
|
||||
LoadAtRuntime = true
|
||||
},
|
||||
GUI = {
|
||||
Name = "Fieldlines ENLIL Slice Equatorial Plane 0.11 AU 2",
|
||||
Path = "/Solar System/Heliosphere"
|
||||
}
|
||||
}
|
||||
|
||||
local ENLILSliceLat411AU1 = {
|
||||
Identifier = "FL_ENLIL_slice_lat4_011AU_1",
|
||||
Parent = transforms.HEEQ180ReferenceFrame.Identifier,
|
||||
Renderable = {
|
||||
Type = "RenderableFieldlinesSequence",
|
||||
SourceFolder = unzippedDataDestination.Lat4011AU1,
|
||||
InputFileType = "Osfls",
|
||||
|
||||
Color = { 0.4, 0.15, 0.4, 0.6 },
|
||||
ColorMethod = "By Quantity", -- Color by Quantity
|
||||
ColorQuantity = 1, -- Velocity
|
||||
ColorTablePaths = {
|
||||
enlilDensityColorTable,
|
||||
enlilVelocityColorTable,
|
||||
},
|
||||
ColorTableRanges = colorRanges,
|
||||
LoadAtRuntime = true
|
||||
},
|
||||
GUI = {
|
||||
Name = "Fieldlines ENLIL Slice Latitude 4 0.11 AU 1",
|
||||
Path = "/Solar System/Heliosphere"
|
||||
}
|
||||
}
|
||||
|
||||
local ENLILSliceLat411AU2 = {
|
||||
Identifier = "FL_ENLIL_slice_lat4_011AU_2",
|
||||
Parent = transforms.HEEQ180ReferenceFrame.Identifier,
|
||||
Renderable = {
|
||||
Type = "RenderableFieldlinesSequence",
|
||||
SourceFolder = unzippedDataDestination.Lat4011AU2,
|
||||
InputFileType = "Osfls",
|
||||
|
||||
Color = { 0.4, 0.15, 0.4, 0.6 },
|
||||
ColorMethod = "By Quantity", -- Color by Quantity
|
||||
ColorQuantity = 1, -- Velocity
|
||||
ColorTablePaths = {
|
||||
enlilDensityColorTable,
|
||||
enlilVelocityColorTable,
|
||||
},
|
||||
ColorTableRanges = colorRanges,
|
||||
LoadAtRuntime = true
|
||||
},
|
||||
GUI = {
|
||||
Name = "Fieldlines ENLIL Slice Latitude 4 0.11 AU 2",
|
||||
Path = "/Solar System/Heliosphere"
|
||||
}
|
||||
}
|
||||
|
||||
local ENLILEarth = {
|
||||
Identifier = "FL_ENLIL_earth",
|
||||
Parent = transforms.HEEQ180ReferenceFrame.Identifier,
|
||||
Renderable = {
|
||||
Type = "RenderableFieldlinesSequence",
|
||||
SourceFolder = unzippedDataDestination.Earth,
|
||||
InputFileType = "Osfls",
|
||||
Color = { 1.0, 1.0, 1.0, 0.6 },
|
||||
ColorTablePaths = {
|
||||
enlilDensityColorTable,
|
||||
enlilVelocityColorTable,
|
||||
},
|
||||
ColorTableRanges = colorRanges,
|
||||
LoadAtRuntime = true
|
||||
},
|
||||
GUI = {
|
||||
Name = "Fieldlines ENLIL Earth",
|
||||
Path = "/Solar System/Heliosphere"
|
||||
}
|
||||
}
|
||||
|
||||
local ENLILStereoA = {
|
||||
Identifier = "FL_ENLIL_stereoa",
|
||||
Parent = transforms.HEEQ180ReferenceFrame.Identifier,
|
||||
Renderable = {
|
||||
Type = "RenderableFieldlinesSequence",
|
||||
SourceFolder = unzippedDataDestination.StereoA,
|
||||
InputFileType = "Osfls",
|
||||
Color = { 1.0, 1.0, 1.0, 0.6 },
|
||||
ColorTablePaths = {
|
||||
enlilDensityColorTable,
|
||||
enlilVelocityColorTable,
|
||||
},
|
||||
ColorTableRanges = colorRanges,
|
||||
FlowEnabled = true,
|
||||
ReversedFlow = true,
|
||||
ParticleSize = 5,
|
||||
ParticleSpacing = 25,
|
||||
FlowSpeed = 25,
|
||||
LoadAtRuntime = true
|
||||
},
|
||||
GUI = {
|
||||
Name = "Fieldlines ENLIL STEREO A",
|
||||
Path = "/Solar System/Heliosphere"
|
||||
}
|
||||
}
|
||||
|
||||
asset.onInitialize(function ()
|
||||
if not openspace.directoryExists(unzippedDataDestination.EqPlane011AU1) then
|
||||
openspace.printInfo("Extracting " .. "Fieldlines from ENLIL model of 2012 event")
|
||||
openspace.unzipFile(fieldlineData .. "011AU_eq_plane_1.zip", unzippedDataDestination.EqPlane011AU1, true)
|
||||
end
|
||||
if not openspace.directoryExists(unzippedDataDestination.EqPlane011AU2) then
|
||||
openspace.printInfo("Extracting " .. "Fieldlines from ENLIL model of 2012 event")
|
||||
openspace.unzipFile(fieldlineData .. "011AU_eq_plane_2.zip", unzippedDataDestination.EqPlane011AU2, true)
|
||||
end
|
||||
if not openspace.directoryExists(unzippedDataDestination.Lat4011AU1) then
|
||||
openspace.printInfo("Extracting " .. "Fieldlines from ENLIL model of 2012 event")
|
||||
openspace.unzipFile(fieldlineData .. "011AU_lat4_1.zip", unzippedDataDestination.Lat4011AU1, true)
|
||||
end
|
||||
if not openspace.directoryExists(unzippedDataDestination.Lat4011AU2) then
|
||||
openspace.printInfo("Extracting " .. "Fieldlines from ENLIL model of 2012 event")
|
||||
openspace.unzipFile(fieldlineData .. "011AU_lat4_2.zip", unzippedDataDestination.Lat4011AU2, true)
|
||||
end
|
||||
if not openspace.directoryExists(unzippedDataDestination.Earth) then
|
||||
openspace.printInfo("Extracting " .. "Fieldlines from ENLIL model of 2012 event")
|
||||
openspace.unzipFile(fieldlineData .. "earth.zip", unzippedDataDestination.Earth, true)
|
||||
end
|
||||
if not openspace.directoryExists(unzippedDataDestination.StereoA) then
|
||||
openspace.printInfo("Extracting " .. "Fieldlines from ENLIL model of 2012 event")
|
||||
openspace.unzipFile(fieldlineData .. "stereoa.zip", unzippedDataDestination.StereoA, true)
|
||||
end
|
||||
|
||||
openspace.addSceneGraphNode(ENLILSliceEqPlane11AU1)
|
||||
openspace.addSceneGraphNode(ENLILSliceEqPlane11AU2)
|
||||
openspace.addSceneGraphNode(ENLILSliceLat411AU1)
|
||||
openspace.addSceneGraphNode(ENLILSliceLat411AU2)
|
||||
openspace.addSceneGraphNode(ENLILEarth)
|
||||
openspace.addSceneGraphNode(ENLILStereoA)
|
||||
|
||||
end)
|
||||
|
||||
asset.onDeinitialize(function ()
|
||||
openspace.removeSceneGraphNode(ENLILStereoA)
|
||||
openspace.removeSceneGraphNode(ENLILEarth)
|
||||
openspace.removeSceneGraphNode(ENLILSliceLat411AU2)
|
||||
openspace.removeSceneGraphNode(ENLILSliceLat411AU1)
|
||||
openspace.removeSceneGraphNode(ENLILSliceEqPlane11AU2)
|
||||
openspace.removeSceneGraphNode(ENLILSliceEqPlane11AU1)
|
||||
end)
|
||||
|
||||
asset.meta = {
|
||||
Name = "Fieldlines from ENLIL model of 2012 event",
|
||||
Version = "1.0",
|
||||
Description = "Magnetic fieldlines from ENLIL model for a 2012 CME event",
|
||||
Author = "CCMC",
|
||||
URL = "",
|
||||
License = "CC-BY"
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
local transforms = asset.require('scene/solarsystem/sun/transforms_heliosphere.asset')
|
||||
|
||||
local transferFunctions = asset.syncedResource({
|
||||
Name = "Fieldlines Transfer Functions",
|
||||
Type = "HttpSynchronization",
|
||||
Identifier = "sun_earth_event_july_2012-fieldlines_transferfunctions",
|
||||
Version = 1
|
||||
})
|
||||
|
||||
local fieldlineData = asset.syncedResource({
|
||||
Name = "Fieldlines Data",
|
||||
Type = "HttpSynchronization",
|
||||
Identifier = "sun_earth_event_july_2012-pfss",
|
||||
Version = 1
|
||||
})
|
||||
|
||||
local pfssTransitionColorTable = transferFunctions .. "pfss_transition.txt"
|
||||
local pfssTopologyColorTable = transferFunctions .. "pfss_topology.txt"
|
||||
local pfssBsignColorTable = transferFunctions .. "pfss_bsign.txt"
|
||||
|
||||
local PFSSPaths = {
|
||||
SolarSoft = fieldlineData .. "leilas_solar_soft/"
|
||||
}
|
||||
|
||||
local PFSS = {
|
||||
Identifier = "FL_PFSS",
|
||||
Parent = transforms.HEEQ180ReferenceFrame.Identifier,
|
||||
Renderable = {
|
||||
Type = "RenderableFieldlinesSequence",
|
||||
SourceFolder = PFSSPaths.SolarSoft,
|
||||
InputFileType = "Osfls",
|
||||
Color = {0.35, 0.51, 0.875, 0.22},
|
||||
FlowEnabled = true,
|
||||
ReversedFlow = true,
|
||||
FlowColor = { 1, 0.9, 1, 0.74 },
|
||||
ParticleSize = 5,
|
||||
ParticleSpacing = 250,
|
||||
FlowSpeed = 75,
|
||||
ColorTablePaths = {
|
||||
pfssTopologyColorTable,
|
||||
pfssBsignColorTable,
|
||||
},
|
||||
ColorTableRanges = {
|
||||
{ 0, 2 },
|
||||
{ -1, 1 },
|
||||
},
|
||||
LoadAtRuntime = true
|
||||
},
|
||||
GUI = {
|
||||
Name = "Fieldlines PFSS",
|
||||
Path = "/Solar System/Heliosphere"
|
||||
}
|
||||
}
|
||||
|
||||
asset.onInitialize(function ()
|
||||
if not openspace.directoryExists(PFSSPaths.SolarSoft) then
|
||||
openspace.printInfo("Extracting " .. "Fieldlines from PFSS model of 2012 event")
|
||||
openspace.unzipFile(fieldlineData .. "leilas_solar_soft.zip", PFSSPaths.SolarSoft, true)
|
||||
end
|
||||
|
||||
openspace.addSceneGraphNode(PFSS)
|
||||
|
||||
-- openspace.setPropertyValueSingle("Scene.FL_PFSS.Renderable.FlowEnabled", true)
|
||||
-- openspace.setPropertyValueSingle("Scene.FL_PFSS.Renderable.Flow.Reversed", true)
|
||||
--openspace.setPropertyValueSingle("Scene.FL_PFSS.Renderable.Flow.particleSize", 5)
|
||||
--openspace.setPropertyValueSingle("Scene.FL_PFSS.Renderable.Flow.particleSpacing", 250)
|
||||
--openspace.setPropertyValueSingle("Scene.FL_PFSS.Renderable.Flow.speed", 75.0)
|
||||
end)
|
||||
|
||||
asset.onDeinitialize(function ()
|
||||
openspace.removeSceneGraphNode(PFSS)
|
||||
end)
|
||||
|
||||
asset.meta = {
|
||||
Name = "Fieldlines from PFSS model of 2012 event",
|
||||
Version = "1.0",
|
||||
Description = "Magnetic fieldlines from PFSS model for a 2012 CME event",
|
||||
Author = "CCMC",
|
||||
URL = "",
|
||||
License = "CC-BY"
|
||||
}
|
||||
@@ -34,14 +34,11 @@ local fieldlines = {
|
||||
asset.localResource("transferfunctions/density-fieldlines.txt"),
|
||||
asset.localResource("transferfunctions/velocity-fieldlines.txt")
|
||||
},
|
||||
ColorTableMinMax = {
|
||||
ColorTableRanges = {
|
||||
{ 0, 1000000 },
|
||||
{ 100, 2000 }
|
||||
},
|
||||
SimulationModel = "mas",
|
||||
Color = {
|
||||
Uniform = { 0.0, 0.725, 0.75, 1.0 }
|
||||
}
|
||||
},
|
||||
GUI = {
|
||||
Path = "/Solar System/Heliosphere/Bastille Day 2000",
|
||||
@@ -71,7 +68,6 @@ end)
|
||||
|
||||
asset.export(fieldlines)
|
||||
|
||||
|
||||
asset.meta = {
|
||||
Name = "Predictive Science Inc. Fieldlines Bastille Day",
|
||||
Version = "1.0",
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
local transforms = asset.require("./transforms_magnetosphere")
|
||||
local transferFunction = asset.localResource("./CMR-illuminance2.txt")
|
||||
local earthAsset = asset.require("scene/solarsystem/planets/earth/earth")
|
||||
|
||||
local fieldlinesDirectory = asset.syncedResource({
|
||||
Name = "Magnetosphere 2012 event",
|
||||
@@ -12,8 +11,6 @@ local fieldlinesDirectory = asset.syncedResource({
|
||||
local earthMagnetosphere = {
|
||||
Identifier = "EarthMagnetosphere",
|
||||
Parent = transforms.GSMReferenceFrame.Identifier,
|
||||
-- Grabs a value from earths ellipsoid. 1.05 just to make it somewhat bigger than earth
|
||||
InteractionSphere = earthAsset.Earth.Renderable.Radii[1] * 1.05,
|
||||
Renderable = {
|
||||
Type = "RenderableFieldlinesSequence",
|
||||
SourceFolder = fieldlinesDirectory,
|
||||
@@ -22,16 +19,14 @@ local earthMagnetosphere = {
|
||||
InputFileType = "Osfls", -- OpenSpace Field lines sequence
|
||||
MaskingEnabled = true,
|
||||
MaskingQuantity = 5, -- corresponds to "topology"
|
||||
MaskingRanges = {{-0, 0}},
|
||||
MaskingRanges = {{-0, 0}}, --closed only
|
||||
ColorMethod = "By Quantity",
|
||||
ColorQuantity = 4,
|
||||
ColorQuantity = 4, -- speed
|
||||
ColorTableRanges = {{50, 300}},
|
||||
ColorTablePaths = {transferFunction},
|
||||
LoadAtRuntime = true,
|
||||
ScaleToMeters = 1.0,
|
||||
Color = {
|
||||
Uniform = { 1.0, 0.725, 0.75, 1.0 }
|
||||
}
|
||||
Color = { 1.0, 0.725, 0.75, 0.8 }
|
||||
},
|
||||
GUI = {
|
||||
Path = "/Solar System/Planets/Earth",
|
||||
@@ -49,7 +44,6 @@ end)
|
||||
|
||||
asset.export(earthMagnetosphere)
|
||||
|
||||
|
||||
asset.meta = {
|
||||
Name = "Static generic magnetosphere of fieldlines",
|
||||
Version = "1.1",
|
||||
|
||||
@@ -24,11 +24,11 @@ local GSMReferenceFrame = {
|
||||
asset.onInitialize(function()
|
||||
openspace.addSceneGraphNode(GSMReferenceFrame)
|
||||
end)
|
||||
|
||||
|
||||
asset.onDeinitialize(function()
|
||||
openspace.removeSceneGraphNode(GSMReferenceFrame)
|
||||
end)
|
||||
|
||||
|
||||
asset.export(GSMReferenceFrame)
|
||||
|
||||
|
||||
|
||||
@@ -28,11 +28,11 @@ local HEEQ180ReferenceFrame = {
|
||||
asset.onInitialize(function()
|
||||
openspace.addSceneGraphNode(HEEQ180ReferenceFrame)
|
||||
end)
|
||||
|
||||
|
||||
asset.onDeinitialize(function()
|
||||
openspace.removeSceneGraphNode(HEEQ180ReferenceFrame)
|
||||
end)
|
||||
|
||||
|
||||
asset.export(HEEQ180ReferenceFrame)
|
||||
|
||||
|
||||
|
||||
@@ -70,7 +70,7 @@ namespace {
|
||||
"Color Table/Transfer Function to use for 'By Quantity' coloring."
|
||||
};
|
||||
constexpr openspace::properties::Property::PropertyInfo ColorUniformInfo = {
|
||||
"Uniform",
|
||||
"Color",
|
||||
"Uniform Line Color",
|
||||
"The uniform color of lines shown when 'Color Method' is set to 'Uniform'."
|
||||
};
|
||||
@@ -105,9 +105,9 @@ namespace {
|
||||
"Valid radial range. [Min, Max]"
|
||||
};
|
||||
constexpr openspace::properties::Property::PropertyInfo FlowColorInfo = {
|
||||
"Color",
|
||||
"Color",
|
||||
"Color of particles."
|
||||
"FlowColor",
|
||||
"Flow Color",
|
||||
"Color of particles flow direction indication."
|
||||
};
|
||||
constexpr openspace::properties::Property::PropertyInfo FlowEnabledInfo = {
|
||||
"FlowEnabled",
|
||||
@@ -197,6 +197,9 @@ namespace {
|
||||
// Set to true if you are streaming data during runtime
|
||||
std::optional<bool> loadAtRuntime;
|
||||
|
||||
// [[codegen::verbatim(ColorUniformInfo.description)]]
|
||||
std::optional<glm::vec4> color [[codegen::color()]];
|
||||
|
||||
// A list of paths to transferfunction .txt files containing color tables
|
||||
// used for colorizing the fieldlines according to different parameters
|
||||
std::optional<std::vector<std::string>> colorTablePaths;
|
||||
@@ -215,6 +218,21 @@ namespace {
|
||||
// would be traveling
|
||||
std::optional<bool> flowEnabled;
|
||||
|
||||
// [[codegen::verbatim(FlowColorInfo.description)]]
|
||||
std::optional<glm::vec4> flowColor;
|
||||
|
||||
// [[codegen::verbatim(FlowReversedInfo.description)]]
|
||||
std::optional<bool> reversedFlow;
|
||||
|
||||
// [[codegen::verbatim(FlowParticleSizeInfo.description)]]
|
||||
std::optional<int> particleSize;
|
||||
|
||||
// [[codegen::verbatim(FlowParticleSpacingInfo.description)]]
|
||||
std::optional<int> particleSpacing;
|
||||
|
||||
// [[codegen::verbatim(FlowSpeedInfo.description)]]
|
||||
std::optional<int> flowSpeed;
|
||||
|
||||
// [[codegen::verbatim(MaskingEnabledInfo.description)]]
|
||||
std::optional<bool> maskingEnabled;
|
||||
|
||||
@@ -380,16 +398,29 @@ RenderableFieldlinesSequence::RenderableFieldlinesSequence(
|
||||
"{} contains no {} files", sourcePath.string(), fileTypeString
|
||||
));
|
||||
}
|
||||
|
||||
_extraVars = p.extraVariables.value_or(_extraVars);
|
||||
_flowEnabled = p.flowEnabled.value_or(_flowEnabled);
|
||||
_flowColor = p.flowColor.value_or(_flowColor);
|
||||
_flowReversed = p.reversedFlow.value_or(_flowReversed);
|
||||
_flowParticleSize = p.particleSize.value_or(_flowParticleSize);
|
||||
_flowParticleSpacing = p.particleSpacing.value_or(_flowParticleSpacing);
|
||||
_flowSpeed = p.flowSpeed.value_or(_flowSpeed);
|
||||
_lineWidth = p.lineWidth.value_or(_lineWidth);
|
||||
_manualTimeOffset = p.manualTimeOffset.value_or(_manualTimeOffset);
|
||||
_modelStr = p.simulationModel.value_or(_modelStr);
|
||||
_seedPointDirectory = p.seedPointDirectory.value_or(_seedPointDirectory);
|
||||
_maskingEnabled = p.maskingEnabled.value_or(_maskingEnabled);
|
||||
_maskingQuantityTemp = p.maskingQuantity.value_or(_maskingQuantityTemp);
|
||||
_colorTablePaths = p.colorTablePaths.value_or(_colorTablePaths);
|
||||
if (p.colorTablePaths.has_value()) {
|
||||
_colorTablePaths = p.colorTablePaths.value();
|
||||
}
|
||||
else {
|
||||
// Set a default color table, just in case the (optional) user defined paths are
|
||||
// corrupt or not provided
|
||||
_colorTablePaths.push_back(FieldlinesSequenceModule::DefaultTransferFunctionFile);
|
||||
}
|
||||
|
||||
_colorUniform = p.color.value_or(_colorUniform);
|
||||
|
||||
_colorMethod.addOption(static_cast<int>(ColorMethod::Uniform), "Uniform");
|
||||
_colorMethod.addOption(static_cast<int>(ColorMethod::ByQuantity), "By Quantity");
|
||||
@@ -442,12 +473,18 @@ RenderableFieldlinesSequence::RenderableFieldlinesSequence(
|
||||
}
|
||||
|
||||
void RenderableFieldlinesSequence::initialize() {
|
||||
// Set a default color table, just in case the (optional) user defined paths are
|
||||
// corrupt or not provided
|
||||
_colorTablePaths.push_back(FieldlinesSequenceModule::DefaultTransferFunctionFile);
|
||||
_transferFunction = std::make_unique<TransferFunction>(
|
||||
absPath(_colorTablePaths[0]).string()
|
||||
);
|
||||
}
|
||||
|
||||
void RenderableFieldlinesSequence::initializeGL() {
|
||||
// Setup shader program
|
||||
_shaderProgram = global::renderEngine->buildRenderProgram(
|
||||
"FieldlinesSequence",
|
||||
absPath("${MODULE_FIELDLINESSEQUENCE}/shaders/fieldlinessequence_vs.glsl"),
|
||||
absPath("${MODULE_FIELDLINESSEQUENCE}/shaders/fieldlinessequence_fs.glsl")
|
||||
);
|
||||
|
||||
// Extract source file type specific information from dictionary
|
||||
// & get states from source
|
||||
@@ -489,17 +526,7 @@ void RenderableFieldlinesSequence::initialize() {
|
||||
|
||||
computeSequenceEndTime();
|
||||
setModelDependentConstants();
|
||||
|
||||
setupProperties();
|
||||
}
|
||||
|
||||
void RenderableFieldlinesSequence::initializeGL() {
|
||||
// Setup shader program
|
||||
_shaderProgram = global::renderEngine->buildRenderProgram(
|
||||
"FieldlinesSequence",
|
||||
absPath("${MODULE_FIELDLINESSEQUENCE}/shaders/fieldlinessequence_vs.glsl"),
|
||||
absPath("${MODULE_FIELDLINESSEQUENCE}/shaders/fieldlinessequence_fs.glsl")
|
||||
);
|
||||
|
||||
glGenVertexArrays(1, &_vertexArrayObject);
|
||||
glGenBuffers(1, &_vertexPositionBuffer);
|
||||
@@ -631,6 +658,7 @@ void RenderableFieldlinesSequence::setupProperties() {
|
||||
// Each quantity should have its own color table and color table range
|
||||
// no more, no less
|
||||
_colorTablePaths.resize(nExtraQuantities, _colorTablePaths.back());
|
||||
_colorTablePath = _colorTablePaths[0];
|
||||
_colorTableRanges.resize(nExtraQuantities, _colorTableRanges.back());
|
||||
_maskingRanges.resize(nExtraQuantities, _maskingRanges.back());
|
||||
}
|
||||
@@ -641,7 +669,6 @@ void RenderableFieldlinesSequence::setupProperties() {
|
||||
// Set defaults
|
||||
_colorQuantity = _colorQuantityTemp;
|
||||
_colorQuantityMinMax = _colorTableRanges[_colorQuantity];
|
||||
_colorTablePath = _colorTablePaths[0];
|
||||
|
||||
_maskingQuantity = _maskingQuantityTemp;
|
||||
_maskingMinMax = _maskingRanges[_colorQuantity];
|
||||
@@ -660,7 +687,6 @@ void RenderableFieldlinesSequence::definePropertyCallbackFunctions() {
|
||||
|
||||
_colorTablePath.onChange([this]() {
|
||||
_transferFunction->setPath(_colorTablePath);
|
||||
_colorTablePaths[_colorQuantity] = _colorTablePath;
|
||||
});
|
||||
|
||||
_colorQuantityMinMax.onChange([this]() {
|
||||
@@ -819,7 +845,7 @@ std::unordered_map<std::string, std::vector<glm::vec3>>
|
||||
continue;
|
||||
}
|
||||
|
||||
std::ifstream seedFile(spFile.path());
|
||||
std::ifstream seedFile(spFile);
|
||||
if (!seedFile.good()) {
|
||||
LERROR(fmt::format("Could not open seed points file '{}'", seedFilePath));
|
||||
outMap.clear();
|
||||
@@ -848,7 +874,7 @@ std::unordered_map<std::string, std::vector<glm::vec3>>
|
||||
std::string name = seedFilePath.substr(0, lastIndex); // remove file extention
|
||||
size_t dateAndTimeSeperator = name.find_last_of('_');
|
||||
std::string time = name.substr(dateAndTimeSeperator + 1, name.length());
|
||||
std::string date = name.substr(dateAndTimeSeperator - 8, 8); //8 for yyyymmdd
|
||||
std::string date = name.substr(dateAndTimeSeperator - 8, 8); // 8 for yyyymmdd
|
||||
std::string dateAndTime = date + time;
|
||||
|
||||
// add outVec as value and time stamp as int as key
|
||||
@@ -953,10 +979,7 @@ void RenderableFieldlinesSequence::render(const RenderData& data, RendererTasks&
|
||||
textureUnit.activate();
|
||||
_transferFunction->bind(); // Calls update internally
|
||||
_shaderProgram->setUniform("colorTable", textureUnit);
|
||||
_shaderProgram->setUniform(
|
||||
"colorTableRange",
|
||||
_colorTableRanges[_colorQuantity]
|
||||
);
|
||||
_shaderProgram->setUniform("colorTableRange", _colorTableRanges[_colorQuantity]);
|
||||
}
|
||||
|
||||
if (_maskingEnabled) {
|
||||
@@ -994,7 +1017,7 @@ void RenderableFieldlinesSequence::render(const RenderData& data, RendererTasks&
|
||||
#endif
|
||||
|
||||
glMultiDrawArrays(
|
||||
GL_LINE_STRIP, //_drawingOutputType,
|
||||
GL_LINE_STRIP,
|
||||
_states[_activeStateIndex].lineStart().data(),
|
||||
_states[_activeStateIndex].lineCount().data(),
|
||||
static_cast<GLsizei>(_states[_activeStateIndex].lineStart().size())
|
||||
@@ -1048,7 +1071,7 @@ void RenderableFieldlinesSequence::update(const UpdateData& data) {
|
||||
}
|
||||
else {
|
||||
// Not in interval => set everything to false
|
||||
_activeTriggerTimeIndex = -1;
|
||||
_activeTriggerTimeIndex = -1;
|
||||
mustLoadNewStateFromDisk = false;
|
||||
needUpdate = false;
|
||||
}
|
||||
|
||||
@@ -92,7 +92,6 @@ private:
|
||||
std::filesystem::path _seedPointDirectory;
|
||||
// optional except when using json input
|
||||
std::string _modelStr;
|
||||
fls::Model thismodel;
|
||||
|
||||
// Used for 'runtime-states'. True when loading a new state from disk on another
|
||||
// thread.
|
||||
|
||||
@@ -54,8 +54,8 @@ uniform vec2 domainLimR;
|
||||
|
||||
// Inputs
|
||||
layout(location = 0) in vec3 in_position; // Should be provided in meters
|
||||
layout(location = 1) in float in_color_scalar; // The extra value used to color lines. Location must correspond to _VA_COLOR in renderablefieldlinessequence.h
|
||||
layout(location = 2) in float in_masking_scalar; // The extra value used to mask out parts of lines. Location must correspond to _VA_MASKING in renderablefieldlinessequence.h
|
||||
layout(location = 1) in float in_color_scalar; // The extra value used to color lines.
|
||||
layout(location = 2) in float in_masking_scalar; // The extra value used to mask out parts of lines.
|
||||
|
||||
// These should correspond to the enum 'ColorMethod' in renderablefieldlinesequence.cpp
|
||||
const int uniformColor = 0;
|
||||
|
||||
Reference in New Issue
Block a user