mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-04-23 20:50:59 -05:00
Feature/jenkins warnings (#538)
* Remove warnings from Jenkins * Improve Jenkins behavior
This commit is contained in:
@@ -249,7 +249,7 @@ void AtmosphereDeferredcaster::preRaycast(const RenderData& renderData,
|
||||
|
||||
// The following scale comes from PSC transformations.
|
||||
float fScaleFactor = renderData.camera.scaling().x *
|
||||
pow(10.0, renderData.camera.scaling().y);
|
||||
pow(10.f, renderData.camera.scaling().y);
|
||||
glm::dmat4 dfScaleCamTransf = glm::scale(glm::dvec3(fScaleFactor));
|
||||
program.setUniform(
|
||||
"dInverseScaleTransformMatrix",
|
||||
|
||||
@@ -323,11 +323,11 @@ DashboardItemAngle::DashboardItemAngle(ghoul::Dictionary dictionary)
|
||||
);
|
||||
});
|
||||
if (dictionary.hasKey(DestinationTypeInfo.identifier)) {
|
||||
std::string value = dictionary.value<std::string>(DestinationTypeInfo.identifier);
|
||||
if (value == "Node") {
|
||||
std::string type = dictionary.value<std::string>(DestinationTypeInfo.identifier);
|
||||
if (type == "Node") {
|
||||
_destination.type = Type::Node;
|
||||
}
|
||||
else if (value == "Focus") {
|
||||
else if (type == "Focus") {
|
||||
_destination.type = Type::Focus;
|
||||
}
|
||||
else {
|
||||
@@ -391,7 +391,7 @@ std::pair<glm::dvec3, std::string> DashboardItemAngle::positionAndLabel(
|
||||
default:
|
||||
return { glm::dvec3(0.0), "Unknown" };
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
void DashboardItemAngle::render(glm::vec2& penPosition) {
|
||||
std::pair<glm::dvec3, std::string> sourceInfo = positionAndLabel(_source);
|
||||
|
||||
@@ -409,7 +409,7 @@ std::pair<glm::dvec3, std::string> DashboardItemDistance::positionAndLabel(
|
||||
default:
|
||||
return { glm::dvec3(0.0), "Unknown" };
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
void DashboardItemDistance::render(glm::vec2& penPosition) {
|
||||
std::pair<glm::dvec3, std::string> sourceInfo = positionAndLabel(
|
||||
|
||||
@@ -51,7 +51,7 @@ public:
|
||||
static documentation::Documentation Documentation();
|
||||
|
||||
protected:
|
||||
virtual void bindTexture();
|
||||
virtual void bindTexture() override;
|
||||
|
||||
private:
|
||||
void loadTexture();
|
||||
|
||||
@@ -50,7 +50,7 @@ public:
|
||||
static documentation::Documentation Documentation();
|
||||
|
||||
protected:
|
||||
virtual void bindTexture();
|
||||
virtual void bindTexture() override;
|
||||
|
||||
private:
|
||||
std::future<DownloadManager::MemoryFile> downloadImageToMemory(std::string url);
|
||||
@@ -61,10 +61,6 @@ private:
|
||||
std::unique_ptr<ghoul::opengl::Texture> _texture;
|
||||
|
||||
bool _textureIsDirty;
|
||||
bool _downloadImage;
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
@@ -302,16 +302,16 @@ void RenderableSphere::render(const RenderData& data, RendererTasks&) {
|
||||
float adjustedTransparency = _transparency;
|
||||
|
||||
if (_fadeInThreshold > 0.0) {
|
||||
float distCamera = glm::length(data.camera.positionVec3());
|
||||
double distCamera = glm::length(data.camera.positionVec3());
|
||||
float funcValue = static_cast<float>(
|
||||
(1.0 / double(_fadeInThreshold/1E24))*(distCamera / 1E24)
|
||||
);
|
||||
|
||||
adjustedTransparency *= funcValue > 1.0 ? 1.0 : funcValue;
|
||||
adjustedTransparency *= funcValue > 1.f ? 1.f : funcValue;
|
||||
}
|
||||
|
||||
if (_fadeOutThreshold > -1.0) {
|
||||
float distCamera = glm::distance(
|
||||
double distCamera = glm::distance(
|
||||
data.camera.positionVec3(),
|
||||
data.position.dvec3()
|
||||
);
|
||||
|
||||
@@ -533,7 +533,7 @@ bool FixedRotation::initialize() {
|
||||
return res;
|
||||
}
|
||||
|
||||
glm::dmat3 FixedRotation::matrix(const Time& time) const {
|
||||
glm::dmat3 FixedRotation::matrix(const Time&) const {
|
||||
if (!_enabled) {
|
||||
return glm::dmat3();
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ public:
|
||||
StaticTranslation();
|
||||
StaticTranslation(const ghoul::Dictionary& dictionary);
|
||||
|
||||
glm::dvec3 position(const Time& time) const;
|
||||
glm::dvec3 position(const Time& time) const override;
|
||||
static documentation::Documentation Documentation();
|
||||
|
||||
private:
|
||||
|
||||
@@ -521,8 +521,6 @@ void RenderableDUMeshes::renderLabels(const RenderData& data,
|
||||
const glm::vec3& orthoRight,
|
||||
const glm::vec3& orthoUp)
|
||||
{
|
||||
RenderEngine& renderEngine = OsEng.renderEngine();
|
||||
|
||||
float scale = 0.0;
|
||||
switch (_unit) {
|
||||
case Meter:
|
||||
|
||||
@@ -674,8 +674,6 @@ void RenderablePlanesCloud::renderLabels(const RenderData& data,
|
||||
const glm::dvec3& orthoRight,
|
||||
const glm::dvec3& orthoUp, float fadeInVariable)
|
||||
{
|
||||
RenderEngine& renderEngine = OsEng.renderEngine();
|
||||
|
||||
float scale = 0.0;
|
||||
switch (_unit) {
|
||||
case Meter:
|
||||
|
||||
@@ -388,8 +388,8 @@ void RenderablePoints::update(const UpdateData&) {
|
||||
|
||||
if (_hasColorMapFile) {
|
||||
|
||||
const size_t nAstronomicalObjects = _fullData.size() /
|
||||
_nValuesPerAstronomicalObject;
|
||||
// const size_t nAstronomicalObjects = _fullData.size() /
|
||||
// _nValuesPerAstronomicalObject;
|
||||
// const size_t nValues = _slicedData.size() / nAstronomicalObjects;
|
||||
// GLsizei stride = static_cast<GLsizei>(sizeof(double) * nValues);
|
||||
|
||||
|
||||
@@ -38,38 +38,39 @@
|
||||
#include <fstream>
|
||||
|
||||
namespace {
|
||||
|
||||
std::string _loggerCat = "RenderableFieldlines";
|
||||
|
||||
const float defaultFieldlineStepSize = 0.5f;;
|
||||
constexpr const float defaultFieldlineStepSize = 0.5f;
|
||||
const glm::vec4 defaultFieldlineColor = glm::vec4(1.f, 0.f, 0.f, 1.f);
|
||||
|
||||
const char* keyVectorField = "VectorField";
|
||||
const char* keyVectorFieldType = "Type";
|
||||
const char* keyVectorFieldFile = "File";
|
||||
const char* keyVectorFieldVolumeModel = "Model";
|
||||
const char* keyVectorFieldVolumeVariable = "Variables";
|
||||
constexpr const char* keyVectorField = "VectorField";
|
||||
constexpr const char* keyVectorFieldType = "Type";
|
||||
constexpr const char* keyVectorFieldFile = "File";
|
||||
constexpr const char* keyVectorFieldVolumeModel = "Model";
|
||||
constexpr const char* keyVectorFieldVolumeVariable = "Variables";
|
||||
|
||||
const char* keyFieldlines = "Fieldlines";
|
||||
const char* keyFieldlinesStepSize = "Stepsize";
|
||||
const char* keyFieldlinesClassification = "Classification";
|
||||
const char* keyFieldlinesColor = "Color";
|
||||
constexpr const char* keyFieldlines = "Fieldlines";
|
||||
constexpr const char* keyFieldlinesStepSize = "Stepsize";
|
||||
constexpr const char* keyFieldlinesClassification = "Classification";
|
||||
constexpr const char* keyFieldlinesColor = "Color";
|
||||
|
||||
const char* keySeedPoints = "SeedPoints";
|
||||
const char* keySeedPointsType = "Type";
|
||||
const char* keySeedPointsFile = "File";
|
||||
const char* keySeedPointsTable = "SeedPoints";
|
||||
constexpr const char* keySeedPoints = "SeedPoints";
|
||||
constexpr const char* keySeedPointsType = "Type";
|
||||
constexpr const char* keySeedPointsFile = "File";
|
||||
constexpr const char* keySeedPointsTable = "SeedPoints";
|
||||
|
||||
const char* seedPointsSourceFile = "File";
|
||||
const char* seedPointsSourceTable = "Table";
|
||||
constexpr const char* seedPointsSourceFile = "File";
|
||||
constexpr const char* seedPointsSourceTable = "Table";
|
||||
|
||||
const char* vectorFieldTypeVolumeKameleon = "VolumeKameleon";
|
||||
constexpr const char* vectorFieldTypeVolumeKameleon = "VolumeKameleon";
|
||||
|
||||
const char* vectorFieldKameleonModelBATSRUS = "BATSRUS";
|
||||
constexpr const char* vectorFieldKameleonModelBATSRUS = "BATSRUS";
|
||||
|
||||
const char* vectorFieldKameleonVariableLorentz = "Lorentz";
|
||||
constexpr const char* vectorFieldKameleonVariableLorentz = "Lorentz";
|
||||
|
||||
const int SeedPointSourceFile = 0;
|
||||
const int SeedPointSourceTable = 1;
|
||||
constexpr const int SeedPointSourceFile = 0;
|
||||
constexpr const int SeedPointSourceTable = 1;
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo StepSizeInfo = {
|
||||
"StepSize",
|
||||
@@ -309,7 +310,7 @@ void RenderableFieldlines::update(const UpdateData&) {
|
||||
int prevEnd = 0;
|
||||
std::vector<LinePoint> vertexData;
|
||||
// Arrange data for glMultiDrawArrays
|
||||
for (int j = 0; j < fieldlines.size(); ++j) {
|
||||
for (size_t j = 0; j < fieldlines.size(); ++j) {
|
||||
_lineStart.push_back(prevEnd);
|
||||
_lineCount.push_back(static_cast<int>(fieldlines[j].size()));
|
||||
prevEnd = prevEnd + static_cast<int>(fieldlines[j].size());
|
||||
|
||||
@@ -88,7 +88,7 @@ T Angle<T>::asRadians() const {
|
||||
|
||||
template <typename T>
|
||||
T Angle<T>::asDegrees() const {
|
||||
return _radians * 180.0 / PI;
|
||||
return _radians * T(180.0) / PI;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
|
||||
@@ -47,7 +47,6 @@ namespace {
|
||||
const char* KeyPerformPreProcessing = "PerformPreProcessing";
|
||||
const char* KeyTilePixelSize = "TilePixelSize";
|
||||
const char* KeyFilePath = "FilePath";
|
||||
const char* KeyBasePath = "BasePath";
|
||||
const char* KeyPreCacheLevel = "PreCacheLevel";
|
||||
const char* KeyPadTiles = "PadTiles";
|
||||
|
||||
|
||||
@@ -141,11 +141,11 @@ void GuiIswaComponent::render() {
|
||||
int cdfOptionValue = _cdfOptionsMap[groupName];
|
||||
const auto& cdfs = group.second;
|
||||
|
||||
for (int i = 0; i < cdfs.size(); ++i) {
|
||||
for (size_t i = 0; i < cdfs.size(); ++i) {
|
||||
ImGui::RadioButton(
|
||||
cdfs[i].name.c_str(),
|
||||
&_cdfOptionsMap[groupName],
|
||||
i
|
||||
static_cast<int>(i)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -192,7 +192,7 @@ void GuiIswaComponent::render() {
|
||||
ImGui::SameLine();
|
||||
|
||||
if (ImGui::CollapsingHeader(("Description" + std::to_string(id)).c_str())) {
|
||||
ImGui::TextWrapped(info->description.c_str());
|
||||
ImGui::TextWrapped("%s", info->description.c_str());
|
||||
ImGui::Spacing();
|
||||
}
|
||||
|
||||
|
||||
@@ -37,10 +37,8 @@
|
||||
#include <openspace/scripting/scriptengine.h>
|
||||
|
||||
#include <ghoul/filesystem/filesystem.h>
|
||||
#include <glm/ext.hpp>
|
||||
#include <ghoul/misc/misc.h>
|
||||
|
||||
#include <glm/gtx/component_wise.hpp>
|
||||
#include <imgui_internal.h>
|
||||
|
||||
namespace openspace {
|
||||
@@ -505,8 +503,8 @@ void renderVec2Property(Property* prop, const std::string& ownerName,
|
||||
ImGui::PushID((ownerName + "." + name).c_str());
|
||||
|
||||
Vec2Property::ValueType value = *p;
|
||||
float min = static_cast<float>(glm::compMin(p->minValue()));
|
||||
float max = static_cast<float>(glm::compMax(p->maxValue()));
|
||||
float min = glm::compMin(p->minValue());
|
||||
float max = glm::compMax(p->maxValue());
|
||||
|
||||
bool changed = ImGui::SliderFloat2(
|
||||
name.c_str(),
|
||||
@@ -541,8 +539,8 @@ void renderVec3Property(Property* prop, const std::string& ownerName,
|
||||
ImGui::PushID((ownerName + "." + name).c_str());
|
||||
|
||||
Vec3Property::ValueType value = *p;
|
||||
float min = static_cast<float>(glm::compMin(p->minValue()));
|
||||
float max = static_cast<float>(glm::compMax(p->maxValue()));
|
||||
float min = glm::compMin(p->minValue());
|
||||
float max = glm::compMax(p->maxValue());
|
||||
|
||||
bool changed = false;
|
||||
if (prop->viewOption(Property::ViewOptions::Color)) {
|
||||
@@ -586,8 +584,8 @@ void renderVec4Property(Property* prop, const std::string& ownerName,
|
||||
ImGui::PushID((ownerName + "." + name).c_str());
|
||||
|
||||
Vec4Property::ValueType value = *p;
|
||||
float min = static_cast<float>(glm::compMin(p->minValue()));
|
||||
float max = static_cast<float>(glm::compMax(p->maxValue()));
|
||||
float min = glm::compMin(p->minValue());
|
||||
float max = glm::compMax(p->maxValue());
|
||||
|
||||
bool changed = false;
|
||||
if (prop->viewOption(Property::ViewOptions::Color)) {
|
||||
@@ -610,7 +608,7 @@ void renderVec4Property(Property* prop, const std::string& ownerName,
|
||||
renderTooltip(prop, tooltipDelay);
|
||||
}
|
||||
|
||||
if (value != p->value()) {
|
||||
if (changed) {
|
||||
executeScript(
|
||||
p->fullyQualifiedIdentifier(),
|
||||
std::to_string(value),
|
||||
|
||||
@@ -30,8 +30,19 @@
|
||||
#pragma warning (disable : 4706) // assignment within conditional expression
|
||||
#endif // WIN32
|
||||
|
||||
#if defined(__GNUC__) && !defined(__clang__)
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant"
|
||||
#pragma GCC diagnostic ignored "-Wuseless-cast"
|
||||
#endif // __GNUC__
|
||||
|
||||
|
||||
#include <modules/iswa/ext/json/json.hpp>
|
||||
|
||||
#if defined(__GNUC__) && !defined(__clang__)
|
||||
#pragma GCC diagnostic pop
|
||||
#endif // __GNUC__
|
||||
|
||||
#ifdef WIN32
|
||||
#pragma warning (pop)
|
||||
#endif // WIN32
|
||||
|
||||
@@ -83,14 +83,15 @@ namespace openspace {
|
||||
|
||||
DataCygnet::DataCygnet(const ghoul::Dictionary& dictionary)
|
||||
: IswaCygnet(dictionary)
|
||||
, _dataProcessor(nullptr)
|
||||
, _dataOptions(DataOptionsInfo)
|
||||
, _transferFunctionsFile(TransferFunctionsFile, "${SCENE}/iswa/tfs/default.tf")
|
||||
, _backgroundValues(BackgroundInfo, glm::vec2(0.f), glm::vec2(0.f), glm::vec2(1.f))
|
||||
, _normValues(NormalizeValuesInfo, glm::vec2(1.f), glm::vec2(0.f), glm::vec2(5.f))
|
||||
, _useLog(UseLogInfo, false)
|
||||
, _useHistogram(UseHistogramInfo, false)
|
||||
, _autoFilter(AutoFilterInfo, true)
|
||||
, _normValues(NormalizeValuesInfo, glm::vec2(1.f), glm::vec2(0.f), glm::vec2(5.f))
|
||||
, _backgroundValues(BackgroundInfo, glm::vec2(0.f), glm::vec2(0.f), glm::vec2(1.f))
|
||||
, _transferFunctionsFile(TransferFunctionsFile, "${SCENE}/iswa/tfs/default.tf")
|
||||
|
||||
, _dataProcessor(nullptr)
|
||||
//FOR TESTING
|
||||
, _numOfBenchmarks(0)
|
||||
, _avgBenchmarkTime(0.0f)
|
||||
@@ -187,8 +188,11 @@ bool DataCygnet::readyToRender() const{
|
||||
*/
|
||||
void DataCygnet::setTextureUniforms(){
|
||||
std::vector<int> selectedOptions = _dataOptions.value();
|
||||
int activeTextures = std::min((int)selectedOptions.size(), MAX_TEXTURES);
|
||||
int activeTransferfunctions = std::min((int)_transferFunctions.size(), MAX_TEXTURES);
|
||||
int activeTextures = std::min(static_cast<int>(selectedOptions.size()), MAX_TEXTURES);
|
||||
int activeTransferfunctions = std::min(
|
||||
static_cast<int>(_transferFunctions.size()),
|
||||
MAX_TEXTURES
|
||||
);
|
||||
|
||||
// Set Textures
|
||||
ghoul::opengl::TextureUnit txUnits[MAX_TEXTURES];
|
||||
@@ -207,8 +211,11 @@ void DataCygnet::setTextureUniforms(){
|
||||
}
|
||||
}
|
||||
|
||||
if(activeTextures > 0 && selectedOptions.back()>=(int)_transferFunctions.size())
|
||||
if (activeTextures > 0 &&
|
||||
selectedOptions.back() >= static_cast<int>(_transferFunctions.size()))
|
||||
{
|
||||
activeTransferfunctions = 1;
|
||||
}
|
||||
|
||||
ghoul::opengl::TextureUnit tfUnits[MAX_TEXTURES];
|
||||
j = 0;
|
||||
|
||||
@@ -78,18 +78,7 @@ protected:
|
||||
*/
|
||||
virtual bool updateTextureResource() override;
|
||||
|
||||
// Subclass interface.
|
||||
// ===================
|
||||
virtual bool createGeometry() = 0;
|
||||
virtual bool destroyGeometry() = 0;
|
||||
virtual void renderGeometry() const = 0;
|
||||
/**
|
||||
* This function should return the processed data that
|
||||
* will populate the texture
|
||||
*/
|
||||
virtual std::vector<float*> textureData() = 0;
|
||||
// This function can call parent setTextureUniforms()
|
||||
virtual void setUniforms() = 0;
|
||||
|
||||
properties::SelectionProperty _dataOptions;
|
||||
properties::StringProperty _transferFunctionsFile;
|
||||
|
||||
@@ -27,10 +27,6 @@
|
||||
|
||||
#include <ghoul/opengl/programobject.h>
|
||||
|
||||
namespace {
|
||||
constexpr const char* _loggerCat = "DataPlane";
|
||||
} // namespace
|
||||
|
||||
namespace openspace {
|
||||
|
||||
DataPlane::DataPlane(const ghoul::Dictionary& dictionary)
|
||||
|
||||
@@ -66,9 +66,9 @@ IswaBaseGroup::IswaBaseGroup(std::string name, std::string type)
|
||||
, _enabled(EnabledInfo, true)
|
||||
, _alpha(AlphaInfo, 0.9f, 0.f, 1.f)
|
||||
, _delete(DeleteInfo)
|
||||
, _dataProcessor(nullptr)
|
||||
, _registered(false)
|
||||
, _type(type)
|
||||
, _dataProcessor(nullptr)
|
||||
{
|
||||
addProperty(_enabled);
|
||||
addProperty(_alpha);
|
||||
@@ -102,8 +102,7 @@ std::shared_ptr<DataProcessor> IswaBaseGroup::dataProcessor(){
|
||||
|
||||
std::shared_ptr<ghoul::Event<ghoul::Dictionary> > IswaBaseGroup::groupEvent() {
|
||||
return _groupEvent;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
void IswaBaseGroup::registerProperties(){
|
||||
_enabled.onChange([this]{
|
||||
|
||||
@@ -82,8 +82,8 @@ IswaCygnet::IswaCygnet(const ghoul::Dictionary& dictionary)
|
||||
dictionary.getValue("CoordinateType", _data->coordinateType);
|
||||
dictionary.getValue("XOffset", xOffset);
|
||||
|
||||
_data->id = (int) renderableId;
|
||||
_data->updateTime = (int) updateTime;
|
||||
_data->id = static_cast<int>(renderableId);
|
||||
_data->updateTime = static_cast<int>(updateTime);
|
||||
_data->spatialScale = spatialScale;
|
||||
_data->gridMin = min;
|
||||
_data->gridMax = max;
|
||||
@@ -98,7 +98,6 @@ IswaCygnet::IswaCygnet(const ghoul::Dictionary& dictionary)
|
||||
(max.z - min.z)
|
||||
);
|
||||
|
||||
|
||||
offset = glm::vec3(
|
||||
(min.x + (std::abs(min.x)+std::abs(max.x))/2.0f)+xOffset,
|
||||
(min.y + (std::abs(min.y)+std::abs(max.y))/2.0f),
|
||||
@@ -112,7 +111,6 @@ IswaCygnet::IswaCygnet(const ghoul::Dictionary& dictionary)
|
||||
addProperty(_delete);
|
||||
|
||||
dictionary.getValue("Group", _data->groupName);
|
||||
|
||||
}
|
||||
|
||||
IswaCygnet::~IswaCygnet(){}
|
||||
@@ -294,7 +292,7 @@ void IswaCygnet::initializeGroup() {
|
||||
_alpha.setValue(dict.value<float>("alpha"));
|
||||
});
|
||||
|
||||
groupEvent->subscribe(name(), "clearGroup", [&](ghoul::Dictionary dict){
|
||||
groupEvent->subscribe(name(), "clearGroup", [&](ghoul::Dictionary){
|
||||
LDEBUG(name() + " Event clearGroup");
|
||||
OsEng.scriptEngine().queueScript(
|
||||
"openspace.removeSceneGraphNode('" + name() + "')",
|
||||
|
||||
@@ -26,7 +26,17 @@
|
||||
#include <modules/iswa/rendering/kameleonplane.h>
|
||||
#include <modules/iswa/util/dataprocessorkameleon.h>
|
||||
#include <ghoul/filesystem/filesystem>
|
||||
|
||||
#ifdef __GNUC__
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant"
|
||||
#endif // __GNUC__
|
||||
|
||||
#include <modules/iswa/ext/json.h>
|
||||
#ifdef __GNUC__
|
||||
#pragma GCC diagnostic pop
|
||||
#endif // __GNUC__
|
||||
|
||||
#include <openspace/engine/openspaceengine.h>
|
||||
#include <openspace/scene/scene.h>
|
||||
|
||||
@@ -147,7 +157,7 @@ void KameleonPlane::initialize() {
|
||||
|
||||
// Set Property callback specific to KameleonPlane
|
||||
_resolution.onChange([this](){
|
||||
for(int i=0; i<_textures.size(); i++){
|
||||
for (size_t i = 0; i < _textures.size(); i++) {
|
||||
_textures[i] = std::move(nullptr);
|
||||
}
|
||||
|
||||
@@ -210,7 +220,7 @@ bool KameleonPlane::createGeometry() {
|
||||
GL_FLOAT,
|
||||
GL_FALSE,
|
||||
sizeof(GLfloat) * 6,
|
||||
reinterpret_cast<void*>(0)
|
||||
nullptr
|
||||
);
|
||||
glEnableVertexAttribArray(1);
|
||||
glVertexAttribPointer(
|
||||
@@ -247,7 +257,7 @@ std::vector<float*> KameleonPlane::textureData() {
|
||||
_dimensions,
|
||||
_slice
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
bool KameleonPlane::updateTextureResource() {
|
||||
_data->offset[_cut] = _data->gridMin[_cut]+_slice.value()*_scale;
|
||||
@@ -377,7 +387,7 @@ void KameleonPlane::setDimensions() {
|
||||
// the cdf files has an offset of 0.5 in normali resolution.
|
||||
// with lower resolution the offset increases.
|
||||
_data->offset = _origOffset - 0.5f* (100.f / _resolution.value());
|
||||
_dimensions = glm::size3_t(_data->scale * ((float)_resolution.value() / 100.f));
|
||||
_dimensions = glm::size3_t(_data->scale * (_resolution.value() / 100.f));
|
||||
_dimensions[_cut] = 1;
|
||||
|
||||
if (_cut == 0) {
|
||||
|
||||
@@ -78,9 +78,9 @@ private:
|
||||
void changeKwPath(std::string path);
|
||||
static int id();
|
||||
|
||||
properties::SelectionProperty _fieldlines;
|
||||
properties::FloatProperty _resolution;
|
||||
properties::FloatProperty _slice;
|
||||
properties::SelectionProperty _fieldlines;
|
||||
|
||||
std::string _kwPath;
|
||||
|
||||
@@ -98,7 +98,7 @@ private:
|
||||
* This is the name, path to seedpoints file and a boolean to determine if it is
|
||||
* active or inactive.
|
||||
*/
|
||||
std::map<int, std::tuple<std::string, std::string, bool> > _fieldlineState;
|
||||
std::map<int, std::tuple<std::string, std::string, bool>> _fieldlineState;
|
||||
std::string _fieldlineIndexFile;
|
||||
int _cut;
|
||||
|
||||
|
||||
@@ -29,23 +29,13 @@
|
||||
#include <modules/iswa/util/iswamanager.h>
|
||||
#include <openspace/engine/openspaceengine.h>
|
||||
|
||||
namespace {
|
||||
constexpr const char* _loggerCat = "ScreenSpaceCygnet";
|
||||
} // namespace
|
||||
|
||||
namespace openspace {
|
||||
|
||||
ScreenSpaceCygnet::ScreenSpaceCygnet(const ghoul::Dictionary& dictionary)
|
||||
: ScreenSpaceImageOnline(dictionary)
|
||||
{
|
||||
// hacky, have to first get as float and then cast to int.
|
||||
float cygnetid;
|
||||
dictionary.getValue("CygnetId", cygnetid);
|
||||
_cygnetId = (int)cygnetid;
|
||||
|
||||
float interval;
|
||||
dictionary.getValue("UpdateInterval", interval);
|
||||
_updateTime = (int) interval;
|
||||
_cygnetId = static_cast<int>(dictionary.value<double>("CygnetId"));
|
||||
_updateTime = static_cast<int>(dictionary.value<double>("UpdateInterval"));
|
||||
|
||||
_downloadImage = true;
|
||||
_texturePath = IswaManager::ref().iswaUrl(_cygnetId);
|
||||
|
||||
@@ -42,7 +42,7 @@ TextureCygnet::~TextureCygnet() {}
|
||||
|
||||
bool TextureCygnet::updateTexture() {
|
||||
auto texture = ghoul::io::TextureReader::ref().loadTexture(
|
||||
(void*) _imageFile.buffer,
|
||||
reinterpret_cast<void*>(_imageFile.buffer),
|
||||
_imageFile.size,
|
||||
_imageFile.format
|
||||
);
|
||||
|
||||
@@ -48,12 +48,6 @@ protected:
|
||||
bool readyToRender() const override;
|
||||
bool updateTextureResource() override;
|
||||
|
||||
// Interface for concrete subclasses
|
||||
virtual void setUniforms() = 0;
|
||||
virtual bool createGeometry() = 0;
|
||||
virtual bool destroyGeometry() = 0;
|
||||
virtual void renderGeometry() const = 0;
|
||||
|
||||
private:
|
||||
DownloadManager::MemoryFile _imageFile;
|
||||
};
|
||||
|
||||
@@ -43,7 +43,7 @@ DataProcessor::DataProcessor()
|
||||
_coordinateVariables = {"x", "y", "z", "phi", "theta"};
|
||||
}
|
||||
|
||||
DataProcessor::~DataProcessor() {};
|
||||
DataProcessor::~DataProcessor() {}
|
||||
|
||||
void DataProcessor::useLog(bool useLog) {
|
||||
_useLog = useLog;
|
||||
|
||||
@@ -35,9 +35,8 @@ namespace openspace {
|
||||
|
||||
DataProcessorKameleon::DataProcessorKameleon()
|
||||
: DataProcessor()
|
||||
, _kwPath("")
|
||||
, _kw(nullptr)
|
||||
, _initialized(false)
|
||||
, _kwPath("")
|
||||
, _slice(0.5)
|
||||
{}
|
||||
|
||||
|
||||
@@ -52,7 +52,6 @@ private:
|
||||
std::shared_ptr<KameleonWrapper> _kw;
|
||||
std::string _kwPath;
|
||||
std::vector<std::string> _loadedVariables;
|
||||
bool _initialized;
|
||||
float _slice;
|
||||
// std::vector<float*> _data;
|
||||
};
|
||||
|
||||
@@ -23,18 +23,6 @@
|
||||
****************************************************************************************/
|
||||
|
||||
#include <modules/iswa/util/dataprocessortext.h>
|
||||
//#include <algorithm>
|
||||
//#include <boost/iostreams/device/mapped_file.hpp>
|
||||
//
|
||||
//#include <boost/config/warning_disable.hpp>
|
||||
//#include <boost/spirit/include/qi.hpp>
|
||||
//#include <boost/spirit/include/phoenix_core.hpp>
|
||||
//#include <boost/spirit/include/phoenix_operator.hpp>
|
||||
//#include <boost/spirit/include/phoenix_stl.hpp>
|
||||
|
||||
namespace {
|
||||
constexpr const char* _loggerCat = "DataProcessorText";
|
||||
} // namespace
|
||||
|
||||
namespace openspace{
|
||||
|
||||
|
||||
@@ -194,7 +194,7 @@ void IswaManager::addKameleonCdf(std::string groupName, int pos) {
|
||||
std::future<DownloadManager::MemoryFile> IswaManager::fetchImageCygnet(int id,
|
||||
double timestamp)
|
||||
{
|
||||
return std::move(OsEng.downloadManager().fetchFile(
|
||||
return OsEng.downloadManager().fetchFile(
|
||||
iswaUrl(id, timestamp, "image"),
|
||||
[id](const DownloadManager::MemoryFile&) {
|
||||
LDEBUG(
|
||||
@@ -208,13 +208,13 @@ std::future<DownloadManager::MemoryFile> IswaManager::fetchImageCygnet(int id,
|
||||
std::to_string(id) + ": " + err
|
||||
);
|
||||
}
|
||||
) );
|
||||
);
|
||||
}
|
||||
|
||||
std::future<DownloadManager::MemoryFile> IswaManager::fetchDataCygnet(int id,
|
||||
double timestamp)
|
||||
{
|
||||
return std::move(OsEng.downloadManager().fetchFile(
|
||||
return OsEng.downloadManager().fetchFile(
|
||||
iswaUrl(id, timestamp, "data"),
|
||||
[id](const DownloadManager::MemoryFile&) {
|
||||
LDEBUG(
|
||||
@@ -228,7 +228,7 @@ std::future<DownloadManager::MemoryFile> IswaManager::fetchDataCygnet(int id,
|
||||
std::to_string(id) + ": " + err
|
||||
);
|
||||
}
|
||||
) );
|
||||
);
|
||||
}
|
||||
|
||||
std::string IswaManager::iswaUrl(int id, double timestamp, std::string type) {
|
||||
@@ -703,7 +703,7 @@ void IswaManager::addCdfFiles(std::string cdfpath) {
|
||||
_cdfInformation[groupName] = std::vector<CdfInfo>();
|
||||
|
||||
json cdfs = cdfGroup["cdfs"];
|
||||
for (int j = 0; j < cdfs.size(); j++) {
|
||||
for (size_t j = 0; j < cdfs.size(); j++) {
|
||||
json cdf = cdfs.at(j);
|
||||
|
||||
std::string name = cdf["name"];
|
||||
|
||||
@@ -68,16 +68,15 @@ int iswa_addScreenSpaceCygnet(lua_State* L) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
float id;
|
||||
d.getValue("CygnetId", id);
|
||||
int id = static_cast<int>(d.value<double>("CygnetId"));
|
||||
|
||||
auto cygnetInformation = IswaManager::ref().cygnetInformation();
|
||||
if (cygnetInformation.find((int)id) == cygnetInformation.end()) {
|
||||
if (cygnetInformation.find(id) == cygnetInformation.end()) {
|
||||
LWARNING("Could not find Cygnet with id = " + std::to_string(id));
|
||||
return 0;
|
||||
}
|
||||
|
||||
auto info = cygnetInformation[(int)id];
|
||||
auto info = cygnetInformation[id];
|
||||
std::string name = info->name;
|
||||
int updateInterval = info->updateInterval;
|
||||
info->selected = true;
|
||||
@@ -88,7 +87,7 @@ int iswa_addScreenSpaceCygnet(lua_State* L) {
|
||||
} else {
|
||||
d.setValue("Name", name);
|
||||
d.setValue("Type", "ScreenSpaceCygnet");
|
||||
d.setValue("UpdateInterval", (float) updateInterval);
|
||||
d.setValue("UpdateInterval", static_cast<float>(updateInterval));
|
||||
|
||||
std::shared_ptr<ScreenSpaceRenderable> s(
|
||||
ScreenSpaceRenderable::createFromDictionary(d)
|
||||
|
||||
@@ -93,21 +93,26 @@ double getTime(ccmc::Kameleon* kameleon) {
|
||||
if (N_CHARS < 19) {
|
||||
// Fall through to add the required characters
|
||||
switch (N_CHARS) {
|
||||
case 10 : // YYYY-MM-DD => YYYY-MM-DDTHH
|
||||
case 10: // YYYY-MM-DD => YYYY-MM-DDTHH
|
||||
seqStartStr += "T00";
|
||||
case 13 : // YYYY-MM-DDTHH => YYYY-MM-DDTHH:
|
||||
[[fallthrough]];
|
||||
case 13: // YYYY-MM-DDTHH => YYYY-MM-DDTHH:
|
||||
seqStartStr += ":";
|
||||
case 14 : // YYYY-MM-DDTHH: => YYYY-MM-DDTHH:MM
|
||||
[[fallthrough]];
|
||||
case 14: // YYYY-MM-DDTHH: => YYYY-MM-DDTHH:MM
|
||||
seqStartStr += "00";
|
||||
case 16 : // YYYY-MM-DDTHH:MM => YYYY-MM-DDTHH:MM:
|
||||
[[fallthrough]];
|
||||
case 16: // YYYY-MM-DDTHH:MM => YYYY-MM-DDTHH:MM:
|
||||
seqStartStr += ":";
|
||||
case 17 : // YYYY-MM-DDTHH:MM: => YYYY-MM-DDTHH:MM:SS
|
||||
[[fallthrough]];
|
||||
case 17: // YYYY-MM-DDTHH:MM: => YYYY-MM-DDTHH:MM:SS
|
||||
seqStartStr += "00";
|
||||
// case 19 : // YYYY-MM-DDTHH:MM:SS => YYYY-MM-DDTHH:MM:SS.000
|
||||
[[fallthrough]];
|
||||
// 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";
|
||||
default :
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -432,16 +432,13 @@ float* KameleonWrapper::getUniformSliceValues(const std::string& var,
|
||||
if (_gridType == GridType::Spherical) {
|
||||
// int z = zSlice;
|
||||
// Put r in the [0..sqrt(3)] range
|
||||
double rNorm = sqrt(3.0) * static_cast<double>(xi) /
|
||||
static_cast<double>(xDim);
|
||||
double rNorm = sqrt(3.0) * static_cast<double>(xi) / xDim;
|
||||
|
||||
// Put theta in the [0..PI] range
|
||||
double thetaNorm = M_PI * static_cast<double>(yi) /
|
||||
static_cast<double>(yDim);
|
||||
double thetaNorm = M_PI * static_cast<double>(yi) / yDim;
|
||||
|
||||
// Put phi in the [0..2PI] range
|
||||
double phiNorm = 2.0 * M_PI * static_cast<double>(zi) /
|
||||
static_cast<double>(zDim);
|
||||
double phiNorm = 2.0 * M_PI * static_cast<double>(zi) / zDim;
|
||||
|
||||
// Go to physical coordinates before sampling
|
||||
double rPh = _xMin + rNorm * (_xMax-_xMin);
|
||||
@@ -546,12 +543,10 @@ float* KameleonWrapper::getUniformSampledVectorValues(const std::string& xVar,
|
||||
//LDEBUG(zVar << "Max: " << varZMax);
|
||||
|
||||
//ProgressBar pb(static_cast<int>(outDimensions.x));
|
||||
for (int x = 0; x < outDimensions.x; ++x) {
|
||||
for (size_t x = 0; x < outDimensions.x; ++x) {
|
||||
//pb.print(x);
|
||||
|
||||
for (int y = 0; y < outDimensions.y; ++y) {
|
||||
for (int z = 0; z < outDimensions.z; ++z) {
|
||||
|
||||
for (size_t y = 0; y < outDimensions.y; ++y) {
|
||||
for (size_t z = 0; z < outDimensions.z; ++z) {
|
||||
unsigned int index = static_cast<unsigned int>(
|
||||
x * channels + y * channels * outDimensions.x +
|
||||
z * channels * outDimensions.x * outDimensions.y
|
||||
|
||||
@@ -89,12 +89,12 @@ std::unique_ptr<volume::RawVolume<float>> KameleonVolumeReader::readFloatVolume(
|
||||
}
|
||||
|
||||
std::unique_ptr<volume::RawVolume<float>> KameleonVolumeReader::readFloatVolume(
|
||||
const glm::uvec3 & dimensions,
|
||||
const std::string & variable,
|
||||
const glm::vec3 & lowerBound,
|
||||
const glm::vec3 & upperBound,
|
||||
float& minValue,
|
||||
float& maxValue) const
|
||||
const glm::uvec3 & dimensions,
|
||||
const std::string & variable,
|
||||
const glm::vec3 & lowerBound,
|
||||
const glm::vec3 & upperBound,
|
||||
float& minValue,
|
||||
float& maxValue) const
|
||||
{
|
||||
minValue = FLT_MAX;
|
||||
maxValue = FLT_MIN;
|
||||
@@ -104,9 +104,9 @@ std::unique_ptr<volume::RawVolume<float>> KameleonVolumeReader::readFloatVolume(
|
||||
const glm::vec3 diff = upperBound - lowerBound;
|
||||
|
||||
auto interpolate =
|
||||
[this](const std::string& variable, glm::vec3 volumeCoords) {
|
||||
[this](const std::string& var, glm::vec3 volumeCoords) {
|
||||
return _interpolator->interpolate(
|
||||
variable,
|
||||
var,
|
||||
volumeCoords[0],
|
||||
volumeCoords[1],
|
||||
volumeCoords[2]);
|
||||
|
||||
@@ -152,9 +152,9 @@ RenderableKameleonVolume::RenderableKameleonVolume(const ghoul::Dictionary& dict
|
||||
, _stepSize(StepSizeInfo, 0.02f, 0.01f, 1.f)
|
||||
, _sourcePath(SourcePathInfo)
|
||||
, _transferFunctionPath(TransferFunctionInfo)
|
||||
, _cache(CacheInfo)
|
||||
, _raycaster(nullptr)
|
||||
, _transferFunction(nullptr)
|
||||
, _cache(CacheInfo)
|
||||
{
|
||||
|
||||
glm::vec3 dimensions;
|
||||
|
||||
@@ -49,7 +49,7 @@ bool AtlasManager::initialize() {
|
||||
_nBricksPerDim = header.xNumBricks_;
|
||||
_nOtLeaves = _nBricksPerDim * _nBricksPerDim * _nBricksPerDim;
|
||||
_nOtNodes = _tsp->numOTNodes();
|
||||
_nOtLevels = log(_nOtLeaves)/log(8) + 1;
|
||||
_nOtLevels = static_cast<unsigned int>(log(_nOtLeaves)/log(8) + 1);
|
||||
_paddedBrickDim = _tsp->paddedBrickDim();
|
||||
_nBricksInMap = _nBricksPerDim * _nBricksPerDim * _nBricksPerDim;
|
||||
_atlasDim = _nBricksPerDim * _paddedBrickDim;
|
||||
@@ -124,7 +124,11 @@ void AtlasManager::updateAtlas(BUFFER_INDEX bufferIndex, std::vector<int>& brick
|
||||
int lastBrick = firstBrick;
|
||||
|
||||
auto itEnd = itStart;
|
||||
for (itEnd++; itEnd != _requiredBricks.end() && *itEnd == lastBrick + 1; itEnd++) {
|
||||
for (itEnd++;
|
||||
itEnd != _requiredBricks.end() &&
|
||||
*itEnd == static_cast<unsigned int>(lastBrick) + 1;
|
||||
itEnd++)
|
||||
{
|
||||
lastBrick = *itEnd;
|
||||
}
|
||||
|
||||
@@ -145,7 +149,9 @@ void AtlasManager::updateAtlas(BUFFER_INDEX bufferIndex, std::vector<int>& brick
|
||||
pboToAtlas(bufferIndex);
|
||||
|
||||
glBindBuffer(GL_SHADER_STORAGE_BUFFER, _atlasMapBuffer);
|
||||
GLint *to = (GLint*)glMapBuffer(GL_SHADER_STORAGE_BUFFER, GL_WRITE_ONLY);
|
||||
GLint *to = reinterpret_cast<GLint*>(
|
||||
glMapBuffer(GL_SHADER_STORAGE_BUFFER, GL_WRITE_ONLY)
|
||||
);
|
||||
memcpy(to, _atlasMap.data(), sizeof(GLint)*_atlasMap.size());
|
||||
glUnmapBuffer(GL_SHADER_STORAGE_BUFFER);
|
||||
glBindBuffer(GL_SHADER_STORAGE_BUFFER, 0);
|
||||
@@ -169,7 +175,7 @@ void AtlasManager::addToAtlas(int firstBrickIndex, int lastBrickIndex, float* ma
|
||||
if (!_brickMap.count(brickIndex)) {
|
||||
unsigned int atlasCoords = _freeAtlasCoords.back();
|
||||
_freeAtlasCoords.pop_back();
|
||||
int level = _nOtLevels - floor(log((7.0 * (float(brickIndex % _nOtNodes)) + 1.0))/log(8)) - 1;
|
||||
int level = _nOtLevels - static_cast<int>(floor(log((7.0 * (float(brickIndex % _nOtNodes)) + 1.0))/log(8)) - 1);
|
||||
ghoul_assert(atlasCoords <= 0x0FFFFFFF, "@MISSING");
|
||||
unsigned int atlasData = (level << 28) + atlasCoords;
|
||||
_brickMap.insert(std::pair<unsigned int, unsigned int>(brickIndex, atlasData));
|
||||
@@ -220,17 +226,18 @@ void AtlasManager::pboToAtlas(BUFFER_INDEX bufferIndex) {
|
||||
glBindBuffer(GL_PIXEL_UNPACK_BUFFER, _pboHandle[bufferIndex]);
|
||||
glm::size3_t dim = _textureAtlas->dimensions();
|
||||
glBindTexture(GL_TEXTURE_3D, *_textureAtlas);
|
||||
glTexSubImage3D(GL_TEXTURE_3D, // target
|
||||
0, // level
|
||||
0, // xoffset
|
||||
0, // yoffset
|
||||
0, // zoffset
|
||||
dim[0], // width
|
||||
dim[1], // height
|
||||
dim[2], // depth
|
||||
GL_RED, // format
|
||||
GL_FLOAT, // type
|
||||
NULL // *pixels
|
||||
glTexSubImage3D(
|
||||
GL_TEXTURE_3D, // target
|
||||
0, // level
|
||||
0, // xoffset
|
||||
0, // yoffset
|
||||
0, // zoffset
|
||||
static_cast<GLsizei>(dim[0]), // width
|
||||
static_cast<GLsizei>(dim[1]), // height
|
||||
static_cast<GLsizei>(dim[2]), // depth
|
||||
GL_RED, // format
|
||||
GL_FLOAT, // type
|
||||
NULL // *pixels
|
||||
);
|
||||
glBindTexture(GL_TEXTURE_3D, 0);
|
||||
glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0);
|
||||
|
||||
@@ -285,13 +285,13 @@ bool BrickManager::FillVolume(float *_in, float *_out,
|
||||
void BrickManager::IncCoord() {
|
||||
// Update atlas coordinate
|
||||
xCoord_++;
|
||||
if (xCoord_ == _header.xNumBricks_) {
|
||||
if (xCoord_ == static_cast<int>(_header.xNumBricks_)) {
|
||||
xCoord_ = 0;
|
||||
yCoord_++;
|
||||
if (yCoord_ == _header.yNumBricks_) {
|
||||
if (yCoord_ == static_cast<int>(_header.yNumBricks_)) {
|
||||
yCoord_ = 0;
|
||||
zCoord_++;
|
||||
if (zCoord_ == _header.zNumBricks_) {
|
||||
if (zCoord_ == static_cast<int>(_header.zNumBricks_)) {
|
||||
zCoord_ = 0;
|
||||
}
|
||||
}
|
||||
@@ -365,7 +365,7 @@ bool BrickManager::DiskToPBO(BUFFER_INDEX _pboIndex) {
|
||||
static_cast<std::ios::pos_type>(brickSize_);
|
||||
*/
|
||||
|
||||
long offset = TSP::dataPosition() +
|
||||
long long offset = TSP::dataPosition() +
|
||||
static_cast<long>(brickIndex)*
|
||||
static_cast<long>(brickSize_);
|
||||
|
||||
@@ -442,16 +442,17 @@ bool BrickManager::PBOToAtlas(BUFFER_INDEX _pboIndex) {
|
||||
glBindBuffer(GL_PIXEL_UNPACK_BUFFER, pboHandle_[_pboIndex]);
|
||||
glm::size3_t dim = textureAtlas_->dimensions();
|
||||
glBindTexture(GL_TEXTURE_3D, *textureAtlas_);
|
||||
glTexSubImage3D(GL_TEXTURE_3D, // target
|
||||
glTexSubImage3D(
|
||||
GL_TEXTURE_3D, // target
|
||||
0, // level
|
||||
0, // xoffset
|
||||
0, // yoffset
|
||||
0, // zoffset
|
||||
dim[0], // width
|
||||
dim[1], // height
|
||||
dim[2], // depth
|
||||
GL_RED, // format
|
||||
GL_FLOAT, // type
|
||||
static_cast<GLsizei>(dim[0]), // width
|
||||
static_cast<GLsizei>(dim[1]), // height
|
||||
static_cast<GLsizei>(dim[2]), // depth
|
||||
GL_RED, // format
|
||||
GL_FLOAT, // type
|
||||
NULL); // *pixels
|
||||
glBindTexture(GL_TEXTURE_3D, 0);
|
||||
glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0);
|
||||
|
||||
@@ -55,8 +55,10 @@ bool ErrorHistogramManager::buildHistograms(int numBins) {
|
||||
_maxBin = 1.0; // Should be calculated from tsp file as (maxValue - minValue)
|
||||
|
||||
unsigned int numOtLevels = _tsp->numOTLevels();
|
||||
unsigned int numOtLeaves = pow(8, numOtLevels - 1);
|
||||
unsigned int numBstLeaves = pow(2, _tsp->numBSTLevels() - 1);
|
||||
unsigned int numOtLeaves = static_cast<unsigned int>(pow(8, numOtLevels - 1));
|
||||
unsigned int numBstLeaves = static_cast<unsigned int>(
|
||||
pow(2, _tsp->numBSTLevels() - 1)
|
||||
);
|
||||
|
||||
_numInnerNodes = _tsp->numTotalNodes() - numOtLeaves * numBstLeaves;
|
||||
_histograms = std::vector<Histogram>(_numInnerNodes);
|
||||
|
||||
@@ -71,9 +71,9 @@ bool HistogramManager::buildHistogram(TSP* tsp, unsigned int brickIndex) {
|
||||
if (isBstLeaf && isOctreeLeaf) {
|
||||
// TSP leaf, read from file and build histogram
|
||||
std::vector<float> voxelValues = readValues(tsp, brickIndex);
|
||||
unsigned int numVoxels = voxelValues.size();
|
||||
size_t numVoxels = voxelValues.size();
|
||||
|
||||
for (unsigned int v = 0; v < numVoxels; ++v) {
|
||||
for (size_t v = 0; v < numVoxels; ++v) {
|
||||
histogram.add(voxelValues[v], 1.0);
|
||||
}
|
||||
} else {
|
||||
@@ -92,8 +92,8 @@ bool HistogramManager::buildHistogram(TSP* tsp, unsigned int brickIndex) {
|
||||
children.push_back(firstChild + c);
|
||||
}
|
||||
}
|
||||
int numChildren = children.size();
|
||||
for (int c = 0; c < numChildren; c++) {
|
||||
size_t numChildren = children.size();
|
||||
for (size_t c = 0; c < numChildren; c++) {
|
||||
// Visit child
|
||||
unsigned int childIndex = children[c];
|
||||
if (_histograms[childIndex].isValid() || buildHistogram(tsp, childIndex)) {
|
||||
@@ -167,7 +167,7 @@ bool HistogramManager::saveToFile(const std::string& filename) {
|
||||
return false;
|
||||
}
|
||||
|
||||
int numHistograms = _histograms.size();
|
||||
size_t numHistograms = _histograms.size();
|
||||
file.write(reinterpret_cast<char*>(&numHistograms), sizeof(int));
|
||||
file.write(reinterpret_cast<char*>(&_numBins), sizeof(int));
|
||||
file.write(reinterpret_cast<char*>(&_minBin), sizeof(float));
|
||||
@@ -176,9 +176,9 @@ bool HistogramManager::saveToFile(const std::string& filename) {
|
||||
int nFloats = numHistograms * _numBins;
|
||||
float* histogramData = new float[nFloats];
|
||||
|
||||
for (int i = 0; i < numHistograms; ++i) {
|
||||
int offset = i*_numBins;
|
||||
memcpy(&histogramData[offset], _histograms[i].data(), sizeof(float) * _numBins);
|
||||
for (size_t i = 0; i < numHistograms; ++i) {
|
||||
int offset = i*_numBins;
|
||||
memcpy(&histogramData[offset], _histograms[i].data(), sizeof(float) * _numBins);
|
||||
}
|
||||
|
||||
file.write(reinterpret_cast<char*>(histogramData), sizeof(float) * nFloats);
|
||||
|
||||
@@ -74,7 +74,7 @@ public:
|
||||
bool isReady() const override;
|
||||
|
||||
virtual void update(const UpdateData& data) override;
|
||||
virtual void render(const RenderData& data, RendererTasks& tasks);
|
||||
virtual void render(const RenderData& data, RendererTasks& tasks) override;
|
||||
|
||||
//virtual void preResolve(ghoul::opengl::ProgramObject* program) override;
|
||||
//virtual std::string getHeaderPath() override;
|
||||
|
||||
@@ -412,7 +412,7 @@ glm::dmat4 RenderablePlanet::computeModelTransformMatrix(
|
||||
glm::dmat4 modelTransform =
|
||||
glm::translate(glm::dmat4(1.0), transformData.translation) * // Translation
|
||||
glm::dmat4(transformData.rotation) * // Spice rotation
|
||||
glm::dmat4(glm::scale(glm::dmat4(1.0), glm::dvec3(transformData.scale)));
|
||||
glm::scale(glm::dmat4(1.0), glm::dvec3(transformData.scale));
|
||||
|
||||
// scale the planet to appropriate size since the planet is a unit sphere
|
||||
//glm::mat4 transform = glm::mat4(1);
|
||||
|
||||
@@ -187,8 +187,6 @@ private:
|
||||
|
||||
// current simulation time
|
||||
double _currentTime;
|
||||
// simulation time of previous frame
|
||||
double _previousTime;
|
||||
// time between current simulation time and an upcoming capture
|
||||
double _intervalLength;
|
||||
// next consecutive capture in time
|
||||
|
||||
@@ -45,9 +45,7 @@ namespace {
|
||||
constexpr const char* KeyHttpSynchronizationRepositories =
|
||||
"HttpSynchronizationRepositories";
|
||||
constexpr const char* KeySynchronizationRoot = "SynchronizationRoot";
|
||||
|
||||
const char* _loggerCat = "SyncModule";
|
||||
}
|
||||
} // namespace
|
||||
|
||||
namespace openspace {
|
||||
|
||||
|
||||
@@ -127,9 +127,9 @@ void HttpSynchronization::start() {
|
||||
"&" + QueryKeyFileVersion + "=" + std::to_string(_version) +
|
||||
"&" + QueryKeyApplicationVersion + "=" + std::to_string(ApplicationVersion);
|
||||
|
||||
_syncThread = std::thread([this](const std::string& query) {
|
||||
_syncThread = std::thread([this](const std::string& q) {
|
||||
for (const std::string& url : _synchronizationRepositories) {
|
||||
if (trySyncFromUrl(url + query)) {
|
||||
if (trySyncFromUrl(url + q)) {
|
||||
createSyncFile();
|
||||
resolve();
|
||||
return;
|
||||
|
||||
@@ -38,7 +38,6 @@
|
||||
|
||||
|
||||
namespace {
|
||||
constexpr const char* _loggerCat = "TorrentSynchronization";
|
||||
constexpr const char* KeyIdentifier = "Identifier";
|
||||
constexpr const char* KeyMagnet = "Magnet";
|
||||
} // namespace
|
||||
|
||||
@@ -84,7 +84,7 @@ UrlSynchronization::UrlSynchronization(const ghoul::Dictionary& dict,
|
||||
}
|
||||
else {
|
||||
ghoul::Dictionary urls = dict.value<ghoul::Dictionary>(KeyUrl);
|
||||
for (int i = 1; i <= urls.size(); ++i) {
|
||||
for (size_t i = 1; i <= urls.size(); ++i) {
|
||||
std::string url = urls.value<std::string>(std::to_string(i));
|
||||
_urls.push_back(std::move(url));
|
||||
}
|
||||
|
||||
@@ -29,12 +29,23 @@
|
||||
#include <ghoul/logging/logmanager.h>
|
||||
|
||||
#ifdef SYNC_USE_LIBTORRENT
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning (push)
|
||||
#pragma warning (disable : 4265)
|
||||
#pragma warning (disable : 4996)
|
||||
#endif // _MSC_VER
|
||||
|
||||
#include <libtorrent/entry.hpp>
|
||||
#include <libtorrent/bencode.hpp>
|
||||
#include <libtorrent/session.hpp>
|
||||
#include <libtorrent/alert_types.hpp>
|
||||
#include <libtorrent/torrent_info.hpp>
|
||||
#include <libtorrent/magnet_uri.hpp>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning (pop)
|
||||
#endif // _MSC_VER
|
||||
|
||||
#endif // SYNC_USE_LIBTORRENT
|
||||
|
||||
namespace {
|
||||
@@ -44,8 +55,8 @@ namespace {
|
||||
|
||||
namespace openspace {
|
||||
|
||||
TorrentError::TorrentError(std::string message)
|
||||
: RuntimeError(std::move(message), "TorrentClient")
|
||||
TorrentError::TorrentError(std::string msg)
|
||||
: RuntimeError(std::move(msg), "TorrentClient")
|
||||
{}
|
||||
|
||||
TorrentClient::~TorrentClient() {
|
||||
@@ -61,23 +72,35 @@ void TorrentClient::initialize() {
|
||||
std::to_string(openspace::OPENSPACE_VERSION_PATCH)
|
||||
);
|
||||
|
||||
settings.set_str(
|
||||
libtorrent::settings_pack::listen_interfaces,
|
||||
"0.0.0.0:6881,0.0.0.0:20280,0.0.0.0:20285,0.0.0.0:20290,0.0.0.0:0"
|
||||
);
|
||||
settings.set_bool(libtorrent::settings_pack::allow_multiple_connections_per_ip, true);
|
||||
settings.set_bool(libtorrent::settings_pack::enable_upnp, true);
|
||||
//settings.set_bool(libtorrent::settings_pack::ignore_limits_on_local_network, true);
|
||||
settings.set_int(libtorrent::settings_pack::connection_speed, 20);
|
||||
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,\
|
||||
router.bitcomet.com"
|
||||
);
|
||||
settings.set_int(libtorrent::settings_pack::dht_announce_interval, 15);
|
||||
|
||||
_session.apply_settings(settings);
|
||||
|
||||
_session.add_dht_router({ "router.utorrent.com", 6881 });
|
||||
_session.add_dht_router({ "dht.transmissionbt.com", 6881 });
|
||||
_session.add_dht_router({ "router.bittorrent.com", 6881 });
|
||||
_session.add_dht_router({ "router.bitcomet.com", 6881 });
|
||||
//_session.add_dht_router({ "router.utorrent.com", 6881 });
|
||||
//_session.add_dht_router({ "dht.transmissionbt.com", 6881 });
|
||||
//_session.add_dht_router({ "router.bittorrent.com", 6881 });
|
||||
//_session.add_dht_router({ "router.bitcomet.com", 6881 });
|
||||
|
||||
libtorrent::error_code ec;
|
||||
_session.listen_on(std::make_pair(20280, 20290), ec);
|
||||
_session.start_upnp();
|
||||
//_session.listen_on(std::make_pair(20280, 20290), ec);
|
||||
//_session.start_upnp();
|
||||
|
||||
_isInitialized = true;
|
||||
|
||||
@@ -164,7 +187,7 @@ TorrentClient::TorrentId TorrentClient::addTorrentFile(const std::string& torren
|
||||
libtorrent::error_code ec;
|
||||
libtorrent::add_torrent_params p;
|
||||
p.save_path = destination;
|
||||
p.ti = std::make_shared<libtorrent::torrent_info>(torrentFile, ec, 0);
|
||||
p.ti = std::make_shared<libtorrent::torrent_info>(torrentFile, ec);
|
||||
if (ec) {
|
||||
LERROR(torrentFile << ": " << ec.message());
|
||||
}
|
||||
|
||||
@@ -35,9 +35,20 @@
|
||||
#include <unordered_map>
|
||||
|
||||
#ifdef SYNC_USE_LIBTORRENT
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning (push)
|
||||
#pragma warning (disable : 4265)
|
||||
#pragma warning (disable : 4996)
|
||||
#endif // _MSC_VER
|
||||
|
||||
#include <libtorrent/torrent_handle.hpp>
|
||||
#include <libtorrent/session.hpp>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning (pop)
|
||||
#endif // _MSC_VER
|
||||
|
||||
|
||||
#else // SYNC_USE_LIBTORRENT
|
||||
// Dummy definition to make TorrentClient compile, these is not actually used if
|
||||
// SYNC_USE_LIBTORRENT is FALSE
|
||||
|
||||
@@ -46,9 +46,9 @@ BasicVolumeRaycaster::BasicVolumeRaycaster(
|
||||
std::shared_ptr<ghoul::opengl::Texture> volumeTexture,
|
||||
std::shared_ptr<TransferFunction> transferFunction,
|
||||
std::shared_ptr<VolumeClipPlanes> clipPlanes)
|
||||
: _volumeTexture(volumeTexture)
|
||||
: _clipPlanes(clipPlanes)
|
||||
, _volumeTexture(volumeTexture)
|
||||
, _transferFunction(transferFunction)
|
||||
, _clipPlanes(clipPlanes)
|
||||
, _boundingBox(glm::vec3(1.0))
|
||||
, _opacity(20.0)
|
||||
, _rNormalization(0.0)
|
||||
|
||||
@@ -156,21 +156,21 @@ namespace volume {
|
||||
RenderableTimeVaryingVolume::RenderableTimeVaryingVolume(
|
||||
const ghoul::Dictionary& dictionary)
|
||||
: Renderable(dictionary)
|
||||
, _gridType(GridTypeInfo, properties::OptionProperty::DisplayType::Dropdown)
|
||||
, _clipPlanes(nullptr)
|
||||
, _stepSize(StepSizeInfo, 0.02f, 0.001f, 1.f)
|
||||
, _gridType(GridTypeInfo, properties::OptionProperty::DisplayType::Dropdown)
|
||||
, _opacity(OpacityInfo, 10.f, 0.f, 500.f)
|
||||
, _rNormalization(rNormalizationInfo, 0.f, 0.f, 2.f)
|
||||
, _rUpperBound(rUpperBoundInfo, 1.f, 0.f, 2.f)
|
||||
, _secondsBefore(SecondsBeforeInfo, 0.f, 0.01f, SecondsInOneDay)
|
||||
, _secondsAfter(SecondsAfterInfo, 0.f, 0.01f, SecondsInOneDay)
|
||||
, _sourceDirectory(SourceDirectoryInfo)
|
||||
, _transferFunctionPath(TransferFunctionInfo)
|
||||
, _lowerValueBound(lowerValueBoundInfo, 0.f, 0.f, 1000000.f)
|
||||
, _upperValueBound(upperValueBoundInfo, 0.f, 0.f, 1000000.f)
|
||||
, _triggerTimeJump(TriggerTimeJumpInfo)
|
||||
, _jumpToTimestep(JumpToTimestepInfo, 0, 0, 256)
|
||||
, _currentTimestep(CurrentTimeStepInfo, 0, 0, 256)
|
||||
, _opacity(OpacityInfo, 10.f, 0.f, 500.f)
|
||||
, _rNormalization(rNormalizationInfo, 0.f, 0.f, 2.f)
|
||||
, _rUpperBound(rUpperBoundInfo, 1.f, 0.f, 2.f)
|
||||
, _lowerValueBound(lowerValueBoundInfo, 0.f, 0.f, 1000000.f)
|
||||
, _upperValueBound(upperValueBoundInfo, 0.f, 0.f, 1000000.f)
|
||||
, _raycaster(nullptr)
|
||||
, _transferFunction(nullptr)
|
||||
{
|
||||
@@ -368,7 +368,6 @@ void RenderableTimeVaryingVolume::loadTimestepMetadata(const std::string& path)
|
||||
}
|
||||
|
||||
RenderableTimeVaryingVolume::Timestep* RenderableTimeVaryingVolume::currentTimestep() {
|
||||
using TimeStep = RenderableTimeVaryingVolume::Timestep;
|
||||
if (_volumeTimesteps.size() == 0) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -43,9 +43,10 @@ TextureSliceVolumeReader<VoxelType>::TextureSliceVolumeReader(
|
||||
std::vector<std::string> paths,
|
||||
size_t sliceCacheNIndices,
|
||||
size_t sliceCacheCapacity)
|
||||
: _initialized(false)
|
||||
, _paths(paths)
|
||||
, _cache(sliceCacheCapacity, sliceCacheNIndices) {}
|
||||
: _paths(paths)
|
||||
, _cache(sliceCacheCapacity, sliceCacheNIndices)
|
||||
, _initialized(false)
|
||||
{}
|
||||
|
||||
template <typename VoxelType>
|
||||
void TextureSliceVolumeReader<VoxelType>::initialize() {
|
||||
@@ -70,8 +71,10 @@ ghoul::opengl::Texture&
|
||||
TextureSliceVolumeReader<VoxelType>::getSlice(int sliceIndex) const
|
||||
{
|
||||
ghoul_assert(_initialized, "Volume is not initialized");
|
||||
ghoul_assert(sliceIndex >= 0 && sliceIndex < _paths.size(),
|
||||
"Slice index " + std::to_string(sliceIndex) + "is outside the range.");
|
||||
ghoul_assert(
|
||||
sliceIndex >= 0 && sliceIndex < static_cast<int>(_paths.size()),
|
||||
"Slice index " + std::to_string(sliceIndex) + "is outside the range."
|
||||
);
|
||||
|
||||
if (!_cache.has(sliceIndex)) {
|
||||
std::shared_ptr<ghoul::opengl::Texture> texture =
|
||||
|
||||
Reference in New Issue
Block a user