...
 
Commits (9)
......@@ -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
......
......@@ -56,42 +56,42 @@ public:
MultiObjectPropertyModel(const QStringList& res, QObject *parent = 0);
virtual ~MultiObjectPropertyModel();
virtual int rowCount(const QModelIndex & parent = QModelIndex()) const;
virtual QVariant data(const QModelIndex & index, int role = Qt::DisplayRole) const;
virtual QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
virtual int rowCount(const QModelIndex & parent = QModelIndex()) const override;
virtual QVariant data(const QModelIndex & index, int role = Qt::DisplayRole) const override;
virtual QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
/// Revisualizes visualized properties.
virtual void objectUpdated();
virtual void objectUpdated() override;
/// Visualizes the selected properties.
virtual void visualize(QModelIndexList selectedIndices, QWidgetList widgets = QWidgetList());
virtual void visualize(QModelIndexList selectedIndices, QWidgetList widgets = QWidgetList()) override;
/// Removes the selected properties.
virtual void removeProperty(QModelIndexList selectedIndices);
virtual void removeProperty(QModelIndexList selectedIndices) override;
/// Duplicates the selected properties.
virtual void duplicateProperty(QModelIndexList selectedIndices);
virtual void duplicateProperty(QModelIndexList selectedIndices) override;
/// Searches for properties and creates PropertyVisualizers.
virtual void gatherProperties();
virtual void gatherProperties() override;
/// Clears the selected property visualization.
virtual void clear(QModelIndexList selectedIndices);
virtual void clear(QModelIndexList selectedIndices) override;
/// Hides the widget.
virtual void hideWidget();
virtual void hideWidget() override;
/// Returns the widget.
virtual QWidget* getWidget();
virtual QWidget* getWidget() override;
/// Updates the widget
virtual void updateWidget(const QModelIndexList& selectedIndices);
virtual void updateWidget(const QModelIndexList& selectedIndices) override;
/// Connects the PropertyVisualizer log signals with the log slot.
virtual void connectLogs(PropertyVisualizer* propViz);
virtual void connectLogs(PropertyVisualizer* propViz) override;
/// Returns the property info for the property with the given index.
virtual PropertyInfo getPropertyInfo(const QModelIndex index) const;
virtual PropertyInfo getPropertyInfo(const QModelIndex index) const override;
private:
QWidget* createWidgetForType(const TypeInfoWrapper& info) const;
......
......@@ -45,6 +45,7 @@
#include <OpenMesh/Core/Utils/Property.hh>
#include <ACG/Math/VectorT.hh>
#include <ACG/Math/Matrix3x3T.hh>
#include <iostream>
......@@ -64,6 +65,8 @@ const PropertyNameListModel::TypeInfoWrapper PropertyNameListModel::proptype_Vec
PropertyNameListModel::TypeInfoWrapper(typeid(OpenMesh::PropertyT<ACG::Vec2d>), "Vec2d");
const PropertyNameListModel::TypeInfoWrapper PropertyNameListModel::proptype_Vec2f =
PropertyNameListModel::TypeInfoWrapper(typeid(OpenMesh::PropertyT<ACG::Vec2f>), "Vec2f");
const PropertyNameListModel::TypeInfoWrapper PropertyNameListModel::proptype_Matrix3x3d =
PropertyNameListModel::TypeInfoWrapper(typeid(OpenMesh::PropertyT<ACG::Matrix3x3d>), "Matrix3x3d");
#ifdef ENABLE_SKELETON_SUPPORT
#include <ObjectTypes/Skeleton/BaseSkin.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:
......
......@@ -84,48 +84,48 @@ private slots:
void slotLog(QString _message){ emit log(_message);}
public:
virtual void pickModeChanged(const std::string& _mode) {}
virtual void mouseEvent(QMouseEvent* _event) {}
virtual void pickModeChanged(const std::string& _mode) override {}
virtual void mouseEvent(QMouseEvent* _event) override {}
explicit SingleObjectPropertyModel(QObject *parent = 0);
virtual ~SingleObjectPropertyModel();
virtual int rowCount(const QModelIndex & parent = QModelIndex()) const;
virtual QVariant data(const QModelIndex & index, int role = Qt::DisplayRole) const;
virtual QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
virtual int rowCount(const QModelIndex & parent = QModelIndex()) const override;
virtual QVariant data(const QModelIndex & index, int role = Qt::DisplayRole) const override;
virtual QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
/// Revisualizes visualized properties.
virtual void objectUpdated();
virtual void objectUpdated() override;
/// Visualizes the selected properties.
virtual void visualize(QModelIndexList selectedIndices, QWidgetList widgets = QWidgetList());
virtual void visualize(QModelIndexList selectedIndices, QWidgetList widgets = QWidgetList()) override;
/// Removes the selected properties.
virtual void removeProperty(QModelIndexList selectedIndices);
virtual void removeProperty(QModelIndexList selectedIndices) override;
/// Duplicates the selected properties.
virtual void duplicateProperty(QModelIndexList selectedIndices);
virtual void duplicateProperty(QModelIndexList selectedIndices) override;
/// Searches for properties and creates PropertyVisualizers.
virtual void gatherProperties(){ /* implemented by subclass */ }
virtual void gatherProperties() override { /* implemented by subclass */ }
/// Clears the selected property visualization.
virtual void clear(QModelIndexList selectedIndices);
virtual void clear(QModelIndexList selectedIndices) override;
/// Hides the widget.
inline void hideWidget() { widgets->hide(); }
inline void hideWidget() override { widgets->hide(); }
/// Returns the widget.
inline QWidget* getWidget() { return widgets; }
inline QWidget* getWidget() override { return widgets; }
/// Updates the widget
virtual void updateWidget(const QModelIndexList& selectedIndices);
virtual void updateWidget(const QModelIndexList& selectedIndices) override;
/// Connects the PropertyVisualizer log signals with the log slot.
void connectLogs(PropertyVisualizer* propViz);
void connectLogs(PropertyVisualizer* propViz) override;
/// Returns the property info for the property with the given index.
virtual PropertyInfo getPropertyInfo(const QModelIndex index) const;
virtual PropertyInfo getPropertyInfo(const QModelIndex index) const override;
/// Returns a qscript object that can be used to access visualisation parameters
virtual QScriptValue getScriptObject(const QModelIndex index, QScriptContext *ctx);
......
/*===========================================================================*\
* *
* 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 <ACG/GL/acg_glew.hh>
#include "BoxesNode.hh"
#include <ACG/GL/IRenderer.hh>
namespace ACG {
namespace SceneGraph {
BoxesNode::BoxesNode(BaseNode* _parent,
std::string _name) :
MaterialNode(_parent, _name),
updateVBO_(true)
{
const std::array<Vec4f,3> 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<Vec3f, 8> 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<float> 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<float> 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<GLsizeiptr>(geom_vbo_data.size()*sizeof(float)),
geom_vbo_data.data(),
GL_STATIC_DRAW_ARB);
instance_vbo_.upload(
static_cast<GLsizeiptr>(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<GLsizei>(3 * triangles_.size()),
static_cast<GLsizei>(elem_.size()));
_renderer->addRenderObject(&ro);
}
} // namespace SceneGraph
} // namespace ACG
#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 <ACG/Scenegraph/MaterialNode.hh>
#include <ACG/Scenegraph/DrawModes.hh>
#include <ACG/GL/VertexDeclaration.hh>
#include <ACG/GL/globjects.hh>
#include <ACG/Math/Matrix3x3T.hh>
#include <vector>
#include <limits>
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>" );
~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<BoxElement> elem_;
float scaleFactor_ = 1.0f;
// geometry of a single box
std::vector<std::array<Vec3f,3>> triangles_;
std::vector<Vec4f> 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
//=============================================================================
#pragma once
#include <ACG/Math/VectorT.hh>
#include <OpenVolumeMesh/Core/Entities.hh>
#include <OpenVolumeMesh/Core/GeometryKernel.hh>
template<class MeshT>
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_;
};
......@@ -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 <typename T> const TypeInfoWrapper OVMPropertyModel<T>::proptype_##prim
template <typename T> const TypeInfoWrapper OVMPropertyModel<T>::proptype_##primitive##_Vec3d \
= TypeInfoWrapper(typeid(OpenVolumeMesh::primitive##PropertyT<ACG::Vec3d>), "Vec3d"); \
template <typename T> const TypeInfoWrapper OVMPropertyModel<T>::proptype_##primitive##_Vec3f \
= TypeInfoWrapper(typeid(OpenVolumeMesh::primitive##PropertyT<ACG::Vec3f>), "Vec3f");
= TypeInfoWrapper(typeid(OpenVolumeMesh::primitive##PropertyT<ACG::Vec3f>), "Vec3f"); \
template <typename T> const TypeInfoWrapper OVMPropertyModel<T>::proptype_##primitive##_Matrix3x3d \
= TypeInfoWrapper(typeid(OpenVolumeMesh::primitive##PropertyT<ACG::Matrix3x3d>), "Matrix3x3d");
INITIALIZE_PROPTYPES(Cell)
INITIALIZE_PROPTYPES(Face)
......
......@@ -646,6 +646,23 @@ bool OVMPropertyModel<MeshT>::isVectorType(const TypeInfoWrapper& typeInfo)
return isVec3fType(typeInfo) || isVec3dType(typeInfo);
}
template<typename MeshT>
bool OVMPropertyModel<MeshT>::isMatrix3x3Type(const PropertyInfo& propInfo)
{
return isMatrix3x3Type(propInfo.typeinfo());
}
template<typename MeshT>
bool OVMPropertyModel<MeshT>::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<typename MeshT>
bool OVMPropertyModel<MeshT>::isEntityType(const TypeInfoWrapper& typeInfo, PropertyInfo::ENTITY_FILTER entity_type) const
{
......@@ -732,6 +749,8 @@ void OVMPropertyModel<MeshT>::addPropertyVisualizer(OpenVolumeMesh::BaseProperty
propertyVisualizers.push_back(new OVMPropertyVisualizerDouble<MeshT>(mesh, objectID_, propInfo));
else if (isVectorType(propInfo))
propertyVisualizers.push_back(new OVMPropertyVisualizerVector<MeshT>(mesh, objectID_, propInfo));
else if (isMatrix3x3Type(propInfo))
propertyVisualizers.push_back(new OVMPropertyVisualizerMatrix3x3<MeshT>(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)
......
/*===========================================================================*\
* *
* 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 <ACG/Scenegraph/LineNode.hh>
#include <ACG/Scenegraph/MeshNode2T.hh>
#include "Nodes/BoxesNode.hh"
#include <OpenFlipper/BasePlugin/PluginFunctions.hh>
#include <OpenVolumeMesh/Core/BaseEntities.hh>
#include <OpenVolumeMesh/Core/BaseProperty.hh>
#include "Widgets/Matrix3x3Widget.hh"
#include <iostream>
template <typename MeshT>
class OVMPropertyVisualizerMatrix3x3: public OVMPropertyVisualizer<MeshT>{
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<typename EntityTag, typename Property, typename EntityIterator>
void visualizeAsCrossesForEntity(Property prop, EntityIterator e_begin, EntityIterator e_end);
template<typename EntityTag, typename Property, typename EntityIterator>
void visualizeAsBoxesForEntity(Property prop, EntityIterator e_begin, EntityIterator e_end);
template<typename EntityTag, typename EntityIterator>
void visualizeForEntity(EntityIterator e_begin, EntityIterator e_end);
Matrix3x3Widget* getMatWidget() {return static_cast<Matrix3x3Widget*>(PropertyVisualizer::widget);}
};
#if defined(INCLUDE_TEMPLATES) && !defined(OVM_PROPERTY_VISUALIZER_MAT3X3_CC)
#include "OVMPropertyVisualizerMatrix3x3_impl.hh"
#endif
/*===========================================================================*\
* *
* 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 <ACG/Utils/ColorConversion.hh>
#include "OVMPropertyVisualizerMatrix3x3.hh"
#include "ACG/Scenegraph/DrawModes.hh"
#include "EntityPosition.hh"
using Color4f = ACG::SceneGraph::LineNode::Color4f;
static std::array<Color4f, 3> 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 <typename MeshT>
OVMPropertyVisualizerMatrix3x3<MeshT>::OVMPropertyVisualizerMatrix3x3(MeshT* _mesh, int objectID, PropertyInfo _propertyInfo)
: OVMPropertyVisualizer<MeshT>(_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<double>::of(&QDoubleSpinBox::valueChanged),
[this](double value) {lineNode->set_line_width(value);});
}
template <typename MeshT>
void OVMPropertyVisualizerMatrix3x3<MeshT>::clear()
{
lineNode->clear();
boxesNode->clear();
OVMPropertyVisualizer<MeshT>::clear();
}
template <typename MeshT>
void OVMPropertyVisualizerMatrix3x3<MeshT>::duplicateProperty()
{
OVMPropertyVisualizer<MeshT>::template duplicateProperty_stage1<ACG::Matrix3x3d>();
}
template<typename MeshT>
template<typename EntityTag, typename Property, typename EntityIterator>
void OVMPropertyVisualizerMatrix3x3<MeshT>::
visualizeAsCrossesForEntity(Property prop, EntityIterator e_begin, EntityIterator e_end)
{
using ACG::Vec3d;
using ACG::Matrix3x3d;
MeshT &m = *OVMPropertyVisualizer<MeshT>::mesh;
EntityPosition<MeshT> 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<typename MeshT>
template<typename EntityTag, typename Property, typename EntityIterator>
void OVMPropertyVisualizerMatrix3x3<MeshT>::
visualizeAsBoxesForEntity(Property prop, EntityIterator e_begin, EntityIterator e_end)
{
using ACG::Vec3d;
using ACG::Matrix3x3d;
MeshT &m = *OVMPropertyVisualizer<MeshT>::mesh;
EntityPosition<MeshT> 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<typename MeshT>
template<typename EntityTag, typename EntityIterator>
void OVMPropertyVisualizerMatrix3x3<MeshT>::
visualizeForEntity(EntityIterator e_begin, EntityIterator e_end)
{
clear();
MeshT &m = * OVMPropertyVisualizer<MeshT>::mesh;
auto prop = m.template request_property<ACG::Matrix3x3d, EntityTag>(OVMPropertyVisualizer<MeshT>::propertyInfo.propName());
if (!prop)
throw VizException("Getting PropHandle from mesh for selected property failed.");
if (getMatWidget()->as_crosses->isChecked()) {
visualizeAsCrossesForEntity<EntityTag>(prop, e_begin, e_end);
} else if (getMatWidget()->as_boxes->isChecked()) {
visualizeAsBoxesForEntity<EntityTag>(prop, e_begin, e_end);
}
}
template <typename MeshT>
void OVMPropertyVisualizerMatrix3x3<MeshT>::visualizeCellProp(bool /*_setDrawMode*/)
{
MeshT &m = * OVMPropertyVisualizer<MeshT>::mesh;
visualizeForEntity<OpenVolumeMesh::Entity::Cell>(m.cells_begin(), m.cells_end());
}
template <typename MeshT>
void OVMPropertyVisualizerMatrix3x3<MeshT>::visualizeFaceProp(bool /*_setDrawMode*/)
{
MeshT &m = * OVMPropertyVisualizer<MeshT>::mesh;
visualizeForEntity<OpenVolumeMesh::Entity::Face>(m.faces_begin(), m.faces_end());
}
template <typename MeshT>
void OVMPropertyVisualizerMatrix3x3<MeshT>::visualizeHalffaceProp(bool /*_setDrawMode*/)
{
MeshT &m = * OVMPropertyVisualizer<MeshT>::mesh;
visualizeForEntity<OpenVolumeMesh::Entity::HalfFace>(m.halffaces_begin(), m.halffaces_end());
}
template <typename MeshT>
void OVMPropertyVisualizerMatrix3x3<MeshT>::visualizeEdgeProp(bool /*_setDrawMode*/)
{
MeshT &m = * OVMPropertyVisualizer<MeshT>::mesh;
visualizeForEntity<OpenVolumeMesh::Entity::Edge>(m.edges_begin(), m.edges_end());
}
template <typename MeshT>
void OVMPropertyVisualizerMatrix3x3<MeshT>::visualizeHalfedgeProp(bool /*_setDrawMode*/)
{
MeshT &m = * OVMPropertyVisualizer<MeshT>::mesh;
visualizeForEntity<OpenVolumeMesh::Entity::HalfEdge>(m.halfedges_begin(), m.halfedges_end());
}
template <typename MeshT>
void OVMPropertyVisualizerMatrix3x3<MeshT>::visualizeVertexProp(bool /*_setDrawMode*/)
{
MeshT &m = * OVMPropertyVisualizer<MeshT>::mesh;
visualizeForEntity<OpenVolumeMesh::Entity::Vertex>(m.vertices_begin(), m.vertices_end());
}
template <typename MeshT>
QString OVMPropertyVisualizerMatrix3x3<MeshT>::getPropertyText(unsigned int index)
{
return OVMPropertyVisualizer<MeshT>::template getPropertyText_<ACG::Matrix3x3d>(index);
}
......@@ -59,7 +59,7 @@ OVMPropertyVisualizerVector<MeshT>::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<double>::of(&QDoubleSpinBox::valueChanged),
[this](double value) {lineNode->set_line_width(value);});
......
......@@ -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)
{
......
......@@ -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
......
#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;
}
......@@ -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();
......
......@@ -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
......
......@@ -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
......
......@@ -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();
......
/*===========================================================================*\
* *
* 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 <ACG/Utils/ColorConversion.hh>
Matrix3x3Widget::Matrix3x3Widget(QWidget * parent)
: QWidget(parent)
{
setupUi(this);
}
void Matrix3x3Widget::showEvent ( QShowEvent* /*event*/ ) {
emit widgetShown();
}
/*===========================================================================*\
* *
* 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 <ACG/Utils/SmartPointer.hh>
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*/ );
};
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Mat3x3Widget</class>
<widget class="QWidget" name="Mat3x3Widget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>352</width>
<height>270</height>
</rect>
</property>
<property name="windowTitle">
<string>Property Visualization</string>
</property>
<property name="toolTip">
<string>Vectors are normalized and then transformed to the [0,1] range</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_7">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QGroupBox" name="paramVector">
<property name="title">
<string>3x3 Matrix Parameters</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QWidget" name="vector_edgeColors_widget" native="true">
<property name="enabled">
<bool>false</bool>
</property>
<property name="visible">
<bool>false</bool>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_15">
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QDoubleSpinBox" name="vectors_edges_alpha">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="prefix">
<string>α = </string>
</property>
<property name="decimals">
<number>4</number>
</property>
<property name="maximum">
<double>1.000000000000000</double>
</property>
<property name="singleStep">
<double>0.100000000000000</double>
</property>
<property name="value">
<double>0.400000000000000</double>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_4">
<property name="text">
<string></string>
</property>
</widget>
</item>
<item>
<widget class="QDoubleSpinBox" name="vectors_edges_beta">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="prefix">
<string>β = </string>
</property>
<property name="decimals">
<number>4</number>
</property>
<property name="maximum">
<double>1.000000000000000</double>
</property>
<property name="singleStep">
<double>0.100000000000000</double>
</property>
<property name="value">
<double>0.600000000000000</double>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Show transformation on:</string>
</property>
</widget>
</item>
<item>
<layout class="QGridLayout" name="gridLayout">
<item row="1" column="0">
<widget class="QRadioButton" name="as_crosses">
<property name="text">
<string>Crosses</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
<attribute name="buttonGroup">
<string notr="true">vector_buttonGroup</string>
</attribute>
</widget>
</item>
<item row="1" column="1">
<widget class="QRadioButton" name="as_boxes">
<property name="text">
<string>Boxes</string>
</property>
<attribute name="buttonGroup">
<string notr="true">vector_buttonGroup</string>
</attribute>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QWidget" name="vector_strokes_widget" native="true">
<layout class="QVBoxLayout" name="verticalLayout_11">
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<layout class="QGridLayout" name="gridLayout_2">
<item row="1" column="1">
<widget class="QDoubleSpinBox" name="lineWidth">
<property name="minimum">
<double>0.100000000000000</double>
</property>
<property name="maximum">
<double>50.000000000000000</double>
</property>
<property name="value">
<double>3.000000000000000</double>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="lineWidthLabel">
<property name="text">
<string>Line width</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QCheckBox" name="scale">
<property name="text">
<string>Scale with factor</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
<property name="tristate">
<bool>false</bool>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QDoubleSpinBox" name="scaleBox">
<property name="enabled">
<bool>true</bool>
</property>
<property name="decimals">
<number>7</number>
</property>
<property name="maximum">
<double>1000.000000000000000</double>
</property>
<property name="value">
<double>0.050000000000000</double>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QCheckBox" name="normalize_colors">
<property name="enabled">
<bool>true</bool>
</property>
<property name="visible">
<bool>false</bool>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Vectors are first normalized and then scaled to the [0,1] range&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Normalize</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<tabstops>
<tabstop>as_crosses</tabstop>
<tabstop>as_boxes</tabstop>
<tabstop>scale</tabstop>
<tabstop>scaleBox</tabstop>
<tabstop>vectors_edges_alpha</tabstop>
<tabstop>vectors_edges_beta</tabstop>
</tabstops>
<resources/>
<connections>
<connection>
<sender>scale</sender>
<signal>toggled(bool)</signal>
<receiver>scaleBox</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>172</x>
<y>142</y>
</hint>
<hint type="destinationlabel">
<x>324</x>
<y>145</y>
</hint>
</hints>
</connection>
<connection>
<sender>as_crosses</sender>
<signal>toggled(bool)</signal>
<receiver>lineWidth</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>93</x>
<y>62</y>
</hint>
<hint type="destinationlabel">
<x>260</x>
<y>147</y>
</hint>
</hints>
</connection>
<connection>
<sender>as_crosses</sender>
<signal>toggled(bool)</signal>
<receiver>lineWidthLabel</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>93</x>
<y>62</y>
</hint>
<hint type="destinationlabel">
<x>100</x>
<y>147</y>
</hint>
</hints>
</connection>
</connections>
<buttongroups>
<buttongroup name="vector_buttonGroup"/>
</buttongroups>
</ui>