diff --git a/plugins/mmadios/src/adiosWriter.cpp b/plugins/mmadios/src/adiosWriter.cpp index 7d9db4421a..49110c1b61 100644 --- a/plugins/mmadios/src/adiosWriter.cpp +++ b/plugins/mmadios/src/adiosWriter.cpp @@ -62,7 +62,7 @@ bool adiosWriter::create() { if (MpiInitialized) { adiosInst = adios2::ADIOS(this->mpi_comm_); } else { - adiosInst = adios2::ADIOS(adios2::DebugON); + adiosInst = adios2::ADIOS(); } #else try { diff --git a/plugins/mmospray/include/mmospray/CallOSPRayStructure.h b/plugins/mmospray/include/mmospray/CallOSPRayStructure.h index 7eddfe9ae8..b1a6d296dd 100644 --- a/plugins/mmospray/include/mmospray/CallOSPRayStructure.h +++ b/plugins/mmospray/include/mmospray/CallOSPRayStructure.h @@ -13,6 +13,8 @@ #include "mmcore/factories/CallAutoDescription.h" #include "mmospray/CallOSPRayMaterial.h" #include "mmospray/CallOSPRayTransformation.h" +#include "rkcommon/math/vec.h" + #include #include @@ -85,7 +87,7 @@ struct curveStructure { }; struct ClippingPlane { - std::array coeff = {0, 0, 0, 0}; + ::rkcommon::math::vec4f coeff = {0, 0, 0, 0}; bool isValid = false; }; diff --git a/plugins/mmospray/src/AbstractOSPRayRenderer.cpp b/plugins/mmospray/src/AbstractOSPRayRenderer.cpp index cbfe1a148b..14239354a5 100644 --- a/plugins/mmospray/src/AbstractOSPRayRenderer.cpp +++ b/plugins/mmospray/src/AbstractOSPRayRenderer.cpp @@ -1162,17 +1162,13 @@ bool AbstractOSPRayRenderer::generateRepresentations() { if (entry.second.clippingPlane.isValid) { _baseStructures[entry.first].emplace_back(::ospray::cpp::Geometry("plane"), GEOMETRY); - ::rkcommon::math::vec4f plane; - plane[0] = entry.second.clippingPlane.coeff[0]; - plane[1] = entry.second.clippingPlane.coeff[1]; - plane[2] = entry.second.clippingPlane.coeff[2]; - plane[3] = entry.second.clippingPlane.coeff[3]; std::get<::ospray::cpp::Geometry>(_baseStructures[entry.first].structures.back()) - .setParam("plane.coefficients", ::ospray::cpp::CopiedData(plane)); + .setParam("plane.coefficients", ::ospray::cpp::SharedData(entry.second.clippingPlane.coeff)); std::get<::ospray::cpp::Geometry>(_baseStructures[entry.first].structures.back()).commit(); _clippingModels[entry.first].emplace_back(::ospray::cpp::GeometricModel( std::get<::ospray::cpp::Geometry>(_baseStructures[entry.first].structures.back()))); + _clippingModels[entry.first].back().setParam("invertNormals", true); _clippingModels[entry.first].back().commit(); _groups[entry.first].setParam( diff --git a/plugins/mmospray/src/AbstractOSPRayStructure.cpp b/plugins/mmospray/src/AbstractOSPRayStructure.cpp index e4044c6ff3..e733ad2334 100644 --- a/plugins/mmospray/src/AbstractOSPRayStructure.cpp +++ b/plugins/mmospray/src/AbstractOSPRayStructure.cpp @@ -145,12 +145,12 @@ void AbstractOSPRayStructure::processClippingPlane() { // ccp->GetPlane().Point().GetX(), ccp->GetPlane().Point().GetY(), ccp->GetPlane().Point().GetZ()}; //float d = glm::dot(point, normal); ClippingPlane& cp = this->structureContainer.clippingPlane; - if (cp.coeff[0] != normal.x || cp.coeff[1] != normal.y || cp.coeff[2] != normal.z || cp.coeff[3] != d) { + if (cp.coeff[0] != normal.x || cp.coeff[1] != normal.y || cp.coeff[2] != normal.z || cp.coeff[3] != -d) { this->structureContainer.clippingPlaneChanged = true; cp.coeff[0] = normal.x; cp.coeff[1] = normal.y; cp.coeff[2] = normal.z; - cp.coeff[3] = d; + cp.coeff[3] = -d; } else { this->structureContainer.clippingPlaneChanged = false; } diff --git a/plugins/mmstd/include/mmstd/renderer/ClipPlane.h b/plugins/mmstd/include/mmstd/renderer/ClipPlane.h index bfb0c66212..f2b7131827 100644 --- a/plugins/mmstd/include/mmstd/renderer/ClipPlane.h +++ b/plugins/mmstd/include/mmstd/renderer/ClipPlane.h @@ -97,6 +97,9 @@ class ClipPlane : public Module { /** The plane-origin distance */ param::ParamSlot distSlot; + + /** A button to normalize the normal */ + param::ParamSlot normalizeSlot; }; } // namespace megamol::core::view diff --git a/plugins/mmstd/src/renderer/ClipPlane.cpp b/plugins/mmstd/src/renderer/ClipPlane.cpp index d7ef68106b..6c7e8896ae 100644 --- a/plugins/mmstd/src/renderer/ClipPlane.cpp +++ b/plugins/mmstd/src/renderer/ClipPlane.cpp @@ -6,6 +6,7 @@ #include "mmstd/renderer/ClipPlane.h" #include "mmcore/param/BoolParam.h" +#include "mmcore/param/ButtonParam.h" #include "mmcore/param/ColorParam.h" #include "mmcore/param/FloatParam.h" #include "mmcore/param/Vector3fParam.h" @@ -29,7 +30,8 @@ view::ClipPlane::ClipPlane() , colourSlot("colour", "Defines the colour of the clipping plane") , normalSlot("normal", "Defines the normal of the clipping plane") , pointSlot("point", "Defines a point in the clipping plane") - , distSlot("dist", "The plane-origin distance") { + , distSlot("dist", "The plane-origin distance") + , normalizeSlot("normalize", "normalizes the normal") { this->plane.Set(vislib::math::Point(0.0, 0.0f, 0.0f), vislib::math::Vector(1.0f, 0.0f, 0.0f)); this->col[0] = this->col[1] = this->col[2] = 0.5f; @@ -53,6 +55,9 @@ view::ClipPlane::ClipPlane() this->distSlot << new param::FloatParam(-this->plane.Distance(vislib::math::Point(0.0f, 0.0f, 0.0f))); this->MakeSlotAvailable(&this->distSlot); + + this->normalizeSlot << new param::ButtonParam(); + this->MakeSlotAvailable(&this->normalizeSlot); } @@ -94,6 +99,12 @@ bool view::ClipPlane::requestPlane(Call& call) { return false; } + if (this->normalizeSlot.IsDirty()) { + auto n = this->normalSlot.Param()->Value(); + n.Normalise(); + this->normalSlot.Param()->SetValue(n); + } + if (this->colourSlot.IsDirty()) { this->colourSlot.ResetDirty(); this->colourSlot.Param()->Value(this->col[0], this->col[1], this->col[2], this->col[3]);