mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-02-25 06:19:02 -06:00
Solved merge conflict
This commit is contained in:
@@ -40,8 +40,20 @@ DataCygnet::DataCygnet(const ghoul::Dictionary& dictionary)
|
||||
:IswaCygnet(dictionary)
|
||||
,_dataProcessor(nullptr)
|
||||
,_dataOptions("dataOptions", "Data Options")
|
||||
,_useLog("useLog","Use Logarithm", false)
|
||||
,_useHistogram("useHistogram", "Auto Contrast", false)
|
||||
,_autoFilter("autoFilter", "Auto Filter", true)
|
||||
,_normValues("normValues", "Normalize Values", glm::vec2(1.0,1.0), glm::vec2(0), glm::vec2(5.0))
|
||||
,_backgroundValues("backgroundValues", "Background Values", glm::vec2(0.0), glm::vec2(0), glm::vec2(1.0))
|
||||
,_transferFunctionsFile("transferfunctions", "Transfer Functions", "${SCENE}/iswa/tfs/default.tf")
|
||||
{
|
||||
addProperty(_dataOptions);
|
||||
addProperty(_useLog);
|
||||
addProperty(_useHistogram);
|
||||
addProperty(_autoFilter);
|
||||
addProperty(_normValues);
|
||||
addProperty(_backgroundValues);
|
||||
addProperty(_transferFunctionsFile);
|
||||
registerProperties();
|
||||
}
|
||||
|
||||
@@ -216,5 +228,92 @@ void DataCygnet::fillOptions(std::string& source){
|
||||
}
|
||||
}
|
||||
|
||||
void DataCygnet::setPropertyCallbacks(){
|
||||
_normValues.onChange([this](){
|
||||
_dataProcessor->normValues(_normValues.value());
|
||||
updateTexture();
|
||||
});
|
||||
|
||||
_useLog.onChange([this](){
|
||||
_dataProcessor->useLog(_useLog.value());
|
||||
updateTexture();
|
||||
});
|
||||
|
||||
_useHistogram.onChange([this](){
|
||||
_dataProcessor->useHistogram(_useHistogram.value());
|
||||
updateTexture();
|
||||
if(_autoFilter.value())
|
||||
_backgroundValues.setValue(_dataProcessor->filterValues());
|
||||
});
|
||||
|
||||
_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](){
|
||||
readTransferFunctions(_transferFunctionsFile.value());
|
||||
});
|
||||
}
|
||||
|
||||
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){
|
||||
_dataOptions.setValue(values);
|
||||
}
|
||||
});
|
||||
|
||||
groupEvent->subscribe(name(), "normValuesChanged", [&](ghoul::Dictionary dict){
|
||||
LDEBUG(name() + " Event normValuesChanged");
|
||||
glm::vec2 values;
|
||||
bool success = dict.getValue("normValues", values);
|
||||
if(success){
|
||||
_normValues.setValue(values);
|
||||
}
|
||||
});
|
||||
|
||||
groupEvent->subscribe(name(), "backgroundValuesChanged", [&](ghoul::Dictionary dict){
|
||||
LDEBUG(name() + " Event backgroundValuesChanged");
|
||||
glm::vec2 values;
|
||||
bool success = dict.getValue("backgroundValues", values);
|
||||
if(success){
|
||||
_backgroundValues.setValue(values);
|
||||
}
|
||||
});
|
||||
|
||||
groupEvent->subscribe(name(), "transferFunctionsChanged", [&](ghoul::Dictionary dict){
|
||||
LDEBUG(name() + " Event transferFunctionsChanged");
|
||||
_transferFunctionsFile.setValue(dict.value<std::string>("transferFunctions"));
|
||||
});
|
||||
|
||||
groupEvent->subscribe(name(), "useLogChanged", [&](const ghoul::Dictionary& dict){
|
||||
LDEBUG(name() + " Event useLogChanged");
|
||||
_useLog.setValue(dict.value<bool>("useLog"));
|
||||
});
|
||||
|
||||
groupEvent->subscribe(name(), "useHistogramChanged", [&](ghoul::Dictionary dict){
|
||||
LDEBUG(name() + " Event useHistogramChanged");
|
||||
_useHistogram.setValue(dict.value<bool>("useHistogram"));
|
||||
});
|
||||
|
||||
groupEvent->subscribe(name(), "autoFilterChanged", [&](ghoul::Dictionary dict){
|
||||
LDEBUG(name() + " Event autoFilterChanged");
|
||||
_autoFilter.setValue(dict.value<bool>("autoFilter"));
|
||||
});
|
||||
|
||||
groupEvent->subscribe(name(), "updateGroup", [&](ghoul::Dictionary dict){
|
||||
LDEBUG(name() + " Event updateGroup");
|
||||
if(_autoFilter.value())
|
||||
_backgroundValues.setValue(_dataProcessor->filterValues());
|
||||
updateTexture();
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
} //namespace openspace
|
||||
@@ -60,6 +60,17 @@ protected:
|
||||
* shader program, this includes both the data and transferfunctions.
|
||||
*/
|
||||
void setTextureUniforms();
|
||||
|
||||
/**
|
||||
* Sets and defines the on-change handlers for the gui properties.
|
||||
*/
|
||||
void setPropertyCallbacks();
|
||||
|
||||
/**
|
||||
* Subscribes to the group events that are shared by all DataCygnets
|
||||
*/
|
||||
void subscribeToGroup();
|
||||
|
||||
/**
|
||||
* Optional interface method. this has an implementation
|
||||
* in datacygnet.cpp, but needs to be overriden for kameleonplane
|
||||
@@ -80,6 +91,13 @@ protected:
|
||||
virtual void setUniforms() = 0;
|
||||
|
||||
properties::SelectionProperty _dataOptions;
|
||||
properties::StringProperty _transferFunctionsFile;
|
||||
properties::Vec2Property _backgroundValues;
|
||||
properties::Vec2Property _normValues;
|
||||
properties::BoolProperty _useLog;
|
||||
properties::BoolProperty _useHistogram;
|
||||
properties::BoolProperty _autoFilter;
|
||||
|
||||
std::shared_ptr<DataProcessor> _dataProcessor;
|
||||
std::string _dataBuffer;
|
||||
glm::size3_t _textureDimensions;
|
||||
|
||||
@@ -32,21 +32,7 @@ namespace openspace {
|
||||
|
||||
DataPlane::DataPlane(const ghoul::Dictionary& dictionary)
|
||||
:DataCygnet(dictionary)
|
||||
,_useLog("useLog","Use Logarithm", false)
|
||||
,_useHistogram("useHistogram", "Auto Contrast", false)
|
||||
,_autoFilter("autoFilter", "Auto Filter", true)
|
||||
,_normValues("normValues", "Normalize Values", glm::vec2(1.0,1.0), glm::vec2(0), glm::vec2(5.0))
|
||||
,_backgroundValues("backgroundValues", "Background Values", glm::vec2(0.0), glm::vec2(0), glm::vec2(1.0))
|
||||
,_transferFunctionsFile("transferfunctions", "Transfer Functions", "${SCENE}/iswa/tfs/default.tf")
|
||||
{
|
||||
|
||||
addProperty(_useLog);
|
||||
addProperty(_useHistogram);
|
||||
addProperty(_autoFilter);
|
||||
addProperty(_normValues);
|
||||
addProperty(_backgroundValues);
|
||||
addProperty(_transferFunctionsFile);
|
||||
|
||||
_programName = "DataPlaneProgram";
|
||||
_vsPath = "${MODULE_ISWA}/shaders/dataplane_vs.glsl";
|
||||
_fsPath = "${MODULE_ISWA}/shaders/dataplane_fs.glsl";
|
||||
@@ -86,32 +72,7 @@ bool DataPlane::initialize(){
|
||||
|
||||
readTransferFunctions(_transferFunctionsFile.value());
|
||||
|
||||
_normValues.onChange([this](){
|
||||
_dataProcessor->normValues(_normValues.value());
|
||||
updateTexture();
|
||||
});
|
||||
|
||||
_useLog.onChange([this](){
|
||||
_dataProcessor->useLog(_useLog.value());
|
||||
updateTexture();
|
||||
});
|
||||
|
||||
_useHistogram.onChange([this](){
|
||||
_dataProcessor->useHistogram(_useHistogram.value());
|
||||
updateTexture();
|
||||
if(_autoFilter.value())
|
||||
_backgroundValues.setValue(_dataProcessor->filterValues());
|
||||
});
|
||||
|
||||
_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](){
|
||||
readTransferFunctions(_transferFunctionsFile.value());
|
||||
});
|
||||
setPropertyCallbacks();
|
||||
|
||||
_autoFilter.setValue(true);
|
||||
|
||||
@@ -195,61 +156,4 @@ std::vector<float*> DataPlane::textureData(){
|
||||
return _dataProcessor->processData(_dataBuffer, _dataOptions, _textureDimensions);
|
||||
}
|
||||
|
||||
void DataPlane::subscribeToGroup(){
|
||||
auto groupEvent = _group->groupEvent();
|
||||
groupEvent->subscribe(name(), "useLogChanged", [&](const ghoul::Dictionary& dict){
|
||||
LDEBUG(name() + " Event useLogChanged");
|
||||
_useLog.setValue(dict.value<bool>("useLog"));
|
||||
});
|
||||
|
||||
groupEvent->subscribe(name(), "normValuesChanged", [&](ghoul::Dictionary dict){
|
||||
LDEBUG(name() + " Event normValuesChanged");
|
||||
glm::vec2 values;
|
||||
bool success = dict.getValue("normValues", values);
|
||||
if(success){
|
||||
_normValues.setValue(values);
|
||||
}
|
||||
});
|
||||
|
||||
groupEvent->subscribe(name(), "useHistogramChanged", [&](ghoul::Dictionary dict){
|
||||
LDEBUG(name() + " Event useHistogramChanged");
|
||||
_useHistogram.setValue(dict.value<bool>("useHistogram"));
|
||||
});
|
||||
|
||||
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){
|
||||
_dataOptions.setValue(values);
|
||||
}
|
||||
});
|
||||
|
||||
groupEvent->subscribe(name(), "transferFunctionsChanged", [&](ghoul::Dictionary dict){
|
||||
LDEBUG(name() + " Event transferFunctionsChanged");
|
||||
_transferFunctionsFile.setValue(dict.value<std::string>("transferFunctions"));
|
||||
});
|
||||
|
||||
groupEvent->subscribe(name(), "backgroundValuesChanged", [&](ghoul::Dictionary dict){
|
||||
LDEBUG(name() + " Event backgroundValuesChanged");
|
||||
glm::vec2 values;
|
||||
bool success = dict.getValue("backgroundValues", values);
|
||||
if(success){
|
||||
_backgroundValues.setValue(values);
|
||||
}
|
||||
});
|
||||
|
||||
groupEvent->subscribe(name(), "autoFilterChanged", [&](ghoul::Dictionary dict){
|
||||
LDEBUG(name() + " Event autoFilterChanged");
|
||||
_autoFilter.setValue(dict.value<bool>("autoFilter"));
|
||||
});
|
||||
|
||||
groupEvent->subscribe(name(), "updateGroup", [&](ghoul::Dictionary dict){
|
||||
LDEBUG(name() + " Event updateGroup");
|
||||
if(_autoFilter.value())
|
||||
_backgroundValues.setValue(_dataProcessor->filterValues());
|
||||
updateTexture();
|
||||
});
|
||||
}
|
||||
|
||||
}// namespace openspace
|
||||
@@ -26,8 +26,6 @@
|
||||
#define __DATAPLANE_H__
|
||||
|
||||
#include <modules/iswa/rendering/datacygnet.h>
|
||||
#include <openspace/properties/vectorproperty.h>
|
||||
#include <openspace/properties/selectionproperty.h>
|
||||
|
||||
namespace openspace{
|
||||
/**
|
||||
@@ -53,14 +51,6 @@ private:
|
||||
void renderGeometry() const override;
|
||||
void setUniforms() override;
|
||||
std::vector<float*> textureData() override;
|
||||
void subscribeToGroup();
|
||||
|
||||
properties::StringProperty _transferFunctionsFile;
|
||||
properties::Vec2Property _backgroundValues;
|
||||
properties::Vec2Property _normValues;
|
||||
properties::BoolProperty _useLog;
|
||||
properties::BoolProperty _useHistogram;
|
||||
properties::BoolProperty _autoFilter;
|
||||
|
||||
GLuint _quad;
|
||||
GLuint _vertexPositionBuffer;
|
||||
|
||||
@@ -34,25 +34,12 @@ namespace openspace {
|
||||
|
||||
DataSphere::DataSphere(const ghoul::Dictionary& dictionary)
|
||||
:DataCygnet(dictionary)
|
||||
,_useLog("useLog","Use Logarithm", false)
|
||||
,_useHistogram("useHistogram", "Auto Contrast", false)
|
||||
,_autoFilter("autoFilter", "Auto Filter", false)
|
||||
,_normValues("normValues", "Normalize Values", glm::vec2(1.0,1.0), glm::vec2(0), glm::vec2(5.0))
|
||||
,_backgroundValues("backgroundValues", "Background Values", glm::vec2(0.0), glm::vec2(0), glm::vec2(1.0))
|
||||
,_transferFunctionsFile("transferfunctions", "Transfer Functions", "${SCENE}/iswa/tfs/default.tf")
|
||||
,_sphere(nullptr)
|
||||
{
|
||||
float radius;
|
||||
dictionary.getValue("Radius", radius);
|
||||
_radius = radius;
|
||||
|
||||
addProperty(_useLog);
|
||||
addProperty(_useHistogram);
|
||||
addProperty(_autoFilter);
|
||||
addProperty(_normValues);
|
||||
addProperty(_backgroundValues);
|
||||
addProperty(_transferFunctionsFile);
|
||||
|
||||
_programName = "DataSphereProgram";
|
||||
_vsPath = "${MODULE_ISWA}/shaders/datasphere_vs.glsl";
|
||||
_fsPath = "${MODULE_ISWA}/shaders/datasphere_fs.glsl";
|
||||
@@ -91,33 +78,7 @@ bool DataSphere::initialize(){
|
||||
|
||||
readTransferFunctions(_transferFunctionsFile.value());
|
||||
|
||||
_normValues.onChange([this](){
|
||||
_dataProcessor->normValues(_normValues.value());
|
||||
updateTexture();
|
||||
});
|
||||
|
||||
_useLog.onChange([this](){
|
||||
_dataProcessor->useLog(_useLog.value());
|
||||
updateTexture();
|
||||
});
|
||||
|
||||
_useHistogram.onChange([this](){
|
||||
_dataProcessor->useHistogram(_useHistogram.value());
|
||||
updateTexture();
|
||||
if(_autoFilter.value())
|
||||
_backgroundValues.setValue(_dataProcessor->filterValues());
|
||||
});
|
||||
|
||||
_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](){
|
||||
readTransferFunctions(_transferFunctionsFile.value());
|
||||
});
|
||||
|
||||
setPropertyCallbacks();
|
||||
_useHistogram.setValue(true);
|
||||
_autoFilter.setValue(true);
|
||||
|
||||
@@ -169,60 +130,4 @@ void DataSphere::setUniforms(){
|
||||
_shader->setUniform("backgroundValues", _backgroundValues.value());
|
||||
_shader->setUniform("transparency", _alpha.value());
|
||||
}
|
||||
|
||||
void DataSphere::subscribeToGroup(){
|
||||
auto groupEvent = _group->groupEvent();
|
||||
groupEvent->subscribe(name(), "useLogChanged", [&](const ghoul::Dictionary& dict){
|
||||
LDEBUG(name() + " Event useLogChanged");
|
||||
_useLog.setValue(dict.value<bool>("useLog"));
|
||||
});
|
||||
|
||||
groupEvent->subscribe(name(), "normValuesChanged", [&](ghoul::Dictionary dict){
|
||||
LDEBUG(name() + " Event normValuesChanged");
|
||||
glm::vec2 values;
|
||||
bool success = dict.getValue("normValues", values);
|
||||
if(success){
|
||||
_normValues.setValue(values);
|
||||
}
|
||||
});
|
||||
|
||||
groupEvent->subscribe(name(), "useHistogramChanged", [&](ghoul::Dictionary dict){
|
||||
LDEBUG(name() + " Event useHistogramChanged");
|
||||
_useHistogram.setValue(dict.value<bool>("useHistogram"));
|
||||
});
|
||||
|
||||
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){
|
||||
_dataOptions.setValue(values);
|
||||
}
|
||||
});
|
||||
|
||||
groupEvent->subscribe(name(), "transferFunctionsChanged", [&](ghoul::Dictionary dict){
|
||||
LDEBUG(name() + " Event transferFunctionsChanged");
|
||||
_transferFunctionsFile.setValue(dict.value<std::string>("transferFunctions"));
|
||||
});
|
||||
|
||||
groupEvent->subscribe(name(), "backgroundValuesChanged", [&](ghoul::Dictionary dict){
|
||||
LDEBUG(name() + " Event backgroundValuesChanged");
|
||||
glm::vec2 values;
|
||||
bool success = dict.getValue("backgroundValues", values);
|
||||
if(success){
|
||||
_backgroundValues.setValue(values);
|
||||
}
|
||||
});
|
||||
|
||||
groupEvent->subscribe(name(), "autoFilterChanged", [&](ghoul::Dictionary dict){
|
||||
LDEBUG(name() + " Event autoFilterChanged");
|
||||
_autoFilter.setValue(dict.value<bool>("autoFilter"));
|
||||
});
|
||||
|
||||
groupEvent->subscribe(name(), "updateGroup", [&](ghoul::Dictionary dict){
|
||||
LDEBUG(name() + " Event updateGroup");
|
||||
updateTexture();
|
||||
});
|
||||
}
|
||||
|
||||
} //namespace openspace
|
||||
@@ -26,8 +26,6 @@
|
||||
#define __DATASPHERE_H__
|
||||
|
||||
#include <modules/iswa/rendering/datacygnet.h>
|
||||
#include <openspace/properties/vectorproperty.h>
|
||||
#include <openspace/properties/selectionproperty.h>
|
||||
|
||||
namespace openspace{
|
||||
class PowerScaledSphere;
|
||||
@@ -53,14 +51,6 @@ protected:
|
||||
void renderGeometry() const override;
|
||||
void setUniforms() override;
|
||||
std::vector<float*> textureData() override;
|
||||
void subscribeToGroup();
|
||||
|
||||
properties::StringProperty _transferFunctionsFile;
|
||||
properties::Vec2Property _backgroundValues;
|
||||
properties::Vec2Property _normValues;
|
||||
properties::BoolProperty _useLog;
|
||||
properties::BoolProperty _useHistogram;
|
||||
properties::BoolProperty _autoFilter;
|
||||
|
||||
std::shared_ptr<PowerScaledSphere> _sphere;
|
||||
float _radius;
|
||||
|
||||
@@ -64,7 +64,6 @@ struct Metadata {
|
||||
|
||||
|
||||
class IswaCygnet : public Renderable, public std::enable_shared_from_this<IswaCygnet> {
|
||||
friend class IswaBaseGroup;
|
||||
|
||||
public:
|
||||
IswaCygnet(const ghoul::Dictionary& dictionary);
|
||||
@@ -134,6 +133,20 @@ protected:
|
||||
|
||||
std::shared_ptr<Metadata> _data;
|
||||
|
||||
std::vector<std::shared_ptr<TransferFunction>> _transferFunctions;
|
||||
std::future<DownloadManager::MemoryFile> _futureObject;
|
||||
|
||||
std::shared_ptr<IswaBaseGroup> _group;
|
||||
|
||||
bool _textureDirty;
|
||||
|
||||
// Must be set by children.
|
||||
std::string _vsPath;
|
||||
std::string _fsPath;
|
||||
std::string _programName;
|
||||
|
||||
private:
|
||||
bool destroyShader();
|
||||
glm::dmat3 _stateMatrix;
|
||||
|
||||
double _openSpaceTime;
|
||||
@@ -142,21 +155,6 @@ protected:
|
||||
std::chrono::milliseconds _realTime;
|
||||
std::chrono::milliseconds _lastUpdateRealTime;
|
||||
int _minRealTimeUpdateInterval;
|
||||
|
||||
std::vector<std::shared_ptr<TransferFunction>> _transferFunctions;
|
||||
std::future<DownloadManager::MemoryFile> _futureObject;
|
||||
|
||||
std::shared_ptr<IswaBaseGroup> _group;
|
||||
|
||||
bool _textureDirty;
|
||||
|
||||
std::string _vsPath;
|
||||
std::string _fsPath;
|
||||
std::string _programName;
|
||||
|
||||
private:
|
||||
bool destroyShader();
|
||||
|
||||
};
|
||||
|
||||
}//namespace openspace
|
||||
|
||||
@@ -39,25 +39,13 @@ namespace openspace {
|
||||
|
||||
KameleonPlane::KameleonPlane(const ghoul::Dictionary& dictionary)
|
||||
:DataCygnet(dictionary)
|
||||
,_useLog("useLog","Use Logarithm", false)
|
||||
,_useHistogram("useHistogram", "Auto Contrast", false)
|
||||
,_autoFilter("autoFilter", "Auto Filter", true)
|
||||
,_normValues("normValues", "Normalize Values", glm::vec2(1.0,1.0), glm::vec2(0), glm::vec2(5.0))
|
||||
,_backgroundValues("backgroundValues", "Background Values", glm::vec2(0.0), glm::vec2(0), glm::vec2(1.0))
|
||||
,_transferFunctionsFile("transferfunctions", "Transfer Functions", "${SCENE}/iswa/tfs/default.tf")
|
||||
,_fieldlines("fieldlineSeedsIndexFile", "Fieldline Seedpoints")
|
||||
,_resolution("resolution", "Resolution%", 100.0f, 10.0f, 200.0f)
|
||||
,_slice("slice", "Slice", 0.0, 0.0, 1.0)
|
||||
{
|
||||
|
||||
addProperty(_useLog);
|
||||
addProperty(_useHistogram);
|
||||
addProperty(_autoFilter);
|
||||
addProperty(_normValues);
|
||||
addProperty(_backgroundValues);
|
||||
addProperty(_resolution);
|
||||
addProperty(_slice);
|
||||
addProperty(_transferFunctionsFile);
|
||||
addProperty(_fieldlines);
|
||||
|
||||
dictionary.getValue("kwPath", _kwPath);
|
||||
@@ -139,27 +127,14 @@ bool KameleonPlane::initialize(){
|
||||
});
|
||||
}
|
||||
|
||||
fillOptions(_kwPath);
|
||||
|
||||
readTransferFunctions(_transferFunctionsFile.value());
|
||||
|
||||
_normValues.onChange([this](){
|
||||
_dataProcessor->normValues(_normValues.value());
|
||||
updateTexture();
|
||||
});
|
||||
|
||||
_useLog.onChange([this](){
|
||||
_dataProcessor->useLog(_useLog.value());
|
||||
updateTexture();
|
||||
});
|
||||
|
||||
_useHistogram.onChange([this](){
|
||||
_dataProcessor->useHistogram(_useHistogram.value());
|
||||
updateTexture();
|
||||
});
|
||||
|
||||
_transferFunctionsFile.onChange([this](){
|
||||
readTransferFunctions(_transferFunctionsFile.value());
|
||||
});
|
||||
|
||||
// Set Property Callbacks of DataCygnet (must be called after fillOptions)
|
||||
setPropertyCallbacks();
|
||||
|
||||
// Set Property callback specific to KameleonPlane
|
||||
_resolution.onChange([this](){
|
||||
for(int i=0; i<_textures.size(); i++){
|
||||
_textures[i] = std::move(nullptr);
|
||||
@@ -178,14 +153,6 @@ bool KameleonPlane::initialize(){
|
||||
updateFieldlineSeeds();
|
||||
});
|
||||
|
||||
fillOptions(_kwPath);
|
||||
// Has to be done after fillOptions
|
||||
_dataOptions.onChange([this](){
|
||||
if(_dataOptions.value().size() > MAX_TEXTURES)
|
||||
LWARNING("Too many options chosen, max is " + std::to_string(MAX_TEXTURES));
|
||||
updateTexture();
|
||||
});
|
||||
|
||||
std::dynamic_pointer_cast<DataProcessorKameleon>(_dataProcessor)->dimensions(_dimensions);
|
||||
_dataProcessor->addDataValues(_kwPath, _dataOptions);
|
||||
// if this datacygnet has added new values then reload texture
|
||||
@@ -319,62 +286,11 @@ void KameleonPlane::readFieldlinePaths(std::string indexFile){
|
||||
}
|
||||
|
||||
void KameleonPlane::subscribeToGroup(){
|
||||
// Subscribe to DataCygnet events
|
||||
DataCygnet::subscribeToGroup();
|
||||
|
||||
//Add additional Events specific to KameleonPlane
|
||||
auto groupEvent = _group->groupEvent();
|
||||
|
||||
groupEvent->subscribe(name(), "useLogChanged", [&](const ghoul::Dictionary& dict){
|
||||
LDEBUG(name() + " Event useLogChanged");
|
||||
_useLog.setValue(dict.value<bool>("useLog"));
|
||||
});
|
||||
|
||||
groupEvent->subscribe(name(), "normValuesChanged", [&](ghoul::Dictionary dict){
|
||||
LDEBUG(name() + " Event normValuesChanged");
|
||||
glm::vec2 values;
|
||||
bool success = dict.getValue("normValues", values);
|
||||
if(success){
|
||||
_normValues.setValue(values);
|
||||
}
|
||||
});
|
||||
|
||||
groupEvent->subscribe(name(), "useHistogramChanged", [&](ghoul::Dictionary dict){
|
||||
LDEBUG(name() + " Event useHistogramChanged");
|
||||
_useHistogram.setValue(dict.value<bool>("useHistogram"));
|
||||
});
|
||||
|
||||
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){
|
||||
_dataOptions.setValue(values);
|
||||
}
|
||||
});
|
||||
|
||||
groupEvent->subscribe(name(), "transferFunctionsChanged", [&](ghoul::Dictionary dict){
|
||||
LDEBUG(name() + " Event transferFunctionsChanged");
|
||||
_transferFunctionsFile.setValue(dict.value<std::string>("transferFunctions"));
|
||||
});
|
||||
|
||||
groupEvent->subscribe(name(), "backgroundValuesChanged", [&](ghoul::Dictionary dict){
|
||||
LDEBUG(name() + " Event backgroundValuesChanged");
|
||||
glm::vec2 values;
|
||||
bool success = dict.getValue("backgroundValues", values);
|
||||
if(success){
|
||||
_backgroundValues.setValue(values);
|
||||
}
|
||||
});
|
||||
|
||||
groupEvent->subscribe(name(), "autoFilterChanged", [&](ghoul::Dictionary dict){
|
||||
LDEBUG(name() + " Event autoFilterChanged");
|
||||
_autoFilter.setValue(dict.value<bool>("autoFilter"));
|
||||
});
|
||||
|
||||
groupEvent->subscribe(name(), "updateGroup", [&](ghoul::Dictionary dict){
|
||||
LDEBUG(name() + " Event updateGroup");
|
||||
if(_autoFilter.value())
|
||||
_backgroundValues.setValue(_dataProcessor->filterValues());
|
||||
updateTexture();
|
||||
});
|
||||
|
||||
groupEvent->subscribe(name(), "resolutionChanged", [&](ghoul::Dictionary dict){
|
||||
LDEBUG(name() + " Event resolutionChanged");
|
||||
float resolution;
|
||||
@@ -391,7 +307,6 @@ void KameleonPlane::subscribeToGroup(){
|
||||
if(success){
|
||||
changeKwPath(path);
|
||||
}
|
||||
|
||||
updateTexture();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -26,7 +26,6 @@
|
||||
#define __KAMELEONPLANE_H__
|
||||
|
||||
#include <modules/iswa/rendering/datacygnet.h>
|
||||
#include <openspace/properties/vectorproperty.h>
|
||||
#include <openspace/properties/selectionproperty.h>
|
||||
|
||||
namespace openspace{
|
||||
@@ -81,17 +80,8 @@ private:
|
||||
|
||||
properties::FloatProperty _resolution;
|
||||
properties::FloatProperty _slice;
|
||||
properties::StringProperty _transferFunctionsFile;
|
||||
|
||||
properties::SelectionProperty _fieldlines;
|
||||
|
||||
properties::Vec2Property _backgroundValues;
|
||||
properties::Vec2Property _normValues;
|
||||
|
||||
properties::BoolProperty _useLog;
|
||||
properties::BoolProperty _useHistogram;
|
||||
properties::BoolProperty _autoFilter;
|
||||
|
||||
std::string _kwPath;
|
||||
|
||||
glm::size3_t _dimensions;
|
||||
|
||||
@@ -156,7 +156,7 @@ std::vector<float*> DataProcessorText::processData(std::string data, properties:
|
||||
if(line.find("#") == 0) continue;
|
||||
|
||||
values = std::vector<float>();
|
||||
|
||||
|
||||
int first = 0;
|
||||
int last = 0;
|
||||
int option = -3;
|
||||
|
||||
@@ -464,12 +464,12 @@ float* KameleonWrapper::getUniformSliceValues(
|
||||
if(value != missingValue){
|
||||
doubleData[index] = value;
|
||||
data[index] = value;
|
||||
if(value > maxValue){
|
||||
maxValue = value;
|
||||
}
|
||||
if(value < minValue){
|
||||
minValue = value;
|
||||
}
|
||||
// if(value > maxValue){
|
||||
// maxValue = value;
|
||||
// }
|
||||
// if(value < minValue){
|
||||
// minValue = value;
|
||||
// }
|
||||
}else{
|
||||
// std::cout << "value missing" << std::endl;
|
||||
doubleData[index] = 0;
|
||||
|
||||
@@ -64,11 +64,15 @@
|
||||
_kameleon->_cxform(from.c_str(), to.c_str(), ephemerisTime, &in1, &out1);
|
||||
_kameleon->_cxform(from.c_str(), to.c_str(), ephemerisTime, &in2, &out2);
|
||||
|
||||
return glm::dmat3(
|
||||
glm::dmat3 out = glm::dmat3(
|
||||
out0.c0 , out0.c1 , out0.c2,
|
||||
out1.c0 , out1.c1 , out1.c2,
|
||||
out2.c0 , out2.c1 , out2.c2
|
||||
);
|
||||
|
||||
// Need to rotate 90 degrees around x-axis becuase kameleon is flipped
|
||||
out = glm::dmat3(glm::rotate(glm::mat4(out), (float)M_PI_2, glm::vec3(1.0f, 0.0f, 0.0f)));
|
||||
return out;
|
||||
}
|
||||
|
||||
glm::dmat3 TransformationManager::frameTransformationMatrix(std::string from,
|
||||
|
||||
Reference in New Issue
Block a user