From 8e8d949107aa5450bb297368eb0b954d4db7e429 Mon Sep 17 00:00:00 2001 From: Sebastian Piwell Date: Fri, 3 Jun 2016 13:42:50 -0400 Subject: [PATCH 1/2] Summer school release --- data/scene/default.scene | 71 +++----------------- data/scene/iswa/tfs/default.tf | 2 +- modules/iswa/rendering/iswakameleongroup.cpp | 2 +- modules/iswa/rendering/kameleonplane.cpp | 6 +- modules/onscreengui/src/guiiswacomponent.cpp | 22 +++--- 5 files changed, 25 insertions(+), 78 deletions(-) diff --git a/data/scene/default.scene b/data/scene/default.scene index 3baee3cb63..75161d487e 100644 --- a/data/scene/default.scene +++ b/data/scene/default.scene @@ -29,59 +29,7 @@ function postInitialization() openspace.setPropertyValue("MilkyWay.renderable.segments", 50) openspace.printInfo("Done setting default values") - - --openspace.iswa.addCygnet(-4,"Data","Ion"); - - --openspace.iswa.addCygnet(-1,"Data"); - --openspace.iswa.addCygnet(-2,"Data"); - --openspace.iswa.addCygnet(-3,"Data"); - - --openspace.iswa.addCygnet(-1,"Texture"); - --openspace.iswa.addCygnet(-2,"Texture"); - --openspace.iswa.addCygnet(-3,"Texture"); - - - --openspace.iswa.addCygnet(-3,"Data","GM"); - --openspace.iswa.addCygnet(-2,"Data","GM"); - --openspace.iswa.addCygnet(-1,"Data","GM"); - openspace.iswa.addCdfFiles("${OPENSPACE_DATA}/cdflist.json"); - - --[[ - openspace.iswa.addScreenSpaceCygnet( - { - CygnetId = 2, - Position = {-0.8, 0.3}, - Scale = 0.2 - }); - { - Type = "ScreenSpaceCygnet", - CygnetId = 7, - Position = {0.0, 0.0}, - FlatScreen = true, - Scale = 0.25, - }); - - openspace.registerScreenSpaceRenderable( - { - Name = "Crazy Cat", - Type = "ScreenSpaceImage", - TexturePath = "${OPENSPACE_DATA}/test2.jpg", - Position = {0.8, -0.3}, - FlatScreen = true, - Scale = 0.25, - }); - - openspace.registerScreenSpaceRenderable( - { - Name = "From Online", - Type = "ScreenSpaceImage", - URL = "http://i.imgur.com/KUunHgr.jpg", - Position = {-0.8, 0.3}, - FlatScreen = true, - Scale = 0.25, - }); - ]]-- end @@ -94,20 +42,19 @@ return { }, Modules = { "sun", - --"mercury", - --"venus", + "mercury", + "venus", "earth", - --"mars", - --"jupiter", - --"saturn", - --"uranus", - --"neptune", + "mars", + "jupiter", + "saturn", + "uranus", + "neptune", "stars", - -- "stars-denver", + --"stars-denver", "milkyway", - -- "milkyway-eso", + "milkyway-eso", --"constellationbounds", - --"fieldlines", --"io", --"europa", --"ganymede", diff --git a/data/scene/iswa/tfs/default.tf b/data/scene/iswa/tfs/default.tf index 3d030ecda9..98b5ef56b7 100644 --- a/data/scene/iswa/tfs/default.tf +++ b/data/scene/iswa/tfs/default.tf @@ -1 +1 @@ -${SCENE}/iswa/tfs/colormap_hot.jpg \ No newline at end of file +${SCENE}/iswa/tfs/colormap_hot.png \ No newline at end of file diff --git a/modules/iswa/rendering/iswakameleongroup.cpp b/modules/iswa/rendering/iswakameleongroup.cpp index 83b5a77a85..688bba237b 100644 --- a/modules/iswa/rendering/iswakameleongroup.cpp +++ b/modules/iswa/rendering/iswakameleongroup.cpp @@ -42,7 +42,7 @@ namespace { namespace openspace{ IswaKameleonGroup::IswaKameleonGroup(std::string name, std::string type) :IswaDataGroup(name, type) - ,_resolution("resolution", "Resolution%", 1.0f, 0.1, 2.0f) + ,_resolution("resolution", "Resolution%", 100.0f, 10.0f, 200.0f) ,_fieldlines("fieldlineSeedsIndexFile", "Fieldline Seedpoints") ,_fieldlineIndexFile("") ,_kameleonPath("") diff --git a/modules/iswa/rendering/kameleonplane.cpp b/modules/iswa/rendering/kameleonplane.cpp index a18da4503f..36eb8f81b0 100644 --- a/modules/iswa/rendering/kameleonplane.cpp +++ b/modules/iswa/rendering/kameleonplane.cpp @@ -57,7 +57,7 @@ KameleonPlane::KameleonPlane(const ghoul::Dictionary& dictionary) ,_transferFunctionsFile("transferfunctions", "Transfer Functions", "${SCENE}/iswa/tfs/default.tf") ,_dataOptions("dataOptions", "Data Options") ,_fieldlines("fieldlineSeedsIndexFile", "Fieldline Seedpoints") - ,_resolution("resolution", "Resolution%", 1.0f, 0.1, 2.0f) + ,_resolution("resolution", "Resolution%", 100.0f, 10.0f, 200.0f) ,_slice("slice", "Slice", 0.0, 0.0, 1.0) { @@ -486,8 +486,8 @@ void KameleonPlane::subscribeToGroup(){ 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*(1.0f/_resolution.value()); - _dimensions = glm::size3_t(_data->scale*(float)_resolution.value()); + _data->offset = _origOffset - 0.5f*(100.0f/_resolution.value()); + _dimensions = glm::size3_t(_data->scale*((float)_resolution.value()/100.f)); _dimensions[_cut] = 1; if(_cut == 0){ diff --git a/modules/onscreengui/src/guiiswacomponent.cpp b/modules/onscreengui/src/guiiswacomponent.cpp index 276ca8f79c..3e4fab7f0f 100644 --- a/modules/onscreengui/src/guiiswacomponent.cpp +++ b/modules/onscreengui/src/guiiswacomponent.cpp @@ -70,21 +70,21 @@ void GuiIswaComponent::render() { bool iondatavalue = _iondata; ImGui::Begin("ISWA", &_isEnabled, size, 0.5f); - ImGui::Text("Global Magnetosphere"); - ImGui::Checkbox("Gm From Data", &_gmdata); ImGui::SameLine(); - ImGui::Checkbox("Gm From Images", &_gmimage); + // ImGui::Text("Global Magnetosphere"); + // ImGui::Checkbox("Gm From Data", &_gmdata); ImGui::SameLine(); + // ImGui::Checkbox("Gm From Images", &_gmimage); - ImGui::Text("Ionosphere"); - ImGui::Checkbox("Ion From Data", &_iondata); + // ImGui::Text("Ionosphere"); + // ImGui::Checkbox("Ion From Data", &_iondata); - ImGui::Spacing(); - static const int addCygnetBufferSize = 256; - static char addCygnetBuffer[addCygnetBufferSize]; - ImGui::InputText("addCynget", addCygnetBuffer, addCygnetBufferSize); + // ImGui::Spacing(); + // static const int addCygnetBufferSize = 256; + // static char addCygnetBuffer[addCygnetBufferSize]; + // ImGui::InputText("addCynget", addCygnetBuffer, addCygnetBufferSize); - if(ImGui::SmallButton("Add Cygnet")) - OsEng.scriptEngine().queueScript("openspace.iswa.addCygnet("+std::string(addCygnetBuffer)+");"); + // if(ImGui::SmallButton("Add Cygnet")) + // OsEng.scriptEngine().queueScript("openspace.iswa.addCygnet("+std::string(addCygnetBuffer)+");"); if(_gmdata != gmdatavalue){ if(_gmdata){ From 4ae4ecca3cc69eba5b59e62e19bd52877602fcdd Mon Sep 17 00:00:00 2001 From: Sebastian Piwell Date: Fri, 3 Jun 2016 14:16:15 -0400 Subject: [PATCH 2/2] 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(); });