refactor kameleonplane

This commit is contained in:
Michael Nilsson
2016-06-02 18:00:26 -04:00
parent 7401595e93
commit c05b417519
13 changed files with 284 additions and 302 deletions
+25 -5
View File
@@ -88,17 +88,17 @@ bool DataPlane::initialize(){
_normValues.onChange([this](){
_dataProcessor->normValues(_normValues.value());
loadTexture();
updateTexture();
});
_useLog.onChange([this](){
_dataProcessor->useLog(_useLog.value());
loadTexture();
updateTexture();
});
_useHistogram.onChange([this](){
_dataProcessor->useHistogram(_useHistogram.value());
loadTexture();
updateTexture();
if(_autoFilter.value())
_backgroundValues.setValue(_dataProcessor->filterValues());
});
@@ -106,7 +106,7 @@ bool DataPlane::initialize(){
_dataOptions.onChange([this](){
if(_dataOptions.value().size() > MAX_TEXTURES)
LWARNING("Too many options chosen, max is " + std::to_string(MAX_TEXTURES));
loadTexture();
updateTexture();
});
_transferFunctionsFile.onChange([this](){
@@ -175,6 +175,26 @@ void DataPlane::setUniforms(){
_shader->setUniform("transparency", _alpha.value());
}
std::vector<float*> DataPlane::textureData(){
// if the buffer in the datafile is empty, do not proceed
if(_dataBuffer.empty())
return std::vector<float*>();
if(!_dataOptions.options().size()){ // load options for value selection
fillOptions(_dataBuffer);
_dataProcessor->addDataValues(_dataBuffer, _dataOptions);
// if this datacygnet has added new values then reload texture
// for the whole group, including this datacygnet, and return after.
if(_group){
_group->updateGroup();
return std::vector<float*>();
}
}
_textureDimensions = _dataProcessor->dimensions();
return _dataProcessor->processData(_dataBuffer, _dataOptions);
}
void DataPlane::subscribeToGroup(){
auto groupEvent = _group->groupEvent();
groupEvent->subscribe(name(), "useLogChanged", [&](const ghoul::Dictionary& dict){
@@ -226,7 +246,7 @@ void DataPlane::subscribeToGroup(){
groupEvent->subscribe(name(), "updateGroup", [&](ghoul::Dictionary dict){
LDEBUG(name() + " Event updateGroup");
loadTexture();
updateTexture();
});
}