mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-02-25 06:19:02 -06:00
mirror backside parameter of renderableplane, renamed renderabletimevaryingplaneimagelocal to renderableplanetimevaryingimage. mm.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
asset.meta = {
|
||||
Name = "Predictive Science Inc. Stream nodes Bastille Days",
|
||||
Name = "Predictive Science Inc. EUV texture sequence Bastille Days",
|
||||
Version = "1.0",
|
||||
Description = "EUV simulation, texture sequence",
|
||||
Author = "CCMC, OpenSpace team",
|
||||
|
||||
@@ -59,15 +59,7 @@ local densityVolume = {
|
||||
XAxis = {-1.0, 0.0, 0.0},
|
||||
YAxis = {0.0, 1.0, 0.0},
|
||||
ZAxis = {0.0, 0.0, -1.0}
|
||||
|
||||
--XAxis = {1.0, 0.0, 0.0},
|
||||
--YAxis = {0.0, 1.0, 0.0},
|
||||
--ZAxis = {0.0, 0.0, -1.0}
|
||||
|
||||
--XAxis = {1.0, 0.0, 0.0},
|
||||
--YAxis = {0.0, 1.0, 0.0},
|
||||
--ZAxis = {0.0, 0.0, -1.0}
|
||||
|
||||
|
||||
--Script = asset.localResource("kernels/carringtonRotation.lua")
|
||||
}
|
||||
},
|
||||
|
||||
@@ -65,6 +65,15 @@ local fieldlines = {
|
||||
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},
|
||||
|
||||
@@ -2,7 +2,7 @@ asset.info = {
|
||||
Name = "Predictive Science Inc. Stream nodes Bastille Day",
|
||||
Version = "1.0",
|
||||
Description = " Stream nodes for the bastille day CME event ",
|
||||
Author = "Christian Adamsson, Emilie Ho",
|
||||
Author = "CCMC, Christian Adamsson, Emilie Ho",
|
||||
URL = "https://dx.doi.org/10.3847/1538-4357/aab36d",
|
||||
License = ""
|
||||
}
|
||||
@@ -11,11 +11,6 @@ local assetHelper = asset.require('util/asset_helper')
|
||||
local transforms = asset.require('./transforms')
|
||||
local sunTransforms = asset.require('scene/solarsystem/sun/transforms')
|
||||
|
||||
openspace.setPropertyValueSingle("Modules.Space.ShowExceptions", false)
|
||||
--openspace.setPropertyValueSingle("Scene.NeptuneTrail.Renderable.Enabled", false)
|
||||
--openspace.setPropertyValueSingle("Scene.UranusTrail.Renderable.Enabled", false)
|
||||
--openspace.setPropertyValueSingle("Scene.SaturnTrail.Renderable.Enabled", false)
|
||||
|
||||
local transferFunctions = asset.localResource("transferfunctions")
|
||||
local streamnodeColorTable = transferFunctions .. "/stream_nodes.txt"
|
||||
local streamnodeColorTableCMR = transferFunctions .. "/CMR.txt"
|
||||
@@ -45,7 +40,7 @@ local Streamnodes = {
|
||||
Parent = transforms.HNMReferenceFrame.Identifier,
|
||||
--Parent = sunTransforms.SunIAU.Identifier,
|
||||
--Parent = sunTransforms.SolarSystemBarycenter.Identifier,
|
||||
--transforms.asset, referens till suntransforms.solarsystemBarycenter.identifier
|
||||
--transforms.asset, referens to suntransforms.solarsystemBarycenter.identifier
|
||||
Renderable = {
|
||||
Type = "RenderableStreamNodes",
|
||||
--SourceFolder = streamnodesDirectory,
|
||||
@@ -62,18 +57,11 @@ local Streamnodes = {
|
||||
--streamnodeColorTableIlluminance,
|
||||
--streamnodeColorTableIlluminance2,
|
||||
},
|
||||
--ColorTableMinMax = {
|
||||
-- { 0, 1000000 },
|
||||
-- { 100, 2000 }
|
||||
--},
|
||||
LoadAtRuntime = true,
|
||||
ScaleToMeters = 1.0,
|
||||
SecondsBefore = 24*60*60,
|
||||
SecondsAfter = 24*60*60,
|
||||
--SimulationModel = "mas",
|
||||
-- Color = {
|
||||
-- Uniform = {0, 0.725, 0.75, 1}
|
||||
-- }
|
||||
--SimulationModel = "mas"
|
||||
},
|
||||
GUI = {
|
||||
Path = "/Solar System/Heliosphere",
|
||||
@@ -85,6 +73,15 @@ local Streamnodes = {
|
||||
Scale = 1
|
||||
},
|
||||
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},
|
||||
|
||||
@@ -16,7 +16,7 @@ local assetHelper = asset.require("util/asset_helper")
|
||||
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 = 8
|
||||
local textureversion = 1
|
||||
|
||||
local TexturesPathEarth = asset.syncedResource({
|
||||
Type = "HttpSynchronization",
|
||||
|
||||
@@ -16,13 +16,13 @@ local TexturesPathEquitorial = asset.syncedResource({
|
||||
Type = "HttpSynchronization",
|
||||
Name = "cutplanes_textures",
|
||||
Identifier = "cutplanes_textures",
|
||||
Version = 16
|
||||
Version = 1
|
||||
})
|
||||
local TexturesPathMeridial = asset.syncedResource({
|
||||
Type = "HttpSynchronization",
|
||||
Name = "cutplane_meridial_textures",
|
||||
Identifier = "cutplane_meridial_textures",
|
||||
Version = 6
|
||||
Version = 1
|
||||
})
|
||||
|
||||
local Cutplane = {
|
||||
@@ -31,6 +31,15 @@ local Cutplane = {
|
||||
--Parent = transforms.SunIAU.Identifier,
|
||||
Transform = {
|
||||
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},
|
||||
@@ -38,67 +47,43 @@ local Cutplane = {
|
||||
}
|
||||
},
|
||||
Renderable = {
|
||||
Type = "RenderableTimeVaryingPlaneImageLocal",
|
||||
Type = "RenderablePlaneTimeVaryingImage",
|
||||
Size = 1.57*10^11,
|
||||
Enabled = true,
|
||||
Enabled = false,
|
||||
Texture = TexturesPathEquitorial,
|
||||
BlendMode = "Normal",
|
||||
Opacity = 0,
|
||||
},
|
||||
MirrorBackside = false,
|
||||
Opacity = 0.7
|
||||
},
|
||||
GUI = {
|
||||
Name = "Cutplane Equitorial",
|
||||
Path = "/Solar System/Heliosphere"
|
||||
},
|
||||
};
|
||||
|
||||
--local Cutplane2 = {
|
||||
-- Identifier = "Cutplane2",
|
||||
-- Parent = transformssun.HNMReferenceFrame.Identifier,
|
||||
-- Transform = {
|
||||
--Rotation = {
|
||||
--Type = "StaticRotation",
|
||||
--Rotation = {-1.5707965, -3.141593, 0}
|
||||
--}
|
||||
local Cutplane2 = {
|
||||
Identifier = "Cutplane2",
|
||||
Parent = transformssun.HNMReferenceFrame.Identifier,
|
||||
Transform = {
|
||||
Rotation = {
|
||||
Type = "StaticRotation",
|
||||
Rotation = {-1.5707965, -3.141593, 0}
|
||||
}
|
||||
},
|
||||
Renderable = {
|
||||
Type = "RenderablePlaneTimeVaryingImage",
|
||||
Size = 1.57*10^11,
|
||||
Enabled = false,
|
||||
Texture = TexturesPathMeridial,
|
||||
BlendMode = "Normal",
|
||||
MirrorBackside = false,
|
||||
Opacity = 0.7
|
||||
},
|
||||
GUI = {
|
||||
Name = "Cutplane Meridial",
|
||||
Path = "/Solar System/Heliosphere"
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
--Rotation = {
|
||||
-- Type = "FixedRotation",
|
||||
-- XAxis = {-0.63338087262755016203262119192353, -0.77384020972650618518999944537717, 0.0},
|
||||
-- YAxis = {0.77384020972650618518999944537717, -0.63338087262755016203262119192353, 0.0},
|
||||
--ZAxis = {0.0, 0.0, 1.0}
|
||||
-- }
|
||||
--Rotation = {
|
||||
--Type = "FixedRotation",
|
||||
-- XAxis = {0.95741409339769648946, 1.1697314441411185352, 0.0},
|
||||
-- YAxis = {-2.4310909859953234782, 1.9898249157806033154, 0.0},
|
||||
-- ZAxis = {0.0, 0.0, 2.178407}
|
||||
--}
|
||||
-- Rotation = {
|
||||
-- Type = "FixedRotation",
|
||||
-- XAxis = {0, 0, 1},
|
||||
-- YAxis = {0.7738402097265061, -0.6333808726275502, 0.0},
|
||||
-- ZAxis = {0.6333808726275502, 0.7738402097265061, 1}
|
||||
--}
|
||||
-- Rotation = {
|
||||
-- Type = "FixedRotation",
|
||||
-- XAxis = {0, 0, 1},
|
||||
-- YAxis = {-0.6333808726275502, -0.7738402097265061, 0},
|
||||
-- ZAxis = {0.7738402097265061, -0.6333808726275502, 1}
|
||||
--}
|
||||
--},
|
||||
--Renderable = {
|
||||
-- Type = "RenderableTimeVaryingPlaneImageLocal",
|
||||
-- Size = 1.57*10^11,
|
||||
-- Enabled = true,
|
||||
-- Texture = TexturesPathMeridial,
|
||||
-- BlendMode = "Normal",
|
||||
-- Opacity = 1,
|
||||
--},
|
||||
--GUI = {
|
||||
--Name = "Cutplane Meridial",
|
||||
-- Path = "/Solar System/Heliosphere"
|
||||
--},
|
||||
--};
|
||||
|
||||
--assetHelper.registerSceneGraphNodesAndExport(asset, { Cutplane, Cutplane2})
|
||||
assetHelper.registerSceneGraphNodesAndExport(asset, { Cutplane})
|
||||
assetHelper.registerSceneGraphNodesAndExport(asset, { Cutplane, Cutplane2})
|
||||
--assetHelper.registerSceneGraphNodesAndExport(asset, { Cutplane})
|
||||
|
||||
@@ -23,9 +23,10 @@
|
||||
"scene/solarsystem/planets/earth/satellites/misc/iss"
|
||||
],
|
||||
"camera": {
|
||||
"altitude": 3400000000.0,
|
||||
"anchor": "Sun",
|
||||
"latitude": 58.5877,
|
||||
"longitude": 16.1924,
|
||||
"latitude": 20.5877,
|
||||
"longitude": -35.1924,
|
||||
"type": "goToGeo"
|
||||
},
|
||||
"delta_times": [
|
||||
|
||||
@@ -58,6 +58,14 @@ namespace {
|
||||
"transformations."
|
||||
};
|
||||
|
||||
constexpr openspace::properties::Property::PropertyInfo MirrorBacksideInfo = {
|
||||
"MirrorBackside",
|
||||
"Mirror backside of image plane",
|
||||
"If this value is set to false, the image plane will not be mirrored when "
|
||||
"looking from the backside. This is usually desirable when the image shows "
|
||||
"data at a specific location, but not if it is desplaying text for example."
|
||||
};
|
||||
|
||||
constexpr openspace::properties::Property::PropertyInfo SizeInfo = {
|
||||
"Size",
|
||||
"Size (in meters)",
|
||||
@@ -74,6 +82,9 @@ namespace {
|
||||
// [[codegen::verbatim(BillboardInfo.description)]]
|
||||
std::optional<bool> billboard;
|
||||
|
||||
// [[codegen::verbatim(MirrorBacksideInfo.description)]]
|
||||
std::optional<bool> mirrorBackside;
|
||||
|
||||
// [[codegen::verbatim(SizeInfo.description)]]
|
||||
float size;
|
||||
|
||||
@@ -99,6 +110,7 @@ RenderablePlane::RenderablePlane(const ghoul::Dictionary& dictionary)
|
||||
: Renderable(dictionary)
|
||||
, _blendMode(BlendModeInfo, properties::OptionProperty::DisplayType::Dropdown)
|
||||
, _billboard(BillboardInfo, false)
|
||||
, _mirrorBackside(MirrorBacksideInfo, true)
|
||||
, _size(SizeInfo, 10.f, 0.f, 1e25f)
|
||||
{
|
||||
Parameters p = codegen::bake<Parameters>(dictionary);
|
||||
@@ -108,6 +120,7 @@ RenderablePlane::RenderablePlane(const ghoul::Dictionary& dictionary)
|
||||
|
||||
_size = p.size;
|
||||
_billboard = p.billboard.value_or(_billboard);
|
||||
_mirrorBackside = p.mirrorBackside.value_or(_mirrorBackside);
|
||||
|
||||
_blendMode.addOptions({
|
||||
{ BlendModeNormal, "Normal" },
|
||||
@@ -196,6 +209,8 @@ void RenderablePlane::render(const RenderData& data, RendererTasks&) {
|
||||
_shader->activate();
|
||||
_shader->setUniform("opacity", _opacity);
|
||||
|
||||
_shader->setUniform("mirrorBackside", _mirrorBackside);
|
||||
|
||||
glm::dvec3 objectPositionWorld = glm::dvec3(
|
||||
glm::translate(
|
||||
glm::dmat4(1.0),
|
||||
|
||||
@@ -74,6 +74,7 @@ private:
|
||||
void createPlane();
|
||||
|
||||
properties::BoolProperty _billboard;
|
||||
properties::BoolProperty _mirrorBackside;
|
||||
properties::FloatProperty _size;
|
||||
|
||||
ghoul::opengl::ProgramObject* _shader = nullptr;
|
||||
|
||||
@@ -32,6 +32,7 @@ in vec3 vs_gNormal;
|
||||
uniform sampler2D texture1;
|
||||
uniform bool additiveBlending;
|
||||
uniform float opacity = 1.0;
|
||||
uniform bool mirrorBackside = true;
|
||||
|
||||
|
||||
Fragment getFragment() {
|
||||
@@ -40,7 +41,12 @@ Fragment getFragment() {
|
||||
frag.color = texture(texture1, vs_st);
|
||||
}
|
||||
else {
|
||||
frag.color = texture(texture1, vec2(1 - vs_st.s, vs_st.t));
|
||||
if (mirrorBackside){
|
||||
frag.color = texture(texture1, vec2(1 - vs_st.s, vs_st.t));
|
||||
}
|
||||
else {
|
||||
frag.color = texture(texture1, vs_st);
|
||||
}
|
||||
}
|
||||
|
||||
frag.color.a *= opacity;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include <modules/streamnodes/rendering/renderabletimevaryingplaneimagelocal.h>
|
||||
#include <modules/streamnodes/rendering/renderableplanetimevaryingimage.h>
|
||||
#include <ghoul/misc/profiling.h>
|
||||
#include <modules/base/basemodule.h>
|
||||
#include <openspace/documentation/documentation.h>
|
||||
@@ -57,7 +57,7 @@ namespace {
|
||||
|
||||
namespace openspace {
|
||||
|
||||
documentation::Documentation RenderableTimeVaryingPlaneImageLocal::Documentation() {
|
||||
documentation::Documentation RenderablePlaneTimeVaryingImage::Documentation() {
|
||||
using namespace documentation;
|
||||
return {
|
||||
"Renderable Plane Image Local",
|
||||
@@ -88,7 +88,7 @@ namespace openspace {
|
||||
};
|
||||
}
|
||||
|
||||
RenderableTimeVaryingPlaneImageLocal::RenderableTimeVaryingPlaneImageLocal(const ghoul::Dictionary& dictionary)
|
||||
RenderablePlaneTimeVaryingImage::RenderablePlaneTimeVaryingImage(const ghoul::Dictionary& dictionary)
|
||||
: RenderablePlane(dictionary)
|
||||
, _texturePath(TextureInfo)
|
||||
{
|
||||
@@ -150,13 +150,13 @@ namespace openspace {
|
||||
}
|
||||
}
|
||||
|
||||
bool RenderableTimeVaryingPlaneImageLocal::isReady() const {
|
||||
bool RenderablePlaneTimeVaryingImage::isReady() const {
|
||||
return RenderablePlane::isReady();
|
||||
}
|
||||
|
||||
#pragma optimize ("", off)
|
||||
|
||||
void RenderableTimeVaryingPlaneImageLocal::initializeGL() {
|
||||
void RenderablePlaneTimeVaryingImage::initializeGL() {
|
||||
RenderablePlane::initializeGL();
|
||||
|
||||
LDEBUG("sourcefiles size:" + std::to_string(_sourceFiles.size()));
|
||||
@@ -254,9 +254,10 @@ namespace openspace {
|
||||
if (!_isLoadingLazily) {
|
||||
loadTexture();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
bool RenderableTimeVaryingPlaneImageLocal::extractMandatoryInfoFromDictionary()
|
||||
bool RenderablePlaneTimeVaryingImage::extractMandatoryInfoFromDictionary()
|
||||
{
|
||||
// Ensure that the source folder exists and then extract
|
||||
// the files with the same extension as <inputFileTypeString>
|
||||
@@ -288,24 +289,21 @@ namespace openspace {
|
||||
LDEBUG("returning true");
|
||||
return true;
|
||||
}
|
||||
void RenderableTimeVaryingPlaneImageLocal::deinitializeGL() {
|
||||
void RenderablePlaneTimeVaryingImage::deinitializeGL() {
|
||||
_textureFile = nullptr;
|
||||
|
||||
|
||||
BaseModule::TextureManager.release(_texture);
|
||||
// for (int i = 0; i < _textureFiles.size(); ++i) {
|
||||
// BaseModule::TextureManager.release(_textureFiles[i]);
|
||||
// }
|
||||
|
||||
_textureFiles.clear();
|
||||
RenderablePlane::deinitializeGL();
|
||||
}
|
||||
|
||||
void RenderableTimeVaryingPlaneImageLocal::bindTexture() {
|
||||
void RenderablePlaneTimeVaryingImage::bindTexture() {
|
||||
_texture->bind();
|
||||
// _textureFiles[_activeTriggerTimeIndex]->bind();
|
||||
}
|
||||
|
||||
void RenderableTimeVaryingPlaneImageLocal::update(const UpdateData& data) {
|
||||
void RenderablePlaneTimeVaryingImage::update(const UpdateData& data) {
|
||||
ZoneScoped
|
||||
RenderablePlane::update(data);
|
||||
|
||||
@@ -313,49 +311,49 @@ namespace openspace {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
const double currentTime = data.time.j2000Seconds();
|
||||
const bool isInInterval = (currentTime >= _startTimes[0]) &&
|
||||
(currentTime < _sequenceEndTime);
|
||||
//const bool isInInterval = true;
|
||||
if (isInInterval) {
|
||||
ZoneScopedN("isInInterval")
|
||||
const size_t nextIdx = _activeTriggerTimeIndex + 1;
|
||||
if (
|
||||
// true => Previous frame was not within the sequence interval
|
||||
//_activeTriggerTimeIndex < 0 ||
|
||||
// true => We stepped back to a time represented by another state
|
||||
currentTime < _startTimes[_activeTriggerTimeIndex] ||
|
||||
// true => We stepped forward to a time represented by another state
|
||||
(nextIdx < _nStates && currentTime >= _startTimes[nextIdx]))
|
||||
{
|
||||
updateActiveTriggerTimeIndex(currentTime);
|
||||
//LDEBUG("Vi borde uppdatera1");
|
||||
const double currentTime = data.time.j2000Seconds();
|
||||
const bool isInInterval = (currentTime >= _startTimes[0]) &&
|
||||
(currentTime < _sequenceEndTime);
|
||||
//const bool isInInterval = true;
|
||||
if (isInInterval) {
|
||||
ZoneScopedN("isInInterval")
|
||||
const size_t nextIdx = _activeTriggerTimeIndex + 1;
|
||||
if (
|
||||
// true => Previous frame was not within the sequence interval
|
||||
//_activeTriggerTimeIndex < 0 ||
|
||||
// true => We stepped back to a time represented by another state
|
||||
currentTime < _startTimes[_activeTriggerTimeIndex] ||
|
||||
// true => We stepped forward to a time represented by another state
|
||||
(nextIdx < _nStates && currentTime >= _startTimes[nextIdx]))
|
||||
{
|
||||
updateActiveTriggerTimeIndex(currentTime);
|
||||
//LDEBUG("Vi borde uppdatera1");
|
||||
|
||||
// _mustLoadNewStateFromDisk = true;
|
||||
//LDEBUG("vi borde uppdatera");
|
||||
_needsUpdate = true;
|
||||
// _mustLoadNewStateFromDisk = true;
|
||||
//LDEBUG("vi borde uppdatera");
|
||||
_needsUpdate = true;
|
||||
|
||||
} // else {we're still in same state as previous frame (no changes needed)}
|
||||
}
|
||||
else {
|
||||
ZoneScopedN("else")
|
||||
//not in interval => set everything to false
|
||||
//LDEBUG("not in interval");
|
||||
_activeTriggerTimeIndex = 0;
|
||||
_needsUpdate = false;
|
||||
}
|
||||
} // else we're still in same state as previous frame (no changes needed)
|
||||
}
|
||||
else {
|
||||
ZoneScopedN("else")
|
||||
//not in interval => set everything to false
|
||||
//LDEBUG("not in interval");
|
||||
_activeTriggerTimeIndex = 0;
|
||||
_needsUpdate = false;
|
||||
}
|
||||
|
||||
if ((_needsUpdate || _textureIsDirty) && !_isLoadingTexture) {
|
||||
ZoneScopedN("needsupdate")
|
||||
_isLoadingTexture = true;
|
||||
loadTexture();
|
||||
_textureIsDirty = false;
|
||||
}
|
||||
if ((_needsUpdate || _textureIsDirty) && !_isLoadingTexture) {
|
||||
ZoneScopedN("needsupdate")
|
||||
_isLoadingTexture = true;
|
||||
loadTexture();
|
||||
_textureIsDirty = false;
|
||||
}
|
||||
glFrontFace(GL_CCW);
|
||||
}
|
||||
// Extract J2000 time from file names
|
||||
// Requires files to be named as such: 'YYYY-MM-DDTHH-MM-SS-XXX.json'
|
||||
void RenderableTimeVaryingPlaneImageLocal::extractTriggerTimesFromFileNames() {
|
||||
void RenderablePlaneTimeVaryingImage::extractTriggerTimesFromFileNames() {
|
||||
// number of characters in filename (excluding '.json')
|
||||
constexpr const int FilenameSize = 23;
|
||||
// size(".json")
|
||||
@@ -380,7 +378,7 @@ namespace openspace {
|
||||
_startTimes.push_back(triggerTime);
|
||||
}
|
||||
}
|
||||
void RenderableTimeVaryingPlaneImageLocal::updateActiveTriggerTimeIndex(double currentTime) {
|
||||
void RenderablePlaneTimeVaryingImage::updateActiveTriggerTimeIndex(double currentTime) {
|
||||
auto iter = std::upper_bound(_startTimes.begin(), _startTimes.end(), currentTime);
|
||||
if (iter != _startTimes.end()) {
|
||||
if (iter != _startTimes.begin()) {
|
||||
@@ -396,7 +394,7 @@ namespace openspace {
|
||||
_activeTriggerTimeIndex = static_cast<int>(_nStates) - 1;
|
||||
}
|
||||
}
|
||||
void RenderableTimeVaryingPlaneImageLocal::computeSequenceEndTime() {
|
||||
void RenderablePlaneTimeVaryingImage::computeSequenceEndTime() {
|
||||
if (_nStates > 1) {
|
||||
const double lastTriggerTime = _startTimes[_nStates - 1];
|
||||
const double sequenceDuration = lastTriggerTime - _startTimes[0];
|
||||
@@ -409,7 +407,7 @@ namespace openspace {
|
||||
_sequenceEndTime = DBL_MAX;
|
||||
}
|
||||
}
|
||||
void RenderableTimeVaryingPlaneImageLocal::loadTexture() {
|
||||
void RenderablePlaneTimeVaryingImage::loadTexture() {
|
||||
if (_activeTriggerTimeIndex != -1) {
|
||||
// ghoul::opengl::Texture* t = _texture;
|
||||
//std::unique_ptr<ghoul::opengl::Texture> t = _texture;
|
||||
@@ -37,9 +37,9 @@ namespace openspace {
|
||||
|
||||
namespace documentation { struct Documentation; }
|
||||
|
||||
class RenderableTimeVaryingPlaneImageLocal : public RenderablePlane {
|
||||
class RenderablePlaneTimeVaryingImage : public RenderablePlane {
|
||||
public:
|
||||
RenderableTimeVaryingPlaneImageLocal(const ghoul::Dictionary& dictionary);
|
||||
RenderablePlaneTimeVaryingImage(const ghoul::Dictionary& dictionary);
|
||||
|
||||
void initializeGL() override;
|
||||
void deinitializeGL() override;
|
||||
@@ -50,10 +50,11 @@
|
||||
#include <openspace/json.h>
|
||||
#include <openspace/query/query.h>
|
||||
#include <sys/stat.h>
|
||||
// This is a call to use the nlohmann json file
|
||||
#pragma
|
||||
|
||||
// This is a call to use the nlohmann json file
|
||||
using json = nlohmann::json;
|
||||
|
||||
#pragma optimize("", off)
|
||||
|
||||
namespace {
|
||||
@@ -75,9 +76,9 @@ namespace {
|
||||
"filterLower", "filterUpper", "scalingMode", "colorTableRange", "domainLimZ",
|
||||
"nodeSkip", "nodeSkipDefault", "nodeSkipEarth", "nodeSkipMethod",
|
||||
"nodeSkipFluxThreshold", "nodeSkipRadiusThreshold", "fluxColorAlpha",
|
||||
"fluxColorAlphaIlluminance", "earthPos", "distanceThreshold", "activeStreamNumber",
|
||||
"enhanceMethod", "flowColor", "usingParticles", "usingInterestingStreams",
|
||||
"particleSize", "particleSpacing", "particleSpeed"
|
||||
"fluxColorAlphaIlluminance", "earthPos", "distanceThreshold",
|
||||
"activeStreamNumber", "enhanceMethod", "flowColor", "usingParticles",
|
||||
"usingInterestingStreams","particleSize", "particleSpacing", "particleSpeed"
|
||||
};
|
||||
constexpr const std::array<const char*, 14> UniformNames2 = {
|
||||
"time", "flowColoring", "maxNodeDistanceSize", "usingCameraPerspective",
|
||||
@@ -209,7 +210,9 @@ namespace {
|
||||
"Flux Color Alpha",
|
||||
"The value of alpha for the flux color mode."
|
||||
};
|
||||
constexpr openspace::properties::Property::PropertyInfo FluxColorAlphaIlluminanceInfo = {
|
||||
constexpr openspace::properties::Property::PropertyInfo
|
||||
FluxColorAlphaIlluminanceInfo =
|
||||
{
|
||||
"fluxColorAlphaIlluminance",
|
||||
"Flux Color Alpha for illuminance",
|
||||
"The value of alpha for the flux color mode."
|
||||
@@ -219,7 +222,9 @@ namespace {
|
||||
"Skipping Nodes By Flux",
|
||||
"Select nodes to skip depending on flux value."
|
||||
};
|
||||
constexpr openspace::properties::Property::PropertyInfo RadiusNodeSkipThresholdInfo = {
|
||||
constexpr openspace::properties::Property::PropertyInfo
|
||||
RadiusNodeSkipThresholdInfo =
|
||||
{
|
||||
"skippingNodesByRadius",
|
||||
"Skipping Nodes By Radius",
|
||||
"Select nodes to skip depending on Radius."
|
||||
@@ -305,10 +310,13 @@ namespace {
|
||||
"Node Distance Threshold",
|
||||
"Threshold for where to interpolate between the max and min node distance."
|
||||
};
|
||||
constexpr openspace::properties::Property::PropertyInfo CameraPerspectiveEnabledInfo = {
|
||||
constexpr openspace::properties::Property::PropertyInfo
|
||||
CameraPerspectiveEnabledInfo =
|
||||
{
|
||||
"cameraPerspectiveEnabled",
|
||||
"Use Camera perspective",
|
||||
"Camera perspective changes the size of the nodes dependent on distance from camera."
|
||||
"Camera perspective changes the size of the nodes dependent on "
|
||||
"distance from camera."
|
||||
};
|
||||
constexpr openspace::properties::Property::PropertyInfo DrawingCirclesInfo = {
|
||||
"renderingcircles",
|
||||
@@ -326,15 +334,21 @@ namespace {
|
||||
"Using fragment shader to draw nodes with Gaussian filter for alpha value."
|
||||
|
||||
};
|
||||
constexpr openspace::properties::Property::PropertyInfo RadiusPerspectiveEnabledInfo = {
|
||||
constexpr openspace::properties::Property::PropertyInfo
|
||||
RadiusPerspectiveEnabledInfo =
|
||||
{
|
||||
"radiusPerspectiveEnabled",
|
||||
"Include radius with cameraperspective",
|
||||
"If false, then nodes closer to the sun will not be larger regardless of distance to camera."
|
||||
"If false, then nodes closer to the sun will not be larger "
|
||||
"regardless of distance to camera."
|
||||
};
|
||||
constexpr openspace::properties::Property::PropertyInfo PerspectiveDistanceFactorInfo = {
|
||||
constexpr openspace::properties::Property::PropertyInfo
|
||||
PerspectiveDistanceFactorInfo =
|
||||
{
|
||||
"perspectiveDistanceFactor",
|
||||
"Perspective Distance factor",
|
||||
"This value decides how far away the camera must be to start impacting the node size."
|
||||
"This value decides how far away the camera must be to start "
|
||||
"impacting the node size."
|
||||
};
|
||||
constexpr openspace::properties::Property::PropertyInfo MinNodeSizeInfo = {
|
||||
"minNodeSize",
|
||||
@@ -472,15 +486,15 @@ void RenderableStreamNodes::definePropertyCallbackFunctions() {
|
||||
});
|
||||
|
||||
_pGoesEnergyBins.onChange([this] {
|
||||
if (_pGoesEnergyBins == 1) { // 1 == Emin03 == Mev > 100
|
||||
if (_pGoesEnergyBins.option().value == 1) { // 1 == Emin03 == Mev > 100
|
||||
if (_shouldreadBinariesDirectly) {
|
||||
bool success = loadBinaryfilesDirectly("_emin03");
|
||||
bool success = loadBinaryfilesDirectly(""); // empty string == emin03 for default
|
||||
if (success) return;
|
||||
}
|
||||
}
|
||||
else if(_pGoesEnergyBins == 0) { // 0 == Emin01 == Mev > 10
|
||||
else if(_pGoesEnergyBins.option().value == 0) { // 0 == Emin01 == Mev > 10
|
||||
if (_shouldreadBinariesDirectly) {
|
||||
bool success = loadBinaryfilesDirectly("");
|
||||
bool success = loadBinaryfilesDirectly("_emin01");
|
||||
if (success) return;
|
||||
}
|
||||
}
|
||||
@@ -509,10 +523,13 @@ void RenderableStreamNodes::setModelDependentConstants() {
|
||||
_pDomainZ.setMaxValue(glm::vec2(limitZMax));
|
||||
_pDomainZ = glm::vec2(limitZMin, limitZMax);
|
||||
}
|
||||
|
||||
void RenderableStreamNodes::initialize() {
|
||||
|
||||
}
|
||||
|
||||
void RenderableStreamNodes::initializeGL() {
|
||||
// EXTRACT MANDATORY INFORMATION FROM DICTIONARY
|
||||
// std::string filepath = "C:/Users/chrad171//openspace/OpenSpace/sync/http/bastille_day_streamnodes/1/datawithoutprettyprint_newmethod.json";
|
||||
|
||||
if (!extractMandatoryInfoFromDictionary()) {
|
||||
return;
|
||||
@@ -606,11 +623,11 @@ void RenderableStreamNodes::loadNodeData() {
|
||||
if (_shouldreadBinariesDirectly) {
|
||||
bool success = false;
|
||||
if(_shouldloademin03directly){
|
||||
success = loadBinaryfilesDirectly("_emin03");
|
||||
_pGoesEnergyBins = 1;
|
||||
success = loadBinaryfilesDirectly("");
|
||||
//_pGoesEnergyBins.addOption(1,"");
|
||||
}
|
||||
else {
|
||||
success = loadBinaryfilesDirectly("");
|
||||
success = loadBinaryfilesDirectly("_emin01");
|
||||
}
|
||||
if(success) return;
|
||||
}
|
||||
@@ -655,7 +672,7 @@ void RenderableStreamNodes::loadNodeData() {
|
||||
cachedFile, _file
|
||||
));
|
||||
//Read in the data from the cached file
|
||||
bool success = loadBinaryfilesDirectly("_emin03"); //readCachedFile(cachedfile, "")
|
||||
bool success = loadBinaryfilesDirectly(""); //readCachedFile(cachedfile, "")
|
||||
if (!success) {
|
||||
// If something went wrong it is probably because we changed
|
||||
// the cache version or some file was not found.
|
||||
@@ -849,9 +866,9 @@ bool RenderableStreamNodes::loadBinaryfilesDirectly(const std::string& energybin
|
||||
//std::string _file2 = _binarySourceFilePath + "\\StreamnodesCacheColorv3" + energybin;
|
||||
//std::string _file3 = _binarySourceFilePath + "\\StreamnodesCacheRadiusv3" + energybin;
|
||||
|
||||
std::string _file = _binarySourceFilePath + "\\positions";
|
||||
std::string _file2 = _binarySourceFilePath + "\\fluxes";
|
||||
std::string _file3 = _binarySourceFilePath + "\\radiuses";
|
||||
std::string _file = _binarySourceFilePath + "\\positions" + energybin;
|
||||
std::string _file2 = _binarySourceFilePath + "\\fluxes" + energybin;
|
||||
std::string _file3 = _binarySourceFilePath + "\\radiuses" + energybin;
|
||||
//ghoul::filesystem::File file(_file);
|
||||
|
||||
//std::string cachedFile = FileSys.cacheManager()->cachedFilename(
|
||||
|
||||
@@ -43,6 +43,7 @@ class RenderableStreamNodes : public Renderable {
|
||||
public:
|
||||
RenderableStreamNodes(const ghoul::Dictionary& dictionary);
|
||||
|
||||
void initialize() override;
|
||||
void initializeGL() override;
|
||||
void deinitializeGL() override;
|
||||
|
||||
|
||||
@@ -479,6 +479,8 @@ void RenderableTimeVaryingSphere::render(const RenderData& data, RendererTasks&)
|
||||
else if (orientation == Orientation::Both) {
|
||||
glEnable(GL_CULL_FACE);
|
||||
}
|
||||
glDisable(GL_CULL_FACE);
|
||||
|
||||
}
|
||||
bool RenderableTimeVaryingSphere::extractMandatoryInfoFromDictionary()
|
||||
{
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
#include <modules/streamnodes/streamnodesmodule.h>
|
||||
#include <modules/streamnodes/rendering/renderablestreamnodes.h>
|
||||
#include <modules/streamnodes/rendering/renderablelighttravel.h>
|
||||
#include <modules/streamnodes/rendering/renderabletimevaryingplaneimagelocal.h>
|
||||
#include <modules/streamnodes/rendering/renderableplanetimevaryingimage.h>
|
||||
#include <modules/streamnodes/rendering/renderabletimevaryingsphere.h>
|
||||
#include <openspace/util/factorymanager.h>
|
||||
#include <ghoul/filesystem/filesystem.h>
|
||||
@@ -64,7 +64,8 @@ void StreamNodesModule::internalInitialize(const ghoul::Dictionary&) {
|
||||
|
||||
factory->registerClass<RenderableStreamNodes>("RenderableStreamNodes");
|
||||
factory->registerClass<RenderableLightTravel>("RenderableLightTravel");
|
||||
factory->registerClass<RenderableTimeVaryingPlaneImageLocal>("RenderableTimeVaryingPlaneImageLocal");
|
||||
factory->registerClass<RenderablePlaneTimeVaryingImage>
|
||||
("RenderablePlaneTimeVaryingImage");
|
||||
factory->registerClass<RenderableTimeVaryingSphere>("RenderableTimeVaryingSphere");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user