diff --git a/CMakeLists.txt b/CMakeLists.txt index 863cea2ac1f71cc63c99c58d67725e3bb2191456..3778701d66658e72adbd8e0b78e28eed534a077b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,8 +7,8 @@ if(APPLE) add_definitions(-DOVM_FORCE_STATIC_CAST) endif() -openflipper_plugin (INSTALLDATA Icons - DIRS OpenMesh OpenVolumeMesh Widgets ScriptObjects Toolbars Models PropertyVisualizer +openflipper_plugin (INSTALLDATA Icons Shaders + DIRS OpenMesh OpenVolumeMesh Widgets ScriptObjects Toolbars Models Nodes PropertyVisualizer DEPS OpenMesh OPTDEPS OpenVolumeMesh OPT_TYPES SKELETON BSPLINECURVE POLYHEDRALMESH HEXAHEDRALMESH TETRAHEDRALMESH diff --git a/Models/PropertyNameListModel.cc b/Models/PropertyNameListModel.cc index b272718fc3b8dd110b935ffd6032c616b70dcb62..b4a7fbb0973f588e18074d816de611e034014a9a 100644 --- a/Models/PropertyNameListModel.cc +++ b/Models/PropertyNameListModel.cc @@ -45,6 +45,7 @@ #include #include +#include #include @@ -64,6 +65,8 @@ const PropertyNameListModel::TypeInfoWrapper PropertyNameListModel::proptype_Vec PropertyNameListModel::TypeInfoWrapper(typeid(OpenMesh::PropertyT), "Vec2d"); const PropertyNameListModel::TypeInfoWrapper PropertyNameListModel::proptype_Vec2f = PropertyNameListModel::TypeInfoWrapper(typeid(OpenMesh::PropertyT), "Vec2f"); +const PropertyNameListModel::TypeInfoWrapper PropertyNameListModel::proptype_Matrix3x3d = + PropertyNameListModel::TypeInfoWrapper(typeid(OpenMesh::PropertyT), "Matrix3x3d"); #ifdef ENABLE_SKELETON_SUPPORT #include diff --git a/Models/PropertyNameListModel.hh b/Models/PropertyNameListModel.hh index c4aa1b50345a64fc9adbe7046ca65371263e9d41..cd84af198ef20a63181942d1d1ee8dc77079b7b1 100644 --- a/Models/PropertyNameListModel.hh +++ b/Models/PropertyNameListModel.hh @@ -66,7 +66,7 @@ class PropertyNameListModel: public QAbstractListModel { class TypeInfoWrapper { public: TypeInfoWrapper(const std::type_info & ti, const char *friendlyName) : ti(&ti), friendlyName(friendlyName) {} - TypeInfoWrapper(const std::type_info & ti) : ti(&ti),friendlyName("") {} + explicit TypeInfoWrapper(const std::type_info & ti) : ti(&ti),friendlyName("") {} operator const std::type_info *() const { return ti; } operator const std::type_info &() const { return *ti; } @@ -191,7 +191,7 @@ class PropertyNameListModel: public QAbstractListModel { OpenMesh::BaseProperty * const baseProp = *pit; if (!baseProp) continue; - TypeInfoWrapper bp_type = typeid(*baseProp); + TypeInfoWrapper bp_type {typeid(*baseProp)}; TYPE_INFO_SET::const_iterator sane_prop_it = sane_prop_types.find(bp_type); if ((typeIdFilter == 0 || TypeInfoWrapper(*typeIdFilter) == bp_type) && sane_prop_it != sane_prop_types.end()) { *oit++ = PROP_INFO(baseProp->name(), *sane_prop_it, entity); @@ -215,6 +215,7 @@ class PropertyNameListModel: public QAbstractListModel { static const TypeInfoWrapper proptype_Vec3f; static const TypeInfoWrapper proptype_Vec2d; static const TypeInfoWrapper proptype_Vec2f; + static const TypeInfoWrapper proptype_Matrix3x3d; static const TypeInfoWrapper proptype_SkinWeights; private: diff --git a/Nodes/BoxesNode.cc b/Nodes/BoxesNode.cc new file mode 100644 index 0000000000000000000000000000000000000000..237ba2bdb4eecc739837c205857f0c4909df59b9 --- /dev/null +++ b/Nodes/BoxesNode.cc @@ -0,0 +1,201 @@ +/*===========================================================================*\ + * * + * OpenFlipper * + * Copyright (c) 2001-2015, RWTH-Aachen University * + * Department of Computer Graphics and Multimedia * + * All rights reserved. * + * www.openflipper.org * + * * + *---------------------------------------------------------------------------* + * This file is part of OpenFlipper. * + *---------------------------------------------------------------------------* + * * + * Redistribution and use in source and binary forms, with or without * + * modification, are permitted provided that the following conditions * + * are met: * + * * + * 1. Redistributions of source code must retain the above copyright notice, * + * this list of conditions and the following disclaimer. * + * * + * 2. Redistributions in binary form must reproduce the above copyright * + * notice, this list of conditions and the following disclaimer in the * + * documentation and/or other materials provided with the distribution. * + * * + * 3. Neither the name of the copyright holder nor the names of its * + * contributors may be used to endorse or promote products derived from * + * this software without specific prior written permission. * + * * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * + * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER * + * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * + * * +\*===========================================================================*/ + + +#include +#include "BoxesNode.hh" +#include + + +namespace ACG { +namespace SceneGraph { + +BoxesNode::BoxesNode(BaseNode* _parent, + std::string _name) : + MaterialNode(_parent, _name), + updateVBO_(true) +{ + const std::array dim_color = { + Vec4f{1.f,0.f,0.f,1.f}, + Vec4f{0.f,1.f,0.f,1.f}, + Vec4f{0.f,0.f,1.f,1.f} + }; + + const std::array vertices = { + Vec3f( 1.f, -1.f, -1.f), + Vec3f( 1.f, 1.f, -1.f), + Vec3f( 1.f, 1.f, 1.f), + Vec3f( 1.f, -1.f, 1.f), + Vec3f(-1.f, -1.f, -1.f), + Vec3f(-1.f, 1.f, -1.f), + Vec3f(-1.f, 1.f, 1.f), + Vec3f(-1.f, -1.f, 1.f)}; + + auto add_triangle = [this, &vertices, &dim_color] + (size_t v0, size_t v1, size_t v2, size_t dim) + { + triangles_.push_back({vertices[v0], vertices[v1], vertices[v2]}); + triangle_colors_.push_back(dim_color[dim]); + }; + + triangles_.reserve(6*2); + triangle_colors_.reserve(6*2); + add_triangle(0, 1, 2, 0); + add_triangle(0, 2, 3, 0); + add_triangle(4, 6, 5, 0); + add_triangle(4, 7, 6, 0); + + add_triangle(1, 5, 6, 1); + add_triangle(1, 6, 2, 1); + add_triangle(0, 3, 7, 1); + add_triangle(0, 7, 4, 1); + + add_triangle(2, 7, 3, 2); + add_triangle(2, 6, 7, 2); + add_triangle(0, 4, 1, 2); + add_triangle(1, 4, 5, 2); +} + +void +BoxesNode:: +boundingBox(Vec3d& _bbMin, Vec3d& _bbMax) +{ + // FIXME: this assumes matrices to only consist of vectors up to unit length + for (const auto &be: elem_) { + _bbMax.maximize(be.pos + Vec3d(scaleFactor_,scaleFactor_,scaleFactor_)); + _bbMin.minimize(be.pos + Vec3d(-scaleFactor_, -scaleFactor_, -scaleFactor_)); + } +} + +void BoxesNode::createVBO() +{ + if (!updateVBO_) + return; + + // generate if needed: + geometry_vbo_.bind(); + instance_vbo_.bind(); + + vertexDecl_.clear(); + vertexDecl_.addElement(GL_FLOAT, 3, VERTEX_USAGE_POSITION, nullptr, nullptr, 0, geometry_vbo_.id()); + vertexDecl_.addElement(GL_FLOAT, 4, VERTEX_USAGE_COLOR, nullptr, nullptr, 0, geometry_vbo_.id()); + std::vector geom_vbo_data; geom_vbo_data.reserve(3 * (3+4) * triangles_.size()); + + vertexDecl_.addElement(GL_FLOAT, 3, VERTEX_USAGE_SHADER_INPUT, nullptr, "inst_v0", 1, instance_vbo_.id()); + vertexDecl_.addElement(GL_FLOAT, 3, VERTEX_USAGE_SHADER_INPUT, nullptr, "inst_v1", 1, instance_vbo_.id()); + vertexDecl_.addElement(GL_FLOAT, 3, VERTEX_USAGE_SHADER_INPUT, nullptr, "inst_v2", 1, instance_vbo_.id()); + vertexDecl_.addElement(GL_FLOAT, 3, VERTEX_USAGE_SHADER_INPUT, nullptr, "inst_pos", 1, instance_vbo_.id()); + std::vector instance_vbo_data; instance_vbo_data.reserve(3 * 4 * elem_.size()); + + assert(triangles_.size() == triangle_colors_.size()); + for (size_t i = 0; i < triangles_.size(); ++i) + { + auto &tri = triangles_[i]; + auto &color = triangle_colors_[i]; + for (const auto &point: tri) { + std::copy(point.begin(), point.end(), std::back_inserter(geom_vbo_data)); + std::copy(color.begin(), color.end(), std::back_inserter(geom_vbo_data)); + } + } + for (const auto &be: elem_) { + for (const auto &point: { + be.transform.getRow(0), + be.transform.getRow(1), + be.transform.getRow(2), + be.pos}) + { + std::copy(point.begin(), point.end(), std::back_inserter(instance_vbo_data)); + } + } + + geometry_vbo_.upload( + static_cast(geom_vbo_data.size()*sizeof(float)), + geom_vbo_data.data(), + GL_STATIC_DRAW_ARB); + instance_vbo_.upload( + static_cast(instance_vbo_data.size()*sizeof(float)), + instance_vbo_data.data(), + GL_STATIC_DRAW_ARB); + + // Update done. + updateVBO_ = false; + +} + +void +BoxesNode:: +getRenderObjects(IRenderer* _renderer, GLState& _state , const DrawModes::DrawMode& /* _drawMode */, const ACG::SceneGraph::Material* _mat) +{ + if (elem_.empty()) + return; + + RenderObject ro; + ro.initFromState(&_state); + ro.setMaterial(_mat); + + boxesNodeName_ = std::string("BoxesNode: ")+name(); + ro.debugName = boxesNodeName_; + + ro.depthTest = true; + ro.depthWrite = true; + + ro.blending = true; + ro.blendSrc = GL_SRC_ALPHA; + ro.blendDest = GL_ONE_MINUS_SRC_ALPHA; + + ro.shaderDesc.shadeMode = SG_SHADE_UNLIT; + ro.shaderDesc.vertexColors = true; + ro.shaderDesc.vertexTemplateFile = "BoxesNode/vert.glsl"; + + ro.setUniform("scale", scaleFactor_); + + createVBO(); + ro.vertexBuffer = geometry_vbo_.id(); + ro.vertexDecl = &vertexDecl_; + + ro.glDrawInstancedArrays(GL_TRIANGLES, 0, + static_cast(3 * triangles_.size()), + static_cast(elem_.size())); + _renderer->addRenderObject(&ro); +} + +} // namespace SceneGraph +} // namespace ACG diff --git a/Nodes/BoxesNode.hh b/Nodes/BoxesNode.hh new file mode 100644 index 0000000000000000000000000000000000000000..30b0ce55e85fdd458fb0f919ba4e29eac59c490e --- /dev/null +++ b/Nodes/BoxesNode.hh @@ -0,0 +1,116 @@ +#pragma once +/*===========================================================================*\ + * * + * OpenFlipper * + * Copyright (c) 2001-2015, RWTH-Aachen University * + * Department of Computer Graphics and Multimedia * + * All rights reserved. * + * www.openflipper.org * + * * + *---------------------------------------------------------------------------* + * This file is part of OpenFlipper. * + *---------------------------------------------------------------------------* + * * + * Redistribution and use in source and binary forms, with or without * + * modification, are permitted provided that the following conditions * + * are met: * + * * + * 1. Redistributions of source code must retain the above copyright notice, * + * this list of conditions and the following disclaimer. * + * * + * 2. Redistributions in binary form must reproduce the above copyright * + * notice, this list of conditions and the following disclaimer in the * + * documentation and/or other materials provided with the distribution. * + * * + * 3. Neither the name of the copyright holder nor the names of its * + * contributors may be used to endorse or promote products derived from * + * this software without specific prior written permission. * + * * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * + * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER * + * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * + * * +\*===========================================================================*/ + + +#include +#include +#include +#include +#include +#include +#include + +namespace ACG { +namespace SceneGraph { + +struct BoxElement { + Matrix3x3d transform; + Vec3d pos; +}; + +class BoxesNode : public MaterialNode +{ +public: + ACG_CLASSNAME(BoxesNode) + + BoxesNode(BaseNode* _parent=nullptr, + std::string _name="" ); + + ~BoxesNode() = default; + + DrawModes::DrawMode availableDrawModes() const { + return DrawModes::SOLID_FACES_COLORED_FLAT_SHADED; + } + + void boundingBox(Vec3d& _bbMin, Vec3d& _bbMax); + + void clear() { elem_.clear(); updateVBO_ = true; } + + void reserve(size_t _n) { elem_.reserve(_n); } + + /// STL conformance + void push_back(const BoxElement& _v) { elem_.push_back(_v); updateVBO_ = true; } + typedef BoxElement value_type; + typedef BoxElement& reference; + typedef const BoxElement& const_reference; + + void getRenderObjects(IRenderer* _renderer, GLState& _state, const DrawModes::DrawMode& _drawMode, const ACG::SceneGraph::Material* _mat); + + void setScaleFactor(float _val) { scaleFactor_ = _val;} + +protected: + /// creates the vbo only if update was requested + void createVBO(); + + std::vector elem_; + float scaleFactor_ = 1.0f; + + // geometry of a single box + std::vector> triangles_; + std::vector triangle_colors_; + + GeometryBuffer geometry_vbo_; + GeometryBuffer instance_vbo_; + + // True if points changed and the vbo has to be updated + bool updateVBO_; + + ACG::VertexDeclaration vertexDecl_; + + std::string boxesNodeName_; +}; + + +//============================================================================= +} // namespace SceneGraph +} // namespace ACG +//============================================================================= diff --git a/OpenVolumeMesh/EntityPosition.hh b/OpenVolumeMesh/EntityPosition.hh new file mode 100644 index 0000000000000000000000000000000000000000..0ed13aa476d1f7da540c0f11af2c4d8eabf32ec1 --- /dev/null +++ b/OpenVolumeMesh/EntityPosition.hh @@ -0,0 +1,56 @@ +#pragma once + +#include +#include +#include + +template +class EntityPosition +{ +public: + EntityPosition(MeshT &mesh) : mesh_(mesh) {} + ACG::Vec3d operator()(OpenVolumeMesh::VertexHandle vh) + { + return mesh_.vertex(vh); + } + ACG::Vec3d operator()(OpenVolumeMesh::EdgeHandle eh) + { + auto edge = mesh_.edge(eh); + return 0.5 * (mesh_.vertex(edge.from_vertex()) + mesh_.vertex(edge.to_vertex())); + } + ACG::Vec3d operator()(OpenVolumeMesh::HalfEdgeHandle heh) + { + auto edge = mesh_.halfedge(heh); + return (1./3.) * (2 * mesh_.vertex(edge.from_vertex()) + mesh_.vertex(edge.to_vertex())); + } + ACG::Vec3d operator()(OpenVolumeMesh::CellHandle ch) + { + int count = 0; + ACG::Vec3d sum{0.,0.,0.}; + for (auto vh: mesh_.cell_vertices(ch)) { + sum += mesh_.vertex(vh); + ++count; + } + return sum / count; + } + + ACG::Vec3d operator()(OpenVolumeMesh::FaceHandle fh) + { + return (*this)(mesh_.halfface_handle(fh, 0)); + } + + ACG::Vec3d operator()(OpenVolumeMesh::HalfFaceHandle hfh) + { + // TODO: maybe offset this slightly from the face barycenter? + int count = 0; + ACG::Vec3d sum{0.,0.,0.}; + for (auto vh: mesh_.halfface_vertices(hfh)) { + sum += mesh_.vertex(vh); + ++count; + } + return sum / count; + } +private: + MeshT &mesh_; +}; + diff --git a/OpenVolumeMesh/OVMPropertyModelT.hh b/OpenVolumeMesh/OVMPropertyModelT.hh index 132c4bfa3b7adc11c3407d9f2387f3edf970903a..7346881596be8ecadee4cc8cb4554149cde92183 100644 --- a/OpenVolumeMesh/OVMPropertyModelT.hh +++ b/OpenVolumeMesh/OVMPropertyModelT.hh @@ -48,6 +48,7 @@ #include "OVMPropertyVisualizerBoolean.hh" #include "OVMPropertyVisualizerDouble.hh" #include "OVMPropertyVisualizerInteger.hh" +#include "OVMPropertyVisualizerMatrix3x3.hh" #include "OVMPropertyVisualizerVector.hh" #include "OVMPropertyVisualizerVectorFieldDifference.hh" @@ -104,6 +105,8 @@ public: static bool isVec3fType(const TypeInfoWrapper& typeInfo); static bool isVectorType(const PropertyInfo& propInfo); static bool isVectorType(const TypeInfoWrapper& typeInfo); + static bool isMatrix3x3Type(const PropertyInfo& propInfo); + static bool isMatrix3x3Type(const TypeInfoWrapper& typeInfo); #define DECLARE_PROPTYPES(primitive) \ static const TypeInfoWrapper proptype_##primitive##_bool; \ @@ -111,7 +114,8 @@ public: static const TypeInfoWrapper proptype_##primitive##_uint; \ static const TypeInfoWrapper proptype_##primitive##_double; \ static const TypeInfoWrapper proptype_##primitive##_Vec3d; \ - static const TypeInfoWrapper proptype_##primitive##_Vec3f; + static const TypeInfoWrapper proptype_##primitive##_Vec3f; \ + static const TypeInfoWrapper proptype_##primitive##_Matrix3x3d; DECLARE_PROPTYPES(Cell) DECLARE_PROPTYPES(Face) @@ -206,7 +210,9 @@ template const TypeInfoWrapper OVMPropertyModel::proptype_##prim template const TypeInfoWrapper OVMPropertyModel::proptype_##primitive##_Vec3d \ = TypeInfoWrapper(typeid(OpenVolumeMesh::primitive##PropertyT), "Vec3d"); \ template const TypeInfoWrapper OVMPropertyModel::proptype_##primitive##_Vec3f \ - = TypeInfoWrapper(typeid(OpenVolumeMesh::primitive##PropertyT), "Vec3f"); + = TypeInfoWrapper(typeid(OpenVolumeMesh::primitive##PropertyT), "Vec3f"); \ +template const TypeInfoWrapper OVMPropertyModel::proptype_##primitive##_Matrix3x3d \ + = TypeInfoWrapper(typeid(OpenVolumeMesh::primitive##PropertyT), "Matrix3x3d"); INITIALIZE_PROPTYPES(Cell) INITIALIZE_PROPTYPES(Face) diff --git a/OpenVolumeMesh/OVMPropertyModelT_impl.hh b/OpenVolumeMesh/OVMPropertyModelT_impl.hh index 41707040c61dc955b18a8600db8c3e0f6e4d597d..92bf86c16d6440df63e12c200f33390c21988a11 100644 --- a/OpenVolumeMesh/OVMPropertyModelT_impl.hh +++ b/OpenVolumeMesh/OVMPropertyModelT_impl.hh @@ -646,6 +646,23 @@ bool OVMPropertyModel::isVectorType(const TypeInfoWrapper& typeInfo) return isVec3fType(typeInfo) || isVec3dType(typeInfo); } +template +bool OVMPropertyModel::isMatrix3x3Type(const PropertyInfo& propInfo) +{ + return isMatrix3x3Type(propInfo.typeinfo()); +} + +template +bool OVMPropertyModel::isMatrix3x3Type(const TypeInfoWrapper& typeInfo) +{ + return typeInfo == proptype_Cell_Matrix3x3d || + typeInfo == proptype_Face_Matrix3x3d || + typeInfo == proptype_HalfFace_Matrix3x3d || + typeInfo == proptype_Edge_Matrix3x3d || + typeInfo == proptype_HalfEdge_Matrix3x3d || + typeInfo == proptype_Vertex_Matrix3x3d; +} + template bool OVMPropertyModel::isEntityType(const TypeInfoWrapper& typeInfo, PropertyInfo::ENTITY_FILTER entity_type) const { @@ -732,6 +749,8 @@ void OVMPropertyModel::addPropertyVisualizer(OpenVolumeMesh::BaseProperty propertyVisualizers.push_back(new OVMPropertyVisualizerDouble(mesh, objectID_, propInfo)); else if (isVectorType(propInfo)) propertyVisualizers.push_back(new OVMPropertyVisualizerVector(mesh, objectID_, propInfo)); + else if (isMatrix3x3Type(propInfo)) + propertyVisualizers.push_back(new OVMPropertyVisualizerMatrix3x3(mesh, objectID_, propInfo)); connectLogs(propertyVisualizers.back()); } @@ -936,6 +955,7 @@ supportedPropertyTypes.insert(proptype_##primitive##_uint); \ supportedPropertyTypes.insert(proptype_##primitive##_double); \ supportedPropertyTypes.insert(proptype_##primitive##_Vec3d); \ supportedPropertyTypes.insert(proptype_##primitive##_Vec3f); \ +supportedPropertyTypes.insert(proptype_##primitive##_Matrix3x3d); \ INSERT_PROPTYPES(Cell) INSERT_PROPTYPES(Face) diff --git a/OpenVolumeMesh/OVMPropertyVisualizerMatrix3x3.hh b/OpenVolumeMesh/OVMPropertyVisualizerMatrix3x3.hh new file mode 100644 index 0000000000000000000000000000000000000000..6a8f4ffd8e63b145da78228f52406f55563ca0c6 --- /dev/null +++ b/OpenVolumeMesh/OVMPropertyVisualizerMatrix3x3.hh @@ -0,0 +1,100 @@ +/*===========================================================================*\ +* * +* OpenFlipper * + * Copyright (c) 2001-2015, RWTH-Aachen University * + * Department of Computer Graphics and Multimedia * + * All rights reserved. * + * www.openflipper.org * + * * + *---------------------------------------------------------------------------* + * This file is part of OpenFlipper. * + *---------------------------------------------------------------------------* + * * + * Redistribution and use in source and binary forms, with or without * + * modification, are permitted provided that the following conditions * + * are met: * + * * + * 1. Redistributions of source code must retain the above copyright notice, * + * this list of conditions and the following disclaimer. * + * * + * 2. Redistributions in binary form must reproduce the above copyright * + * notice, this list of conditions and the following disclaimer in the * + * documentation and/or other materials provided with the distribution. * + * * + * 3. Neither the name of the copyright holder nor the names of its * + * contributors may be used to endorse or promote products derived from * + * this software without specific prior written permission. * + * * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * + * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER * + * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * +* * +\*===========================================================================*/ + + +#pragma once + +#include "OVMPropertyVisualizer.hh" + +#include +#include +#include "Nodes/BoxesNode.hh" + +#include + +#include +#include + +#include "Widgets/Matrix3x3Widget.hh" + +#include + +template +class OVMPropertyVisualizerMatrix3x3: public OVMPropertyVisualizer{ + +public: + OVMPropertyVisualizerMatrix3x3(MeshT* _mesh, int objectID, PropertyInfo _propertyInfo); + virtual ~OVMPropertyVisualizerMatrix3x3(){ clear(); } + + void clear() override; + +protected: + void duplicateProperty() override; + + + void visualizeFaceProp(bool _setDrawMode = true) override; + void visualizeEdgeProp(bool _setDrawMode = true) override; + void visualizeHalfedgeProp(bool _setDrawMode = true) override; + void visualizeVertexProp(bool _setDrawMode = true) override; + void visualizeCellProp(bool _setDrawMode = true) override; + void visualizeHalffaceProp(bool _setDrawMode = true) override; + + QString getPropertyText(unsigned int index) override; + + ACG::SceneGraph::LineNode* lineNode; + ACG::SceneGraph::BoxesNode* boxesNode; + +private: + template + void visualizeAsCrossesForEntity(Property prop, EntityIterator e_begin, EntityIterator e_end); + template + void visualizeAsBoxesForEntity(Property prop, EntityIterator e_begin, EntityIterator e_end); + template + void visualizeForEntity(EntityIterator e_begin, EntityIterator e_end); + + Matrix3x3Widget* getMatWidget() {return static_cast(PropertyVisualizer::widget);} + +}; + +#if defined(INCLUDE_TEMPLATES) && !defined(OVM_PROPERTY_VISUALIZER_MAT3X3_CC) +#include "OVMPropertyVisualizerMatrix3x3_impl.hh" +#endif + diff --git a/OpenVolumeMesh/OVMPropertyVisualizerMatrix3x3_impl.hh b/OpenVolumeMesh/OVMPropertyVisualizerMatrix3x3_impl.hh new file mode 100644 index 0000000000000000000000000000000000000000..9be571a40112f4bbc11838823076704f9d15901a --- /dev/null +++ b/OpenVolumeMesh/OVMPropertyVisualizerMatrix3x3_impl.hh @@ -0,0 +1,201 @@ +/*===========================================================================*\ +* * +* OpenFlipper * + * Copyright (c) 2001-2015, RWTH-Aachen University * + * Department of Computer Graphics and Multimedia * + * All rights reserved. * + * www.openflipper.org * + * * + *---------------------------------------------------------------------------* + * This file is part of OpenFlipper. * + *---------------------------------------------------------------------------* + * * + * Redistribution and use in source and binary forms, with or without * + * modification, are permitted provided that the following conditions * + * are met: * + * * + * 1. Redistributions of source code must retain the above copyright notice, * + * this list of conditions and the following disclaimer. * + * * + * 2. Redistributions in binary form must reproduce the above copyright * + * notice, this list of conditions and the following disclaimer in the * + * documentation and/or other materials provided with the distribution. * + * * + * 3. Neither the name of the copyright holder nor the names of its * + * contributors may be used to endorse or promote products derived from * + * this software without specific prior written permission. * + * * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * + * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER * + * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * +* * +\*===========================================================================*/ + + + + +#define OVM_PROPERTY_VISUALIZER_MAT3X3_CC + +#include +#include "OVMPropertyVisualizerMatrix3x3.hh" +#include "ACG/Scenegraph/DrawModes.hh" +#include "EntityPosition.hh" + +using Color4f = ACG::SceneGraph::LineNode::Color4f; +static std::array dim_color { + Color4f{1.f,0.f,0.f,1.f}, + Color4f{0.f,1.f,0.f,1.f}, + Color4f{0.f,0.f,1.f,1.f} +}; + +template +OVMPropertyVisualizerMatrix3x3::OVMPropertyVisualizerMatrix3x3(MeshT* _mesh, int objectID, PropertyInfo _propertyInfo) + : OVMPropertyVisualizer(_mesh, objectID, _propertyInfo) +{ + if (PropertyVisualizer::widget) delete PropertyVisualizer::widget; + Matrix3x3Widget* w = new Matrix3x3Widget(); + PropertyVisualizer::widget = w; + + BaseObjectData *bod; + PluginFunctions::getObject(objectID, bod); + + boxesNode = new ACG::SceneGraph::BoxesNode(bod->manipulatorNode()); + + lineNode = new ACG::SceneGraph::LineNode(ACG::SceneGraph::LineNode::LineSegmentsMode, bod->manipulatorNode()); + this->connect(w->lineWidth, QOverload::of(&QDoubleSpinBox::valueChanged), + [this](double value) {lineNode->set_line_width(value);}); +} + +template +void OVMPropertyVisualizerMatrix3x3::clear() +{ + lineNode->clear(); + boxesNode->clear(); + OVMPropertyVisualizer::clear(); +} + +template +void OVMPropertyVisualizerMatrix3x3::duplicateProperty() +{ + OVMPropertyVisualizer::template duplicateProperty_stage1(); +} + +template +template +void OVMPropertyVisualizerMatrix3x3:: +visualizeAsCrossesForEntity(Property prop, EntityIterator e_begin, EntityIterator e_end) +{ + using ACG::Vec3d; + using ACG::Matrix3x3d; + + MeshT &m = *OVMPropertyVisualizer::mesh; + EntityPosition ep{m}; + + + double scaleFactor = getMatWidget()->getScaleFactor(); + + for (EntityIterator e_it = e_begin; e_it != e_end; ++e_it) { + Matrix3x3d mat = prop[*e_it]; + Vec3d center_pos = ep(*e_it); + for (unsigned char dim = 0; dim < 3; ++dim) { + ACG::Vec3d v = mat.getCol(dim) * scaleFactor; + lineNode->add_line(center_pos - v, center_pos + v); + lineNode->add_color(dim_color[dim]); + } + } +} + +template +template +void OVMPropertyVisualizerMatrix3x3:: +visualizeAsBoxesForEntity(Property prop, EntityIterator e_begin, EntityIterator e_end) +{ + using ACG::Vec3d; + using ACG::Matrix3x3d; + MeshT &m = *OVMPropertyVisualizer::mesh; + EntityPosition ep{m}; + + + for (EntityIterator e_it = e_begin; e_it != e_end; ++e_it) { + const Matrix3x3d &mat = prop[*e_it]; + Vec3d center_pos = ep(*e_it); + boxesNode->push_back({mat, center_pos}); + } + boxesNode->setScaleFactor(getMatWidget()->getScaleFactor()); +} + +template +template +void OVMPropertyVisualizerMatrix3x3:: +visualizeForEntity(EntityIterator e_begin, EntityIterator e_end) +{ + clear(); + MeshT &m = * OVMPropertyVisualizer::mesh; + auto prop = m.template request_property(OVMPropertyVisualizer::propertyInfo.propName()); + if (!prop) + throw VizException("Getting PropHandle from mesh for selected property failed."); + + if (getMatWidget()->as_crosses->isChecked()) { + visualizeAsCrossesForEntity(prop, e_begin, e_end); + } else if (getMatWidget()->as_boxes->isChecked()) { + visualizeAsBoxesForEntity(prop, e_begin, e_end); + } +} + +template +void OVMPropertyVisualizerMatrix3x3::visualizeCellProp(bool /*_setDrawMode*/) +{ + MeshT &m = * OVMPropertyVisualizer::mesh; + visualizeForEntity(m.cells_begin(), m.cells_end()); +} + +template +void OVMPropertyVisualizerMatrix3x3::visualizeFaceProp(bool /*_setDrawMode*/) +{ + MeshT &m = * OVMPropertyVisualizer::mesh; + visualizeForEntity(m.faces_begin(), m.faces_end()); +} + + +template +void OVMPropertyVisualizerMatrix3x3::visualizeHalffaceProp(bool /*_setDrawMode*/) +{ + MeshT &m = * OVMPropertyVisualizer::mesh; + visualizeForEntity(m.halffaces_begin(), m.halffaces_end()); +} + +template +void OVMPropertyVisualizerMatrix3x3::visualizeEdgeProp(bool /*_setDrawMode*/) +{ + MeshT &m = * OVMPropertyVisualizer::mesh; + visualizeForEntity(m.edges_begin(), m.edges_end()); +} + +template +void OVMPropertyVisualizerMatrix3x3::visualizeHalfedgeProp(bool /*_setDrawMode*/) +{ + MeshT &m = * OVMPropertyVisualizer::mesh; + visualizeForEntity(m.halfedges_begin(), m.halfedges_end()); +} + +template +void OVMPropertyVisualizerMatrix3x3::visualizeVertexProp(bool /*_setDrawMode*/) +{ + MeshT &m = * OVMPropertyVisualizer::mesh; + visualizeForEntity(m.vertices_begin(), m.vertices_end()); +} + +template +QString OVMPropertyVisualizerMatrix3x3::getPropertyText(unsigned int index) +{ + return OVMPropertyVisualizer::template getPropertyText_(index); +} + diff --git a/OpenVolumeMesh/OVMPropertyVisualizerVectorT_impl.hh b/OpenVolumeMesh/OVMPropertyVisualizerVectorT_impl.hh index b9fb578c5afc3176ec95d3a1c56a9d0842d0b8cd..3390595e0cb698e89a987558e418fa7e7d1ffda8 100644 --- a/OpenVolumeMesh/OVMPropertyVisualizerVectorT_impl.hh +++ b/OpenVolumeMesh/OVMPropertyVisualizerVectorT_impl.hh @@ -59,7 +59,7 @@ OVMPropertyVisualizerVector::OVMPropertyVisualizerVector(MeshT* _mesh, in BaseObjectData *bod; PluginFunctions::getObject(objectID, bod); - lineNode = new ACG::SceneGraph::LineNode(ACG::SceneGraph::LineNode::LineSegmentsMode, bod->baseNode()); + lineNode = new ACG::SceneGraph::LineNode(ACG::SceneGraph::LineNode::LineSegmentsMode, bod->manipulatorNode()); w->vectors_edges_rb->hide(); this->connect(w->lineWidth, QOverload::of(&QDoubleSpinBox::valueChanged), [this](double value) {lineNode->set_line_width(value);}); diff --git a/PropertyVisualizer/PropertyVisualizer.cc b/PropertyVisualizer/PropertyVisualizer.cc index 956b53a7705a14abdf1421b7489fc2f3b785bef8..6a43dbc3da4ccc8bdee09b3c0195e70cf9c7cb60 100644 --- a/PropertyVisualizer/PropertyVisualizer.cc +++ b/PropertyVisualizer/PropertyVisualizer.cc @@ -42,6 +42,7 @@ #include "PropertyVisualizer.hh" +#include "ACG/Math/Matrix3x3T.hh" /*! \brief Visualizes the property * @@ -107,6 +108,14 @@ QString PropertyVisualizer::toStr(OpenMesh::Vec2f v) return QObject::tr("∥(%1, %2)∥ = %3").arg(v[0]).arg(v[1]).arg(v.norm()); } +QString PropertyVisualizer::toStr(const ACG::Matrix3x3d &v) +{ + return QString("(%1, %2, %3); (%4, %5, %6); (%7, %8, %9) ") + .arg(v(0, 0)).arg(v(0, 1)).arg(v(0, 2)) + .arg(v(1, 0)).arg(v(1, 1)).arg(v(1, 2)) + .arg(v(2, 0)).arg(v(2, 1)).arg(v(2, 2)); +} + #ifdef ENABLE_SKELETON_SUPPORT QString PropertyVisualizer::toStr(BaseSkin::SkinWeights sw) { diff --git a/PropertyVisualizer/PropertyVisualizer.hh b/PropertyVisualizer/PropertyVisualizer.hh index 119933136c8abd3c9822e119558d3539ee71be72..d8a0d0fbb9c2c780af4e74cdae05e2dfa9281624 100644 --- a/PropertyVisualizer/PropertyVisualizer.hh +++ b/PropertyVisualizer/PropertyVisualizer.hh @@ -161,6 +161,7 @@ public: static QString toStr(OpenMesh::Vec3d v); static QString toStr(OpenMesh::Vec2d v); static QString toStr(OpenMesh::Vec2f v); + static QString toStr(const ACG::Matrix3x3d &v); #ifdef ENABLE_SKELETON_SUPPORT static QString toStr(BaseSkin::SkinWeights sw); #endif diff --git a/Shaders/BoxesNode/vert.glsl b/Shaders/BoxesNode/vert.glsl new file mode 100644 index 0000000000000000000000000000000000000000..266632f8790ee1fa9f6d74f4bb7d32b38dfdde87 --- /dev/null +++ b/Shaders/BoxesNode/vert.glsl @@ -0,0 +1,38 @@ +#version 140 + +in vec3 inst_v0; +in vec3 inst_v1; +in vec3 inst_v2; +in vec3 inst_pos; + +uniform float scale; + +void main() +{ + SG_VERTEX_BEGIN; + + vec4 pa_posOS = SG_INPUT_POSOS; + + vec4 pa_posWS; + pa_posWS.x = dot(inst_v0, pa_posOS.xyz); + pa_posWS.y = dot(inst_v1, pa_posOS.xyz); + pa_posWS.z = dot(inst_v2, pa_posOS.xyz); + pa_posWS.w = 1.0; + pa_posWS.xyz *= scale; + pa_posWS.xyz += inst_pos; + + +#ifdef SG_INPUT_NORMALOS + sg_vNormalVS.x = dot(pa_worldTransform0.xyz, SG_INPUT_NORMALOS.xyz); + sg_vNormalVS.y = dot(pa_worldTransform1.xyz, SG_INPUT_NORMALOS.xyz); + sg_vNormalVS.z = dot(pa_worldTransform2.xyz, SG_INPUT_NORMALOS.xyz); + + sg_vNormalVS = g_mWVIT * sg_vNormalVS; + sg_vNormalVS = normalize(sg_vNormalVS); +#endif + + sg_vPosVS = g_mWV * pa_posWS; + sg_vPosPS = g_mWVP * pa_posWS; + + SG_VERTEX_END; +} diff --git a/Widgets/BooleanWidget.hh b/Widgets/BooleanWidget.hh index d52a606664ae717c03969a1f74ff318e01eae88c..b7a41fef98c8b8e3821dc2f9c249c0c214aa4517 100644 --- a/Widgets/BooleanWidget.hh +++ b/Widgets/BooleanWidget.hh @@ -48,7 +48,7 @@ class BooleanWidget : public QWidget, public Ui::BooleanWidget Q_OBJECT public: - explicit BooleanWidget(QWidget * parent = 0); + explicit BooleanWidget(QWidget * parent = nullptr); signals: void widgetShown(); diff --git a/Widgets/DoubleWidget.hh b/Widgets/DoubleWidget.hh index 215db3bdb5d53978b98bbaab2777d2ba07df31df..0d19fdaf01c7f56814b52d08de4f32c6ee368a5b 100644 --- a/Widgets/DoubleWidget.hh +++ b/Widgets/DoubleWidget.hh @@ -51,7 +51,7 @@ class DoubleWidget : public QWidget, public Ui::DoubleWidget Q_OBJECT public: - explicit DoubleWidget(QWidget * parent = 0); + explicit DoubleWidget(QWidget * parent = nullptr); /** * @brief Builds a color coder according to UI settings diff --git a/Widgets/IntegerWidget.hh b/Widgets/IntegerWidget.hh index eccddb01141a08e566afcb74ed65e2717c7ca202..7696bd2819ed5326e926ba97ec6e80bdd3c09deb 100644 --- a/Widgets/IntegerWidget.hh +++ b/Widgets/IntegerWidget.hh @@ -53,7 +53,7 @@ class IntegerWidget : public QWidget, public Ui::IntegerWidget Q_OBJECT public: - explicit IntegerWidget(QWidget * parent = 0); + explicit IntegerWidget(QWidget * parent = nullptr); /** * @brief Builds a color coder according to UI settings diff --git a/Widgets/LoadSaveWidget.hh b/Widgets/LoadSaveWidget.hh index 16079794df872f02936497eecfd03a1d1f2e9b89..2e02707105c7125457437b2a4fb3c5449927b904 100644 --- a/Widgets/LoadSaveWidget.hh +++ b/Widgets/LoadSaveWidget.hh @@ -47,7 +47,7 @@ class LoadSaveWidget : public QWidget, public Ui::LoadSaveWidget Q_OBJECT public: - explicit LoadSaveWidget(QWidget * parent = 0); + explicit LoadSaveWidget(QWidget * parent = nullptr); signals: void widgetShown(); diff --git a/Widgets/Matrix3x3Widget.cc b/Widgets/Matrix3x3Widget.cc new file mode 100644 index 0000000000000000000000000000000000000000..8b207e71c6d21d7d54d0c0bf8650f36fba091524 --- /dev/null +++ b/Widgets/Matrix3x3Widget.cc @@ -0,0 +1,60 @@ +/*===========================================================================*\ +* * +* OpenFlipper * + * Copyright (c) 2001-2015, RWTH-Aachen University * + * Department of Computer Graphics and Multimedia * + * All rights reserved. * + * www.openflipper.org * + * * + *---------------------------------------------------------------------------* + * This file is part of OpenFlipper. * + *---------------------------------------------------------------------------* + * * + * Redistribution and use in source and binary forms, with or without * + * modification, are permitted provided that the following conditions * + * are met: * + * * + * 1. Redistributions of source code must retain the above copyright notice, * + * this list of conditions and the following disclaimer. * + * * + * 2. Redistributions in binary form must reproduce the above copyright * + * notice, this list of conditions and the following disclaimer in the * + * documentation and/or other materials provided with the distribution. * + * * + * 3. Neither the name of the copyright holder nor the names of its * + * contributors may be used to endorse or promote products derived from * + * this software without specific prior written permission. * + * * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * + * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER * + * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * +* * +\*===========================================================================*/ + + +#include "Matrix3x3Widget.hh" + +#include "ACG/Utils/ColorCoder.hh" +#include "ACG/Utils/LinearTwoColorCoder.hh" +#include + +Matrix3x3Widget::Matrix3x3Widget(QWidget * parent) +: QWidget(parent) +{ + setupUi(this); +} + +void Matrix3x3Widget::showEvent ( QShowEvent* /*event*/ ) { + emit widgetShown(); +} + + + diff --git a/Widgets/Matrix3x3Widget.hh b/Widgets/Matrix3x3Widget.hh new file mode 100644 index 0000000000000000000000000000000000000000..6d995550dc969d39588c858d2fb5e8ca0bbaa0d5 --- /dev/null +++ b/Widgets/Matrix3x3Widget.hh @@ -0,0 +1,67 @@ +/*===========================================================================*\ +* * +* OpenFlipper * + * Copyright (c) 2001-2015, RWTH-Aachen University * + * Department of Computer Graphics and Multimedia * + * All rights reserved. * + * www.openflipper.org * + * * + *---------------------------------------------------------------------------* + * This file is part of OpenFlipper. * + *---------------------------------------------------------------------------* + * * + * Redistribution and use in source and binary forms, with or without * + * modification, are permitted provided that the following conditions * + * are met: * + * * + * 1. Redistributions of source code must retain the above copyright notice, * + * this list of conditions and the following disclaimer. * + * * + * 2. Redistributions in binary form must reproduce the above copyright * + * notice, this list of conditions and the following disclaimer in the * + * documentation and/or other materials provided with the distribution. * + * * + * 3. Neither the name of the copyright holder nor the names of its * + * contributors may be used to endorse or promote products derived from * + * this software without specific prior written permission. * + * * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * + * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER * + * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * +* * +\*===========================================================================*/ + + + +#pragma once + +#include "ui_Matrix3x3Widget.h" + +#include "ACG/Utils/IColorCoder.hh" +#include + +class Matrix3x3Widget : public QWidget, public Ui::Mat3x3Widget +{ + Q_OBJECT + +public: + explicit Matrix3x3Widget(QWidget * parent = nullptr); + + double getScaleFactor() { return scale->isChecked() ? scaleBox->value() : 1.0; } + +signals: + void widgetShown(); + +protected: + void showEvent ( QShowEvent* /*event*/ ); +}; + + diff --git a/Widgets/Matrix3x3Widget.ui b/Widgets/Matrix3x3Widget.ui new file mode 100644 index 0000000000000000000000000000000000000000..e7309dff1afa2b52b10a1fa85986ba48496d865e --- /dev/null +++ b/Widgets/Matrix3x3Widget.ui @@ -0,0 +1,314 @@ + + + Mat3x3Widget + + + + 0 + 0 + 352 + 270 + + + + Property Visualization + + + Vectors are normalized and then transformed to the [0,1] range + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + 3x3 Matrix Parameters + + + + + + false + + + false + + + + 0 + + + 0 + + + 0 + + + + + + 0 + 0 + + + + α = + + + 4 + + + 1.000000000000000 + + + 0.100000000000000 + + + 0.400000000000000 + + + + + + + + + + + + + + + 0 + 0 + + + + β = + + + 4 + + + 1.000000000000000 + + + 0.100000000000000 + + + 0.600000000000000 + + + + + + + + + + Show transformation on: + + + + + + + + + Crosses + + + true + + + vector_buttonGroup + + + + + + + Boxes + + + vector_buttonGroup + + + + + + + + + + 0 + + + 0 + + + 0 + + + + + + + 0.100000000000000 + + + 50.000000000000000 + + + 3.000000000000000 + + + + + + + Line width + + + + + + + Scale with factor + + + true + + + false + + + + + + + true + + + 7 + + + 1000.000000000000000 + + + 0.050000000000000 + + + + + + + + + + + + true + + + false + + + <html><head/><body><p>Vectors are first normalized and then scaled to the [0,1] range</p></body></html> + + + Normalize + + + + + + + + + + Qt::Vertical + + + + 0 + 0 + + + + + + + + as_crosses + as_boxes + scale + scaleBox + vectors_edges_alpha + vectors_edges_beta + + + + + scale + toggled(bool) + scaleBox + setEnabled(bool) + + + 172 + 142 + + + 324 + 145 + + + + + as_crosses + toggled(bool) + lineWidth + setEnabled(bool) + + + 93 + 62 + + + 260 + 147 + + + + + as_crosses + toggled(bool) + lineWidthLabel + setEnabled(bool) + + + 93 + 62 + + + 100 + 147 + + + + + + + + diff --git a/Widgets/PickWidget.hh b/Widgets/PickWidget.hh index 8b3ffe7fa344118d0e22e747122fbb39dc22ab8e..cf4299a413af52616f36db1b6da28033bb42d0ba 100644 --- a/Widgets/PickWidget.hh +++ b/Widgets/PickWidget.hh @@ -48,7 +48,7 @@ class PickWidget : public QWidget, public Ui::PickWidget Q_OBJECT public: - explicit PickWidget(QWidget * parent = 0); + explicit PickWidget(QWidget * parent = nullptr); signals: void widgetShown(); diff --git a/Widgets/SkinWeightsWidget.hh b/Widgets/SkinWeightsWidget.hh index e28be1dd6ec38a0477abdc1964798817f1f30d41..eec211a6f0d0ce5fce818f3d55b32873676e1a50 100644 --- a/Widgets/SkinWeightsWidget.hh +++ b/Widgets/SkinWeightsWidget.hh @@ -48,7 +48,7 @@ class SkinWeightsWidget : public QWidget, public Ui::SkinWeightsWidget Q_OBJECT public: - explicit SkinWeightsWidget(QWidget * parent = 0); + explicit SkinWeightsWidget(QWidget * parent = nullptr); signals: void widgetShown(); diff --git a/Widgets/VectorFieldDifferenceWidget.hh b/Widgets/VectorFieldDifferenceWidget.hh index ce4eb09d15abaa907a9767667b1dca9f00e4e2f2..e5cdd66d3719b02dc3c940006057df28224963f2 100644 --- a/Widgets/VectorFieldDifferenceWidget.hh +++ b/Widgets/VectorFieldDifferenceWidget.hh @@ -48,7 +48,7 @@ class VectorFieldDifferenceWidget : public QWidget, public Ui::VectorFieldDiffer Q_OBJECT public: - explicit VectorFieldDifferenceWidget(QWidget * parent = 0); + explicit VectorFieldDifferenceWidget(QWidget * parent = nullptr); signals: void widgetShown(); diff --git a/Widgets/VectorWidget.hh b/Widgets/VectorWidget.hh index 66d56a2b9eb63277c40d6c187b802075b9a3a47a..8ad03d54ce7a889034f76bfa8ac217460a0164ed 100644 --- a/Widgets/VectorWidget.hh +++ b/Widgets/VectorWidget.hh @@ -48,7 +48,7 @@ class VectorWidget : public QWidget, public Ui::VectorWidget Q_OBJECT public: - explicit VectorWidget(QWidget * parent = 0); + explicit VectorWidget(QWidget * parent = nullptr); signals: void widgetShown();