From 4ae4ecca3cc69eba5b59e62e19bd52877602fcdd Mon Sep 17 00:00:00 2001 From: Sebastian Piwell Date: Fri, 3 Jun 2016 14:16:15 -0400 Subject: [PATCH] Auto filter at start --- modules/iswa/rendering/dataplane.cpp | 8 +++++--- modules/iswa/rendering/iswabasegroup.cpp | 2 ++ modules/iswa/rendering/kameleonplane.cpp | 7 +++++++ 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/modules/iswa/rendering/dataplane.cpp b/modules/iswa/rendering/dataplane.cpp index b623d9022c..fb721d080e 100644 --- a/modules/iswa/rendering/dataplane.cpp +++ b/modules/iswa/rendering/dataplane.cpp @@ -34,7 +34,7 @@ DataPlane::DataPlane(const ghoul::Dictionary& dictionary) :DataCygnet(dictionary) ,_useLog("useLog","Use Logarithm", false) ,_useHistogram("useHistogram", "Auto Contrast", false) - ,_autoFilter("autoFilter", "Auto Filter", 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") @@ -136,9 +136,9 @@ bool DataPlane::createGeometry() { // x y z w s t -x, -y, -z, w, 0, 1, x, y, z, w, 1, 0, - -x, ((x>1)?y:-y), z, w, 0, 0, + -x, ((x>0)?y:-y), z, w, 0, 0, -x, -y, -z, w, 0, 1, - x, ((x>1)?-y:y), -z, w, 1, 1, + x, ((x>0)?-y:y), -z, w, 1, 1, x, y, z, w, 1, 0, }; @@ -246,6 +246,8 @@ void DataPlane::subscribeToGroup(){ groupEvent->subscribe(name(), "updateGroup", [&](ghoul::Dictionary dict){ LDEBUG(name() + " Event updateGroup"); + if(_autoFilter.value()) + _backgroundValues.setValue(_dataProcessor->filterValues()); updateTexture(); }); } diff --git a/modules/iswa/rendering/iswabasegroup.cpp b/modules/iswa/rendering/iswabasegroup.cpp index 5df424c599..e7fb9de70d 100644 --- a/modules/iswa/rendering/iswabasegroup.cpp +++ b/modules/iswa/rendering/iswabasegroup.cpp @@ -66,7 +66,9 @@ bool IswaBaseGroup::isType(std::string type){ } void IswaBaseGroup::updateGroup(){ + LDEBUG("Group " + name() + " published updateGroup"); _groupEvent->publish("updateGroup", ghoul::Dictionary()); + } void IswaBaseGroup::clearGroup(){ diff --git a/modules/iswa/rendering/kameleonplane.cpp b/modules/iswa/rendering/kameleonplane.cpp index 46b257ba55..79d046c9b9 100644 --- a/modules/iswa/rendering/kameleonplane.cpp +++ b/modules/iswa/rendering/kameleonplane.cpp @@ -188,6 +188,11 @@ bool KameleonPlane::initialize(){ std::dynamic_pointer_cast(_dataProcessor)->dimensions(_dimensions); _dataProcessor->addDataValues(_kwPath, _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(); + } updateTextureResource(); return true; @@ -365,6 +370,8 @@ void KameleonPlane::subscribeToGroup(){ groupEvent->subscribe(name(), "updateGroup", [&](ghoul::Dictionary dict){ LDEBUG(name() + " Event updateGroup"); + if(_autoFilter.value()) + _backgroundValues.setValue(_dataProcessor->filterValues()); updateTexture(); });