last polishing questionmark

This commit is contained in:
ElonOlsson
2021-09-24 13:08:10 -04:00
parent f46d37e67b
commit 0737ae1834
13 changed files with 63 additions and 90 deletions

View File

@@ -0,0 +1,16 @@
local CarringtonLongitudeToHEEQ180Rotation = {
-- This is a rotation matrix to go from Carrington longitude referens frame to HEEQ180
-- reference fram. At the reference 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 }
}
asset.export("CarringtonLongitudeToHEEQ180Rotation", CarringtonLongitudeToHEEQ180Rotation)

View File

@@ -1,5 +1,5 @@
local assetHelper = asset.require("util/asset_helper")
local propertyHelper = asset.require('../../../../util/property_helper')
local propertyHelper = asset.require('util/property_helper')
local sunTransforms = asset.require('scene/solarsystem/sun/transforms')
local densityDirectory = asset.syncedResource({

View File

@@ -1,6 +1,7 @@
local assetHelper = asset.require('util/asset_helper')
local heliosphereTransforms = asset.require('scene/solarsystem/sun/transforms_heliosphere')
local propertyHelper = asset.require('../../../../util/property_helper')
local propertyHelper = asset.require('util/property_helper')
local rot = asset.require('./carringtonToHEEQRotation.asset')
local fieldlinesDirectory = asset.syncedResource({
Name = "Bastille Day MAS Fieldlines",
@@ -20,21 +21,7 @@ local fieldlines = {
Type = "StaticScale",
Scale = sunRadius
},
Rotation = {
-- This is a rotation matrix to go from Carrington longitude referens frame to HEEQ180
-- which is what the renderables parent transforms.HEEQ180ReferenceFrame. Identifier is
-- referring to. At the reference 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 }
}
Rotation = rot.CarringtonLongitudeToHEEQ180Rotation
},
Renderable = {
Type = "RenderableFieldlinesSequence",

View File

@@ -1,38 +1,25 @@
local assetHelper = asset.require('util/asset_helper')
local heliosphereTransforms = asset.require('scene/solarsystem/sun/transforms_heliosphere')
local propertyHelper = asset.require('../../../../util/property_helper')
local propertyHelper = asset.require('util/property_helper')
local rot = asset.require('./carringtonToHEEQRotation.asset')
local fluxnodesBinaries = asset.syncedResource({
local fluxNodesBinaries = asset.syncedResource({
Name = "Bastille day Flux nodes binaries",
Type = "HttpSynchronization",
Identifier = "bastille_day_streamnodes_binaries",
Version = 1
})
-- Fluxnodes from binaries
local fluxnodes = {
-- FluxNodes from binaries
local fluxNodes = {
Identifier = "MAS-MHD-FluxNodes",
Parent = heliosphereTransforms.HEEQ180ReferenceFrame.Identifier,
Transform = {
Rotation = {
-- This is a rotation matrix to go from Carrington longitude referens frame to HEEQ180
-- which is what the renderables parent transforms.HEEQ180ReferenceFrame. Identifier is
-- referring to. At the reference 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 }
}
Rotation = rot.CarringtonLongitudeToHEEQ180Rotation
},
Renderable = {
Type = "RenderableFluxNodes",
SourceFolder = fluxnodesBinaries,
SourceFolder = fluxNodesBinaries,
ColorTablePaths = asset.localResource("transferfunctions/CMR.txt"),
LoadAtRuntime = true,
--ScaleToMeters = 1.0,
@@ -42,7 +29,7 @@ local fluxnodes = {
},
GUI = {
Path = "/Solar System/Heliosphere",
Name = "Fluxnodes"
Name = "Flux Nodes"
}
}
@@ -61,7 +48,7 @@ end)
asset.onDeinitialize(function ()
openspace.action.removeAction(toggle_fluxnodes.Identifier)
end)
assetHelper.registerSceneGraphNodesAndExport(asset, { fluxnodes })
assetHelper.registerSceneGraphNodesAndExport(asset, { fluxNodes })
asset.meta = {
Name = "Predictive Science Inc. Flux nodes Bastille Day",

View File

@@ -1,6 +1,7 @@
local assetHelper = asset.require("util/asset_helper")
local propertyHelper = asset.require('../../../../util/property_helper')
local propertyHelper = asset.require("util/property_helper")
local transforms = asset.require('scene/solarsystem/sun/transforms_heliosphere')
local rot = asset.require('./carringtonToHEEQRotation.asset')
local TexturesPathEquitorial = asset.syncedResource({
Type = "HttpSynchronization",
@@ -20,21 +21,7 @@ local EquatorialCutplane = {
Identifier = "EquatorialCutplane",
Parent = transforms.HEEQ180ReferenceFrame.Identifier,
Transform = {
Rotation = {
-- This is a rotation matrix to go from Carrington longitude referens frame to HEEQ180
-- which is what the renderables parent transforms.HEEQ180ReferenceFrame. Identifier is
-- referring to. At the reference 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 }
}
Rotation = rot.CarringtonLongitudeToHEEQ180Rotation
},
Renderable = {
Type = "RenderablePlaneTimeVaryingImage",

View File

@@ -9,7 +9,7 @@ local TexturesPath = asset.syncedResource({
})
local legend = {
Identifier = "LegendFluxnodes",
Identifier = "LegendFluxNodes",
Type = "ScreenSpaceImageLocal",
TexturePath = TexturesPath .. "/CMR_transparent_white_text.png",
Scale = 0.15,
@@ -19,9 +19,9 @@ local legend = {
local show_legend = {
Identifier = "fluxnodelegend.show_legend",
Name = "Show the legend image",
Command = "openspace.setPropertyValueSingle('ScreenSpace.LegendFluxnodes.Opacity', 0.0);" ..
"openspace.setPropertyValueSingle('ScreenSpace.LegendFluxnodes.Enabled', true);" ..
"openspace.setPropertyValueSingle('ScreenSpace.LegendFluxnodes.Opacity', 1.0, 4);",
Command = "openspace.setPropertyValueSingle('ScreenSpace.LegendFluxNodes.Opacity', 0.0);" ..
"openspace.setPropertyValueSingle('ScreenSpace.LegendFluxNodes.Enabled', true);" ..
"openspace.setPropertyValueSingle('ScreenSpace.LegendFluxNodes.Opacity', 1.0, 4);",
Documentation = "Show the legend image",
GuiPath = "/Bastille-Day",
IsLocal = false
@@ -29,7 +29,7 @@ local show_legend = {
local hide_legend = {
Identifier = "fluxnodelegend.hide_legend",
Name = "Hides the legend image",
Command = "openspace.setPropertyValueSingle('ScreenSpace.LegendFluxnodes.Opacity', 0.0, 2);",
Command = "openspace.setPropertyValueSingle('ScreenSpace.LegendFluxNodes.Opacity', 0.0, 2);",
Documentation = "Hides the legend image",
GuiPath = "/Bastille-Day",
IsLocal = false
@@ -38,7 +38,7 @@ local hide_legend = {
asset.onInitialize(function()
openspace.addScreenSpaceRenderable(legend)
-- These numbers are there to put the legend on the side of the screen.
openspace.setPropertyValueSingle('ScreenSpace.LegendFluxnodes.Rotation', { 0.0, 0.0, 0.56652 });
openspace.setPropertyValueSingle('ScreenSpace.LegendFluxNodes.Rotation', { 0.0, 0.0, 0.56652 });
openspace.action.registerAction(show_legend)
openspace.action.registerAction(hide_legend)
end)
@@ -56,5 +56,5 @@ asset.meta = {
Author = "Christian Adamsson, Emilie Ho",
URL = "https://dx.doi.org/10.3847/1538-4357/aab36d",
License = "MIT",
Identifier = {"LegendFluxnodes"}
Identifier = {"LegendFluxNodes"}
}

View File

@@ -31,4 +31,3 @@ FRAME_13371333_SEC_SPEC = 'LATITUDINAL'
FRAME_13371333_SEC_UNITS = 'DEGREES'
FRAME_13371333_SEC_LONGITUDE = 288.43
FRAME_13371333_SEC_LATITUDE = 79.54

View File

@@ -84,8 +84,8 @@ assetHelper.registerSceneGraphNodesAndExport(asset, {
asset.meta = {
Name = "Earth Transforms",
Version = "1.0",
Description = [[ Earth transforms: Earth Barycenter, Earth Center, Earth Inertial,
Earth IAU. A scene graph node is created for each transform.]],
Description = [[ Earth transforms: Earth Barycenter, Earth Center, Earth Inertial,
Earth IAU. A scene graph node is created for each transform.]],
Author = "OpenSpace Team",
URL = "http://openspaceproject.com",
License = "MIT license",

View File

@@ -1,6 +1,6 @@
asset.require("spice/base")
local assetHelper = asset.require("util/asset_helper")
local propertyHelper = asset.require('../../../util/property_helper')
local propertyHelper = asset.require('util/property_helper')
local transforms = asset.require("./transforms")
local textureSourcePath = asset.syncedResource({
@@ -18,7 +18,6 @@ local EUVLayer = {
Size = 6.96E8, -- Slightly bigger than the sun renderable,
Enabled = true,
TextureSource = textureSourcePath,
--BlendMode = "Additive",
Opacity = 1,
Segments = 132
},
@@ -29,7 +28,7 @@ local EUVLayer = {
}
local toggle_EUV_layer ={
Identifier = "EUV_layer.toggle_EUV",
Identifier = "euv_layer.toggle_EUV",
Name = "Toggle EUV Layer",
Command = propertyHelper.invert("Scene.EUV-Layer.Renderable.Enabled"),
Documentation = "Toggle EUV layer of sun",

View File

@@ -55,7 +55,7 @@
"scene/solarsystem/planets/earth/magnetosphere/magnetosphere",
"scene/solarsystem/planets/earth/magnetosphere/transforms_magnetosphere",
"scene/solarsystem/planets/earth/satellites/satellites",
"scene/solarsystem/sun/EUV_layer",
"scene/solarsystem/sun/euv_layer",
"scene/solarsystem/sun/sun_textures"
],
"camera": {
@@ -125,7 +125,7 @@
"key": "I"
},
{
"action": "EUV_layer.toggle_EUV",
"action": "euv_layer.toggle_EUV",
"key": "E"
},
{

View File

@@ -41,22 +41,22 @@ namespace {
constexpr const char* KeyLazyLoading = "LazyLoading";
constexpr const char* _loggerCat = "RenderablePlaneTimeVaryingImage";
constexpr openspace::properties::Property::PropertyInfo TextureInfo = {
constexpr openspace::properties::Property::PropertyInfo SourceFolderInfo = {
"SourceFolder",
"Texture Directory",
"Source Folder",
"This value specifies the image directory that is loaded from disk and "
"is used as a texture that is applied to this plane."
};
constexpr openspace::properties::Property::PropertyInfo RenderTypeInfo = {
"RenderType",
"RenderType",
"Render Type",
"This value specifies if the plane should be rendered in the Background, "
"Opaque, Transparent, or Overlay rendering step."
};
struct [[codegen::Dictionary(RenderablePlaneTimeVaryingImage)]] Parameters {
// [[codegen::verbatim(TextureInfo.description)]]
// [[codegen::verbatim(SourceFolderInfo.description)]]
std::string sourceFolder;
enum class RenderType {
@@ -95,23 +95,22 @@ documentation::Documentation RenderablePlaneTimeVaryingImage::Documentation() {
RenderablePlaneTimeVaryingImage::RenderablePlaneTimeVaryingImage(
const ghoul::Dictionary& dictionary)
: RenderablePlane(dictionary)
, _texturePath(TextureInfo)
, _sourceFolder(SourceFolderInfo)
{
const Parameters p = codegen::bake<Parameters>(dictionary);
addProperty(_blendMode);
_texturePath = p.sourceFolder;
std::filesystem::path textureDirectory = absPath(_texturePath);
if (!std::filesystem::is_directory(textureDirectory)) {
_sourceFolder = p.sourceFolder;
if (!std::filesystem::is_directory(absPath(_sourceFolder))) {
LERROR(fmt::format(
"Time varying image, {} is not a valid directory",
_texturePath
_sourceFolder
));
}
addProperty(_texturePath);
_texturePath.onChange([this]() { _texture = loadTexture(); });
addProperty(_sourceFolder);
_sourceFolder.onChange([this]() { _texture = loadTexture(); });
if (p.renderType.has_value()) {
switch (*p.renderType) {
@@ -166,7 +165,7 @@ void RenderablePlaneTimeVaryingImage::initialize() {
void RenderablePlaneTimeVaryingImage::initializeGL() {
RenderablePlane::initializeGL();
_textureFiles.resize(_sourceFiles.size());
_textureFiles.resize(_sourceFiles.size());
for (size_t i = 0; i < _sourceFiles.size(); ++i) {
_textureFiles[i] = ghoul::io::TextureReader::ref().loadTexture(
absPath(_sourceFiles[i]).string()
@@ -185,7 +184,7 @@ bool RenderablePlaneTimeVaryingImage::extractMandatoryInfoFromDictionary() {
// Ensure that the source folder exists and then extract
// the files with the same extension as <inputFileTypeString>
namespace fs = std::filesystem;
fs::path sourceFolder = absPath(_texturePath);
fs::path sourceFolder = absPath(_sourceFolder);
// Extract all file paths from the provided folder
_sourceFiles.clear();
namespace fs = std::filesystem;
@@ -199,7 +198,7 @@ bool RenderablePlaneTimeVaryingImage::extractMandatoryInfoFromDictionary() {
if (_sourceFiles.empty()) {
LERROR(fmt::format(
"{}: Plane sequence filepath {} was empty",
_identifier, _texturePath
_identifier, _sourceFolder
));
return false;
}
@@ -208,7 +207,6 @@ bool RenderablePlaneTimeVaryingImage::extractMandatoryInfoFromDictionary() {
}
void RenderablePlaneTimeVaryingImage::deinitializeGL() {
BaseModule::TextureManager.release(_texture);
_textureFiles.clear();
@@ -242,7 +240,6 @@ void RenderablePlaneTimeVaryingImage::update(const UpdateData& data) {
{
_activeTriggerTimeIndex = updateActiveTriggerTimeIndex(currentTime);
needsUpdate = true;
} // else we're still in same state as previous frame (no changes needed)
}
else {
@@ -284,8 +281,8 @@ void RenderablePlaneTimeVaryingImage::extractTriggerTimesFromFileNames() {
}
}
int RenderablePlaneTimeVaryingImage::updateActiveTriggerTimeIndex(double currentTime)
const
int RenderablePlaneTimeVaryingImage::updateActiveTriggerTimeIndex(
double currentTime) const
{
int activeIndex = 0;
auto iter = std::upper_bound(_startTimes.begin(), _startTimes.end(), currentTime);
@@ -314,7 +311,7 @@ void RenderablePlaneTimeVaryingImage::computeSequenceEndTime() {
}
}
ghoul::opengl::Texture* RenderablePlaneTimeVaryingImage::loadTexture() const{
ghoul::opengl::Texture* RenderablePlaneTimeVaryingImage::loadTexture() const {
ghoul::opengl::Texture* texture = nullptr;
if (_activeTriggerTimeIndex != -1) {
texture = _textureFiles[_activeTriggerTimeIndex].get();

View File

@@ -65,7 +65,7 @@ private:
std::vector<std::string> _sourceFiles;
std::vector<double> _startTimes;
int _activeTriggerTimeIndex = 0;
properties::StringProperty _texturePath;
properties::StringProperty _sourceFolder;
ghoul::opengl::Texture* _texture = nullptr;
std::vector<std::unique_ptr<ghoul::opengl::Texture>> _textureFiles;
bool _isLoadingLazily = false;

View File

@@ -134,6 +134,7 @@ RenderableTravelSpeed::RenderableTravelSpeed(const ghoul::Dictionary& dictionary
setRenderBin(RenderBin::Overlay);
_lineColor = p.color.value_or(_lineColor);
_lineColor.setViewOption(properties::Property::ViewOptions::Color);
addProperty(_lineColor);
_opacity = p.opacity.value_or(_opacity);