mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-04-23 04:30:09 -05:00
Merge branch 'master' into feature/PerformanceATM
This commit is contained in:
@@ -192,7 +192,7 @@ void DashboardItemSimulationIncrement::render(glm::vec2& penPosition) {
|
||||
double convertedT = convertTime(t, TimeUnit::Second, unit);
|
||||
deltaTime = { convertedT, nameForTimeUnit(unit, convertedT != 1.0) };
|
||||
}
|
||||
|
||||
|
||||
penPosition.y -= _font->height();
|
||||
RenderFont(
|
||||
*_font,
|
||||
|
||||
@@ -123,6 +123,10 @@ RenderableModel::RenderableModel(const ghoul::Dictionary& dictionary)
|
||||
"RenderableModel"
|
||||
);
|
||||
|
||||
addProperty(_opacity);
|
||||
registerUpdateRenderBinFromOpacity();
|
||||
|
||||
|
||||
if (dictionary.hasKey(KeyGeometry)) {
|
||||
std::string name = dictionary.value<std::string>(SceneGraphNode::KeyName);
|
||||
ghoul::Dictionary dict = dictionary.value<ghoul::Dictionary>(KeyGeometry);
|
||||
@@ -163,6 +167,7 @@ void RenderableModel::initializeGL() {
|
||||
absPath("${MODULE_BASE}/shaders/model_fs.glsl")
|
||||
);
|
||||
|
||||
_uniformCache.opacity = _programObject->uniformLocation("opacity");
|
||||
_uniformCache.directionToSunViewSpace = _programObject->uniformLocation(
|
||||
"directionToSunViewSpace"
|
||||
);
|
||||
@@ -176,6 +181,8 @@ void RenderableModel::initializeGL() {
|
||||
"performShading"
|
||||
);
|
||||
_uniformCache.texture = _programObject->uniformLocation("texture1");
|
||||
|
||||
|
||||
loadTexture();
|
||||
|
||||
_geometry->initialize(this);
|
||||
@@ -197,6 +204,8 @@ void RenderableModel::deinitializeGL() {
|
||||
void RenderableModel::render(const RenderData& data, RendererTasks&) {
|
||||
_programObject->activate();
|
||||
|
||||
_programObject->setUniform(_uniformCache.opacity, _opacity);
|
||||
|
||||
// Model transform and view transform needs to be in double precision
|
||||
glm::dmat4 modelTransform =
|
||||
glm::translate(glm::dmat4(1.0), data.modelTransform.translation) * // Translation
|
||||
@@ -244,6 +253,7 @@ void RenderableModel::update(const UpdateData&) {
|
||||
if (_programObject->isDirty()) {
|
||||
_programObject->rebuildFromFile();
|
||||
|
||||
_uniformCache.opacity = _programObject->uniformLocation("opacity");
|
||||
_uniformCache.directionToSunViewSpace = _programObject->uniformLocation(
|
||||
"directionToSunViewSpace"
|
||||
);
|
||||
|
||||
@@ -74,8 +74,8 @@ private:
|
||||
properties::Mat3Property _modelTransform;
|
||||
|
||||
std::unique_ptr<ghoul::opengl::ProgramObject> _programObject;
|
||||
UniformCache(directionToSunViewSpace, modelViewTransform, projectionTransform,
|
||||
performShading, texture) _uniformCache;
|
||||
UniformCache(opacity, directionToSunViewSpace, modelViewTransform,
|
||||
projectionTransform, performShading, texture) _uniformCache;
|
||||
|
||||
std::unique_ptr<ghoul::opengl::Texture> _texture;
|
||||
|
||||
|
||||
@@ -111,6 +111,9 @@ RenderablePlane::RenderablePlane(const ghoul::Dictionary& dictionary)
|
||||
"RenderablePlane"
|
||||
);
|
||||
|
||||
addProperty(_opacity);
|
||||
registerUpdateRenderBinFromOpacity();
|
||||
|
||||
_size = static_cast<float>(dictionary.value<double>(SizeInfo.identifier));
|
||||
|
||||
if (dictionary.hasKey(BillboardInfo.identifier)) {
|
||||
@@ -185,6 +188,8 @@ void RenderablePlane::deinitializeGL() {
|
||||
void RenderablePlane::render(const RenderData& data, RendererTasks&) {
|
||||
_shader->activate();
|
||||
|
||||
_shader->setUniform("opacity", _opacity);
|
||||
|
||||
// Model transform and view transform needs to be in double precision
|
||||
const glm::dmat4 rotationTransform = _billboard ?
|
||||
glm::inverse(glm::dmat4(data.camera.viewRotationMatrix())) :
|
||||
|
||||
@@ -96,7 +96,6 @@ void RenderablePlaneImageLocal::deinitializeGL() {
|
||||
RenderablePlane::deinitializeGL();
|
||||
}
|
||||
|
||||
|
||||
void RenderablePlaneImageLocal::bindTexture() {
|
||||
_texture->bind();
|
||||
}
|
||||
|
||||
@@ -62,7 +62,8 @@ documentation::Documentation RenderablePlaneImageOnline::Documentation() {
|
||||
};
|
||||
}
|
||||
|
||||
RenderablePlaneImageOnline::RenderablePlaneImageOnline(const ghoul::Dictionary& dictionary)
|
||||
RenderablePlaneImageOnline::RenderablePlaneImageOnline(
|
||||
const ghoul::Dictionary& dictionary)
|
||||
: RenderablePlane(dictionary)
|
||||
, _texturePath(TextureInfo)
|
||||
, _texture(nullptr)
|
||||
|
||||
@@ -71,13 +71,6 @@ namespace {
|
||||
"This value specifies the radius of the sphere in meters."
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo TransparencyInfo = {
|
||||
"Alpha",
|
||||
"Transparency",
|
||||
"This value determines the transparency of the sphere. If this value is set to "
|
||||
"1, the sphere is completely opaque. At 0, the sphere is completely transparent."
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo FadeOutThreshouldInfo = {
|
||||
"FadeOutThreshould",
|
||||
"Fade-Out Threshould",
|
||||
@@ -131,12 +124,6 @@ documentation::Documentation RenderableSphere::Documentation() {
|
||||
Optional::Yes,
|
||||
OrientationInfo.description
|
||||
},
|
||||
{
|
||||
TransparencyInfo.identifier,
|
||||
new DoubleInRangeVerifier(0.0, 1.0),
|
||||
Optional::Yes,
|
||||
TransparencyInfo.description
|
||||
},
|
||||
{
|
||||
FadeOutThreshouldInfo.identifier,
|
||||
new DoubleInRangeVerifier(0.0, 1.0),
|
||||
@@ -166,7 +153,6 @@ RenderableSphere::RenderableSphere(const ghoul::Dictionary& dictionary)
|
||||
, _orientation(OrientationInfo, properties::OptionProperty::DisplayType::Dropdown)
|
||||
, _size(SizeInfo, 1.f, 0.f, 1e35f)
|
||||
, _segments(SegmentsInfo, 8, 4, 1000)
|
||||
, _transparency(TransparencyInfo, 1.f, 0.f, 1.f)
|
||||
, _disableFadeInDistance(DisableFadeInOuInfo, true)
|
||||
, _fadeOutThreshold(-1.0)
|
||||
, _fadeInThreshold(0.0)
|
||||
@@ -181,6 +167,9 @@ RenderableSphere::RenderableSphere(const ghoul::Dictionary& dictionary)
|
||||
"RenderableSphere"
|
||||
);
|
||||
|
||||
addProperty(_opacity);
|
||||
registerUpdateRenderBinFromOpacity();
|
||||
|
||||
_size = static_cast<float>(dictionary.value<double>(SizeInfo.identifier));
|
||||
_segments = static_cast<int>(dictionary.value<double>(SegmentsInfo.identifier));
|
||||
_texturePath = absPath(dictionary.value<std::string>(TextureInfo.identifier));
|
||||
@@ -217,21 +206,6 @@ RenderableSphere::RenderableSphere(const ghoul::Dictionary& dictionary)
|
||||
addProperty(_segments);
|
||||
_segments.onChange([this](){ _sphereIsDirty = true; });
|
||||
|
||||
_transparency.onChange([this](){
|
||||
if (_transparency > 0.f && _transparency < 1.f) {
|
||||
setRenderBin(Renderable::RenderBin::Transparent);
|
||||
}
|
||||
else {
|
||||
setRenderBin(Renderable::RenderBin::Opaque);
|
||||
}
|
||||
});
|
||||
if (dictionary.hasKey(TransparencyInfo.identifier)) {
|
||||
_transparency = static_cast<float>(
|
||||
dictionary.value<double>(TransparencyInfo.identifier)
|
||||
);
|
||||
}
|
||||
addProperty(_transparency);
|
||||
|
||||
addProperty(_texturePath);
|
||||
_texturePath.onChange([this]() { loadTexture(); });
|
||||
|
||||
@@ -252,7 +226,6 @@ RenderableSphere::RenderableSphere(const ghoul::Dictionary& dictionary)
|
||||
_disableFadeInDistance.set(false);
|
||||
addProperty(_disableFadeInDistance);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
bool RenderableSphere::isReady() const {
|
||||
@@ -272,6 +245,11 @@ void RenderableSphere::initializeGL() {
|
||||
absPath("${MODULE_BASE}/shaders/sphere_fs.glsl")
|
||||
);
|
||||
|
||||
_uniformCache.opacity = _shader->uniformLocation("opacity");
|
||||
_uniformCache.viewProjection = _shader->uniformLocation("ViewProjection");
|
||||
_uniformCache.modelTransform = _shader->uniformLocation("ModelTransform");
|
||||
_uniformCache.texture = _shader->uniformLocation("texture1");
|
||||
|
||||
loadTexture();
|
||||
}
|
||||
|
||||
@@ -294,12 +272,12 @@ void RenderableSphere::render(const RenderData& data, RendererTasks&) {
|
||||
_shader->activate();
|
||||
_shader->setIgnoreUniformLocationError(IgnoreError::Yes);
|
||||
|
||||
_shader->setUniform("ViewProjection", data.camera.viewProjectionMatrix());
|
||||
_shader->setUniform("ModelTransform", transform);
|
||||
_shader->setUniform(_uniformCache.viewProjection, data.camera.viewProjectionMatrix());
|
||||
_shader->setUniform(_uniformCache.modelTransform, transform);
|
||||
|
||||
setPscUniforms(*_shader.get(), data.camera, data.position);
|
||||
|
||||
float adjustedTransparency = _transparency;
|
||||
float adjustedTransparency = _opacity;
|
||||
|
||||
if (_fadeInThreshold > 0.0) {
|
||||
double distCamera = glm::length(data.camera.positionVec3());
|
||||
@@ -323,16 +301,16 @@ void RenderableSphere::render(const RenderData& data, RendererTasks&) {
|
||||
}
|
||||
|
||||
// Performance wise
|
||||
if (adjustedTransparency < 0.01) {
|
||||
if (adjustedTransparency < 0.01f) {
|
||||
return;
|
||||
}
|
||||
|
||||
_shader->setUniform("alpha", adjustedTransparency);
|
||||
_shader->setUniform(_uniformCache.opacity, _opacity);
|
||||
|
||||
ghoul::opengl::TextureUnit unit;
|
||||
unit.activate();
|
||||
_texture->bind();
|
||||
_shader->setUniform("texture1", unit);
|
||||
_shader->setUniform(_uniformCache.texture, unit);
|
||||
|
||||
glEnable(GL_CULL_FACE);
|
||||
glCullFace(GL_BACK);
|
||||
@@ -366,6 +344,11 @@ void RenderableSphere::render(const RenderData& data, RendererTasks&) {
|
||||
void RenderableSphere::update(const UpdateData&) {
|
||||
if (_shader->isDirty()) {
|
||||
_shader->rebuildFromFile();
|
||||
|
||||
_uniformCache.opacity = _shader->uniformLocation("opacity");
|
||||
_uniformCache.viewProjection = _shader->uniformLocation("ViewProjection");
|
||||
_uniformCache.modelTransform = _shader->uniformLocation("ModelTransform");
|
||||
_uniformCache.texture = _shader->uniformLocation("texture1");
|
||||
}
|
||||
|
||||
if (_sphereIsDirty) {
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
#include <openspace/properties/optionproperty.h>
|
||||
#include <openspace/properties/scalar/intproperty.h>
|
||||
#include <openspace/properties/scalar/floatproperty.h>
|
||||
#include <ghoul/opengl/uniformcache.h>
|
||||
|
||||
namespace ghoul::opengl {
|
||||
class ProgramObject;
|
||||
@@ -68,8 +69,6 @@ private:
|
||||
properties::FloatProperty _size;
|
||||
properties::IntProperty _segments;
|
||||
|
||||
properties::FloatProperty _transparency;
|
||||
|
||||
properties::BoolProperty _disableFadeInDistance;
|
||||
|
||||
float _fadeOutThreshold;
|
||||
@@ -80,6 +79,9 @@ private:
|
||||
|
||||
std::unique_ptr<PowerScaledSphere> _sphere;
|
||||
|
||||
UniformCache(opacity, viewProjection, modelTransform, texture) _uniformCache;
|
||||
|
||||
|
||||
bool _sphereIsDirty;
|
||||
};
|
||||
|
||||
|
||||
@@ -137,6 +137,9 @@ RenderableSphericalGrid::RenderableSphericalGrid(const ghoul::Dictionary& dictio
|
||||
"RenderableSphericalGrid"
|
||||
);
|
||||
|
||||
addProperty(_opacity);
|
||||
registerUpdateRenderBinFromOpacity();
|
||||
|
||||
if (dictionary.hasKey(GridMatrixInfo.identifier)) {
|
||||
_gridMatrix = dictionary.value<glm::dmat4>(GridMatrixInfo.identifier);
|
||||
}
|
||||
@@ -210,6 +213,8 @@ void RenderableSphericalGrid::deinitializeGL() {
|
||||
void RenderableSphericalGrid::render(const RenderData& data, RendererTasks&){
|
||||
_gridProgram->activate();
|
||||
|
||||
_gridProgram->setUniform("opacity", _opacity);
|
||||
|
||||
glm::dmat4 modelTransform =
|
||||
glm::translate(glm::dmat4(1.0), data.modelTransform.translation) * // Translation
|
||||
glm::dmat4(data.modelTransform.rotation) * // Spice rotation
|
||||
|
||||
@@ -169,6 +169,9 @@ RenderableTrail::RenderableTrail(const ghoul::Dictionary& dictionary)
|
||||
, _renderingModes(RenderingModeInfo, properties::OptionProperty::DisplayType::Dropdown
|
||||
)
|
||||
{
|
||||
addProperty(_opacity);
|
||||
registerUpdateRenderBinFromOpacity();
|
||||
|
||||
_translation = Translation::createFromDictionary(
|
||||
dictionary.value<ghoul::Dictionary>(KeyTranslation)
|
||||
);
|
||||
@@ -226,6 +229,7 @@ void RenderableTrail::initializeGL() {
|
||||
absPath("${MODULE_BASE}/shaders/renderabletrail_fs.glsl")
|
||||
);
|
||||
|
||||
_uniformCache.opacity = _programObject->uniformLocation("opacity");
|
||||
_uniformCache.modelView = _programObject->uniformLocation("modelViewTransform");
|
||||
_uniformCache.projection = _programObject->uniformLocation("projectionTransform");
|
||||
_uniformCache.color = _programObject->uniformLocation("color");
|
||||
@@ -255,6 +259,7 @@ bool RenderableTrail::isReady() const {
|
||||
|
||||
void RenderableTrail::render(const RenderData& data, RendererTasks&) {
|
||||
_programObject->activate();
|
||||
_programObject->setUniform(_uniformCache.opacity, _opacity);
|
||||
|
||||
glm::dmat4 modelTransform =
|
||||
glm::translate(glm::dmat4(1.0), data.modelTransform.translation) *
|
||||
|
||||
@@ -160,8 +160,8 @@ private:
|
||||
/// Program object used to render the data stored in RenderInformation
|
||||
std::unique_ptr<ghoul::opengl::ProgramObject> _programObject;
|
||||
|
||||
UniformCache(modelView, projection, color, useLineFade, lineFade, vertexSorting,
|
||||
idOffset, nVertices, stride, pointSize, renderPhase) _uniformCache;
|
||||
UniformCache(opacity, modelView, projection, color, useLineFade, lineFade,
|
||||
vertexSorting, idOffset, nVertices, stride, pointSize, renderPhase) _uniformCache;
|
||||
};
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
@@ -213,7 +213,8 @@ void RenderableTrailOrbit::update(const UpdateData& data) {
|
||||
// 3
|
||||
if (!report.permanentPointsNeedUpdate) {
|
||||
if (report.floatingPointNeedsUpdate) {
|
||||
// If no other values have been touched, we only need to upload the floating value
|
||||
// If no other values have been touched, we only need to upload the
|
||||
// floating value
|
||||
glBufferSubData(
|
||||
GL_ARRAY_BUFFER,
|
||||
_primaryRenderInformation.first * sizeof(TrailVBOLayout),
|
||||
|
||||
@@ -94,7 +94,7 @@ int addDashboardItemToScreenSpace(lua_State* L) {
|
||||
}
|
||||
|
||||
dash->dashboard().addDashboardItem(DashboardItem::createFromDictionary(d));
|
||||
|
||||
|
||||
lua_settop(L, 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -29,10 +29,12 @@ in float vs_screenSpaceDepth;
|
||||
in vec4 vs_positionViewSpace;
|
||||
|
||||
uniform vec4 gridColor;
|
||||
uniform float opacity;
|
||||
|
||||
Fragment getFragment() {
|
||||
Fragment frag;
|
||||
frag.color = gridColor;
|
||||
frag.color.a *= opacity;
|
||||
frag.depth = vs_screenSpaceDepth;
|
||||
frag.gPosition = vs_positionViewSpace;
|
||||
frag.gNormal = vec4(0.0, 0.0, 0.0, 1.0);
|
||||
|
||||
@@ -33,6 +33,7 @@ in vec3 vs_normalObjSpace;
|
||||
uniform bool performShading = true;
|
||||
uniform vec3 directionToSunViewSpace;
|
||||
uniform sampler2D texture1;
|
||||
uniform float opacity = 1.0;
|
||||
|
||||
const vec3 SpecularAlbedo = vec3(1.0);
|
||||
|
||||
@@ -69,7 +70,7 @@ Fragment getFragment() {
|
||||
frag.color.rgb = diffuseAlbedo;
|
||||
}
|
||||
|
||||
frag.color.a = 1.0;
|
||||
frag.color.a = opacity;
|
||||
frag.depth = vs_screenSpaceDepth;
|
||||
frag.gPosition = vs_positionCameraSpace;
|
||||
frag.gNormal = vec4(vs_normalObjSpace, 1.0);
|
||||
|
||||
@@ -34,7 +34,7 @@ out vec2 vs_st;
|
||||
out vec3 vs_normalViewSpace;
|
||||
out float vs_screenSpaceDepth;
|
||||
out vec4 vs_positionCameraSpace;
|
||||
out vec3 vs_normalObjSpace;
|
||||
out vec3 vs_normalObjSpace;
|
||||
|
||||
uniform mat4 modelViewTransform;
|
||||
uniform mat4 projectionTransform;
|
||||
|
||||
@@ -31,6 +31,7 @@ in vec3 vs_gNormal;
|
||||
|
||||
uniform sampler2D texture1;
|
||||
uniform bool additiveBlending;
|
||||
uniform float opacity = 1.0;
|
||||
|
||||
|
||||
Fragment getFragment() {
|
||||
@@ -42,6 +43,7 @@ Fragment getFragment() {
|
||||
frag.color = texture(texture1, vec2(1 - vs_st.s, vs_st.t));
|
||||
}
|
||||
|
||||
frag.color.a *= opacity;
|
||||
if (frag.color.a == 0.0) {
|
||||
discard;
|
||||
}
|
||||
|
||||
@@ -30,6 +30,7 @@ in float fade;
|
||||
|
||||
uniform vec3 color;
|
||||
uniform int renderPhase;
|
||||
uniform float opacity = 1.0;
|
||||
|
||||
// Fragile! Keep in sync with RenderableTrail::render::RenderPhase
|
||||
#define RenderPhaseLines 0
|
||||
@@ -40,7 +41,7 @@ uniform int renderPhase;
|
||||
|
||||
Fragment getFragment() {
|
||||
Fragment frag;
|
||||
frag.color = vec4(color * fade, fade);
|
||||
frag.color = vec4(color * fade, fade * opacity);
|
||||
frag.depth = vs_positionScreenSpace.w;
|
||||
frag.blend = BLEND_MODE_ADDITIVE;
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ in vec4 vs_gPosition;
|
||||
|
||||
uniform float time;
|
||||
uniform sampler2D texture1;
|
||||
uniform float alpha;
|
||||
uniform float opacity;
|
||||
|
||||
|
||||
Fragment getFragment() {
|
||||
@@ -42,7 +42,7 @@ Fragment getFragment() {
|
||||
texCoord.t = 1 - texCoord.y;
|
||||
|
||||
Fragment frag;
|
||||
frag.color = texture(texture1, texCoord) * vec4(1.0, 1.0, 1.0, alpha);
|
||||
frag.color = texture(texture1, texCoord) * vec4(1.0, 1.0, 1.0, opacity);
|
||||
frag.depth = pscDepth(position);
|
||||
|
||||
// G-Buffer
|
||||
|
||||
@@ -730,7 +730,7 @@ void RenderableBillboardsCloud::renderBillboards(const RenderData& data,
|
||||
"screenSize",
|
||||
glm::vec2(OsEng.renderEngine().renderingResolution())
|
||||
);
|
||||
|
||||
|
||||
_program->setUniform(_uniformCache.modelViewProjection, projMatrix * modelViewMatrix);
|
||||
_program->setUniform(
|
||||
_uniformCache.cameraPos,
|
||||
|
||||
@@ -355,7 +355,7 @@ void RenderableFieldlines::update(const UpdateData&) {
|
||||
GL_FLOAT,
|
||||
GL_FALSE,
|
||||
sizeof(LinePoint),
|
||||
(void*)(sizeof(glm::vec3))
|
||||
reinterpret_cast<void*>(sizeof(glm::vec3))
|
||||
);
|
||||
|
||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
|
||||
@@ -34,7 +34,7 @@ public:
|
||||
constexpr static const char* Name = "FieldlinesSequence";
|
||||
|
||||
FieldlinesSequenceModule();
|
||||
|
||||
|
||||
static std::string DefaultTransferFunctionFile;
|
||||
|
||||
private:
|
||||
|
||||
@@ -49,29 +49,42 @@ namespace {
|
||||
|
||||
// ----- KEYS POSSIBLE IN MODFILE. EXPECTED DATA TYPE OF VALUE IN [BRACKETS] ----- //
|
||||
// ---------------------------- MANDATORY MODFILE KEYS ---------------------------- //
|
||||
const char* KeyInputFileType = "InputFileType"; // [STRING] "cdf", "json" or "osfls"
|
||||
const char* KeySourceFolder = "SourceFolder"; // [STRING] should be path to folder containing the input files
|
||||
// [STRING] "cdf", "json" or "osfls"
|
||||
constexpr const char* KeyInputFileType = "InputFileType";
|
||||
// [STRING] should be path to folder containing the input files
|
||||
constexpr const char* KeySourceFolder = "SourceFolder";
|
||||
|
||||
// ---------------------- MANDATORY INPUT TYPE SPECIFIC KEYS ---------------------- //
|
||||
const char* KeyCdfSeedPointFile = "SeedPointFile"; // [STRING] Path to a .txt file containing seed points
|
||||
const char* KeyJsonSimulationModel = "SimulationModel"; // [STRING] Currently supports: "batsrus", "enlil" & "pfss"
|
||||
// ---------------------- MANDATORY INPUT TYPE SPECIFIC KEYS ---------------------- //
|
||||
// [STRING] Path to a .txt file containing seed points
|
||||
constexpr const char* KeyCdfSeedPointFile = "SeedPointFile";
|
||||
// [STRING] Currently supports: "batsrus", "enlil" & "pfss"
|
||||
constexpr const char* KeyJsonSimulationModel = "SimulationModel";
|
||||
|
||||
// ----------------------- OPTIONAL INPUT TYPE SPECIFIC KEYS ---------------------- //
|
||||
const char* KeyCdfExtraVariables = "ExtraVariables"; // [STRING ARRAY]
|
||||
const char* KeyCdfTracingVariable = "TracingVariable"; // [STRING]
|
||||
const char* KeyJsonScalingFactor = "ScaleToMeters"; // [STRING]
|
||||
const char* KeyOslfsLoadAtRuntime = "LoadAtRuntime"; // [BOOLEAN] If value False => Load in initializing step and store in RAM
|
||||
// ----------------------- OPTIONAL INPUT TYPE SPECIFIC KEYS ---------------------- //
|
||||
// [STRING ARRAY]
|
||||
constexpr const char* KeyCdfExtraVariables = "ExtraVariables";
|
||||
// [STRING]
|
||||
constexpr const char* KeyCdfTracingVariable = "TracingVariable";
|
||||
// [STRING]
|
||||
constexpr const char* KeyJsonScalingFactor = "ScaleToMeters";
|
||||
// [BOOLEAN] If value False => Load in initializing step and store in RAM
|
||||
constexpr const char* KeyOslfsLoadAtRuntime = "LoadAtRuntime";
|
||||
|
||||
// ---------------------------- OPTIONAL MODFILE KEYS ---------------------------- //
|
||||
const char* KeyColorTablePaths = "ColorTablePaths"; // [STRING ARRAY] Values should be paths to .txt files
|
||||
const char* KeyColorTableRanges = "ColorTableRanges";// [VEC2 ARRAY] Values should be entered as {X, Y}, where X & Y are numbers
|
||||
const char* KeyMaskingRanges = "MaskingRanges"; // [VEC2 ARRAY] Values should be entered as {X, Y}, where X & Y are numbers
|
||||
const char* KeyOutputFolder = "OutputFolder"; // [STRING] Value should be path to folder where states are saved (JSON/CDF input => osfls output & oslfs input => JSON output)
|
||||
// ---------------------------- OPTIONAL MODFILE KEYS ---------------------------- //
|
||||
// [STRING ARRAY] Values should be paths to .txt files
|
||||
constexpr const char* KeyColorTablePaths = "ColorTablePaths";
|
||||
// [VEC2 ARRAY] Values should be entered as {X, Y}, where X & Y are numbers
|
||||
constexpr const char* KeyColorTableRanges = "ColorTableRanges";
|
||||
// [VEC2 ARRAY] Values should be entered as {X, Y}, where X & Y are numbers
|
||||
constexpr const char* KeyMaskingRanges = "MaskingRanges";
|
||||
// [STRING] Value should be path to folder where states are saved (JSON/CDF input
|
||||
// => osfls output & oslfs input => JSON output)
|
||||
constexpr const char* KeyOutputFolder = "OutputFolder";
|
||||
|
||||
// ------------- POSSIBLE STRING VALUES FOR CORRESPONDING MODFILE KEY ------------- //
|
||||
const char* ValueInputFileTypeCdf = "cdf";
|
||||
const char* ValueInputFileTypeJson = "json";
|
||||
const char* ValueInputFileTypeOsfls = "osfls";
|
||||
// ------------- POSSIBLE STRING VALUES FOR CORRESPONDING MODFILE KEY ------------- //
|
||||
constexpr const char* ValueInputFileTypeCdf = "cdf";
|
||||
constexpr const char* ValueInputFileTypeJson = "json";
|
||||
constexpr const char* ValueInputFileTypeOsfls = "osfls";
|
||||
|
||||
// --------------------------------- Property Info -------------------------------- //
|
||||
static const openspace::properties::Property::PropertyInfo ColorMethodInfo = {
|
||||
@@ -288,7 +301,8 @@ void RenderableFieldlinesSequence::initializeGL() {
|
||||
std::string outputFolderPath;
|
||||
extractOptionalInfoFromDictionary(outputFolderPath);
|
||||
|
||||
// EXTRACT SOURCE FILE TYPE SPECIFIC INFOMRATION FROM DICTIONARY & GET STATES FROM SOURCE
|
||||
// EXTRACT SOURCE FILE TYPE SPECIFIC INFOMRATION FROM DICTIONARY & GET STATES FROM
|
||||
// SOURCE
|
||||
switch (sourceFileType) {
|
||||
case SourceFileType::Cdf:
|
||||
if (!getStatesFromCdfFiles(outputFolderPath)) {
|
||||
@@ -536,7 +550,8 @@ bool RenderableFieldlinesSequence::extractJsonInfoFromDictionary(fls::Model& mod
|
||||
return true;
|
||||
}
|
||||
|
||||
bool RenderableFieldlinesSequence::loadJsonStatesIntoRAM(const std::string& outputFolder) {
|
||||
bool RenderableFieldlinesSequence::loadJsonStatesIntoRAM(const std::string& outputFolder)
|
||||
{
|
||||
fls::Model model;
|
||||
if (!extractJsonInfoFromDictionary(model)) {
|
||||
return false;
|
||||
@@ -570,9 +585,10 @@ bool RenderableFieldlinesSequence::prepareForOsflsStreaming() {
|
||||
|
||||
}
|
||||
|
||||
void RenderableFieldlinesSequence::loadOsflsStatesIntoRAM(const std::string& outputFolder) {
|
||||
void RenderableFieldlinesSequence::loadOsflsStatesIntoRAM(const std::string& outputFolder)
|
||||
{
|
||||
// Load states from .osfls files into RAM!
|
||||
for (const std::string filePath : _sourceFiles) {
|
||||
for (const std::string& filePath : _sourceFiles) {
|
||||
FieldlinesState newState;
|
||||
if (newState.loadStateFromOsfls(filePath)) {
|
||||
addStateToSequence(newState);
|
||||
@@ -650,7 +666,7 @@ void RenderableFieldlinesSequence::setupProperties() {
|
||||
// the given sequence have the same extra quantities! */
|
||||
const size_t nExtraQuantities = _states[0].nExtraQuantities();
|
||||
const std::vector<std::string>& extraNamesVec = _states[0].extraQuantityNames();
|
||||
for (int i = 0; i < nExtraQuantities; ++i) {
|
||||
for (int i = 0; i < static_cast<int>(nExtraQuantities); ++i) {
|
||||
_pColorQuantity.addOption(i, extraNamesVec[i]);
|
||||
_pMaskingQuantity.addOption(i, extraNamesVec[i]);
|
||||
}
|
||||
@@ -946,7 +962,7 @@ void RenderableFieldlinesSequence::extractMagnitudeVarsFromStrings(
|
||||
std::vector<std::string>& extraMagVars)
|
||||
{
|
||||
|
||||
for (int i = 0; i < extraVars.size(); i++) {
|
||||
for (int i = 0; i < static_cast<int>(extraVars.size()); i++) {
|
||||
const std::string str = extraVars[i];
|
||||
// Check if string is in the format specified for magnitude variables
|
||||
if (str.substr(0, 2) == "|(" && str.substr(str.size() - 2, 2) == ")|") {
|
||||
@@ -1104,15 +1120,15 @@ void RenderableFieldlinesSequence::update(const UpdateData& data) {
|
||||
|
||||
// Check if current time in OpenSpace is within sequence interval
|
||||
if (isInInterval) {
|
||||
const int nextIdx = _activeTriggerTimeIndex + 1;
|
||||
const size_t nextIdx = _activeTriggerTimeIndex + 1;
|
||||
if (
|
||||
// true => Previous frame was not within the sequence interval
|
||||
_activeTriggerTimeIndex < 0
|
||||
_activeTriggerTimeIndex < 0
|
||||
// true => We stepped back to a time represented by another state
|
||||
|| currentTime < _startTimes[_activeTriggerTimeIndex]
|
||||
|| currentTime < _startTimes[_activeTriggerTimeIndex]
|
||||
// true => We stepped forward to a time represented by another state
|
||||
|| (nextIdx < _nStates && currentTime >= _startTimes[nextIdx]))
|
||||
{
|
||||
{
|
||||
updateActiveTriggerTimeIndex(currentTime);
|
||||
|
||||
if (_loadingStatesDynamically) {
|
||||
|
||||
@@ -67,14 +67,14 @@ out float vs_depth;
|
||||
|
||||
vec4 getTransferFunctionColor() {
|
||||
// Remap the color scalar to a [0,1] range
|
||||
const float lookUpVal = (in_color_scalar - colorTableRange.x) /
|
||||
float lookUpVal = (in_color_scalar - colorTableRange.x) /
|
||||
(colorTableRange.y - colorTableRange.x);
|
||||
return texture(colorTable, lookUpVal);
|
||||
}
|
||||
|
||||
bool isPartOfParticle(const double time, const int vertexId, const int particleSize,
|
||||
const int particleSpeed, const int particleSpacing) {
|
||||
const int modulusResult = int(double(particleSpeed) * time + vertexId) % particleSpacing;
|
||||
int modulusResult = int(double(particleSpeed) * time + vertexId) % particleSpacing;
|
||||
return modulusResult > 0 && modulusResult <= particleSize;
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ void main() {
|
||||
}
|
||||
|
||||
if (usingDomain && hasColor) {
|
||||
const float radius = length(in_position);
|
||||
float radius = length(in_position);
|
||||
|
||||
if (in_position.x < domainLimX.x || in_position.x > domainLimX.y ||
|
||||
in_position.y < domainLimY.x || in_position.y > domainLimY.y ||
|
||||
@@ -100,7 +100,7 @@ void main() {
|
||||
}
|
||||
|
||||
if (hasColor) {
|
||||
const bool isParticle = usingParticles && isPartOfParticle(time, gl_VertexID,
|
||||
bool isParticle = usingParticles && isPartOfParticle(time, gl_VertexID,
|
||||
particleSize,
|
||||
particleSpeed,
|
||||
particleSpacing);
|
||||
@@ -112,7 +112,7 @@ void main() {
|
||||
}
|
||||
|
||||
if (colorMethod == colorByQuantity) {
|
||||
const vec4 quantityColor = getTransferFunctionColor();
|
||||
vec4 quantityColor = getTransferFunctionColor();
|
||||
vs_color = vec4(quantityColor.xyz, vs_color.a * quantityColor.a);
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -345,13 +345,13 @@ void FieldlinesState::saveStateToJson(const std::string& absPath) {
|
||||
|
||||
const std::string timeStr = Time(_triggerTime).ISO8601();
|
||||
const size_t nLines = _lineStart.size();
|
||||
const size_t nPoints = _vertexPositions.size();
|
||||
// const size_t nPoints = _vertexPositions.size();
|
||||
const size_t nExtras = _extraQuantities.size();
|
||||
|
||||
size_t pointIndex = 0;
|
||||
for (size_t lineIndex = 0; lineIndex < nLines; ++lineIndex) {
|
||||
json jData = json::array();
|
||||
for (size_t i = 0; i < _lineCount[lineIndex]; i++, ++pointIndex) {
|
||||
for (GLsizei i = 0; i < _lineCount[lineIndex]; i++, ++pointIndex) {
|
||||
const glm::vec3 pos = _vertexPositions[pointIndex];
|
||||
json jDataElement = {pos.x, pos.y, pos.z};
|
||||
|
||||
|
||||
@@ -231,7 +231,7 @@ void addExtraQuantities(ccmc::Kameleon* kameleon,
|
||||
std::make_unique<ccmc::KameleonInterpolator>(kameleon->model);
|
||||
|
||||
// ------ Extract all the extraQuantities from kameleon and store in state! ------ //
|
||||
for (const glm::vec3 p : state.vertexPositions()) {
|
||||
for (const glm::vec3& p : state.vertexPositions()) {
|
||||
// Load the scalars!
|
||||
for (size_t i = 0; i < nXtraScalars; i++) {
|
||||
float val;
|
||||
@@ -298,7 +298,7 @@ void prepareStateAndKameleonForExtras(ccmc::Kameleon* kameleon,
|
||||
|
||||
// Load the existing SCALAR variables into kameleon.
|
||||
// Remove non-existing variables from vector
|
||||
for (int i = 0; i < extraScalarVars.size(); ++i) {
|
||||
for (int i = 0; i < static_cast<int>(extraScalarVars.size()); ++i) {
|
||||
std::string& str = extraScalarVars[i];
|
||||
bool success = kameleon->doesVariableExist(str) && kameleon->loadVariable(str);
|
||||
if (!success &&
|
||||
|
||||
@@ -85,7 +85,7 @@ void MilkywayConversionTask::perform(const Task::ProgressCallback& progressCallb
|
||||
using namespace openspace::volume;
|
||||
|
||||
std::vector<std::string> filenames;
|
||||
for (int i = 0; i < _inNSlices; i++) {
|
||||
for (size_t i = 0; i < _inNSlices; i++) {
|
||||
filenames.push_back(
|
||||
_inFilenamePrefix + std::to_string(i + _inFirstIndex) + _inFilenameSuffix
|
||||
);
|
||||
|
||||
@@ -155,7 +155,7 @@ int goToChunk(lua_State* L) {
|
||||
|
||||
int goToGeo(lua_State* L) {
|
||||
int nArguments = ghoul::lua::checkArgumentsAndThrow(L, 2, 3, "lua::goToGeo");
|
||||
|
||||
|
||||
using ghoul::lua::luaTypeToString;
|
||||
|
||||
double latitude = lua_tonumber(L, 1);
|
||||
|
||||
@@ -220,6 +220,10 @@ RenderableGlobe::RenderableGlobe(const ghoul::Dictionary& dictionary)
|
||||
dictionary.getValue(keySegmentsPerPatch, patchSegmentsd);
|
||||
int patchSegments = static_cast<int>(patchSegmentsd);
|
||||
|
||||
if (dictionary.hasValue<bool>("PerformShading")) {
|
||||
_generalProperties.performShading = dictionary.value<bool>("PerformShading");
|
||||
}
|
||||
|
||||
// Init layer manager
|
||||
ghoul::Dictionary layersDictionary;
|
||||
if (!dictionary.getValue(keyLayers, layersDictionary)) {
|
||||
|
||||
@@ -49,10 +49,6 @@ private:
|
||||
bool _firstFrame;
|
||||
|
||||
std::string _timeUnits;
|
||||
|
||||
|
||||
//properties::FloatProperty _minMaxDeltaTime;
|
||||
//float _localMinMaxDeltatime; // We don't want the default display inside the component
|
||||
};
|
||||
|
||||
} // namespace openspace::gui
|
||||
|
||||
@@ -281,12 +281,12 @@ void CaptionText(const char* text) {
|
||||
GUI::GUI()
|
||||
: GuiComponent("Main")
|
||||
, _globalProperty("Global Properties")
|
||||
, _moduleProperty("Module Properties")
|
||||
, _sceneProperty(
|
||||
"Scene Properties",
|
||||
GuiPropertyComponent::UseTreeLayout::Yes
|
||||
)
|
||||
, _screenSpaceProperty("ScreenSpace Properties")
|
||||
, _moduleProperty("Module Properties")
|
||||
, _virtualProperty("Virtual Properties")
|
||||
, _featuredProperties("Featured Properties", GuiPropertyComponent::UseTreeLayout::No)
|
||||
, _showInternals(false)
|
||||
|
||||
@@ -317,8 +317,8 @@ void GuiPropertyComponent::render() {
|
||||
|
||||
if (lhsIt != ordering.end() && rhsIt != ordering.end()) {
|
||||
if (lhsToken[1] != rhsToken[1]) {
|
||||
// If both top-level groups are in the ordering list, the order
|
||||
// of the iterators gives us the order of the groups
|
||||
// If both top-level groups are in the ordering list, the
|
||||
// order of the iterators gives us the order of the groups
|
||||
return lhsIt < rhsIt;
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -106,13 +106,14 @@ DataCygnet::DataCygnet(const ghoul::Dictionary& dictionary)
|
||||
registerProperties();
|
||||
}
|
||||
|
||||
DataCygnet::~DataCygnet(){}
|
||||
DataCygnet::~DataCygnet() {}
|
||||
|
||||
bool DataCygnet::updateTexture(){
|
||||
bool DataCygnet::updateTexture() {
|
||||
std::vector<float*> data = textureData();
|
||||
|
||||
if(data.empty())
|
||||
if (data.empty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool texturesReady = false;
|
||||
std::vector<int> selectedOptions = _dataOptions.value();
|
||||
@@ -148,16 +149,17 @@ bool DataCygnet::updateTexture(){
|
||||
return texturesReady;
|
||||
}
|
||||
|
||||
bool DataCygnet::downloadTextureResource(double timestamp){
|
||||
if(_futureObject.valid())
|
||||
bool DataCygnet::downloadTextureResource(double timestamp) {
|
||||
if (_futureObject.valid()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
std::future<DownloadManager::MemoryFile> future = IswaManager::ref().fetchDataCygnet(
|
||||
_data->id,
|
||||
timestamp
|
||||
);
|
||||
|
||||
if(future.valid()){
|
||||
if (future.valid()) {
|
||||
_futureObject = std::move(future);
|
||||
return true;
|
||||
}
|
||||
@@ -168,8 +170,9 @@ bool DataCygnet::downloadTextureResource(double timestamp){
|
||||
bool DataCygnet::updateTextureResource(){
|
||||
DownloadManager::MemoryFile dataFile = _futureObject.get();
|
||||
|
||||
if(dataFile.corrupted)
|
||||
if (dataFile.corrupted) {
|
||||
return false;
|
||||
}
|
||||
|
||||
_dataBuffer = std::string(dataFile.buffer, dataFile.size);
|
||||
delete[] dataFile.buffer;
|
||||
@@ -197,8 +200,8 @@ void DataCygnet::setTextureUniforms(){
|
||||
// Set Textures
|
||||
ghoul::opengl::TextureUnit txUnits[MAX_TEXTURES];
|
||||
int j = 0;
|
||||
for(int option : selectedOptions){
|
||||
if(_textures[option]){
|
||||
for (int option : selectedOptions) {
|
||||
if (_textures[option]) {
|
||||
txUnits[j].activate();
|
||||
_textures[option]->bind();
|
||||
_shader->setUniform(
|
||||
@@ -207,7 +210,9 @@ void DataCygnet::setTextureUniforms(){
|
||||
);
|
||||
|
||||
j++;
|
||||
if(j >= MAX_TEXTURES) break;
|
||||
if (j >= MAX_TEXTURES) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -220,17 +225,16 @@ void DataCygnet::setTextureUniforms(){
|
||||
ghoul::opengl::TextureUnit tfUnits[MAX_TEXTURES];
|
||||
j = 0;
|
||||
|
||||
if((activeTransferfunctions == 1)){
|
||||
if (activeTransferfunctions == 1) {
|
||||
tfUnits[0].activate();
|
||||
_transferFunctions[0]->bind();
|
||||
_shader->setUniform(
|
||||
"transferFunctions[0]",
|
||||
tfUnits[0]
|
||||
);
|
||||
}else{
|
||||
for(int option : selectedOptions){
|
||||
|
||||
if(_transferFunctions[option]){
|
||||
} else {
|
||||
for (int option : selectedOptions) {
|
||||
if (_transferFunctions[option]) {
|
||||
tfUnits[j].activate();
|
||||
_transferFunctions[option]->bind();
|
||||
_shader->setUniform(
|
||||
@@ -248,7 +252,6 @@ void DataCygnet::setTextureUniforms(){
|
||||
_shader->setUniform("numTextures", activeTextures);
|
||||
}
|
||||
|
||||
|
||||
void DataCygnet::readTransferFunctions(std::string tfPath){
|
||||
std::string line;
|
||||
std::ifstream tfFile(absPath(tfPath));
|
||||
@@ -280,7 +283,7 @@ void DataCygnet::fillOptions(std::string& source) {
|
||||
_textureDimensions
|
||||
);
|
||||
|
||||
for (int i = 0; i < options.size(); i++) {
|
||||
for (int i = 0; i < static_cast<int>(options.size()); i++) {
|
||||
_dataOptions.addOption({i, options[i]});
|
||||
_textures.push_back(nullptr);
|
||||
}
|
||||
@@ -297,43 +300,45 @@ void DataCygnet::fillOptions(std::string& source) {
|
||||
}
|
||||
}
|
||||
|
||||
void DataCygnet::setPropertyCallbacks(){
|
||||
_normValues.onChange([this](){
|
||||
void DataCygnet::setPropertyCallbacks() {
|
||||
_normValues.onChange([this]() {
|
||||
_dataProcessor->normValues(_normValues.value());
|
||||
updateTexture();
|
||||
});
|
||||
|
||||
_useLog.onChange([this](){
|
||||
_useLog.onChange([this]() {
|
||||
_dataProcessor->useLog(_useLog.value());
|
||||
updateTexture();
|
||||
});
|
||||
|
||||
_useHistogram.onChange([this](){
|
||||
_useHistogram.onChange([this]() {
|
||||
_dataProcessor->useHistogram(_useHistogram.value());
|
||||
updateTexture();
|
||||
if(_autoFilter.value())
|
||||
if (_autoFilter.value()) {
|
||||
_backgroundValues.setValue(_dataProcessor->filterValues());
|
||||
}
|
||||
});
|
||||
|
||||
_dataOptions.onChange([this](){
|
||||
if(_dataOptions.value().size() > MAX_TEXTURES)
|
||||
_dataOptions.onChange([this]() {
|
||||
if (_dataOptions.value().size() > MAX_TEXTURES) {
|
||||
LWARNING("Too many options chosen, max is " + std::to_string(MAX_TEXTURES));
|
||||
}
|
||||
updateTexture();
|
||||
});
|
||||
|
||||
_transferFunctionsFile.onChange([this](){
|
||||
_transferFunctionsFile.onChange([this]() {
|
||||
readTransferFunctions(_transferFunctionsFile.value());
|
||||
});
|
||||
}
|
||||
|
||||
void DataCygnet::subscribeToGroup(){
|
||||
void DataCygnet::subscribeToGroup() {
|
||||
auto groupEvent = _group->groupEvent();
|
||||
|
||||
groupEvent->subscribe(name(), "dataOptionsChanged", [&](ghoul::Dictionary dict){
|
||||
LDEBUG(name() + " Event dataOptionsChanged");
|
||||
std::vector<int> values;
|
||||
bool success = dict.getValue<std::vector<int> >("dataOptions", values);
|
||||
if(success){
|
||||
if (success) {
|
||||
_dataOptions.setValue(values);
|
||||
}
|
||||
});
|
||||
@@ -342,7 +347,7 @@ void DataCygnet::subscribeToGroup(){
|
||||
LDEBUG(name() + " Event normValuesChanged");
|
||||
glm::vec2 values;
|
||||
bool success = dict.getValue("normValues", values);
|
||||
if(success){
|
||||
if (success) {
|
||||
_normValues.setValue(values);
|
||||
}
|
||||
});
|
||||
@@ -351,7 +356,7 @@ void DataCygnet::subscribeToGroup(){
|
||||
LDEBUG(name() + " Event backgroundValuesChanged");
|
||||
glm::vec2 values;
|
||||
bool success = dict.getValue("backgroundValues", values);
|
||||
if(success){
|
||||
if (success) {
|
||||
_backgroundValues.setValue(values);
|
||||
}
|
||||
});
|
||||
@@ -377,13 +382,13 @@ void DataCygnet::subscribeToGroup(){
|
||||
_autoFilter.setValue(dict.value<bool>("autoFilter"));
|
||||
});
|
||||
|
||||
groupEvent->subscribe(name(), "updateGroup", [&](ghoul::Dictionary dict) {
|
||||
groupEvent->subscribe(name(), "updateGroup", [&](ghoul::Dictionary) {
|
||||
LDEBUG(name() + " Event updateGroup");
|
||||
if(_autoFilter.value())
|
||||
if (_autoFilter.value()) {
|
||||
_backgroundValues.setValue(_dataProcessor->filterValues());
|
||||
}
|
||||
updateTexture();
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
} //namespace openspace
|
||||
|
||||
@@ -33,10 +33,6 @@
|
||||
#include <math.h>
|
||||
#endif
|
||||
|
||||
namespace {
|
||||
constexpr const char* _loggerCat = "DataSphere";
|
||||
} // namespace
|
||||
|
||||
namespace openspace {
|
||||
|
||||
DataSphere::DataSphere(const ghoul::Dictionary& dictionary)
|
||||
@@ -58,7 +54,11 @@ void DataSphere::initialize() {
|
||||
IswaCygnet::initialize();
|
||||
|
||||
//rotate 90 degrees because of the texture coordinates in PowerScaledSphere
|
||||
_rotation = glm::rotate(_rotation, (float)M_PI_2, glm::vec3(1.0, 0.0, 0.0));
|
||||
_rotation = glm::rotate(
|
||||
_rotation,
|
||||
static_cast<float>(M_PI_2),
|
||||
glm::vec3(1.0, 0.0, 0.0)
|
||||
);
|
||||
|
||||
if (_group) {
|
||||
_dataProcessor = _group->dataProcessor();
|
||||
|
||||
@@ -53,8 +53,8 @@ namespace openspace {
|
||||
|
||||
IswaCygnet::IswaCygnet(const ghoul::Dictionary& dictionary)
|
||||
: Renderable(dictionary)
|
||||
, _delete(DeleteInfo)
|
||||
, _alpha(AlphaInfo, 0.9f, 0.f, 1.f)
|
||||
, _delete(DeleteInfo)
|
||||
, _shader(nullptr)
|
||||
, _group(nullptr)
|
||||
, _textureDirty(false)
|
||||
|
||||
@@ -147,6 +147,7 @@ protected:
|
||||
std::string _programName;
|
||||
|
||||
glm::mat4 _rotation; //to rotate objects with fliped texture coordniates
|
||||
|
||||
private:
|
||||
bool destroyShader();
|
||||
glm::dmat3 _stateMatrix;
|
||||
|
||||
@@ -27,13 +27,17 @@
|
||||
#include <modules/iswa/util/dataprocessorkameleon.h>
|
||||
#include <ghoul/filesystem/filesystem.h>
|
||||
|
||||
#ifdef __GNUC__
|
||||
#ifdef __clang__
|
||||
#elif defined(__GNUC__)
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant"
|
||||
#endif // __GNUC__
|
||||
|
||||
#include <modules/iswa/ext/json.h>
|
||||
#ifdef __GNUC__
|
||||
|
||||
#ifdef __clang__
|
||||
|
||||
#elif defined(__GNUC__)
|
||||
#pragma GCC diagnostic pop
|
||||
#endif // __GNUC__
|
||||
|
||||
|
||||
@@ -28,10 +28,6 @@
|
||||
#include <ghoul/opengl/textureunit.h>
|
||||
#include <ghoul/opengl/programobject.h>
|
||||
|
||||
namespace {
|
||||
constexpr const char* _loggerCat = "TexturePlane";
|
||||
} // namespace
|
||||
|
||||
namespace openspace {
|
||||
|
||||
TexturePlane::TexturePlane(const ghoul::Dictionary& dictionary)
|
||||
|
||||
@@ -27,10 +27,6 @@
|
||||
|
||||
#include <fstream>
|
||||
|
||||
namespace {
|
||||
constexpr const char* _loggerCat = "DataProcessor";
|
||||
} // namespace
|
||||
|
||||
namespace openspace {
|
||||
|
||||
DataProcessor::DataProcessor()
|
||||
|
||||
@@ -85,7 +85,7 @@ void DataProcessorJson::addDataValues(std::string data,
|
||||
json row = variables[options[i].description];
|
||||
// int rowsize = row.size();
|
||||
|
||||
for(int y=0; y<row.size(); y++){
|
||||
for(size_t y = 0; y < row.size(); ++y) {
|
||||
json col = row.at(y);
|
||||
int colsize = static_cast<int>(col.size());
|
||||
|
||||
|
||||
@@ -28,10 +28,6 @@
|
||||
#include <ghoul/filesystem/filesystem.h>
|
||||
#include <ghoul/glm.h>
|
||||
|
||||
namespace {
|
||||
constexpr const char* _loggerCat = "DataProcessorKameleon";
|
||||
} // namespace
|
||||
|
||||
namespace openspace {
|
||||
|
||||
DataProcessorKameleon::DataProcessorKameleon()
|
||||
@@ -165,10 +161,12 @@ void DataProcessorKameleon::dimensions(glm::size3_t dimensions) {
|
||||
_dimensions = dimensions;
|
||||
}
|
||||
|
||||
void DataProcessorKameleon::initializeKameleonWrapper(std::string path){
|
||||
void DataProcessorKameleon::initializeKameleonWrapper(std::string path) {
|
||||
const std::string& extension = ghoul::filesystem::File(absPath(path)).fileExtension();
|
||||
if(FileSys.fileExists(absPath(path)) && extension == "cdf"){
|
||||
if(_kw) _kw->close();
|
||||
if (FileSys.fileExists(absPath(path)) && extension == "cdf") {
|
||||
if (_kw) {
|
||||
_kw->close();
|
||||
}
|
||||
|
||||
_kwPath = path;
|
||||
_kw = std::make_shared<KameleonWrapper>(absPath(_kwPath));
|
||||
|
||||
@@ -51,8 +51,8 @@
|
||||
|
||||
#ifdef __clang__
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wuseless-cast"
|
||||
#pragma clang diagnostic ignored "-Wzero-as-null-pointer-constant"
|
||||
// #pragma clang diagnostic ignored "-Wuseless-cast"
|
||||
// #pragma clang diagnostic ignored "-Wzero-as-null-pointer-constant"
|
||||
#elif (defined __GNUC__)
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wuseless-cast"
|
||||
@@ -661,7 +661,7 @@ void IswaManager::fillCygnetInfo(std::string jsonString) {
|
||||
|
||||
for (auto list : lists) {
|
||||
json jsonList = j[list];
|
||||
for (int i=0; i<jsonList.size(); i++) {
|
||||
for (size_t i = 0; i < jsonList.size(); ++i) {
|
||||
json jCygnet = jsonList.at(i);
|
||||
|
||||
std::string name = jCygnet["cygnetDisplayTitle"];
|
||||
@@ -689,7 +689,7 @@ void IswaManager::addCdfFiles(std::string cdfpath) {
|
||||
|
||||
if (jsonFile.is_open()) {
|
||||
json cdfGroups = json::parse(jsonFile);
|
||||
for(int i=0; i<cdfGroups.size(); i++){
|
||||
for(size_t i = 0; i < cdfGroups.size(); ++i) {
|
||||
json cdfGroup = cdfGroups.at(i);
|
||||
|
||||
std::string groupName = cdfGroup["group"];
|
||||
|
||||
@@ -111,7 +111,7 @@ double getTime(ccmc::Kameleon* kameleon) {
|
||||
case 17: // YYYY-MM-DDTHH:MM: => YYYY-MM-DDTHH:MM:SS
|
||||
seqStartStr += "00";
|
||||
[[fallthrough]];
|
||||
// case 19 : // YYYY-MM-DDTHH:MM:SS => YYYY-MM-DDTHH:MM:SS.000
|
||||
// case 19 : // YYYY-MM-DDTHH:MM:SS => YYYY-MM-DDTHH:MM:SS.000
|
||||
// seqStartStr += ".000";
|
||||
// case 23 : // YYYY-MM-DDTHH:MM:SS. => YYYY-MM-DDTHH:MM:SS.000Z
|
||||
// seqStartStr += "Z";
|
||||
@@ -142,7 +142,7 @@ double getTime(ccmc::Kameleon* kameleon) {
|
||||
Time::convertTime(
|
||||
seqStartStr.substr(0, seqStartStr.length() - 2));
|
||||
} else {
|
||||
LWARNING("No starting time attribute could be found in the .cdf file."
|
||||
LWARNING("No starting time attribute could be found in the .cdf file."
|
||||
"Starting time is set to 01.JAN.2000 12:00.");
|
||||
seqStartDbl = 0.0;
|
||||
}
|
||||
|
||||
@@ -45,7 +45,9 @@
|
||||
#pragma warning (pop)
|
||||
#endif // WIN32
|
||||
|
||||
#ifdef WIN32
|
||||
#define _USE_MATH_DEFINES
|
||||
#endif // WIN32
|
||||
#include <math.h>
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
|
||||
@@ -65,7 +65,6 @@ KameleonVolumeReader::KameleonVolumeReader(const std::string& path)
|
||||
if (status != ccmc::FileReader::OK) {
|
||||
LERROR(fmt::format("Failed to open file '{}' with Kameleon", _path));
|
||||
throw ghoul::RuntimeError("Failed to open file: " + _path + " with Kameleon");
|
||||
return;
|
||||
}
|
||||
|
||||
_model = _kameleon.model;
|
||||
|
||||
@@ -132,8 +132,7 @@ namespace {
|
||||
};
|
||||
} // namespace
|
||||
|
||||
namespace openspace {
|
||||
namespace kameleonvolume {
|
||||
namespace openspace::kameleonvolume {
|
||||
|
||||
RenderableKameleonVolume::RenderableKameleonVolume(const ghoul::Dictionary& dictionary)
|
||||
: Renderable(dictionary)
|
||||
@@ -182,7 +181,7 @@ RenderableKameleonVolume::RenderableKameleonVolume(const ghoul::Dictionary& dict
|
||||
if (dictionary.getValue(KeySource, sourcePath)) {
|
||||
_sourcePath = absPath(sourcePath);
|
||||
}
|
||||
|
||||
|
||||
std::string variable;
|
||||
if (dictionary.getValue(KeyVariable, variable)) {
|
||||
_variable = variable;
|
||||
@@ -256,12 +255,12 @@ RenderableKameleonVolume::RenderableKameleonVolume(const ghoul::Dictionary& dict
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
RenderableKameleonVolume::~RenderableKameleonVolume() {}
|
||||
|
||||
void RenderableKameleonVolume::initializeGL() {
|
||||
load();
|
||||
|
||||
|
||||
_volumeTexture->uploadTexture();
|
||||
_transferFunction->update();
|
||||
|
||||
@@ -323,7 +322,7 @@ void RenderableKameleonVolume::initializeGL() {
|
||||
void RenderableKameleonVolume::updateRaycasterModelTransform() {
|
||||
glm::vec3 lowerBoundingBoxBound = _domainScale.value() * _lowerDomainBound.value();
|
||||
glm::vec3 upperBoundingBoxBound = _domainScale.value() * _upperDomainBound.value();
|
||||
|
||||
|
||||
glm::vec3 scale = upperBoundingBoxBound - lowerBoundingBoxBound;
|
||||
glm::vec3 translation = (lowerBoundingBoxBound + upperBoundingBoxBound) * 0.5f;
|
||||
|
||||
@@ -398,7 +397,7 @@ void RenderableKameleonVolume::loadCdf(const std::string& path) {
|
||||
}
|
||||
|
||||
std::vector<std::string> variables = reader.gridVariableNames();
|
||||
|
||||
|
||||
if (variables.size() == 3 && _autoDomainBounds) {
|
||||
_lowerDomainBound = glm::vec3(
|
||||
reader.minValue(variables[0]),
|
||||
@@ -458,18 +457,18 @@ void RenderableKameleonVolume::storeRaw(const std::string& path) {
|
||||
volume::RawVolumeWriter<float> writer(path);
|
||||
writer.write(*_rawVolume);
|
||||
}
|
||||
|
||||
|
||||
void RenderableKameleonVolume::deinitializeGL() {
|
||||
if (_raycaster) {
|
||||
OsEng.renderEngine().raycasterManager().detachRaycaster(*_raycaster.get());
|
||||
_raycaster = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool RenderableKameleonVolume::isReady() const {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void RenderableKameleonVolume::update(const UpdateData&) {
|
||||
if (_raycaster) {
|
||||
_raycaster->setStepSize(_stepSize);
|
||||
@@ -479,6 +478,5 @@ void RenderableKameleonVolume::update(const UpdateData&) {
|
||||
void RenderableKameleonVolume::render(const RenderData& data, RendererTasks& tasks) {
|
||||
tasks.raycasterTasks.push_back({ _raycaster.get(), data });
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
} // openspace::kameleonvolume
|
||||
|
||||
@@ -49,8 +49,6 @@ namespace {
|
||||
|
||||
constexpr const char* KeyMinValue = "MinValue";
|
||||
constexpr const char* KeyMaxValue = "MaxValue";
|
||||
|
||||
constexpr const char* _loggerCat = "KameleonVolumeToRawTask";
|
||||
} // namespace
|
||||
|
||||
namespace openspace {
|
||||
|
||||
@@ -140,7 +140,7 @@ void AtlasManager::updateAtlas(BUFFER_INDEX bufferIndex, std::vector<int>& brick
|
||||
glUnmapBuffer(GL_PIXEL_UNPACK_BUFFER);
|
||||
glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0);
|
||||
|
||||
for (int i = 0; i < nBrickIndices; i++) {
|
||||
for (size_t i = 0; i < nBrickIndices; i++) {
|
||||
_atlasMap[i] = _brickMap[brickIndices[i]];
|
||||
}
|
||||
|
||||
|
||||
@@ -22,17 +22,13 @@
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#include <modules/multiresvolume/rendering/histogrammanager.h>
|
||||
|
||||
#include <openspace/util/histogram.h>
|
||||
#include <cassert>
|
||||
#include <float.h>
|
||||
#include <math.h>
|
||||
#include <string.h>
|
||||
#include <cassert>
|
||||
|
||||
#include <modules/multiresvolume/rendering/histogrammanager.h>
|
||||
#include <openspace/util/histogram.h>
|
||||
|
||||
namespace {
|
||||
constexpr const char* _loggerCat = "HistogramManager";
|
||||
} // namespace
|
||||
|
||||
namespace openspace {
|
||||
|
||||
@@ -173,11 +169,11 @@ bool HistogramManager::saveToFile(const std::string& filename) {
|
||||
file.write(reinterpret_cast<char*>(&_minBin), sizeof(float));
|
||||
file.write(reinterpret_cast<char*>(&_maxBin), sizeof(float));
|
||||
|
||||
int nFloats = numHistograms * _numBins;
|
||||
size_t nFloats = numHistograms * _numBins;
|
||||
float* histogramData = new float[nFloats];
|
||||
|
||||
for (size_t i = 0; i < numHistograms; ++i) {
|
||||
int offset = i*_numBins;
|
||||
size_t offset = i*_numBins;
|
||||
memcpy(&histogramData[offset], _histograms[i].data(), sizeof(float) * _numBins);
|
||||
}
|
||||
|
||||
|
||||
@@ -30,10 +30,6 @@
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
|
||||
namespace {
|
||||
constexpr const char* _loggerCat = "LocalTfBrickSelector";
|
||||
} // namespace
|
||||
|
||||
namespace openspace {
|
||||
|
||||
LocalTfBrickSelector::LocalTfBrickSelector(TSP* tsp, LocalErrorHistogramManager* hm,
|
||||
@@ -355,7 +351,7 @@ bool LocalTfBrickSelector::calculateBrickErrors() {
|
||||
brickIndex
|
||||
);
|
||||
float error = 0;
|
||||
for (int i = 0; i < gradients.size(); i++) {
|
||||
for (size_t i = 0; i < gradients.size(); i++) {
|
||||
float x = (i + 0.5f) / tfWidth;
|
||||
float sample = histogram->interpolate(x);
|
||||
ghoul_assert(sample >= 0, "@MISSING");
|
||||
@@ -372,7 +368,7 @@ bool LocalTfBrickSelector::calculateBrickErrors() {
|
||||
brickIndex
|
||||
);
|
||||
float error = 0;
|
||||
for (int i = 0; i < gradients.size(); i++) {
|
||||
for (size_t i = 0; i < gradients.size(); i++) {
|
||||
float x = (i + 0.5f) / tfWidth;
|
||||
float sample = histogram->interpolate(x);
|
||||
ghoul_assert(sample >= 0, "@MISSING");
|
||||
|
||||
@@ -48,10 +48,10 @@ namespace openspace {
|
||||
MultiresVolumeRaycaster::MultiresVolumeRaycaster(std::shared_ptr<TSP> tsp,
|
||||
std::shared_ptr<AtlasManager> atlasManager,
|
||||
std::shared_ptr<TransferFunction> transferFunction)
|
||||
: _tsp(tsp)
|
||||
: _boundingBox(glm::vec3(1.0))
|
||||
, _tsp(tsp)
|
||||
, _atlasManager(atlasManager)
|
||||
, _transferFunction(transferFunction)
|
||||
, _boundingBox(glm::vec3(1.0))
|
||||
{}
|
||||
|
||||
MultiresVolumeRaycaster::~MultiresVolumeRaycaster() {}
|
||||
|
||||
@@ -77,11 +77,11 @@ public:
|
||||
void setModelTransform(glm::mat4 transform);
|
||||
//void setTime(double time);
|
||||
void setStepSizeCoefficient(float coefficient);
|
||||
|
||||
private:
|
||||
BoxGeometry _boundingBox;
|
||||
glm::mat4 _modelTransform;
|
||||
float _stepSizeCoefficient;
|
||||
double _time;
|
||||
|
||||
std::shared_ptr<TSP> _tsp;
|
||||
std::shared_ptr<AtlasManager> _atlasManager;
|
||||
|
||||
@@ -24,10 +24,6 @@
|
||||
|
||||
#include <modules/multiresvolume/rendering/shenbrickselector.h>
|
||||
|
||||
namespace {
|
||||
constexpr const char* _loggerCat = "ShenBrickSelector";
|
||||
} // namespace
|
||||
|
||||
namespace openspace {
|
||||
|
||||
ShenBrickSelector::ShenBrickSelector(TSP* tsp, float spatialTolerance, float temporalTolerance)
|
||||
|
||||
@@ -307,7 +307,7 @@ bool SimpleTfBrickSelector::calculateBrickImportances() {
|
||||
}
|
||||
|
||||
float dotProduct = 0;
|
||||
for (int i = 0; i < tf->width(); i++) {
|
||||
for (size_t i = 0; i < tf->width(); i++) {
|
||||
float x = static_cast<float>(i) / static_cast<float>(tfWidth);
|
||||
float sample = histogram->interpolate(x);
|
||||
|
||||
|
||||
@@ -30,10 +30,6 @@
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
|
||||
namespace {
|
||||
constexpr const char* _loggerCat = "TfBrickSelector";
|
||||
} // namespace
|
||||
|
||||
namespace openspace {
|
||||
|
||||
TfBrickSelector::TfBrickSelector(TSP* tsp, ErrorHistogramManager* hm,
|
||||
@@ -364,7 +360,7 @@ bool TfBrickSelector::calculateBrickErrors() {
|
||||
} else {
|
||||
const Histogram* histogram = _histogramManager->getHistogram(brickIndex);
|
||||
float error = 0;
|
||||
for (int i = 0; i < gradients.size(); i++) {
|
||||
for (size_t i = 0; i < gradients.size(); i++) {
|
||||
float x = (i + 0.5f) / tfWidth;
|
||||
float sample = histogram->interpolate(x);
|
||||
ghoul_assert(sample >= 0, "@MISSING");
|
||||
|
||||
@@ -56,7 +56,7 @@ namespace {
|
||||
constexpr const char* KeyBoundsSimplification = "SimplifyBounds";
|
||||
|
||||
const int InterpolationSteps = 5;
|
||||
|
||||
|
||||
const double Epsilon = 1e-4;
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo LineWidthInfo = {
|
||||
@@ -360,7 +360,7 @@ void RenderableFov::initializeGL() {
|
||||
"RenderableFov"
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
if (_simplifyBounds) {
|
||||
const size_t sizeBefore = res.bounds.size();
|
||||
for (size_t i = 1; i < res.bounds.size() - 1; ++i) {
|
||||
|
||||
@@ -225,7 +225,9 @@ void RenderableModelProjection::initializeGL() {
|
||||
_fboUniformCache.ProjectorMatrix = _fboProgramObject->uniformLocation(
|
||||
"ProjectorMatrix"
|
||||
);
|
||||
_fboUniformCache.ModelTransform = _fboProgramObject->uniformLocation("ModelTransform");
|
||||
_fboUniformCache.ModelTransform = _fboProgramObject->uniformLocation(
|
||||
"ModelTransform"
|
||||
);
|
||||
_fboUniformCache.boresight = _fboProgramObject->uniformLocation("boresight");
|
||||
|
||||
|
||||
|
||||
@@ -604,7 +604,10 @@ void RenderablePlanetProjection::render(const RenderData& data, RendererTasks&)
|
||||
|
||||
glm::dmat4 modelViewTransform = data.camera.combinedViewMatrix() * modelTransform;
|
||||
|
||||
_programObject->setUniform(_mainUniformCache.modelTransform, glm::mat4(modelTransform));
|
||||
_programObject->setUniform(
|
||||
_mainUniformCache.modelTransform,
|
||||
glm::mat4(modelTransform)
|
||||
);
|
||||
_programObject->setUniform(_mainUniformCache
|
||||
.modelViewProjectionTransform,
|
||||
data.camera.projectionMatrix() * glm::mat4(modelViewTransform)
|
||||
|
||||
@@ -125,7 +125,7 @@ public:
|
||||
* makes the request. If an instance is not registered in the class then the singleton
|
||||
* returns false and no projections will occur.
|
||||
*/
|
||||
bool getImagePaths(std::vector<Image>& captures, std::string projectee,
|
||||
bool getImagePaths(std::vector<Image>& captures, std::string projectee,
|
||||
std::string instrumentRequest, double sinceTime);
|
||||
|
||||
/*
|
||||
|
||||
@@ -515,7 +515,7 @@ void ProjectionComponent::imageProjectBegin() {
|
||||
if (!FramebufferObject::errorChecking(status).empty()) {
|
||||
LERROR(fmt::format(
|
||||
"Read Buffer ({}): {}",
|
||||
msg,
|
||||
msg,
|
||||
FramebufferObject::errorChecking(status)
|
||||
));
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ namespace {
|
||||
"selected, its value is stored in the 'SpoutName' property, overwriting its "
|
||||
"previous value."
|
||||
};
|
||||
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo UpdateInfo = {
|
||||
"UpdateSelection",
|
||||
"Update Selection",
|
||||
@@ -120,7 +120,7 @@ RenderablePlaneSpout::RenderablePlaneSpout(const ghoul::Dictionary& dictionary)
|
||||
}
|
||||
|
||||
_spoutName.onChange([this]() {
|
||||
_isSpoutDirty = true;
|
||||
_isSpoutDirty = true;
|
||||
_isErrorMessageDisplayed = false;
|
||||
|
||||
_receiver->SetActiveSender(_spoutName.value().c_str());
|
||||
@@ -206,7 +206,7 @@ void RenderablePlaneSpout::update(const UpdateData& data) {
|
||||
|
||||
if (!createSuccess) {
|
||||
LWARNINGC(
|
||||
LoggerCat,
|
||||
LoggerCat,
|
||||
fmt::format("Could not create receiver for {}", _currentSenderName)
|
||||
);
|
||||
return;
|
||||
@@ -215,7 +215,7 @@ void RenderablePlaneSpout::update(const UpdateData& data) {
|
||||
|
||||
unsigned int width;
|
||||
unsigned int height;
|
||||
|
||||
|
||||
bool receiveSuccess = _receiver->ReceiveTexture(
|
||||
_currentSenderName,
|
||||
width,
|
||||
|
||||
@@ -69,6 +69,6 @@ private:
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
#endif // __OPENSPACE_MODULE_SPOUT___RENDERABLEPLANESPOUT___H__
|
||||
|
||||
#endif // WIN32
|
||||
|
||||
#endif // __OPENSPACE_MODULE_SPOUT___RENDERABLEPLANESPOUT___H__
|
||||
|
||||
@@ -48,7 +48,7 @@ namespace {
|
||||
"selected, its value is stored in the 'SpoutName' property, overwriting its "
|
||||
"previous value."
|
||||
};
|
||||
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo UpdateInfo = {
|
||||
"UpdateSelection",
|
||||
"Update Selection",
|
||||
@@ -115,7 +115,7 @@ ScreenSpaceSpout::ScreenSpaceSpout(const ghoul::Dictionary& dictionary)
|
||||
}
|
||||
|
||||
_spoutName.onChange([this]() {
|
||||
_isSpoutDirty = true;
|
||||
_isSpoutDirty = true;
|
||||
_isErrorMessageDisplayed = false;
|
||||
|
||||
_receiver->SetActiveSender(_spoutName.value().c_str());
|
||||
@@ -214,7 +214,7 @@ void ScreenSpaceSpout::update() {
|
||||
|
||||
unsigned int width;
|
||||
unsigned int height;
|
||||
|
||||
|
||||
bool receiveSuccess = _receiver->ReceiveTexture(
|
||||
_currentSenderName,
|
||||
width,
|
||||
|
||||
@@ -69,6 +69,6 @@ private:
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
#endif // __OPENSPACE_MODULE_SPOUT___SCREENSPACESPOUT___H__
|
||||
|
||||
#endif // WIN32
|
||||
|
||||
#endif // __OPENSPACE_MODULE_SPOUT___SCREENSPACESPOUT___H__
|
||||
|
||||
@@ -22,27 +22,27 @@
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#include "httpsynchronization.h"
|
||||
#include <modules/sync/syncs/httpsynchronization.h>
|
||||
|
||||
#include <modules/sync/syncmodule.h>
|
||||
|
||||
#include <openspace/documentation/verifier.h>
|
||||
#include <openspace/engine/openspaceengine.h>
|
||||
#include <openspace/engine/moduleengine.h>
|
||||
#include <openspace/util/httprequest.h>
|
||||
|
||||
#include <ghoul/logging/logmanager.h>
|
||||
#include <ghoul/filesystem/filesystem.h>
|
||||
#include <openspace/documentation/verifier.h>
|
||||
|
||||
#include <sstream>
|
||||
#include <ghoul/logging/logmanager.h>
|
||||
#include <cstdio>
|
||||
#include <fstream>
|
||||
#include <numeric>
|
||||
#include <memory>
|
||||
#include <sstream>
|
||||
|
||||
namespace {
|
||||
constexpr const char* KeyIdentifier = "Identifier";
|
||||
constexpr const char* KeyVersion = "Version";
|
||||
|
||||
constexpr const char* TempSuffix = ".tmp";
|
||||
|
||||
constexpr const char* QueryKeyIdentifier = "identifier";
|
||||
constexpr const char* QueryKeyFileVersion = "file_version";
|
||||
constexpr const char* QueryKeyApplicationVersion = "application_version";
|
||||
@@ -214,8 +214,8 @@ bool HttpSynchronization::trySyncFromUrl(std::string listUrl) {
|
||||
std::string filename = line.substr(lastSlash + 1);
|
||||
|
||||
std::string fileDestination = directory() +
|
||||
ghoul::filesystem::FileSystem::PathSeparator +
|
||||
filename;
|
||||
ghoul::filesystem::FileSystem::PathSeparator +
|
||||
filename + TempSuffix;
|
||||
|
||||
downloads.push_back(std::make_unique<AsyncHttpFileDownload>(
|
||||
line, fileDestination, HttpFileDownload::Overwrite::Yes));
|
||||
@@ -256,7 +256,31 @@ bool HttpSynchronization::trySyncFromUrl(std::string listUrl) {
|
||||
bool failed = false;
|
||||
for (std::unique_ptr<AsyncHttpFileDownload>& d : downloads) {
|
||||
d->wait();
|
||||
if (!d->hasSucceeded()) {
|
||||
if (d->hasSucceeded()) {
|
||||
// If we are forcing the override, we download to a temporary file
|
||||
// first, so when we are done here, we need to rename the file to the
|
||||
// original name
|
||||
|
||||
const std::string& tempName = d->destination();
|
||||
std::string originalName = tempName.substr(
|
||||
0,
|
||||
tempName.size() - strlen(TempSuffix)
|
||||
);
|
||||
|
||||
FileSys.deleteFile(originalName);
|
||||
int success = rename(tempName.c_str(), originalName.c_str());
|
||||
if (success != 0) {
|
||||
LERRORC(
|
||||
"URLSynchronization",
|
||||
fmt::format(
|
||||
"Error renaming file {} to {}", tempName, originalName
|
||||
)
|
||||
);
|
||||
|
||||
failed = true;
|
||||
}
|
||||
}
|
||||
else {
|
||||
failed = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -167,9 +167,9 @@ bool TorrentSynchronization::hasSyncFile() {
|
||||
void TorrentSynchronization::createSyncFile() {
|
||||
std::string directoryName = directory();
|
||||
std::string filepath = directoryName + ".ossync";
|
||||
|
||||
|
||||
FileSys.createDirectory(directoryName, ghoul::filesystem::Directory::Recursive::Yes);
|
||||
|
||||
|
||||
std::ofstream syncFile(filepath, std::ofstream::out);
|
||||
syncFile << "Synchronized";
|
||||
syncFile.close();
|
||||
|
||||
@@ -35,10 +35,14 @@
|
||||
#include <fstream>
|
||||
#include <numeric>
|
||||
#include <memory>
|
||||
#include <cstdio>
|
||||
|
||||
namespace {
|
||||
constexpr const char* KeyUrl = "Url";
|
||||
constexpr const char* KeyIdentifier = "Identifier";
|
||||
constexpr const char* KeyOverride = "Override";
|
||||
|
||||
constexpr const char* TempSuffix = ".tmp";
|
||||
} // namespace
|
||||
|
||||
namespace openspace {
|
||||
@@ -63,6 +67,16 @@ documentation::Documentation UrlSynchronization::Documentation() {
|
||||
"This optional identifier will be part of the used folder structure and, "
|
||||
"if provided, can be used to manually find the downloaded folder in the "
|
||||
"synchronization folder."
|
||||
},
|
||||
{
|
||||
KeyOverride,
|
||||
new BoolVerifier,
|
||||
Optional::Yes,
|
||||
"If this value is set to 'true' and it is not overwritten by the global "
|
||||
"settings, the file(s) pointed to by this URLSynchronization will always "
|
||||
"be downloaded, thus overwriting the local files. This is useful for "
|
||||
"files that are updated regularly remotely and should be fetch at every "
|
||||
"startup."
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -101,6 +115,10 @@ UrlSynchronization::UrlSynchronization(const ghoul::Dictionary& dict,
|
||||
else {
|
||||
_identifier = std::to_string(hash);
|
||||
}
|
||||
|
||||
if (dict.hasValue<bool>(KeyOverride)) {
|
||||
_forceOverride = dict.value<bool>(KeyOverride);
|
||||
}
|
||||
}
|
||||
|
||||
UrlSynchronization::~UrlSynchronization() {
|
||||
@@ -116,7 +134,7 @@ void UrlSynchronization::start() {
|
||||
}
|
||||
begin();
|
||||
|
||||
if (hasSyncFile()) {
|
||||
if (hasSyncFile() && !_forceOverride) {
|
||||
resolve();
|
||||
return;
|
||||
}
|
||||
@@ -134,7 +152,7 @@ void UrlSynchronization::start() {
|
||||
|
||||
std::string fileDestination = directory() +
|
||||
ghoul::filesystem::FileSystem::PathSeparator +
|
||||
filename;
|
||||
filename += TempSuffix;
|
||||
|
||||
std::unique_ptr<AsyncHttpFileDownload> download =
|
||||
std::make_unique<AsyncHttpFileDownload>(
|
||||
@@ -174,7 +192,6 @@ void UrlSynchronization::start() {
|
||||
HttpRequest::RequestOptions opt;
|
||||
opt.requestTimeoutSeconds = 0;
|
||||
fileDownload->start(opt);
|
||||
|
||||
}
|
||||
|
||||
startedAllDownloads = true;
|
||||
@@ -182,7 +199,31 @@ void UrlSynchronization::start() {
|
||||
bool failed = false;
|
||||
for (std::unique_ptr<AsyncHttpFileDownload>& d : downloads) {
|
||||
d->wait();
|
||||
if (!d->hasSucceeded()) {
|
||||
if (d->hasSucceeded()) {
|
||||
// If we are forcing the override, we download to a temporary file first,
|
||||
// so when we are done here, we need to rename the file to the original
|
||||
// name
|
||||
|
||||
const std::string& tempName = d->destination();
|
||||
std::string originalName = tempName.substr(
|
||||
0,
|
||||
tempName.size() - strlen(TempSuffix)
|
||||
);
|
||||
|
||||
FileSys.deleteFile(originalName);
|
||||
int success = rename(tempName.c_str(), originalName.c_str());
|
||||
if (success != 0) {
|
||||
LERRORC(
|
||||
"URLSynchronization",
|
||||
fmt::format(
|
||||
"Error renaming file {} to {}", tempName, originalName
|
||||
)
|
||||
);
|
||||
|
||||
failed = true;
|
||||
}
|
||||
}
|
||||
else {
|
||||
failed = true;
|
||||
}
|
||||
}
|
||||
@@ -191,7 +232,7 @@ void UrlSynchronization::start() {
|
||||
createSyncFile();
|
||||
}
|
||||
else {
|
||||
for (auto& d : downloads) {
|
||||
for (std::unique_ptr<AsyncHttpFileDownload>& d : downloads) {
|
||||
d->cancel();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,6 +55,7 @@ private:
|
||||
std::string directory() override;
|
||||
|
||||
std::vector<std::string> _urls;
|
||||
bool _forceOverride = false;
|
||||
std::string _synchronizationRoot;
|
||||
std::string _identifier;
|
||||
|
||||
|
||||
@@ -85,7 +85,7 @@ void TorrentClient::initialize() {
|
||||
settings.set_int(libtorrent::settings_pack::active_downloads, -1);
|
||||
settings.set_int(libtorrent::settings_pack::active_seeds, -1);
|
||||
settings.set_int(libtorrent::settings_pack::active_limit, 30);
|
||||
|
||||
|
||||
settings.set_str(
|
||||
libtorrent::settings_pack::dht_bootstrap_nodes,
|
||||
"router.utorrent.com,dht.transmissionbt.com,router.bittorrent.com,\
|
||||
@@ -146,7 +146,7 @@ void TorrentClient::deinitialize() {
|
||||
void TorrentClient::pollAlerts() {
|
||||
#ifdef SYNC_USE_LIBTORRENT
|
||||
// Libtorrent does not seem to reliably generate alerts for all added torrents.
|
||||
// To make sure that the program does not keep waiting for already finished
|
||||
// To make sure that the program does not keep waiting for already finished
|
||||
// downsloads, we go through the whole list of torrents when polling.
|
||||
// However, in theory, the commented code below should be more efficient:
|
||||
/*
|
||||
|
||||
@@ -97,7 +97,7 @@ public:
|
||||
TorrentProgressCallback cb);
|
||||
|
||||
void removeTorrent(TorrentId id);
|
||||
|
||||
|
||||
private:
|
||||
struct Torrent {
|
||||
TorrentId id;
|
||||
|
||||
@@ -62,7 +62,7 @@ public:
|
||||
// Stores the selected node, the cursor ID as well as the surface coordinates the
|
||||
// cursor touched
|
||||
struct SelectedBody {
|
||||
int id;
|
||||
long id;
|
||||
SceneGraphNode* node;
|
||||
glm::dvec3 coordinates;
|
||||
};
|
||||
|
||||
@@ -25,11 +25,17 @@
|
||||
#ifndef __OPENSPACE_MODULE_TOUCH___TUIO_EAR___H__
|
||||
#define __OPENSPACE_MODULE_TOUCH___TUIO_EAR___H__
|
||||
|
||||
// -Wold-style-cast
|
||||
#if (defined(__GNUC__) && !defined(__clang__))
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wold-style-cast"
|
||||
#endif // defined(__GNUC__) && !defined(__clang__)
|
||||
|
||||
#ifdef __clang__
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wold-style-cast"
|
||||
#endif // __clang__
|
||||
|
||||
#include <modules/touch/ext/libTUIO11/TUIO/TuioListener.h>
|
||||
#include <modules/touch/ext/libTUIO11/TUIO/TuioClient.h>
|
||||
#include <modules/touch/ext/libTUIO11/TUIO/UdpReceiver.h>
|
||||
@@ -38,6 +44,9 @@
|
||||
#if (defined(__GNUC__) && !defined(__clang__))
|
||||
#pragma GCC diagnostic pop
|
||||
#endif // defined(__GNUC__) && !defined(__clang__)
|
||||
#ifdef __clang__
|
||||
#pragma clang diagnostic pop
|
||||
#endif // __clang__
|
||||
|
||||
#include <ghoul/glm.h>
|
||||
|
||||
@@ -107,7 +116,7 @@ class TuioEar : public TUIO::TuioListener {
|
||||
/**
|
||||
* A list that tracks all of the cursor ID's that got removed since last frame
|
||||
*/
|
||||
std::vector<int> _removeList;
|
||||
std::vector<long> _removeList;
|
||||
};
|
||||
|
||||
#endif // __OPENSPACE_MODULE_TOUCH___TUIO_EAR___H__
|
||||
|
||||
@@ -617,9 +617,9 @@ void TouchInteraction::findSelectedNode(const std::vector<TuioCursor>& list) {
|
||||
glm::dvec4(xCo, yCo, -1.0, 1.0));
|
||||
glm::dvec3 raytrace = glm::normalize(cursorInWorldSpace);
|
||||
|
||||
int id = c.getSessionID();
|
||||
long id = c.getSessionID();
|
||||
|
||||
for (SceneGraphNode* node : selectableNodes) {
|
||||
for (SceneGraphNode* node : selectableNodes) {
|
||||
double boundingSphere = node->boundingSphere();
|
||||
glm::dvec3 camToSelectable = node->worldPosition() - camPos;
|
||||
double dist = length(glm::cross(cursorInWorldSpace, camToSelectable)) /
|
||||
@@ -755,7 +755,7 @@ int TouchInteraction::interpretInteraction(const std::vector<TuioCursor>& list,
|
||||
}
|
||||
// find the slowest moving finger - used in roll interpretation
|
||||
double minDiff = 1000;
|
||||
int id = 0;
|
||||
long id = 0;
|
||||
for (const TuioCursor& c : list) {
|
||||
TuioPoint itPoint = std::find_if(
|
||||
lastProcessed.begin(),
|
||||
|
||||
@@ -45,11 +45,11 @@ void TuioEar::addTuioCursor(TuioCursor* tcur) {
|
||||
_tap = false;
|
||||
// find same id in _list if it exists in _removeList (new input with same ID as a
|
||||
// previously stored)
|
||||
int i = tcur->getSessionID();
|
||||
std::vector<int>::iterator foundID = std::find_if(
|
||||
long i = tcur->getSessionID();
|
||||
std::vector<long>::iterator foundID = std::find_if(
|
||||
_removeList.begin(),
|
||||
_removeList.end(),
|
||||
[&i](int id) { return id == i; });
|
||||
[&i](long id) { return id == i; });
|
||||
|
||||
// if found, remove id from _removeList and update, otherwise add new id to list
|
||||
if (foundID != _removeList.end()) {
|
||||
@@ -57,8 +57,9 @@ void TuioEar::addTuioCursor(TuioCursor* tcur) {
|
||||
_list.begin(),
|
||||
_list.end(),
|
||||
[&i](const TuioCursor& cursor) {
|
||||
return cursor.getSessionID() == i;
|
||||
})->update(tcur);
|
||||
return cursor.getSessionID() == i;
|
||||
}
|
||||
)->update(tcur);
|
||||
_removeList.erase(foundID);
|
||||
}
|
||||
else {
|
||||
@@ -70,13 +71,14 @@ void TuioEar::addTuioCursor(TuioCursor* tcur) {
|
||||
void TuioEar::updateTuioCursor(TuioCursor* tcur) {
|
||||
_mx.lock();
|
||||
_tap = false;
|
||||
int i = tcur->getSessionID();
|
||||
long i = tcur->getSessionID();
|
||||
std::find_if(
|
||||
_list.begin(),
|
||||
_list.end(),
|
||||
[&i](const TuioCursor& cursor) {
|
||||
return cursor.getSessionID() == i;
|
||||
})->update(tcur);
|
||||
}
|
||||
)->update(tcur);
|
||||
_mx.unlock();
|
||||
}
|
||||
|
||||
@@ -139,15 +141,16 @@ void TuioEar::clearInput() {
|
||||
_list.begin(),
|
||||
_list.end(),
|
||||
[this](const TuioCursor& cursor) {
|
||||
return std::find_if(
|
||||
_removeList.begin(),
|
||||
_removeList.end(),
|
||||
[&cursor](int id) {
|
||||
return cursor.getSessionID() == id;
|
||||
}
|
||||
) != _removeList.end();
|
||||
}),
|
||||
_list.end()
|
||||
return std::find_if(
|
||||
_removeList.begin(),
|
||||
_removeList.end(),
|
||||
[&cursor](long id) {
|
||||
return cursor.getSessionID() == id;
|
||||
}
|
||||
) != _removeList.end();
|
||||
}
|
||||
),
|
||||
_list.end()
|
||||
);
|
||||
_removeList.clear();
|
||||
_mx.unlock();
|
||||
|
||||
Reference in New Issue
Block a user