mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-02-22 04:49:12 -06:00
removed flow functionality. Was never used and is more confusing than not imo.
This commit is contained in:
@@ -35,8 +35,7 @@ local Fluxnodes = {
|
||||
ColorTablePaths = {
|
||||
Standard = asset.localResource("transferfunctions/flux-nodes.txt"),
|
||||
CMR = asset.localResource("transferfunctions/CMR.txt"),
|
||||
Earth = asset.localResource("transferfunctions/flux-nodes-grey-scale.txt"),
|
||||
Flow = asset.localResource("transferfunctions/flux-nodes-flow.txt")
|
||||
Earth = asset.localResource("transferfunctions/flux-nodes-grey-scale.txt")
|
||||
},
|
||||
|
||||
LoadAtRuntime = true,
|
||||
|
||||
@@ -54,17 +54,16 @@ namespace {
|
||||
constexpr int8_t CurrentCacheVersion = 2;
|
||||
|
||||
//streamColor, nodeSize, nodeSizeLargerFlux, thresholdFlux,
|
||||
constexpr const std::array<const char*, 26> UniformNames = {
|
||||
constexpr const std::array<const char*, 21> UniformNames = {
|
||||
"streamColor", "nodeSize", "nodeSizeLargerFlux", "thresholdFlux", "colorMode",
|
||||
"filterLower", "filterUpper", "scalingMode", "colorTableRange", "domainLimZ",
|
||||
"nodeSkip", "nodeSkipDefault", "nodeSkipEarth", "nodeSkipMethod",
|
||||
"nodeSkipFluxThreshold", "nodeSkipRadiusThreshold", "fluxColorAlpha",
|
||||
"fluxColorAlphaIlluminance", "earthPos", "distanceThreshold",
|
||||
"enhanceMethod", "flowColor", "usingParticles",
|
||||
"particleSize", "particleSpacing", "particleSpeed"
|
||||
"enhanceMethod"
|
||||
};
|
||||
constexpr const std::array<const char*, 13> UniformNames2 = {
|
||||
"time", "flowColoring", "maxNodeDistanceSize", "usingCameraPerspective",
|
||||
constexpr const std::array<const char*, 12> UniformNames2 = {
|
||||
"time", "maxNodeDistanceSize", "usingCameraPerspective",
|
||||
"drawCircles", "drawHollow", "useGaussian", "usingRadiusPerspective",
|
||||
"perspectiveDistanceFactor", "minMaxNodeSize", "usingPulse",
|
||||
"usingGaussianPulse", "pulsatingAlways"
|
||||
@@ -319,7 +318,6 @@ namespace {
|
||||
|
||||
struct TransferFunctions {
|
||||
std::string standard;
|
||||
std::string flow;
|
||||
std::string earth;
|
||||
std::string cmr [[codegen::key("CMR")]];
|
||||
};
|
||||
@@ -370,19 +368,19 @@ RenderableFluxNodes::RenderableFluxNodes(const ghoul::Dictionary& dictionary)
|
||||
, _radiusNodeSkipThreshold(RadiusNodeSkipThresholdInfo, 0.f, 0.f, 5.f)
|
||||
, _earthdistGroup({ "Earthfocus" })
|
||||
, _distanceThreshold(DistanceThresholdInfo, 0.0f, 0.0f, 1.0f)
|
||||
, _flowColor(
|
||||
FlowColorInfo,
|
||||
glm::vec4(0.96f, 0.88f, 0.8f, 0.5f),
|
||||
glm::vec4(0.f),
|
||||
glm::vec4(1.f)
|
||||
)
|
||||
, _flowEnabled(FlowEnabledInfo, false)
|
||||
//, _flowColor(
|
||||
// FlowColorInfo,
|
||||
// glm::vec4(0.96f, 0.88f, 0.8f, 0.5f),
|
||||
// glm::vec4(0.f),
|
||||
// glm::vec4(1.f)
|
||||
//)
|
||||
//, _flowEnabled(FlowEnabledInfo, false)
|
||||
, _interestingStreamsEnabled(InterestingStreamsInfo, false)
|
||||
, _flowGroup({ "Flow" })
|
||||
, _flowParticleSize(FlowParticleSizeInfo, 5, 0, 500)
|
||||
, _flowParticleSpacing(FlowParticleSpacingInfo, 60, 0, 500)
|
||||
, _flowSpeed(FlowSpeedInfo, 20, 0, 1000)
|
||||
, _useFlowColor(UseFlowColorInfo, false)
|
||||
//, _flowParticleSize(FlowParticleSizeInfo, 5, 0, 500)
|
||||
//, _flowParticleSpacing(FlowParticleSpacingInfo, 60, 0, 500)
|
||||
//, _flowSpeed(FlowSpeedInfo, 20, 0, 1000)
|
||||
//, _useFlowColor(UseFlowColorInfo, false)
|
||||
, _maxNodeDistanceSize(MaxNodeDistanceSizeInfo, 1.f, 1.f, 10.f)
|
||||
, _nodeDistanceThreshold(NodeDistanceThresholdInfo, 0.f, 0.f, 40.f)
|
||||
, _cameraPerspectiveEnabled(CameraPerspectiveEnabledInfo, false)
|
||||
@@ -402,7 +400,6 @@ RenderableFluxNodes::RenderableFluxNodes(const ghoul::Dictionary& 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);
|
||||
|
||||
_colorTablePath = p.colorTablePaths.standard;
|
||||
|
||||
@@ -593,7 +590,6 @@ void RenderableFluxNodes::setupProperties() {
|
||||
addPropertySubOwner(_nodesAmountGroup);
|
||||
addPropertySubOwner(_earthdistGroup);
|
||||
addPropertySubOwner(_cameraPerspectiveGroup);
|
||||
_earthdistGroup.addPropertySubOwner(_flowGroup);
|
||||
|
||||
_colorGroup.addProperty(_colorMode);
|
||||
_colorGroup.addProperty(_scalingMethod);
|
||||
@@ -623,12 +619,12 @@ void RenderableFluxNodes::setupProperties() {
|
||||
_earthdistGroup.addProperty(_enhancemethod);
|
||||
_earthdistGroup.addProperty(_interestingStreamsEnabled);
|
||||
|
||||
_flowGroup.addProperty(_flowEnabled);
|
||||
_flowGroup.addProperty(_flowColor);
|
||||
_flowGroup.addProperty(_flowParticleSize);
|
||||
_flowGroup.addProperty(_flowParticleSpacing);
|
||||
_flowGroup.addProperty(_flowSpeed);
|
||||
_flowGroup.addProperty(_useFlowColor);
|
||||
//_flowGroup.addProperty(_flowEnabled);
|
||||
//_flowGroup.addProperty(_flowColor);
|
||||
//_flowGroup.addProperty(_flowParticleSize);
|
||||
//_flowGroup.addProperty(_flowParticleSpacing);
|
||||
//_flowGroup.addProperty(_flowSpeed);
|
||||
//_flowGroup.addProperty(_useFlowColor);
|
||||
|
||||
_cameraPerspectiveGroup.addProperty(_cameraPerspectiveEnabled);
|
||||
_cameraPerspectiveGroup.addProperty(_perspectiveDistanceFactor);
|
||||
@@ -831,16 +827,10 @@ void RenderableFluxNodes::render(const RenderData& data, RendererTasks&) {
|
||||
_shaderProgram->setUniform(_uniformCache.earthPos, earthPos);
|
||||
_shaderProgram->setUniform(_uniformCache.distanceThreshold, _distanceThreshold);
|
||||
_shaderProgram->setUniform(_uniformCache.enhanceMethod, _enhancemethod);
|
||||
_shaderProgram->setUniform(_uniformCache.flowColor, _flowColor);
|
||||
_shaderProgram->setUniform(_uniformCache.usingParticles, _flowEnabled);
|
||||
_shaderProgram->setUniform(_uniformCache.particleSize, _flowParticleSize);
|
||||
_shaderProgram->setUniform(_uniformCache.particleSpacing, _flowParticleSpacing);
|
||||
_shaderProgram->setUniform(_uniformCache.particleSpeed, _flowSpeed);
|
||||
_shaderProgram->setUniform(
|
||||
_uniformCache2.time,
|
||||
global::windowDelegate->applicationTime()
|
||||
);
|
||||
_shaderProgram->setUniform(_uniformCache2.flowColoring, _useFlowColor);
|
||||
_shaderProgram->setUniform(
|
||||
_uniformCache2.maxNodeDistanceSize,
|
||||
_maxNodeDistanceSize
|
||||
@@ -875,7 +865,6 @@ void RenderableFluxNodes::render(const RenderData& data, RendererTasks&) {
|
||||
ghoul::opengl::TextureUnit textureUnit;
|
||||
ghoul::opengl::TextureUnit textureUnitCMR;
|
||||
ghoul::opengl::TextureUnit textureUnitEarth;
|
||||
ghoul::opengl::TextureUnit textureUnitFlow;
|
||||
if (_colorMode == static_cast<int>(ColorMethod::ByFluxValue)) {
|
||||
textureUnit.activate();
|
||||
_transferFunction->bind(); // Calls update internally
|
||||
@@ -888,10 +877,6 @@ void RenderableFluxNodes::render(const RenderData& data, RendererTasks&) {
|
||||
textureUnitEarth.activate();
|
||||
_transferFunctionEarth->bind(); // Calls update internally
|
||||
_shaderProgram->setUniform("colorTableEarth", textureUnitEarth);
|
||||
|
||||
textureUnitFlow.activate();
|
||||
_transferFunctionFlow->bind(); // Calls update internally
|
||||
_shaderProgram->setUniform("colorTableFlow", textureUnitFlow);
|
||||
}
|
||||
|
||||
glBindVertexArray(_vertexArrayObject);
|
||||
|
||||
@@ -98,10 +98,9 @@ private:
|
||||
filterLower, filterUpper, scalingMode, colorTableRange, domainLimZ, nodeSkip,
|
||||
nodeSkipDefault, nodeSkipEarth, nodeSkipMethod, nodeSkipFluxThreshold,
|
||||
nodeSkipRadiusThreshold, fluxColorAlpha, fluxColorAlphaIlluminance, earthPos,
|
||||
distanceThreshold, enhanceMethod, flowColor, usingParticles,
|
||||
particleSize, particleSpacing, particleSpeed)
|
||||
distanceThreshold, enhanceMethod)
|
||||
_uniformCache;
|
||||
UniformCache(time, flowColoring, maxNodeDistanceSize, usingCameraPerspective,
|
||||
UniformCache(time, maxNodeDistanceSize, usingCameraPerspective,
|
||||
drawCircles, drawHollow, useGaussian, usingRadiusPerspective,
|
||||
perspectiveDistanceFactor, minMaxNodeSize, usingPulse,
|
||||
usingGaussianPulse, pulsatingAlways)
|
||||
@@ -224,21 +223,21 @@ private:
|
||||
|
||||
// Flow Properties
|
||||
// Simulated particles' color
|
||||
properties::Vec4Property _flowColor;
|
||||
//properties::Vec4Property _flowColor;
|
||||
// Toggle flow [ON/OFF]
|
||||
properties::BoolProperty _flowEnabled;
|
||||
//properties::BoolProperty _flowEnabled;
|
||||
// Group to hold the flow/particle properties
|
||||
properties::PropertyOwner _flowGroup;
|
||||
// Size of simulated flow particles
|
||||
properties::IntProperty _flowParticleSize;
|
||||
//properties::IntProperty _flowParticleSize;
|
||||
// Size of simulated flow particles
|
||||
properties::IntProperty _flowParticleSpacing;
|
||||
//properties::IntProperty _flowParticleSpacing;
|
||||
// Toggle flow direction [FORWARDS/BACKWARDS]
|
||||
//properties::BoolProperty _pFlowReversed;
|
||||
// Speed of simulated flow
|
||||
properties::IntProperty _flowSpeed;
|
||||
//properties::IntProperty _flowSpeed;
|
||||
//Either use flowcolortable or FlowColor.
|
||||
properties::BoolProperty _useFlowColor;
|
||||
//properties::BoolProperty _useFlowColor;
|
||||
properties::PropertyOwner _cameraPerspectiveGroup;
|
||||
properties::BoolProperty _cameraPerspectiveEnabled;
|
||||
properties::BoolProperty _drawingCircles;
|
||||
|
||||
@@ -29,11 +29,11 @@
|
||||
// Should be provided in meters VaPosition
|
||||
layout(location = 0) in vec3 in_position;
|
||||
|
||||
// The extra value used to color lines. Location must correspond to VaColor in
|
||||
// The extra value used to color lines. Location must correspond to VaColor in
|
||||
// renderablefluxnodes.h
|
||||
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
|
||||
// VaFiltering in renderablefluxnodes.h
|
||||
layout(location = 2) in float rValue;
|
||||
|
||||
@@ -73,17 +73,9 @@ uniform int colorMode;
|
||||
uniform sampler1D colorTable;
|
||||
uniform sampler1D colorTableCMR;
|
||||
uniform sampler1D colorTableEarth;
|
||||
uniform sampler1D colorTableFlow;
|
||||
//uniform sampler1D colorTableFlow;
|
||||
uniform vec2 colorTableRange;
|
||||
|
||||
// Uniforms needed for Particle Flow
|
||||
uniform vec4 flowColor;
|
||||
uniform int particleSize;
|
||||
uniform int particleSpeed;
|
||||
uniform int particleSpacing;
|
||||
uniform bool usingParticles;
|
||||
uniform bool flowColoring;
|
||||
|
||||
// Masking Uniforms
|
||||
uniform bool usingMasking;
|
||||
uniform vec2 maskingRange;
|
||||
@@ -138,7 +130,7 @@ vec4 getTransferFunctionColor(sampler1D inColorTable) {
|
||||
scaleValue = rValue * fluxValue;
|
||||
}
|
||||
else if (scalingMode == log10RFlux) {
|
||||
//conversion from logbase e to log10 since glsl does not support log10.
|
||||
//conversion from logbase e to log10 since glsl does not support log10.
|
||||
float logtoTen = log(rValue) / log(10.0);
|
||||
scaleValue = logtoTen * fluxValue;
|
||||
}
|
||||
@@ -181,11 +173,6 @@ bool checkIfSkipVertex() {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool isParticle() {
|
||||
int modulusResult = int(double(particleSpeed) * time + gl_VertexID) % particleSpacing;
|
||||
return modulusResult > 0 && modulusResult <= particleSize;
|
||||
}
|
||||
|
||||
//function for showing nodes different depending on distance to earth
|
||||
void decideHowToShowCloseToEarth() {
|
||||
// SizeScaling
|
||||
@@ -203,7 +190,7 @@ void decideHowToShowCloseToEarth() {
|
||||
vec4 fluxColor3 = getTransferFunctionColor(colorTable);
|
||||
vs_color = vec4(fluxColor3.xyz, fluxColor3.a);
|
||||
|
||||
float tempR2 = rValue + 0.4;
|
||||
float tempR2 = rValue + 0.4;
|
||||
if (tempR2 > 1.5) {
|
||||
tempR2 = 1.5;
|
||||
}
|
||||
@@ -211,14 +198,14 @@ void decideHowToShowCloseToEarth() {
|
||||
}
|
||||
}
|
||||
|
||||
void checkdistanceMethod() {
|
||||
void checkdistanceMethod() {
|
||||
//Enhance by distance to Earth
|
||||
float maxdist = 10000000000.0 * perspectiveDistanceFactor;
|
||||
float distancevec = distance(earthPos, in_position.xyz);
|
||||
|
||||
vs_closeToEarth = 0.0;
|
||||
|
||||
if (distancevec < AUtoMeter * distanceThreshold && usingPulse) {
|
||||
if (distancevec < AUtoMeter * distanceThreshold && usingPulse) {
|
||||
vs_closeToEarth = 1.0;
|
||||
gl_PointSize = gl_PointSize * 5;
|
||||
vec4 fluxColor = getTransferFunctionColor(colorTable);
|
||||
@@ -246,7 +233,7 @@ void checkdistanceMethod() {
|
||||
}
|
||||
|
||||
if (fluxValue < thresholdFlux) {
|
||||
vs_color.a = fluxColorAlpha;
|
||||
vs_color.a = fluxColorAlpha;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -255,11 +242,11 @@ void main() {
|
||||
// Default gl_PointSize if it is not set anywhere else.
|
||||
gl_PointSize = 2;
|
||||
|
||||
// Checking if we should render the vertex dependent on the vertexindex,
|
||||
// Checking if we should render the vertex dependent on the vertexindex,
|
||||
// by using modulus.
|
||||
if (checkIfSkipVertex() ||
|
||||
if (checkIfSkipVertex() ||
|
||||
distance(earthPos, in_position) < (distanceThreshold * AUtoMeter) &&
|
||||
rValue/AUtoMeter > filterLower &&
|
||||
rValue/AUtoMeter > filterLower &&
|
||||
rValue/AUtoMeter < filterUpper &&
|
||||
in_position.z > (domainLimZ.x * AUtoMeter) &&
|
||||
in_position.z < (domainLimZ.y * AUtoMeter))
|
||||
@@ -268,7 +255,7 @@ void main() {
|
||||
if (colorMode == 0) {
|
||||
vec4 fluxColor = getTransferFunctionColor(colorTableCMR);
|
||||
if (fluxValue > thresholdFlux) {
|
||||
vs_color = vec4(fluxColor.xyz, fluxColor.a);
|
||||
vs_color = vec4(fluxColor.xyz, fluxColor.a);
|
||||
gl_PointSize = nodeSizeLargerFlux;
|
||||
}
|
||||
else {
|
||||
@@ -286,28 +273,9 @@ void main() {
|
||||
vs_color = vec4(0.0);
|
||||
}
|
||||
|
||||
if (usingParticles && isParticle() && rValue > 0.0) {
|
||||
int modulusResult = int(double(particleSpeed) * time + gl_VertexID)
|
||||
% particleSpacing;
|
||||
|
||||
if (modulusResult >= particleSize - 30) {
|
||||
if (flowColoring) {
|
||||
vec4 fluxColor3 = getTransferFunctionColor(colorTable);
|
||||
vs_color = vec4(fluxColor3.xyz, flowColor.a * 0.8);
|
||||
}
|
||||
else {
|
||||
vs_color = vec4(0.9, 0.9, 0.9, 0.5);
|
||||
}
|
||||
}
|
||||
else {
|
||||
vec4 fluxColorFlow = getTransferFunctionColor(colorTableFlow);
|
||||
vs_color = vec4(fluxColorFlow.xyz, 1.0);
|
||||
}
|
||||
}
|
||||
|
||||
if (usingCameraPerspective) {
|
||||
float rtemp = min(rValue, 1.0);
|
||||
|
||||
|
||||
float maxDistance = 100000000000.0 * perspectiveDistanceFactor;
|
||||
float distanceVec = distance(cameraPos, in_position.xyz);
|
||||
|
||||
@@ -327,22 +295,22 @@ void main() {
|
||||
else {
|
||||
factorS = pow(distScale, 9.0) * 500.0;
|
||||
}
|
||||
gl_PointSize = factorS * maxNodeDistanceSize * 0.8;
|
||||
gl_PointSize = factorS * maxNodeDistanceSize * 0.8;
|
||||
}
|
||||
|
||||
if (gl_PointSize > minMaxNodeSize.y) {
|
||||
gl_PointSize = minMaxNodeSize.y;
|
||||
}
|
||||
|
||||
|
||||
if (gl_PointSize < minMaxNodeSize.x) {
|
||||
gl_PointSize = minMaxNodeSize.x;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
vs_time = time;
|
||||
vec4 position_in_meters = vec4(in_position, 1.0);
|
||||
vec4 positionClipSpace = modelViewProjection * position_in_meters;
|
||||
|
||||
|
||||
gl_Position = vec4(positionClipSpace.xy, 0.0, positionClipSpace.w);
|
||||
vs_depth = gl_Position.w;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user