Merge branch 'cpp_check' into 'master'
Cpp check See merge request OpenMesh/OpenMesh!221
This commit is contained in:
4
CI/ci-cppcheck.sh
Normal file → Executable file
4
CI/ci-cppcheck.sh
Normal file → Executable file
@@ -20,7 +20,7 @@ echo -e "${NC}"
|
|||||||
echo "Please Wait ..."
|
echo "Please Wait ..."
|
||||||
|
|
||||||
# Run cppcheck and output into file
|
# Run cppcheck and output into file
|
||||||
cppcheck --enable=all . -I src -i Doc/ --force --suppress=unusedFunction -UCTIME --suppress=missingIncludeSystem --inline-suppr --quiet -Umin -Umax -DOPENMESHDLLEXPORT="" -UPRIVATE_NODE_TYPESYSTEM_SOURCE -USO_NODE_ABSTRACT_SOURCE -USO_NODE_SOURCE -UCLOCK_REALTIME_HR -i src/OpenMesh/Apps/Unsupported/ 2>&1 | tee cppcheck.log
|
cppcheck --enable=all . -I src -i Doc/ -i src/Unittests --force --suppress=unusedFunction -UCTIME --suppress=missingIncludeSystem --inline-suppr --quiet -Umin -Umax -DOPENMESHDLLEXPORT="" -UPRIVATE_NODE_TYPESYSTEM_SOURCE -USO_NODE_ABSTRACT_SOURCE -USO_NODE_SOURCE -UCLOCK_REALTIME_HR -i src/OpenMesh/Apps/Unsupported/ 2>&1 | tee cppcheck.log
|
||||||
|
|
||||||
COUNT=$(wc -l < cppcheck.log )
|
COUNT=$(wc -l < cppcheck.log )
|
||||||
|
|
||||||
@@ -30,7 +30,7 @@ echo "CPPCHECK Summary"
|
|||||||
echo "=============================================================================="
|
echo "=============================================================================="
|
||||||
echo -e "${NC}"
|
echo -e "${NC}"
|
||||||
|
|
||||||
MAX_COUNT=0
|
MAX_COUNT=27
|
||||||
|
|
||||||
if [ $COUNT -gt $MAX_COUNT ]; then
|
if [ $COUNT -gt $MAX_COUNT ]; then
|
||||||
echo -e ${WARNING}
|
echo -e ${WARNING}
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ if ( WIN32 )
|
|||||||
list(APPEND ADDITIONAL_CMAKE_EXE_LINKER_FLAGS "/LARGEADDRESSAWARE" )
|
list(APPEND ADDITIONAL_CMAKE_EXE_LINKER_FLAGS "/LARGEADDRESSAWARE" )
|
||||||
list(APPEND ADDITIONAL_CMAKE_SHARED_LINKER_FLAGS "/LARGEADDRESSAWARE" )
|
list(APPEND ADDITIONAL_CMAKE_SHARED_LINKER_FLAGS "/LARGEADDRESSAWARE" )
|
||||||
list(APPEND ADDITIONAL_CMAKE_MODULE_LINKER_FLAGS "/LARGEADDRESSAWARE" )
|
list(APPEND ADDITIONAL_CMAKE_MODULE_LINKER_FLAGS "/LARGEADDRESSAWARE" )
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
@@ -45,10 +45,12 @@ endif( WIN32 )
|
|||||||
|
|
||||||
if (UNIX)
|
if (UNIX)
|
||||||
|
|
||||||
|
set ( ADDITIONAL_CXX_FLAGS )
|
||||||
set ( ADDITIONAL_CXX_DEBUG_FLAGS )
|
set ( ADDITIONAL_CXX_DEBUG_FLAGS )
|
||||||
set ( ADDITIONAL_CXX_RELEASE_FLAGS )
|
set ( ADDITIONAL_CXX_RELEASE_FLAGS )
|
||||||
set ( ADDITIONAL_CXX_RELWITHDEBINFO_FLAGS )
|
set ( ADDITIONAL_CXX_RELWITHDEBINFO_FLAGS )
|
||||||
|
|
||||||
|
set ( ADDITIONAL_C_FLAGS )
|
||||||
set ( ADDITIONAL_C_DEBUG_FLAGS )
|
set ( ADDITIONAL_C_DEBUG_FLAGS )
|
||||||
set ( ADDITIONAL_C_RELEASE_FLAGS )
|
set ( ADDITIONAL_C_RELEASE_FLAGS )
|
||||||
set ( ADDITIONAL_C_RELWITHDEBINFO_FLAGS )
|
set ( ADDITIONAL_C_RELWITHDEBINFO_FLAGS )
|
||||||
@@ -58,19 +60,13 @@ if (UNIX)
|
|||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
# add our standard flags for Template inclusion
|
# add our standard flags for Template inclusion
|
||||||
list(APPEND ADDITIONAL_CXX_DEBUG_FLAGS "-DINCLUDE_TEMPLATES" )
|
list(APPEND ADDITIONAL_CXX_FLAGS "-DINCLUDE_TEMPLATES" )
|
||||||
list(APPEND ADDITIONAL_CXX_RELEASE_FLAGS "-DINCLUDE_TEMPLATES" )
|
list(APPEND ADDITIONAL_C_FLAGS "-DINCLUDE_TEMPLATES" )
|
||||||
list(APPEND ADDITIONAL_CXX_RELWITHDEBINFO_FLAGS "-DINCLUDE_TEMPLATES" )
|
|
||||||
|
|
||||||
# add our standard flags for Template inclusion
|
|
||||||
list(APPEND ADDITIONAL_C_DEBUG_FLAGS "-DINCLUDE_TEMPLATES" )
|
|
||||||
list(APPEND ADDITIONAL_C_RELEASE_FLAGS "-DINCLUDE_TEMPLATES" )
|
|
||||||
list(APPEND ADDITIONAL_C_RELWITHDEBINFO_FLAGS "-DINCLUDE_TEMPLATES" )
|
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# OS Defines
|
# OS Defines
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
if (APPLE)
|
if (APPLE)
|
||||||
add_definitions( -DARCH_DARWIN )
|
add_definitions( -DARCH_DARWIN )
|
||||||
endif()
|
endif()
|
||||||
@@ -91,7 +87,7 @@ if (UNIX)
|
|||||||
################################################################################
|
################################################################################
|
||||||
# Warnings
|
# Warnings
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
# Add the standard compiler warnings
|
# Add the standard compiler warnings
|
||||||
if ( NOT COMPILER_WARNINGS )
|
if ( NOT COMPILER_WARNINGS )
|
||||||
|
|
||||||
@@ -104,18 +100,27 @@ if (UNIX)
|
|||||||
set ( COMPILER_WARNINGS "" CACHE STRINGLIST "This list contains the warning flags used during compilation " )
|
set ( COMPILER_WARNINGS "" CACHE STRINGLIST "This list contains the warning flags used during compilation " )
|
||||||
ELSE ()
|
ELSE ()
|
||||||
set ( COMPILER_WARNINGS "-W" "-Wall" "-Wno-unused" "-Wextra" "-Wno-variadic-macros" CACHE STRINGLIST "This list contains the warning flags used during compilation " )
|
set ( COMPILER_WARNINGS "-W" "-Wall" "-Wno-unused" "-Wextra" "-Wno-variadic-macros" CACHE STRINGLIST "This list contains the warning flags used during compilation " )
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
endif ( NOT COMPILER_WARNINGS )
|
endif ( NOT COMPILER_WARNINGS )
|
||||||
|
|
||||||
list(APPEND ADDITIONAL_CXX_DEBUG_FLAGS ${COMPILER_WARNINGS} )
|
list(APPEND ADDITIONAL_CXX_FLAGS ${COMPILER_WARNINGS} )
|
||||||
list(APPEND ADDITIONAL_CXX_RELEASE_FLAGS ${COMPILER_WARNINGS} )
|
list(APPEND ADDITIONAL_C_FLAGS ${COMPILER_WARNINGS} )
|
||||||
list(APPEND ADDITIONAL_CXX_RELWITHDEBINFO_FLAGS ${COMPILER_WARNINGS} )
|
|
||||||
|
|
||||||
list(APPEND ADDITIONAL_C_DEBUG_FLAGS ${COMPILER_WARNINGS} )
|
if ("${CMAKE_CXX_COMPILER}" MATCHES ".*clang.*")
|
||||||
list(APPEND ADDITIONAL_C_RELEASE_FLAGS ${COMPILER_WARNINGS} )
|
list(APPEND ADDITIONAL_CXX_FLAGS "-Weverything")
|
||||||
list(APPEND ADDITIONAL_C_RELWITHDEBINFO_FLAGS ${COMPILER_WARNINGS} )
|
list(APPEND ADDITIONAL_CXX_FLAGS "-Wno-c++98-compat")
|
||||||
|
list(APPEND ADDITIONAL_CXX_FLAGS "-Wno-padded")
|
||||||
|
list(APPEND ADDITIONAL_CXX_FLAGS "-Wno-old-style-cast")
|
||||||
|
list(APPEND ADDITIONAL_CXX_FLAGS "-Wno-documentation-unknown-command")
|
||||||
|
list(APPEND ADDITIONAL_CXX_FLAGS "-Wno-unreachable-code-return")
|
||||||
|
# enable later:
|
||||||
|
list(APPEND ADDITIONAL_CXX_FLAGS "-Wno-sign-conversion")
|
||||||
|
list(APPEND ADDITIONAL_CXX_FLAGS "-Wno-deprecated")
|
||||||
|
list(APPEND ADDITIONAL_CXX_FLAGS "-Wno-weak-vtables")
|
||||||
|
endif()
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# STL Vector checks
|
# STL Vector checks
|
||||||
################################################################################
|
################################################################################
|
||||||
@@ -147,43 +152,49 @@ if (UNIX)
|
|||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
# Add the debug flags
|
# Add the debug flags
|
||||||
foreach( flag ${ADDITIONAL_CXX_DEBUG_FLAGS} )
|
foreach( flag ${ADDITIONAL_CXX_FLAGS} ${ADDITIONAL_CXX_DEBUG_FLAGS} )
|
||||||
if( NOT CMAKE_CXX_FLAGS_DEBUG MATCHES "${flag}" )
|
list (FIND ${CMAKE_CXX_FLAGS_DEBUG} ${flag} _index)
|
||||||
|
if (${_index} EQUAL -1)
|
||||||
set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${flag} ")
|
set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${flag} ")
|
||||||
endif()
|
endif()
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
# Add the release flags
|
# Add the release flags
|
||||||
foreach( flag ${ADDITIONAL_CXX_RELEASE_FLAGS} )
|
foreach( flag ${ADDITIONAL_CXX_FLAGS} ${ADDITIONAL_CXX_RELEASE_FLAGS} )
|
||||||
if( NOT CMAKE_CXX_FLAGS_RELEASE MATCHES "${flag}" )
|
list (FIND ${CMAKE_CXX_FLAGS_RELEASE} ${flag} _index)
|
||||||
|
if (${_index} EQUAL -1)
|
||||||
set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${flag} ")
|
set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${flag} ")
|
||||||
endif()
|
endif()
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
# Add the release with debug info flags
|
# Add the release with debug info flags
|
||||||
foreach( flag ${ADDITIONAL_CXX_RELWITHDEBINFO_FLAGS} )
|
foreach( flag ${ADDITIONAL_CXX_FLAGS} ${ADDITIONAL_CXX_RELWITHDEBINFO_FLAGS} )
|
||||||
if( NOT CMAKE_CXX_FLAGS_RELWITHDEBINFO MATCHES "${flag}" )
|
list (FIND ${CMAKE_CXX_FLAGS_RELWITHDEBINFO} ${flag} _index)
|
||||||
|
if (${_index} EQUAL -1)
|
||||||
set( CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} ${flag} ")
|
set( CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} ${flag} ")
|
||||||
endif()
|
endif()
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
# Add the debug flags
|
# Add the debug flags
|
||||||
foreach( flag ${ADDITIONAL_C_DEBUG_FLAGS} )
|
foreach( flag ${ADDITIONAL_C_FLAGS} ${ADDITIONAL_C_DEBUG_FLAGS} )
|
||||||
if( NOT CMAKE_C_FLAGS_DEBUG MATCHES "${flag}" )
|
list (FIND ${CMAKE_C_FLAGS_DEBUG} ${flag} _index)
|
||||||
|
if (${_index} EQUAL -1)
|
||||||
set( CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} ${flag} ")
|
set( CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} ${flag} ")
|
||||||
endif()
|
endif()
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
# Add the release flags
|
# Add the release flags
|
||||||
foreach( flag ${ADDITIONAL_C_RELEASE_FLAGS} )
|
foreach( flag ${ADDITIONAL_C_FLAGS} ${ADDITIONAL_C_RELEASE_FLAGS} )
|
||||||
if( NOT CMAKE_C_FLAGS_RELEASE MATCHES "${flag}" )
|
list (FIND ${CMAKE_C_FLAGS_RELEASE} ${flag} _index)
|
||||||
|
if (${_index} EQUAL -1)
|
||||||
set( CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} ${flag} ")
|
set( CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} ${flag} ")
|
||||||
endif()
|
endif()
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
# Add the release with debug info flags
|
# Add the release with debug info flags
|
||||||
foreach( flag ${ADDITIONAL_C_RELWITHDEBINFO_FLAGS} )
|
foreach( flag ${ADDITIONAL_C_FLAGS} ${ADDITIONAL_C_RELWITHDEBINFO_FLAGS} )
|
||||||
if( NOT CMAKE_C_FLAGS_RELWITHDEBINFO MATCHES "${flag}" )
|
list (FIND ${CMAKE_C_FLAGS_RELWITHDEBINFO} ${flag} _index)
|
||||||
|
if (${_index} EQUAL -1)
|
||||||
set( CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} ${flag} ")
|
set( CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} ${flag} ")
|
||||||
endif()
|
endif()
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|||||||
@@ -144,7 +144,7 @@ public:
|
|||||||
|
|
||||||
public: // inherited
|
public: // inherited
|
||||||
|
|
||||||
bool open_mesh(const char* _filename, OpenMesh::IO::Options _opt)
|
bool open_mesh(const char* _filename, OpenMesh::IO::Options _opt) override
|
||||||
{
|
{
|
||||||
bool rc;
|
bool rc;
|
||||||
|
|
||||||
@@ -170,7 +170,7 @@ protected slots:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
virtual void keyPressEvent(QKeyEvent* _event);
|
virtual void keyPressEvent(QKeyEvent* _event) override;
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -216,7 +216,7 @@ decimate(const std::string &_ifname,
|
|||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
Mesh mesh;
|
Mesh mesh;
|
||||||
OpenMesh::IO::Options opt;
|
OpenMesh::IO::Options readopt;
|
||||||
OpenMesh::Utils::Timer timer;
|
OpenMesh::Utils::Timer timer;
|
||||||
|
|
||||||
// ---------------------------------------- read source mesh
|
// ---------------------------------------- read source mesh
|
||||||
@@ -227,7 +227,7 @@ decimate(const std::string &_ifname,
|
|||||||
|
|
||||||
if (gverbose)
|
if (gverbose)
|
||||||
clog << _ifname << endl;
|
clog << _ifname << endl;
|
||||||
if ( !(rc = OpenMesh::IO::read_mesh(mesh, _ifname, opt)) )
|
if ( !(rc = OpenMesh::IO::read_mesh(mesh, _ifname, readopt)) )
|
||||||
{
|
{
|
||||||
cerr << " ERROR: read failed!" << endl;
|
cerr << " ERROR: read failed!" << endl;
|
||||||
return rc;
|
return rc;
|
||||||
@@ -238,7 +238,7 @@ decimate(const std::string &_ifname,
|
|||||||
{
|
{
|
||||||
// ---- 0 - For module NormalFlipping one needs face normals
|
// ---- 0 - For module NormalFlipping one needs face normals
|
||||||
|
|
||||||
if ( !opt.check( OpenMesh::IO::Options::FaceNormal ) )
|
if ( !readopt.check( OpenMesh::IO::Options::FaceNormal ) )
|
||||||
{
|
{
|
||||||
if ( !mesh.has_face_normals() )
|
if ( !mesh.has_face_normals() )
|
||||||
mesh.request_face_normals();
|
mesh.request_face_normals();
|
||||||
@@ -420,11 +420,11 @@ decimate(const std::string &_ifname,
|
|||||||
ofname.insert(++pos, n );
|
ofname.insert(++pos, n );
|
||||||
}
|
}
|
||||||
|
|
||||||
OpenMesh::IO::Options opt;
|
OpenMesh::IO::Options writeopt;
|
||||||
|
|
||||||
//opt += OpenMesh::IO::Options::Binary;
|
//opt += OpenMesh::IO::Options::Binary;
|
||||||
|
|
||||||
if ( !OpenMesh::IO::write_mesh(mesh, ofname, opt ) )
|
if ( !OpenMesh::IO::write_mesh(mesh, ofname, writeopt ) )
|
||||||
{
|
{
|
||||||
std::cerr << " Cannot write decimated mesh to file '"
|
std::cerr << " Cannot write decimated mesh to file '"
|
||||||
<< ofname << "'\n";
|
<< ofname << "'\n";
|
||||||
|
|||||||
@@ -94,8 +94,12 @@ public:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
/// default constructor
|
/// default constructor
|
||||||
ProgViewerWidget(QWidget* _parent=0)
|
explicit ProgViewerWidget(QWidget* _parent=0)
|
||||||
: MeshViewerWidget(_parent)
|
: MeshViewerWidget(_parent),
|
||||||
|
n_base_vertices_(0),
|
||||||
|
n_base_faces_(0),
|
||||||
|
n_detail_vertices_(0),
|
||||||
|
n_max_vertices_(0)
|
||||||
{
|
{
|
||||||
timer_ = new QTimer(this);
|
timer_ = new QTimer(this);
|
||||||
|
|
||||||
@@ -133,7 +137,7 @@ private:
|
|||||||
/// coarsen mesh down to _n vertices
|
/// coarsen mesh down to _n vertices
|
||||||
void coarsen(unsigned int _n);
|
void coarsen(unsigned int _n);
|
||||||
|
|
||||||
virtual void keyPressEvent(QKeyEvent* _event);
|
virtual void keyPressEvent(QKeyEvent* _event) override;
|
||||||
|
|
||||||
// mesh data
|
// mesh data
|
||||||
bool animateRefinement_;
|
bool animateRefinement_;
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ public:
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
/// default constructor
|
/// default constructor
|
||||||
MeshViewerWidgetT(QWidget* _parent=0)
|
explicit MeshViewerWidgetT(QWidget* _parent=0)
|
||||||
: QGLViewerWidget(_parent),
|
: QGLViewerWidget(_parent),
|
||||||
f_strips_(false),
|
f_strips_(false),
|
||||||
tex_id_(0),
|
tex_id_(0),
|
||||||
@@ -85,7 +85,8 @@ public:
|
|||||||
strips_(mesh_),
|
strips_(mesh_),
|
||||||
use_color_(true),
|
use_color_(true),
|
||||||
show_vnormals_(false),
|
show_vnormals_(false),
|
||||||
show_fnormals_(false)
|
show_fnormals_(false),
|
||||||
|
normal_scale_(1.0)
|
||||||
{
|
{
|
||||||
add_draw_mode("Points");
|
add_draw_mode("Points");
|
||||||
add_draw_mode("Hidden-Line");
|
add_draw_mode("Hidden-Line");
|
||||||
@@ -116,7 +117,7 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
|
|
||||||
/// inherited drawing method
|
/// inherited drawing method
|
||||||
virtual void draw_scene(const std::string& _draw_mode);
|
virtual void draw_scene(const std::string& _draw_mode) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
@@ -170,7 +171,7 @@ protected: // Strip support
|
|||||||
|
|
||||||
protected: // inherited
|
protected: // inherited
|
||||||
|
|
||||||
virtual void keyPressEvent( QKeyEvent* _event);
|
virtual void keyPressEvent( QKeyEvent* _event) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ public:
|
|||||||
typedef QGLWidget Super;
|
typedef QGLWidget Super;
|
||||||
|
|
||||||
// Default constructor.
|
// Default constructor.
|
||||||
QGLViewerWidget( QWidget* _parent=0 );
|
explicit QGLViewerWidget( QWidget* _parent=0 );
|
||||||
|
|
||||||
//
|
//
|
||||||
QGLViewerWidget( QGLFormat& _fmt, QWidget* _parent=0 );
|
QGLViewerWidget( QGLFormat& _fmt, QWidget* _parent=0 );
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ public:
|
|||||||
typedef MeshViewerWidgetT<Mesh> Base;
|
typedef MeshViewerWidgetT<Mesh> Base;
|
||||||
|
|
||||||
/// default constructor
|
/// default constructor
|
||||||
MeshViewerWidget(QWidget* _parent=0)
|
explicit MeshViewerWidget(QWidget* _parent=0)
|
||||||
: Base(_parent)
|
: Base(_parent)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
@@ -80,7 +80,7 @@ public:
|
|||||||
~MeshViewerWidget() {}
|
~MeshViewerWidget() {}
|
||||||
|
|
||||||
/// open mesh
|
/// open mesh
|
||||||
inline bool open_mesh(const char* _filename, OpenMesh::IO::Options _opt)
|
inline bool open_mesh(const char* _filename, OpenMesh::IO::Options _opt) override
|
||||||
{
|
{
|
||||||
if ( Base::open_mesh( _filename, _opt ) )
|
if ( Base::open_mesh( _filename, _opt ) )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -78,7 +78,14 @@ namespace OpenMesh {
|
|||||||
//== IMPLEMENTATION ==========================================================
|
//== IMPLEMENTATION ==========================================================
|
||||||
|
|
||||||
VDPMSynthesizerViewerWidget::VDPMSynthesizerViewerWidget(QWidget* _parent, const char* _name)
|
VDPMSynthesizerViewerWidget::VDPMSynthesizerViewerWidget(QWidget* _parent, const char* _name)
|
||||||
: MeshViewerWidget(_parent)
|
: MeshViewerWidget(_parent),
|
||||||
|
kappa_square_(0.0),
|
||||||
|
adaptive_mode_(false),
|
||||||
|
n_base_vertices_(0),
|
||||||
|
n_base_edges_(0),
|
||||||
|
n_base_faces_(0),
|
||||||
|
n_details_(0)
|
||||||
|
|
||||||
{
|
{
|
||||||
adaptive_mode_ = true;
|
adaptive_mode_ = true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ public:
|
|||||||
|
|
||||||
public: // inherited
|
public: // inherited
|
||||||
|
|
||||||
void initialize(void)
|
void initialize(void) override
|
||||||
{
|
{
|
||||||
BaseModQ::initialize();
|
BaseModQ::initialize();
|
||||||
n_vertices_ = BaseModQ::mesh().n_vertices();
|
n_vertices_ = BaseModQ::mesh().n_vertices();
|
||||||
|
|||||||
@@ -89,17 +89,17 @@ protected:
|
|||||||
|
|
||||||
inline static Scalar compute_limit_weight(uint _valence)
|
inline static Scalar compute_limit_weight(uint _valence)
|
||||||
{
|
{
|
||||||
double proj_weight = compute_proj_weight(_valence);
|
double proj_weight_value = compute_proj_weight(_valence);
|
||||||
proj_weight = proj_weight/(proj_weight + _valence);//normalize the proj_weight
|
proj_weight_value = proj_weight_value/(proj_weight_value + _valence);//normalize the proj_weight
|
||||||
double weight = (3.0/8.0)/(1.0 - proj_weight + (3.0/8.0));
|
double weight = (3.0/8.0)/(1.0 - proj_weight_value + (3.0/8.0));
|
||||||
return (Scalar)weight;
|
return (Scalar)weight;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline static Scalar compute_step_weight(uint _valence)
|
inline static Scalar compute_step_weight(uint _valence)
|
||||||
{
|
{
|
||||||
double proj_weight = compute_proj_weight(_valence);
|
double proj_weight_value = compute_proj_weight(_valence);
|
||||||
proj_weight = proj_weight/(proj_weight + _valence);//normalize the proj_weight
|
proj_weight_value = proj_weight_value/(proj_weight_value + _valence);//normalize the proj_weight
|
||||||
double weight = proj_weight - (3.0/8.0);
|
double weight = proj_weight_value - (3.0/8.0);
|
||||||
return (Scalar)weight;
|
return (Scalar)weight;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -112,7 +112,7 @@ public:
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
template <class _Point>
|
template <class _Point>
|
||||||
QuadricT(const _Point& _pt)
|
explicit QuadricT(const _Point& _pt)
|
||||||
{
|
{
|
||||||
set_distance_to_point(_pt);
|
set_distance_to_point(_pt);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -147,7 +147,7 @@ public:
|
|||||||
bool write(const std::string& _filename,
|
bool write(const std::string& _filename,
|
||||||
BaseExporter& _be,
|
BaseExporter& _be,
|
||||||
Options _opt=Options::Default,
|
Options _opt=Options::Default,
|
||||||
std::streamsize _precision = 6);
|
std::streamsize _precision = 6);
|
||||||
|
|
||||||
/** Write a mesh to open std::ostream _os. The source data structure is specified
|
/** Write a mesh to open std::ostream _os. The source data structure is specified
|
||||||
by the given BaseExporter. The \c save method consecutively queries all
|
by the given BaseExporter. The \c save method consecutively queries all
|
||||||
@@ -159,7 +159,7 @@ public:
|
|||||||
const std::string& _ext,
|
const std::string& _ext,
|
||||||
BaseExporter& _be,
|
BaseExporter& _be,
|
||||||
Options _opt=Options::Default,
|
Options _opt=Options::Default,
|
||||||
std::streamsize _precision = 6);
|
std::streamsize _precision = 6);
|
||||||
|
|
||||||
|
|
||||||
/// Returns true if the format is supported by one of the reader modules.
|
/// Returns true if the format is supported by one of the reader modules.
|
||||||
|
|||||||
@@ -252,7 +252,7 @@ namespace OMFormat {
|
|||||||
|
|
||||||
PropertyName( ) { }
|
PropertyName( ) { }
|
||||||
|
|
||||||
PropertyName( const std::string& _name ) { *this = _name; }
|
explicit PropertyName( const std::string& _name ) { *this = _name; }
|
||||||
|
|
||||||
bool is_valid() const { return is_valid( size() ); }
|
bool is_valid() const { return is_valid( size() ); }
|
||||||
|
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ class ExporterT : public BaseExporter
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
// Constructor
|
// Constructor
|
||||||
ExporterT(const Mesh& _mesh) : mesh_(_mesh) {}
|
explicit ExporterT(const Mesh& _mesh) : mesh_(_mesh) {}
|
||||||
|
|
||||||
|
|
||||||
// get vertex data
|
// get vertex data
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ public:
|
|||||||
typedef std::vector<VertexHandle> VHandles;
|
typedef std::vector<VertexHandle> VHandles;
|
||||||
|
|
||||||
|
|
||||||
ImporterT(Mesh& _mesh) : mesh_(_mesh), halfedgeNormals_() {}
|
explicit ImporterT(Mesh& _mesh) : mesh_(_mesh), halfedgeNormals_() {}
|
||||||
|
|
||||||
|
|
||||||
virtual VertexHandle add_vertex(const Vec3f& _point) override
|
virtual VertexHandle add_vertex(const Vec3f& _point) override
|
||||||
|
|||||||
@@ -135,13 +135,13 @@ read(const std::string& _filename, BaseImporter& _bi, Options& _opt)
|
|||||||
|
|
||||||
{
|
{
|
||||||
#if defined(WIN32)
|
#if defined(WIN32)
|
||||||
std::string::size_type dot = _filename.find_last_of("\\/");
|
std::string::size_type dot_pos = _filename.find_last_of("\\/");
|
||||||
#else
|
#else
|
||||||
std::string::size_type dot = _filename.rfind("/");
|
std::string::size_type dot_pos = _filename.rfind("/");
|
||||||
#endif
|
#endif
|
||||||
path_ = (dot == std::string::npos)
|
path_ = (dot_pos == std::string::npos)
|
||||||
? "./"
|
? "./"
|
||||||
: std::string(_filename.substr(0,dot+1));
|
: std::string(_filename.substr(0,dot_pos+1));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool result = read(in, _bi, _opt);
|
bool result = read(in, _bi, _opt);
|
||||||
|
|||||||
@@ -87,16 +87,16 @@ public:
|
|||||||
|
|
||||||
virtual ~_OBJReader_() { }
|
virtual ~_OBJReader_() { }
|
||||||
|
|
||||||
std::string get_description() const { return "Alias/Wavefront"; }
|
std::string get_description() const override { return "Alias/Wavefront"; }
|
||||||
std::string get_extensions() const { return "obj"; }
|
std::string get_extensions() const override { return "obj"; }
|
||||||
|
|
||||||
bool read(const std::string& _filename,
|
bool read(const std::string& _filename,
|
||||||
BaseImporter& _bi,
|
BaseImporter& _bi,
|
||||||
Options& _opt);
|
Options& _opt) override;
|
||||||
|
|
||||||
bool read(std::istream& _in,
|
bool read(std::istream& _in,
|
||||||
BaseImporter& _bi,
|
BaseImporter& _bi,
|
||||||
Options& _opt);
|
Options& _opt) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
@@ -105,7 +105,7 @@ private:
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
Material() { cleanup(); }
|
Material():Tr_(0),index_Kd_(0) { cleanup(); }
|
||||||
|
|
||||||
void cleanup()
|
void cleanup()
|
||||||
{
|
{
|
||||||
@@ -137,7 +137,7 @@ private:
|
|||||||
void set_Tr( float t )
|
void set_Tr( float t )
|
||||||
{ Tr_=t; Tr_is_set_=true; }
|
{ Tr_=t; Tr_is_set_=true; }
|
||||||
|
|
||||||
void set_map_Kd( std::string _name, int _index_Kd )
|
void set_map_Kd( const std::string& _name, int _index_Kd )
|
||||||
{ map_Kd_ = _name, index_Kd_ = _index_Kd; map_Kd_is_set_ = true; };
|
{ map_Kd_ = _name, index_Kd_ = _index_Kd; map_Kd_is_set_ = true; };
|
||||||
|
|
||||||
const Vec3f& Kd( void ) const { return Kd_; }
|
const Vec3f& Kd( void ) const { return Kd_; }
|
||||||
|
|||||||
@@ -118,17 +118,17 @@ public:
|
|||||||
/// Destructor
|
/// Destructor
|
||||||
virtual ~_OFFReader_() {};
|
virtual ~_OFFReader_() {};
|
||||||
|
|
||||||
std::string get_description() const { return "Object File Format"; }
|
std::string get_description() const override { return "Object File Format"; }
|
||||||
std::string get_extensions() const { return "off"; }
|
std::string get_extensions() const override { return "off"; }
|
||||||
std::string get_magic() const { return "OFF"; }
|
std::string get_magic() const override { return "OFF"; }
|
||||||
|
|
||||||
bool read(const std::string& _filename,
|
bool read(const std::string& _filename,
|
||||||
BaseImporter& _bi,
|
BaseImporter& _bi,
|
||||||
Options& _opt);
|
Options& _opt) override;
|
||||||
|
|
||||||
bool can_u_read(const std::string& _filename) const;
|
bool can_u_read(const std::string& _filename) const override;
|
||||||
|
|
||||||
bool read(std::istream& _in, BaseImporter& _bi, Options& _opt );
|
bool read(std::istream& _in, BaseImporter& _bi, Options& _opt ) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
|||||||
@@ -387,10 +387,12 @@ bool _OMReader_::read_binary_vertex_chunk(std::istream &_is, BaseImporter &_bi,
|
|||||||
default: // skip unknown chunks
|
default: // skip unknown chunks
|
||||||
{
|
{
|
||||||
omerr() << "Unknown chunk type ignored!\n";
|
omerr() << "Unknown chunk type ignored!\n";
|
||||||
size_t size_of = header_.n_vertices_ * OMFormat::vector_size(chunk_header_);
|
size_t chunk_size = header_.n_vertices_ * OMFormat::vector_size(chunk_header_);
|
||||||
_is.ignore(size_of);
|
_is.ignore(chunk_size);
|
||||||
bytes_ += size_of;
|
bytes_ += chunk_size;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// all chunk data has been read..?!
|
// all chunk data has been read..?!
|
||||||
@@ -505,9 +507,9 @@ bool _OMReader_::read_binary_face_chunk(std::istream &_is, BaseImporter &_bi, Op
|
|||||||
default: // skip unknown chunks
|
default: // skip unknown chunks
|
||||||
{
|
{
|
||||||
omerr() << "Unknown chunk type ignore!\n";
|
omerr() << "Unknown chunk type ignore!\n";
|
||||||
size_t size_of = OMFormat::chunk_data_size(header_, chunk_header_);
|
size_t chunk_size = OMFormat::chunk_data_size(header_, chunk_header_);
|
||||||
_is.ignore(size_of);
|
_is.ignore(chunk_size);
|
||||||
bytes_ += size_of;
|
bytes_ += chunk_size;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return fidx == header_.n_faces_;
|
return fidx == header_.n_faces_;
|
||||||
@@ -549,9 +551,9 @@ bool _OMReader_::read_binary_edge_chunk(std::istream &_is, BaseImporter &_bi, Op
|
|||||||
|
|
||||||
default:
|
default:
|
||||||
// skip unknown type
|
// skip unknown type
|
||||||
size_t size_of = OMFormat::chunk_data_size(header_, chunk_header_);
|
size_t chunk_size = OMFormat::chunk_data_size(header_, chunk_header_);
|
||||||
_is.ignore(size_of);
|
_is.ignore(chunk_size);
|
||||||
bytes_ += size_of;
|
bytes_ += chunk_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
return b < bytes_;
|
return b < bytes_;
|
||||||
@@ -627,9 +629,9 @@ bool _OMReader_::read_binary_halfedge_chunk(std::istream &_is, BaseImporter &_bi
|
|||||||
default:
|
default:
|
||||||
// skip unknown chunk
|
// skip unknown chunk
|
||||||
omerr() << "Unknown chunk type ignored!\n";
|
omerr() << "Unknown chunk type ignored!\n";
|
||||||
size_t size_of = OMFormat::chunk_data_size(header_, chunk_header_);
|
size_t chunk_size = OMFormat::chunk_data_size(header_, chunk_header_);
|
||||||
_is.ignore(size_of);
|
_is.ignore(chunk_size);
|
||||||
bytes_ += size_of;
|
bytes_ += chunk_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
return b < bytes_;
|
return b < bytes_;
|
||||||
@@ -655,9 +657,9 @@ bool _OMReader_::read_binary_mesh_chunk(std::istream &_is, BaseImporter &_bi, Op
|
|||||||
|
|
||||||
default:
|
default:
|
||||||
// skip unknown chunk
|
// skip unknown chunk
|
||||||
size_t size_of = OMFormat::chunk_data_size(header_, chunk_header_);
|
size_t chunk_size = OMFormat::chunk_data_size(header_, chunk_header_);
|
||||||
_is.ignore(size_of);
|
_is.ignore(chunk_size);
|
||||||
bytes_ += size_of;
|
bytes_ += chunk_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
return b < bytes_;
|
return b < bytes_;
|
||||||
|
|||||||
@@ -89,20 +89,20 @@ public:
|
|||||||
_OMReader_();
|
_OMReader_();
|
||||||
virtual ~_OMReader_() { }
|
virtual ~_OMReader_() { }
|
||||||
|
|
||||||
std::string get_description() const { return "OpenMesh File Format"; }
|
std::string get_description() const override { return "OpenMesh File Format"; }
|
||||||
std::string get_extensions() const { return "om"; }
|
std::string get_extensions() const override { return "om"; }
|
||||||
std::string get_magic() const { return "OM"; }
|
std::string get_magic() const override { return "OM"; }
|
||||||
|
|
||||||
bool read(const std::string& _filename,
|
bool read(const std::string& _filename,
|
||||||
BaseImporter& _bi,
|
BaseImporter& _bi,
|
||||||
Options& _opt );
|
Options& _opt ) override;
|
||||||
|
|
||||||
//! Stream Reader for std::istream input in binary format
|
//! Stream Reader for std::istream input in binary format
|
||||||
bool read(std::istream& _is,
|
bool read(std::istream& _is,
|
||||||
BaseImporter& _bi,
|
BaseImporter& _bi,
|
||||||
Options& _opt );
|
Options& _opt ) override;
|
||||||
|
|
||||||
virtual bool can_u_read(const std::string& _filename) const;
|
virtual bool can_u_read(const std::string& _filename) const override;
|
||||||
virtual bool can_u_read(std::istream& _is) const;
|
virtual bool can_u_read(std::istream& _is) const;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -97,19 +97,19 @@ public:
|
|||||||
|
|
||||||
_PLYReader_();
|
_PLYReader_();
|
||||||
|
|
||||||
std::string get_description() const { return "PLY polygon file format"; }
|
std::string get_description() const override { return "PLY polygon file format"; }
|
||||||
std::string get_extensions() const { return "ply"; }
|
std::string get_extensions() const override { return "ply"; }
|
||||||
std::string get_magic() const { return "PLY"; }
|
std::string get_magic() const override { return "PLY"; }
|
||||||
|
|
||||||
bool read(const std::string& _filename,
|
bool read(const std::string& _filename,
|
||||||
BaseImporter& _bi,
|
BaseImporter& _bi,
|
||||||
Options& _opt);
|
Options& _opt) override;
|
||||||
|
|
||||||
bool read(std::istream& _is,
|
bool read(std::istream& _is,
|
||||||
BaseImporter& _bi,
|
BaseImporter& _bi,
|
||||||
Options& _opt);
|
Options& _opt) override;
|
||||||
|
|
||||||
bool can_u_read(const std::string& _filename) const;
|
bool can_u_read(const std::string& _filename) const override;
|
||||||
|
|
||||||
enum ValueType {
|
enum ValueType {
|
||||||
Unsupported,
|
Unsupported,
|
||||||
|
|||||||
@@ -92,17 +92,17 @@ public:
|
|||||||
virtual ~_STLReader_() {};
|
virtual ~_STLReader_() {};
|
||||||
|
|
||||||
|
|
||||||
std::string get_description() const
|
std::string get_description() const override
|
||||||
{ return "Stereolithography Interface Format"; }
|
{ return "Stereolithography Interface Format"; }
|
||||||
std::string get_extensions() const { return "stl stla stlb"; }
|
std::string get_extensions() const override { return "stl stla stlb"; }
|
||||||
|
|
||||||
bool read(const std::string& _filename,
|
bool read(const std::string& _filename,
|
||||||
BaseImporter& _bi,
|
BaseImporter& _bi,
|
||||||
Options& _opt);
|
Options& _opt) override;
|
||||||
|
|
||||||
bool read(std::istream& _in,
|
bool read(std::istream& _in,
|
||||||
BaseImporter& _bi,
|
BaseImporter& _bi,
|
||||||
Options& _opt);
|
Options& _opt) override;
|
||||||
|
|
||||||
/** Set the threshold to be used for considering two point to be equal.
|
/** Set the threshold to be used for considering two point to be equal.
|
||||||
Can be used to merge small gaps */
|
Can be used to merge small gaps */
|
||||||
|
|||||||
@@ -133,11 +133,13 @@ protected:
|
|||||||
|
|
||||||
bool check(BaseExporter& _be, Options _opt) const
|
bool check(BaseExporter& _be, Options _opt) const
|
||||||
{
|
{
|
||||||
return (_opt.check(Options::VertexNormal ) <= _be.has_vertex_normals())
|
// Check for all Options. When we want to write them (_opt.check() ) , they have to be available ( has_ )
|
||||||
&& (_opt.check(Options::VertexTexCoord)<= _be.has_vertex_texcoords())
|
// Converts to not A (write them) or B (available)
|
||||||
&& (_opt.check(Options::VertexColor) <= _be.has_vertex_colors())
|
return ( !_opt.check(Options::VertexNormal ) || _be.has_vertex_normals())
|
||||||
&& (_opt.check(Options::FaceNormal) <= _be.has_face_normals())
|
&& ( !_opt.check(Options::VertexTexCoord)|| _be.has_vertex_texcoords())
|
||||||
&& (_opt.check(Options::FaceColor) <= _be.has_face_colors());
|
&& ( !_opt.check(Options::VertexColor) || _be.has_vertex_colors())
|
||||||
|
&& ( !_opt.check(Options::FaceNormal) || _be.has_face_normals())
|
||||||
|
&& ( !_opt.check(Options::FaceColor) || _be.has_face_colors());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -100,24 +100,24 @@ write(const std::string& _filename, BaseExporter& _be, Options _opt, std::stream
|
|||||||
|
|
||||||
{
|
{
|
||||||
#if defined(WIN32)
|
#if defined(WIN32)
|
||||||
std::string::size_type dot = _filename.find_last_of("\\/");
|
std::string::size_type dotposition = _filename.find_last_of("\\/");
|
||||||
#else
|
#else
|
||||||
std::string::size_type dot = _filename.rfind("/");
|
std::string::size_type dotposition = _filename.rfind("/");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (dot == std::string::npos){
|
if (dotposition == std::string::npos){
|
||||||
path_ = "./";
|
path_ = "./";
|
||||||
objName_ = _filename;
|
objName_ = _filename;
|
||||||
}else{
|
}else{
|
||||||
path_ = _filename.substr(0,dot+1);
|
path_ = _filename.substr(0,dotposition+1);
|
||||||
objName_ = _filename.substr(dot+1);
|
objName_ = _filename.substr(dotposition+1);
|
||||||
}
|
}
|
||||||
|
|
||||||
//remove the file extension
|
//remove the file extension
|
||||||
dot = objName_.find_last_of(".");
|
dotposition = objName_.find_last_of(".");
|
||||||
|
|
||||||
if(dot != std::string::npos)
|
if(dotposition != std::string::npos)
|
||||||
objName_ = objName_.substr(0,dot);
|
objName_ = objName_.substr(0,dotposition);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool result = write(out, _be, _opt, _precision);
|
bool result = write(out, _be, _opt, _precision);
|
||||||
@@ -206,7 +206,7 @@ _OBJWriter_::
|
|||||||
write(std::ostream& _out, BaseExporter& _be, Options _opt, std::streamsize _precision) const
|
write(std::ostream& _out, BaseExporter& _be, Options _opt, std::streamsize _precision) const
|
||||||
{
|
{
|
||||||
unsigned int idx;
|
unsigned int idx;
|
||||||
size_t i, j,nV, nF;
|
size_t nV, nF;
|
||||||
Vec3f v, n;
|
Vec3f v, n;
|
||||||
Vec2f t;
|
Vec2f t;
|
||||||
VertexHandle vh;
|
VertexHandle vh;
|
||||||
@@ -273,7 +273,7 @@ write(std::ostream& _out, BaseExporter& _be, Options _opt, std::streamsize _prec
|
|||||||
std::vector<Vec2f> texCoords;
|
std::vector<Vec2f> texCoords;
|
||||||
//add all texCoords to map
|
//add all texCoords to map
|
||||||
unsigned int num = _be.get_face_texcoords(texCoords);
|
unsigned int num = _be.get_face_texcoords(texCoords);
|
||||||
for(unsigned int i = 0; i < num ; ++i)
|
for(size_t i = 0; i < num ; ++i)
|
||||||
{
|
{
|
||||||
texMap[texCoords[i]] = i;
|
texMap[texCoords[i]] = i;
|
||||||
}
|
}
|
||||||
@@ -303,7 +303,7 @@ write(std::ostream& _out, BaseExporter& _be, Options _opt, std::streamsize _prec
|
|||||||
}
|
}
|
||||||
|
|
||||||
// vertex data (point, normals, texcoords)
|
// vertex data (point, normals, texcoords)
|
||||||
for (i=0, nV=_be.n_vertices(); i<nV; ++i)
|
for (size_t i=0, nV=_be.n_vertices(); i<nV; ++i)
|
||||||
{
|
{
|
||||||
vh = VertexHandle(int(i));
|
vh = VertexHandle(int(i));
|
||||||
v = _be.point(vh);
|
v = _be.point(vh);
|
||||||
@@ -324,7 +324,7 @@ write(std::ostream& _out, BaseExporter& _be, Options _opt, std::streamsize _prec
|
|||||||
&& !_opt.check(Options::FaceTexCoord);
|
&& !_opt.check(Options::FaceTexCoord);
|
||||||
|
|
||||||
// faces (indices starting at 1 not 0)
|
// faces (indices starting at 1 not 0)
|
||||||
for (i=0, nF=_be.n_faces(); i<nF; ++i)
|
for (size_t i=0, nF=_be.n_faces(); i<nF; ++i)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (useMatrial && _opt.check(Options::FaceColor) ){
|
if (useMatrial && _opt.check(Options::FaceColor) ){
|
||||||
@@ -351,7 +351,7 @@ write(std::ostream& _out, BaseExporter& _be, Options _opt, std::streamsize _prec
|
|||||||
|
|
||||||
_be.get_vhandles(FaceHandle(int(i)), vhandles);
|
_be.get_vhandles(FaceHandle(int(i)), vhandles);
|
||||||
|
|
||||||
for (j=0; j< vhandles.size(); ++j)
|
for (size_t j=0; j< vhandles.size(); ++j)
|
||||||
{
|
{
|
||||||
|
|
||||||
// Write vertex index
|
// Write vertex index
|
||||||
|
|||||||
@@ -88,14 +88,14 @@ public:
|
|||||||
/// Destructor
|
/// Destructor
|
||||||
virtual ~_OBJWriter_() {};
|
virtual ~_OBJWriter_() {};
|
||||||
|
|
||||||
std::string get_description() const { return "Alias/Wavefront"; }
|
std::string get_description() const override { return "Alias/Wavefront"; }
|
||||||
std::string get_extensions() const { return "obj"; }
|
std::string get_extensions() const override { return "obj"; }
|
||||||
|
|
||||||
bool write(const std::string&, BaseExporter&, Options, std::streamsize _precision = 6) const;
|
bool write(const std::string&, BaseExporter&, Options, std::streamsize _precision = 6) const override;
|
||||||
|
|
||||||
bool write(std::ostream&, BaseExporter&, Options, std::streamsize _precision = 6) const;
|
bool write(std::ostream&, BaseExporter&, Options, std::streamsize _precision = 6) const override;
|
||||||
|
|
||||||
size_t binary_size(BaseExporter&, Options) const { return 0; }
|
size_t binary_size(BaseExporter&, Options) const override { return 0; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
|||||||
@@ -97,14 +97,14 @@ public:
|
|||||||
|
|
||||||
virtual ~_OFFWriter_() {};
|
virtual ~_OFFWriter_() {};
|
||||||
|
|
||||||
std::string get_description() const { return "no description"; }
|
std::string get_description() const override { return "no description"; }
|
||||||
std::string get_extensions() const { return "off"; }
|
std::string get_extensions() const override { return "off"; }
|
||||||
|
|
||||||
bool write(const std::string&, BaseExporter&, Options, std::streamsize _precision = 6) const;
|
bool write(const std::string&, BaseExporter&, Options, std::streamsize _precision = 6) const override;
|
||||||
|
|
||||||
bool write(std::ostream&, BaseExporter&, Options, std::streamsize _precision = 6) const;
|
bool write(std::ostream&, BaseExporter&, Options, std::streamsize _precision = 6) const override;
|
||||||
|
|
||||||
size_t binary_size(BaseExporter& _be, Options _opt) const;
|
size_t binary_size(BaseExporter& _be, Options _opt) const override;
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|||||||
@@ -98,15 +98,15 @@ public:
|
|||||||
/// Destructor
|
/// Destructor
|
||||||
virtual ~_OMWriter_() {};
|
virtual ~_OMWriter_() {};
|
||||||
|
|
||||||
std::string get_description() const
|
std::string get_description() const override
|
||||||
{ return "OpenMesh Format"; }
|
{ return "OpenMesh Format"; }
|
||||||
|
|
||||||
std::string get_extensions() const
|
std::string get_extensions() const override
|
||||||
{ return "om"; }
|
{ return "om"; }
|
||||||
|
|
||||||
bool write(std::ostream&, BaseExporter&, Options, std::streamsize _precision = 6) const;
|
bool write(std::ostream&, BaseExporter&, Options, std::streamsize _precision = 6) const override;
|
||||||
|
|
||||||
size_t binary_size(BaseExporter& _be, Options _opt) const;
|
size_t binary_size(BaseExporter& _be, Options _opt) const override;
|
||||||
|
|
||||||
static OMFormat::uint8 get_version() { return version_; }
|
static OMFormat::uint8 get_version() { return version_; }
|
||||||
|
|
||||||
@@ -116,7 +116,7 @@ protected:
|
|||||||
static const OMFormat::uchar magic_[3];
|
static const OMFormat::uchar magic_[3];
|
||||||
static const OMFormat::uint8 version_;
|
static const OMFormat::uint8 version_;
|
||||||
|
|
||||||
bool write(const std::string&, BaseExporter&, Options, std::streamsize _precision = 6) const;
|
bool write(const std::string&, BaseExporter&, Options, std::streamsize _precision = 6) const override;
|
||||||
|
|
||||||
bool write_binary(std::ostream&, BaseExporter&, Options) const;
|
bool write_binary(std::ostream&, BaseExporter&, Options) const;
|
||||||
|
|
||||||
|
|||||||
@@ -95,14 +95,14 @@ public:
|
|||||||
/// Destructor
|
/// Destructor
|
||||||
virtual ~_PLYWriter_() {};
|
virtual ~_PLYWriter_() {};
|
||||||
|
|
||||||
std::string get_description() const { return "PLY polygon file format"; }
|
std::string get_description() const override { return "PLY polygon file format"; }
|
||||||
std::string get_extensions() const { return "ply"; }
|
std::string get_extensions() const override { return "ply"; }
|
||||||
|
|
||||||
bool write(const std::string&, BaseExporter&, Options, std::streamsize _precision = 6) const;
|
bool write(const std::string&, BaseExporter&, Options, std::streamsize _precision = 6) const override;
|
||||||
|
|
||||||
bool write(std::ostream&, BaseExporter&, Options, std::streamsize _precision = 6) const;
|
bool write(std::ostream&, BaseExporter&, Options, std::streamsize _precision = 6) const override;
|
||||||
|
|
||||||
size_t binary_size(BaseExporter& _be, Options _opt) const;
|
size_t binary_size(BaseExporter& _be, Options _opt) const override;
|
||||||
|
|
||||||
enum ValueType {
|
enum ValueType {
|
||||||
Unsupported = 0,
|
Unsupported = 0,
|
||||||
@@ -120,7 +120,7 @@ private:
|
|||||||
{
|
{
|
||||||
ValueType type;
|
ValueType type;
|
||||||
const BaseProperty* property;
|
const BaseProperty* property;
|
||||||
CustomProperty(const BaseProperty* const _p):type(Unsupported),property(_p){}
|
explicit CustomProperty(const BaseProperty* const _p):type(Unsupported),property(_p){}
|
||||||
};
|
};
|
||||||
|
|
||||||
const char* nameOfType_[12];
|
const char* nameOfType_[12];
|
||||||
|
|||||||
@@ -88,14 +88,14 @@ public:
|
|||||||
/// Destructor
|
/// Destructor
|
||||||
virtual ~_STLWriter_() {};
|
virtual ~_STLWriter_() {};
|
||||||
|
|
||||||
std::string get_description() const { return "Stereolithography Format"; }
|
std::string get_description() const override { return "Stereolithography Format"; }
|
||||||
std::string get_extensions() const { return "stl stla stlb"; }
|
std::string get_extensions() const override { return "stl stla stlb"; }
|
||||||
|
|
||||||
bool write(const std::string&, BaseExporter&, Options, std::streamsize _precision = 6) const;
|
bool write(const std::string&, BaseExporter&, Options, std::streamsize _precision = 6) const override;
|
||||||
|
|
||||||
bool write(std::ostream&, BaseExporter&, Options, std::streamsize _precision = 6) const;
|
bool write(std::ostream&, BaseExporter&, Options, std::streamsize _precision = 6) const override;
|
||||||
|
|
||||||
size_t binary_size(BaseExporter&, Options) const;
|
size_t binary_size(BaseExporter&, Options) const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool write_stla(const std::string&, BaseExporter&, Options) const;
|
bool write_stla(const std::string&, BaseExporter&, Options) const;
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ bool _VTKWriter_::write(const std::string& _filename, BaseExporter& _be, Options
|
|||||||
|
|
||||||
bool _VTKWriter_::write(std::ostream& _out, BaseExporter& _be, Options _opt, std::streamsize _precision) const
|
bool _VTKWriter_::write(std::ostream& _out, BaseExporter& _be, Options _opt, std::streamsize _precision) const
|
||||||
{
|
{
|
||||||
Vec3f v, n;
|
Vec3f n;
|
||||||
Vec2f t;
|
Vec2f t;
|
||||||
VertexHandle vh;
|
VertexHandle vh;
|
||||||
OpenMesh::Vec3f c;
|
OpenMesh::Vec3f c;
|
||||||
@@ -78,7 +78,7 @@ bool _VTKWriter_::write(std::ostream& _out, BaseExporter& _be, Options _opt, std
|
|||||||
_out << "POINTS " << _be.n_vertices() << " float\n";
|
_out << "POINTS " << _be.n_vertices() << " float\n";
|
||||||
size_t nv = _be.n_vertices();
|
size_t nv = _be.n_vertices();
|
||||||
for (size_t i = 0; i < nv; ++i) {
|
for (size_t i = 0; i < nv; ++i) {
|
||||||
Vec3f v = _be.point(VertexHandle(int(i)));
|
const Vec3f v = _be.point(VertexHandle(int(i)));
|
||||||
_out << v[0] << ' ' << v[1] << ' ' << v[2] << '\n';
|
_out << v[0] << ' ' << v[1] << ' ' << v[2] << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -29,13 +29,13 @@ class OPENMESHDLLEXPORT _VTKWriter_ : public BaseWriter
|
|||||||
public:
|
public:
|
||||||
_VTKWriter_();
|
_VTKWriter_();
|
||||||
|
|
||||||
std::string get_description() const { return "VTK"; }
|
std::string get_description() const override { return "VTK"; }
|
||||||
std::string get_extensions() const { return "vtk"; }
|
std::string get_extensions() const override { return "vtk"; }
|
||||||
|
|
||||||
bool write(const std::string&, BaseExporter&, Options, std::streamsize _precision = 6) const;
|
bool write(const std::string&, BaseExporter&, Options, std::streamsize _precision = 6) const override;
|
||||||
bool write(std::ostream&, BaseExporter&, Options, std::streamsize _precision = 6) const;
|
bool write(std::ostream&, BaseExporter&, Options, std::streamsize _precision = 6) const override;
|
||||||
|
|
||||||
size_t binary_size(BaseExporter&, Options) const { return 0; }
|
size_t binary_size(BaseExporter&, Options) const override { return 0; }
|
||||||
};
|
};
|
||||||
|
|
||||||
//== TYPE DEFINITION ==========================================================
|
//== TYPE DEFINITION ==========================================================
|
||||||
|
|||||||
@@ -340,10 +340,10 @@ public:
|
|||||||
void clean_keep_reservation();
|
void clean_keep_reservation();
|
||||||
|
|
||||||
// --- number of items ---
|
// --- number of items ---
|
||||||
size_t n_vertices() const { return vertices_.size(); }
|
size_t n_vertices() const override { return vertices_.size(); }
|
||||||
size_t n_halfedges() const { return 2*edges_.size(); }
|
size_t n_halfedges() const override { return 2*edges_.size(); }
|
||||||
size_t n_edges() const { return edges_.size(); }
|
size_t n_edges() const override { return edges_.size(); }
|
||||||
size_t n_faces() const { return faces_.size(); }
|
size_t n_faces() const override { return faces_.size(); }
|
||||||
|
|
||||||
bool vertices_empty() const { return vertices_.empty(); }
|
bool vertices_empty() const { return vertices_.empty(); }
|
||||||
bool halfedges_empty() const { return edges_.empty(); }
|
bool halfedges_empty() const { return edges_.empty(); }
|
||||||
@@ -697,7 +697,7 @@ public:
|
|||||||
typedef StatusSetT<Handle> Base;
|
typedef StatusSetT<Handle> Base;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
AutoStatusSetT(ArrayKernel& _kernel)
|
explicit AutoStatusSetT(ArrayKernel& _kernel)
|
||||||
: StatusSetT<Handle>(_kernel, _kernel.pop_bit_mask(Handle()))
|
: StatusSetT<Handle>(_kernel, _kernel.pop_bit_mask(Handle()))
|
||||||
{ /*assert(size() == 0);*/ } //the set should be empty on creation
|
{ /*assert(size() == 0);*/ } //the set should be empty on creation
|
||||||
|
|
||||||
|
|||||||
@@ -1121,7 +1121,7 @@ public:
|
|||||||
typedef ITER_TYPE iterator;
|
typedef ITER_TYPE iterator;
|
||||||
typedef ITER_TYPE const_iterator;
|
typedef ITER_TYPE const_iterator;
|
||||||
|
|
||||||
EntityRange(CONTAINER_TYPE &container) : container_(container) {}
|
explicit EntityRange(CONTAINER_TYPE &container) : container_(container) {}
|
||||||
ITER_TYPE begin() const { return (container_.*begin_fn)(); }
|
ITER_TYPE begin() const { return (container_.*begin_fn)(); }
|
||||||
ITER_TYPE end() const { return (container_.*end_fn)(); }
|
ITER_TYPE end() const { return (container_.*end_fn)(); }
|
||||||
|
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ class PolyMesh_ArrayKernelT
|
|||||||
public:
|
public:
|
||||||
PolyMesh_ArrayKernelT() {}
|
PolyMesh_ArrayKernelT() {}
|
||||||
template<class OtherTraits>
|
template<class OtherTraits>
|
||||||
PolyMesh_ArrayKernelT( const TriMesh_ArrayKernelT<OtherTraits> & t)
|
explicit PolyMesh_ArrayKernelT( const TriMesh_ArrayKernelT<OtherTraits> & t)
|
||||||
{
|
{
|
||||||
//assign the connectivity and standard properties
|
//assign the connectivity and standard properties
|
||||||
this->assign(t, true);
|
this->assign(t, true);
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ class TriMesh_ArrayKernelT
|
|||||||
public:
|
public:
|
||||||
TriMesh_ArrayKernelT() {}
|
TriMesh_ArrayKernelT() {}
|
||||||
template<class OtherTraits>
|
template<class OtherTraits>
|
||||||
TriMesh_ArrayKernelT( const PolyMesh_ArrayKernelT<OtherTraits> & t)
|
explicit TriMesh_ArrayKernelT( const PolyMesh_ArrayKernelT<OtherTraits> & t)
|
||||||
{
|
{
|
||||||
//assign the connectivity and standard properties
|
//assign the connectivity and standard properties
|
||||||
this->assign(t,true);
|
this->assign(t,true);
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ class multiplex_target : public basic_multiplex_target
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit multiplex_target(T& _t) : target_(_t) {}
|
explicit multiplex_target(T& _t) : target_(_t) {}
|
||||||
virtual void operator<<(const std::string& _s) { target_ << _s; }
|
virtual void operator<<(const std::string& _s) override { target_ << _s; }
|
||||||
private:
|
private:
|
||||||
T& target_;
|
T& target_;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ public:
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
/// Default constructor
|
/// Default constructor
|
||||||
PropertyT(const std::string& _name = "<unknown>")
|
explicit PropertyT(const std::string& _name = "<unknown>")
|
||||||
: BaseProperty(_name)
|
: BaseProperty(_name)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
@@ -109,22 +109,22 @@ public:
|
|||||||
|
|
||||||
public: // inherited from BaseProperty
|
public: // inherited from BaseProperty
|
||||||
|
|
||||||
virtual void reserve(size_t _n) { data_.reserve(_n); }
|
virtual void reserve(size_t _n) override { data_.reserve(_n); }
|
||||||
virtual void resize(size_t _n) { data_.resize(_n); }
|
virtual void resize(size_t _n) override { data_.resize(_n); }
|
||||||
virtual void clear() { data_.clear(); vector_type().swap(data_); }
|
virtual void clear() override { data_.clear(); vector_type().swap(data_); }
|
||||||
virtual void push_back() { data_.push_back(T()); }
|
virtual void push_back() override { data_.push_back(T()); }
|
||||||
virtual void swap(size_t _i0, size_t _i1)
|
virtual void swap(size_t _i0, size_t _i1) override
|
||||||
{ std::swap(data_[_i0], data_[_i1]); }
|
{ std::swap(data_[_i0], data_[_i1]); }
|
||||||
virtual void copy(size_t _i0, size_t _i1)
|
virtual void copy(size_t _i0, size_t _i1) override
|
||||||
{ data_[_i1] = data_[_i0]; }
|
{ data_[_i1] = data_[_i0]; }
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
virtual void set_persistent( bool _yn )
|
virtual void set_persistent( bool _yn ) override
|
||||||
{ check_and_set_persistent<T>( _yn ); }
|
{ check_and_set_persistent<T>( _yn ); }
|
||||||
|
|
||||||
virtual size_t n_elements() const { return data_.size(); }
|
virtual size_t n_elements() const override { return data_.size(); }
|
||||||
virtual size_t element_size() const { return IO::size_of<T>(); }
|
virtual size_t element_size() const override { return IO::size_of<T>(); }
|
||||||
|
|
||||||
#ifndef DOXY_IGNORE_THIS
|
#ifndef DOXY_IGNORE_THIS
|
||||||
struct plus {
|
struct plus {
|
||||||
@@ -133,17 +133,17 @@ public:
|
|||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
virtual size_t size_of(void) const
|
virtual size_t size_of(void) const override
|
||||||
{
|
{
|
||||||
if (element_size() != IO::UnknownSize)
|
if (element_size() != IO::UnknownSize)
|
||||||
return this->BaseProperty::size_of(n_elements());
|
return this->BaseProperty::size_of(n_elements());
|
||||||
return std::accumulate(data_.begin(), data_.end(), size_t(0), plus());
|
return std::accumulate(data_.begin(), data_.end(), size_t(0), plus());
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual size_t size_of(size_t _n_elem) const
|
virtual size_t size_of(size_t _n_elem) const override
|
||||||
{ return this->BaseProperty::size_of(_n_elem); }
|
{ return this->BaseProperty::size_of(_n_elem); }
|
||||||
|
|
||||||
virtual size_t store( std::ostream& _ostr, bool _swap ) const
|
virtual size_t store( std::ostream& _ostr, bool _swap ) const override
|
||||||
{
|
{
|
||||||
if ( IO::is_streamable<vector_type>() )
|
if ( IO::is_streamable<vector_type>() )
|
||||||
return IO::store(_ostr, data_, _swap );
|
return IO::store(_ostr, data_, _swap );
|
||||||
@@ -153,7 +153,7 @@ public:
|
|||||||
return bytes;
|
return bytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual size_t restore( std::istream& _istr, bool _swap )
|
virtual size_t restore( std::istream& _istr, bool _swap ) override
|
||||||
{
|
{
|
||||||
if ( IO::is_streamable<vector_type>() )
|
if ( IO::is_streamable<vector_type>() )
|
||||||
return IO::restore(_istr, data_, _swap );
|
return IO::restore(_istr, data_, _swap );
|
||||||
@@ -199,7 +199,7 @@ public: // data access interface
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Make a copy of self.
|
/// Make a copy of self.
|
||||||
PropertyT<T>* clone() const
|
PropertyT<T>* clone() const override
|
||||||
{
|
{
|
||||||
PropertyT<T>* p = new PropertyT<T>( *this );
|
PropertyT<T>* p = new PropertyT<T>( *this );
|
||||||
return p;
|
return p;
|
||||||
@@ -230,37 +230,37 @@ public:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
PropertyT(const std::string& _name = "<unknown>")
|
explicit PropertyT(const std::string& _name = "<unknown>")
|
||||||
: BaseProperty(_name)
|
: BaseProperty(_name)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
public: // inherited from BaseProperty
|
public: // inherited from BaseProperty
|
||||||
|
|
||||||
virtual void reserve(size_t _n) { data_.reserve(_n); }
|
virtual void reserve(size_t _n) override { data_.reserve(_n); }
|
||||||
virtual void resize(size_t _n) { data_.resize(_n); }
|
virtual void resize(size_t _n) override { data_.resize(_n); }
|
||||||
virtual void clear() { data_.clear(); vector_type().swap(data_); }
|
virtual void clear() override { data_.clear(); vector_type().swap(data_); }
|
||||||
virtual void push_back() { data_.push_back(bool()); }
|
virtual void push_back() override { data_.push_back(bool()); }
|
||||||
virtual void swap(size_t _i0, size_t _i1)
|
virtual void swap(size_t _i0, size_t _i1) override
|
||||||
{ bool t(data_[_i0]); data_[_i0]=data_[_i1]; data_[_i1]=t; }
|
{ bool t(data_[_i0]); data_[_i0]=data_[_i1]; data_[_i1]=t; }
|
||||||
virtual void copy(size_t _i0, size_t _i1)
|
virtual void copy(size_t _i0, size_t _i1) override
|
||||||
{ data_[_i1] = data_[_i0]; }
|
{ data_[_i1] = data_[_i0]; }
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
virtual void set_persistent( bool _yn )
|
virtual void set_persistent( bool _yn ) override
|
||||||
{
|
{
|
||||||
check_and_set_persistent<bool>( _yn );
|
check_and_set_persistent<bool>( _yn );
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual size_t n_elements() const { return data_.size(); }
|
virtual size_t n_elements() const override { return data_.size(); }
|
||||||
virtual size_t element_size() const { return UnknownSize; }
|
virtual size_t element_size() const override { return UnknownSize; }
|
||||||
virtual size_t size_of() const { return size_of( n_elements() ); }
|
virtual size_t size_of() const override { return size_of( n_elements() ); }
|
||||||
virtual size_t size_of(size_t _n_elem) const
|
virtual size_t size_of(size_t _n_elem) const override
|
||||||
{
|
{
|
||||||
return _n_elem / 8 + ((_n_elem % 8)!=0);
|
return _n_elem / 8 + ((_n_elem % 8)!=0);
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t store( std::ostream& _ostr, bool /* _swap */ ) const
|
size_t store( std::ostream& _ostr, bool /* _swap */ ) const override
|
||||||
{
|
{
|
||||||
size_t bytes = 0;
|
size_t bytes = 0;
|
||||||
|
|
||||||
@@ -299,7 +299,7 @@ public:
|
|||||||
return bytes;
|
return bytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t restore( std::istream& _istr, bool /* _swap */ )
|
size_t restore( std::istream& _istr, bool /* _swap */ ) override
|
||||||
{
|
{
|
||||||
size_t bytes = 0;
|
size_t bytes = 0;
|
||||||
|
|
||||||
@@ -394,40 +394,40 @@ public:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
PropertyT(const std::string& _name = "<unknown>")
|
explicit PropertyT(const std::string& _name = "<unknown>")
|
||||||
: BaseProperty(_name)
|
: BaseProperty(_name)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
public: // inherited from BaseProperty
|
public: // inherited from BaseProperty
|
||||||
|
|
||||||
virtual void reserve(size_t _n) { data_.reserve(_n); }
|
virtual void reserve(size_t _n) override { data_.reserve(_n); }
|
||||||
virtual void resize(size_t _n) { data_.resize(_n); }
|
virtual void resize(size_t _n) override { data_.resize(_n); }
|
||||||
virtual void clear() { data_.clear(); vector_type().swap(data_); }
|
virtual void clear() override { data_.clear(); vector_type().swap(data_); }
|
||||||
virtual void push_back() { data_.push_back(std::string()); }
|
virtual void push_back() override { data_.push_back(std::string()); }
|
||||||
virtual void swap(size_t _i0, size_t _i1) {
|
virtual void swap(size_t _i0, size_t _i1) override {
|
||||||
std::swap(data_[_i0], data_[_i1]);
|
std::swap(data_[_i0], data_[_i1]);
|
||||||
}
|
}
|
||||||
virtual void copy(size_t _i0, size_t _i1)
|
virtual void copy(size_t _i0, size_t _i1) override
|
||||||
{ data_[_i1] = data_[_i0]; }
|
{ data_[_i1] = data_[_i0]; }
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
virtual void set_persistent( bool _yn )
|
virtual void set_persistent( bool _yn ) override
|
||||||
{ check_and_set_persistent<std::string>( _yn ); }
|
{ check_and_set_persistent<std::string>( _yn ); }
|
||||||
|
|
||||||
virtual size_t n_elements() const { return data_.size(); }
|
virtual size_t n_elements() const override { return data_.size(); }
|
||||||
virtual size_t element_size() const { return UnknownSize; }
|
virtual size_t element_size() const override { return UnknownSize; }
|
||||||
virtual size_t size_of() const
|
virtual size_t size_of() const override
|
||||||
{ return IO::size_of( data_ ); }
|
{ return IO::size_of( data_ ); }
|
||||||
|
|
||||||
virtual size_t size_of(size_t /* _n_elem */) const
|
virtual size_t size_of(size_t /* _n_elem */) const override
|
||||||
{ return UnknownSize; }
|
{ return UnknownSize; }
|
||||||
|
|
||||||
/// Store self as one binary block. Max. length of a string is 65535 bytes.
|
/// Store self as one binary block. Max. length of a string is 65535 bytes.
|
||||||
size_t store( std::ostream& _ostr, bool _swap ) const
|
size_t store( std::ostream& _ostr, bool _swap ) const override
|
||||||
{ return IO::store( _ostr, data_, _swap ); }
|
{ return IO::store( _ostr, data_, _swap ); }
|
||||||
|
|
||||||
size_t restore( std::istream& _istr, bool _swap )
|
size_t restore( std::istream& _istr, bool _swap ) override
|
||||||
{ return IO::restore( _istr, data_, _swap ); }
|
{ return IO::restore( _istr, data_, _swap ); }
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|||||||
@@ -322,21 +322,21 @@ private:
|
|||||||
#ifndef DOXY_IGNORE_THIS
|
#ifndef DOXY_IGNORE_THIS
|
||||||
struct Reserve
|
struct Reserve
|
||||||
{
|
{
|
||||||
Reserve(size_t _n) : n_(_n) {}
|
explicit Reserve(size_t _n) : n_(_n) {}
|
||||||
void operator()(BaseProperty* _p) const { if (_p) _p->reserve(n_); }
|
void operator()(BaseProperty* _p) const { if (_p) _p->reserve(n_); }
|
||||||
size_t n_;
|
size_t n_;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Resize
|
struct Resize
|
||||||
{
|
{
|
||||||
Resize(size_t _n) : n_(_n) {}
|
explicit Resize(size_t _n) : n_(_n) {}
|
||||||
void operator()(BaseProperty* _p) const { if (_p) _p->resize(n_); }
|
void operator()(BaseProperty* _p) const { if (_p) _p->resize(n_); }
|
||||||
size_t n_;
|
size_t n_;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ResizeIfSmaller
|
struct ResizeIfSmaller
|
||||||
{
|
{
|
||||||
ResizeIfSmaller(size_t _n) : n_(_n) {}
|
explicit ResizeIfSmaller(size_t _n) : n_(_n) {}
|
||||||
void operator()(BaseProperty* _p) const { if (_p && _p->n_elements() < n_) _p->resize(n_); }
|
void operator()(BaseProperty* _p) const { if (_p && _p->n_elements() < n_) _p->resize(n_); }
|
||||||
size_t n_;
|
size_t n_;
|
||||||
};
|
};
|
||||||
@@ -357,7 +357,7 @@ private:
|
|||||||
struct Delete
|
struct Delete
|
||||||
{
|
{
|
||||||
Delete() {}
|
Delete() {}
|
||||||
void operator()(BaseProperty* _p) const { if (_p) delete _p; _p=NULL; }
|
void operator()(BaseProperty* _p) const { if (_p) delete _p; }
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ public: //-------------------------------------------------------- public types
|
|||||||
typedef typename ModuleList::iterator ModuleListIterator;
|
typedef typename ModuleList::iterator ModuleListIterator;
|
||||||
|
|
||||||
public: //------------------------------------------------------ public methods
|
public: //------------------------------------------------------ public methods
|
||||||
BaseDecimaterT(Mesh& _mesh);
|
explicit BaseDecimaterT(Mesh& _mesh);
|
||||||
virtual ~BaseDecimaterT();
|
virtual ~BaseDecimaterT();
|
||||||
|
|
||||||
/** Initialize decimater and decimating modules.
|
/** Initialize decimater and decimating modules.
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ public: //-------------------------------------------------------- public types
|
|||||||
public: //------------------------------------------------------ public methods
|
public: //------------------------------------------------------ public methods
|
||||||
|
|
||||||
/// Constructor
|
/// Constructor
|
||||||
DecimaterT( Mesh& _mesh );
|
explicit DecimaterT( Mesh& _mesh );
|
||||||
|
|
||||||
/// Destructor
|
/// Destructor
|
||||||
~DecimaterT();
|
~DecimaterT();
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ class ModIndependentSetsT: public ModBaseT<MeshT> {
|
|||||||
;
|
;
|
||||||
|
|
||||||
/// Constructor
|
/// Constructor
|
||||||
ModIndependentSetsT(MeshT &_mesh) :
|
explicit ModIndependentSetsT(MeshT &_mesh) :
|
||||||
Base(_mesh, true) {
|
Base(_mesh, true) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -208,9 +208,9 @@ public:
|
|||||||
// the smaller the factor, the smaller normal_deviation_ gets
|
// the smaller the factor, the smaller normal_deviation_ gets
|
||||||
// thus creating a stricter constraint
|
// thus creating a stricter constraint
|
||||||
// division by error_tolerance_factor_ is for normalization
|
// division by error_tolerance_factor_ is for normalization
|
||||||
Scalar normal_deviation = normal_deviation_ * static_cast<Scalar>( 180.0 / M_PI * _factor / this->error_tolerance_factor_);
|
Scalar normal_deviation_value = normal_deviation_ * static_cast<Scalar>( 180.0 / M_PI * _factor / this->error_tolerance_factor_);
|
||||||
|
|
||||||
set_normal_deviation(normal_deviation);
|
set_normal_deviation(normal_deviation_value);
|
||||||
this->error_tolerance_factor_ = _factor;
|
this->error_tolerance_factor_ = _factor;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ public:
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
/// Constructor
|
/// Constructor
|
||||||
ModNormalFlippingT( MeshT &_mesh) : Base(_mesh, true)
|
explicit ModNormalFlippingT( MeshT &_mesh) : Base(_mesh, true)
|
||||||
{
|
{
|
||||||
set_max_normal_deviation( 90.0f );
|
set_max_normal_deviation( 90.0f );
|
||||||
const bool mesh_has_normals = _mesh.has_face_normals();
|
const bool mesh_has_normals = _mesh.has_face_normals();
|
||||||
@@ -159,8 +159,8 @@ public:
|
|||||||
// the smaller the factor, the smaller max_deviation_ gets
|
// the smaller the factor, the smaller max_deviation_ gets
|
||||||
// thus creating a stricter constraint
|
// thus creating a stricter constraint
|
||||||
// division by error_tolerance_factor_ is for normalization
|
// division by error_tolerance_factor_ is for normalization
|
||||||
double max_normal_deviation = (max_deviation_ * 180.0/M_PI) * _factor / this->error_tolerance_factor_;
|
double max_normal_deviation_value = (max_deviation_ * 180.0/M_PI) * _factor / this->error_tolerance_factor_;
|
||||||
set_max_normal_deviation(max_normal_deviation);
|
set_max_normal_deviation(max_normal_deviation_value);
|
||||||
this->error_tolerance_factor_ = _factor;
|
this->error_tolerance_factor_ = _factor;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ public:
|
|||||||
{
|
{
|
||||||
/// Initializing constructor copies appropriate handles from
|
/// Initializing constructor copies appropriate handles from
|
||||||
/// collapse information \c _ci.
|
/// collapse information \c _ci.
|
||||||
Info( const CollapseInfo& _ci )
|
explicit Info( const CollapseInfo& _ci )
|
||||||
: v0(_ci.v0), v1(_ci.v1), vl(_ci.vl),vr(_ci.vr)
|
: v0(_ci.v0), v1(_ci.v1), vl(_ci.vl),vr(_ci.vr)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
@@ -108,7 +108,7 @@ public:
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
/// Constructor
|
/// Constructor
|
||||||
ModProgMeshT( MeshT &_mesh ) : Base(_mesh, true)
|
explicit ModProgMeshT( MeshT &_mesh ) : Base(_mesh, true)
|
||||||
{
|
{
|
||||||
Base::mesh().add_property( idx_ );
|
Base::mesh().add_property( idx_ );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ public:
|
|||||||
/** Constructor
|
/** Constructor
|
||||||
* \internal
|
* \internal
|
||||||
*/
|
*/
|
||||||
ModQuadricT( MeshT &_mesh )
|
explicit ModQuadricT( MeshT &_mesh )
|
||||||
: Base(_mesh, false)
|
: Base(_mesh, false)
|
||||||
{
|
{
|
||||||
unset_max_err();
|
unset_max_err();
|
||||||
@@ -103,7 +103,7 @@ public:
|
|||||||
public: // inherited
|
public: // inherited
|
||||||
|
|
||||||
/// Initalize the module and prepare the mesh for decimation.
|
/// Initalize the module and prepare the mesh for decimation.
|
||||||
virtual void initialize(void);
|
virtual void initialize(void) override;
|
||||||
|
|
||||||
/** Compute collapse priority based on error quadrics.
|
/** Compute collapse priority based on error quadrics.
|
||||||
*
|
*
|
||||||
@@ -138,7 +138,7 @@ public: // inherited
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// set the percentage of maximum quadric error
|
/// set the percentage of maximum quadric error
|
||||||
void set_error_tolerance_factor(double _factor);
|
void set_error_tolerance_factor(double _factor) override;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ class ModRoundnessT : public ModBaseT<MeshT>
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
/// Constructor
|
/// Constructor
|
||||||
ModRoundnessT( MeshT &_dec ) :
|
explicit ModRoundnessT( MeshT &_dec ) :
|
||||||
Base(_dec, false),
|
Base(_dec, false),
|
||||||
min_r_(-1.0)
|
min_r_(-1.0)
|
||||||
{ }
|
{ }
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ private:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
JacobiLaplaceSmootherT( Mesh& _mesh ) : LaplaceSmootherT<Mesh>(_mesh) {}
|
explicit JacobiLaplaceSmootherT( Mesh& _mesh ) : LaplaceSmootherT<Mesh>(_mesh) {}
|
||||||
|
|
||||||
// override: alloc umbrellas
|
// override: alloc umbrellas
|
||||||
void smooth(unsigned int _n);
|
void smooth(unsigned int _n);
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ public:
|
|||||||
typedef typename SmootherT<Mesh>::EdgeHandle EdgeHandle;
|
typedef typename SmootherT<Mesh>::EdgeHandle EdgeHandle;
|
||||||
|
|
||||||
|
|
||||||
LaplaceSmootherT( Mesh& _mesh );
|
explicit LaplaceSmootherT( Mesh& _mesh );
|
||||||
virtual ~LaplaceSmootherT();
|
virtual ~LaplaceSmootherT();
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -134,7 +134,6 @@ compute_weights(LaplaceWeighting _weighting)
|
|||||||
typename Mesh::EdgeIter e_it, e_end(Base::mesh_.edges_end());
|
typename Mesh::EdgeIter e_it, e_end(Base::mesh_.edges_end());
|
||||||
typename Mesh::HalfedgeHandle heh0, heh1, heh2;
|
typename Mesh::HalfedgeHandle heh0, heh1, heh2;
|
||||||
typename Mesh::VertexHandle v0, v1;
|
typename Mesh::VertexHandle v0, v1;
|
||||||
const typename Mesh::Point *p0, *p1, *p2;
|
|
||||||
typename Mesh::Normal d0, d1;
|
typename Mesh::Normal d0, d1;
|
||||||
typename Mesh::Scalar weight, lb(-1.0), ub(1.0);
|
typename Mesh::Scalar weight, lb(-1.0), ub(1.0);
|
||||||
|
|
||||||
@@ -171,7 +170,9 @@ compute_weights(LaplaceWeighting _weighting)
|
|||||||
case CotWeighting:
|
case CotWeighting:
|
||||||
{
|
{
|
||||||
for (e_it=Base::mesh_.edges_begin(); e_it!=e_end; ++e_it)
|
for (e_it=Base::mesh_.edges_begin(); e_it!=e_end; ++e_it)
|
||||||
{
|
{
|
||||||
|
const typename Mesh::Point *p0, *p1, *p2;
|
||||||
|
|
||||||
weight = 0.0;
|
weight = 0.0;
|
||||||
|
|
||||||
heh0 = Base::mesh_.halfedge_handle(*e_it, 0);
|
heh0 = Base::mesh_.halfedge_handle(*e_it, 0);
|
||||||
|
|||||||
@@ -146,7 +146,7 @@ public:
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
/// Constructor
|
/// Constructor
|
||||||
CompositeT(Mesh& _mesh)
|
explicit CompositeT(Mesh& _mesh)
|
||||||
: subdiv_type_(0),
|
: subdiv_type_(0),
|
||||||
subdiv_rule_(NULL), /*first_rule_(NULL), last_rule_(NULL),*/ mesh_(_mesh)
|
subdiv_rule_(NULL), /*first_rule_(NULL), last_rule_(NULL),*/ mesh_(_mesh)
|
||||||
{ }
|
{ }
|
||||||
@@ -256,15 +256,15 @@ protected:
|
|||||||
protected: // helper
|
protected: // helper
|
||||||
|
|
||||||
// get current generation from state
|
// get current generation from state
|
||||||
state_t generation(state_t _s) { return _s-(_s % n_rules()); }
|
state_t generation(state_t _s) const { return _s-(_s % n_rules()); }
|
||||||
state_t generation( VH _vh ) { return generation(mesh_.data(_vh).state()); }
|
state_t generation( VH _vh ) const { return generation(mesh_.data(_vh).state()); }
|
||||||
state_t generation( EH _eh ) { return generation(mesh_.data(_eh).state()); }
|
state_t generation( EH _eh ) const { return generation(mesh_.data(_eh).state()); }
|
||||||
state_t generation( FH _fh ) { return generation(mesh_.data(_fh).state()); }
|
state_t generation( FH _fh ) const { return generation(mesh_.data(_fh).state()); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
// short cuts
|
// short cuts
|
||||||
Rule* t_rule() { return subdiv_rule_; }
|
Rule* t_rule() const { return subdiv_rule_; }
|
||||||
Rule* f_rule() { return rule_sequence_.front(); }
|
Rule* f_rule() { return rule_sequence_.front(); }
|
||||||
Rule* l_rule() { return rule_sequence_.back(); }
|
Rule* l_rule() { return rule_sequence_.back(); }
|
||||||
|
|
||||||
|
|||||||
@@ -96,7 +96,7 @@ struct RuleHandleT : public BaseHandle
|
|||||||
protected:\
|
protected:\
|
||||||
friend class CompositeT<mesh_type>; \
|
friend class CompositeT<mesh_type>; \
|
||||||
public: \
|
public: \
|
||||||
const char *type() const { return #classname; } \
|
const char *type() const override { return #classname; } \
|
||||||
typedef classname<mesh_type> Self; \
|
typedef classname<mesh_type> Self; \
|
||||||
typedef RuleHandleT< Self > Handle
|
typedef RuleHandleT< Self > Handle
|
||||||
|
|
||||||
@@ -118,7 +118,7 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
|
|
||||||
/// Default constructor
|
/// Default constructor
|
||||||
RuleInterfaceT(Mesh& _mesh) : mesh_(_mesh) {};
|
RuleInterfaceT(Mesh& _mesh) : mesh_(_mesh),prev_rule_(nullptr),subdiv_rule_(nullptr),subdiv_type_(0),number_(0),n_rules_(0) {};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
@@ -358,12 +358,12 @@ protected:
|
|||||||
Self* prev_rule() { return prev_rule_; }
|
Self* prev_rule() { return prev_rule_; }
|
||||||
|
|
||||||
void set_subdiv_rule(Self*& _n) { subdiv_rule_ = _n; }
|
void set_subdiv_rule(Self*& _n) { subdiv_rule_ = _n; }
|
||||||
Self* subdiv_rule() { return subdiv_rule_; }
|
Self* subdiv_rule() const { return subdiv_rule_; }
|
||||||
|
|
||||||
void set_number(int _n) { number_ = _n; }
|
void set_number(int _n) { number_ = _n; }
|
||||||
|
|
||||||
void set_n_rules(int _n) { n_rules_ = _n; }
|
void set_n_rules(int _n) { n_rules_ = _n; }
|
||||||
int n_rules() { return n_rules_; }
|
int n_rules() const { return n_rules_; }
|
||||||
|
|
||||||
void set_subdiv_type(int _n)
|
void set_subdiv_type(int _n)
|
||||||
{ assert(_n == 3 || _n == 4); subdiv_type_ = _n; }
|
{ assert(_n == 3 || _n == 4); subdiv_type_ = _n; }
|
||||||
|
|||||||
@@ -242,7 +242,7 @@ public:
|
|||||||
|
|
||||||
explicit FVc(M& _mesh) : Inherited(_mesh) { init_coeffs(50); }
|
explicit FVc(M& _mesh) : Inherited(_mesh) { init_coeffs(50); }
|
||||||
|
|
||||||
void raise(typename M::VertexHandle& _vh, state_t _target_state);
|
void raise(typename M::VertexHandle& _vh, state_t _target_state) override;
|
||||||
MIPS_WARN_WA(Face) // avoid warning
|
MIPS_WARN_WA(Face) // avoid warning
|
||||||
MIPS_WARN_WA(Edge) // avoid warning
|
MIPS_WARN_WA(Edge) // avoid warning
|
||||||
|
|
||||||
@@ -412,7 +412,7 @@ public:
|
|||||||
|
|
||||||
explicit EVc(M& _mesh) : Inherited(_mesh) { init_coeffs(50); }
|
explicit EVc(M& _mesh) : Inherited(_mesh) { init_coeffs(50); }
|
||||||
|
|
||||||
void raise(typename M::VertexHandle& _vh, state_t _target_state);
|
void raise(typename M::VertexHandle& _vh, state_t _target_state) override;
|
||||||
MIPS_WARN_WA(Face) // avoid warning
|
MIPS_WARN_WA(Face) // avoid warning
|
||||||
MIPS_WARN_WA(Edge) // avoid warning
|
MIPS_WARN_WA(Edge) // avoid warning
|
||||||
|
|
||||||
|
|||||||
@@ -114,15 +114,15 @@ public:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
const char *name() const { return "Uniform CatmullClark"; }
|
const char *name() const override { return "Uniform CatmullClark"; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
/// Initialize properties and weights
|
/// Initialize properties and weights
|
||||||
virtual bool prepare( MeshType& _m );
|
virtual bool prepare( MeshType& _m ) override;
|
||||||
|
|
||||||
/// Remove properties and weights
|
/// Remove properties and weights
|
||||||
virtual bool cleanup( MeshType& _m );
|
virtual bool cleanup( MeshType& _m ) override;
|
||||||
|
|
||||||
/** \brief Execute n subdivision steps
|
/** \brief Execute n subdivision steps
|
||||||
*
|
*
|
||||||
@@ -131,7 +131,7 @@ protected:
|
|||||||
* @param _update_points Unused here
|
* @param _update_points Unused here
|
||||||
* @return successful?
|
* @return successful?
|
||||||
*/
|
*/
|
||||||
virtual bool subdivide( MeshType& _m, size_t _n , const bool _update_points = true);
|
virtual bool subdivide( MeshType& _m, size_t _n , const bool _update_points = true) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
|||||||
@@ -102,13 +102,13 @@ public:
|
|||||||
|
|
||||||
public: // inherited interface
|
public: // inherited interface
|
||||||
|
|
||||||
virtual const char *name( void ) const = 0;
|
virtual const char *name( void ) const override = 0;
|
||||||
|
|
||||||
protected: // inherited interface
|
protected: // inherited interface
|
||||||
|
|
||||||
bool prepare( MeshType& _m );
|
bool prepare( MeshType& _m ) override;
|
||||||
|
|
||||||
bool subdivide( MeshType& _m, size_t _n, const bool _update_points = true )
|
bool subdivide( MeshType& _m, size_t _n, const bool _update_points = true ) override
|
||||||
{
|
{
|
||||||
assert( p_mesh_ == &_m );
|
assert( p_mesh_ == &_m );
|
||||||
|
|
||||||
@@ -124,7 +124,7 @@ protected: // inherited interface
|
|||||||
#ifdef NDEBUG
|
#ifdef NDEBUG
|
||||||
bool cleanup( MeshType& )
|
bool cleanup( MeshType& )
|
||||||
#else
|
#else
|
||||||
bool cleanup( MeshType& _m )
|
bool cleanup( MeshType& _m ) override
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
assert( p_mesh_ == &_m );
|
assert( p_mesh_ == &_m );
|
||||||
|
|||||||
@@ -86,6 +86,7 @@ struct CompositeTraits : public OpenMesh::DefaultTraits
|
|||||||
|
|
||||||
FaceTraits
|
FaceTraits
|
||||||
{
|
{
|
||||||
|
|
||||||
private:
|
private:
|
||||||
typedef typename Refs::HalfedgeHandle HalfedgeHandle;
|
typedef typename Refs::HalfedgeHandle HalfedgeHandle;
|
||||||
typedef typename Refs::Scalar Scalar;
|
typedef typename Refs::Scalar Scalar;
|
||||||
|
|||||||
@@ -82,16 +82,16 @@ public:
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
CompositeLoopT() : Inherited() {};
|
CompositeLoopT() : Inherited() {};
|
||||||
CompositeLoopT(MeshType& _mesh) : Inherited(_mesh) {};
|
explicit CompositeLoopT(MeshType& _mesh) : Inherited(_mesh) {};
|
||||||
~CompositeLoopT() {}
|
~CompositeLoopT() {}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
const char *name() const { return "Uniform Composite Loop"; }
|
const char *name() const override { return "Uniform Composite Loop"; }
|
||||||
|
|
||||||
protected: // inherited interface
|
protected: // inherited interface
|
||||||
|
|
||||||
void apply_rules(void)
|
void apply_rules(void) override
|
||||||
{
|
{
|
||||||
Inherited::Tvv4();
|
Inherited::Tvv4();
|
||||||
Inherited::VdE();
|
Inherited::VdE();
|
||||||
@@ -119,7 +119,7 @@ protected:
|
|||||||
weights_.end(), compute_weight() );
|
weights_.end(), compute_weight() );
|
||||||
}
|
}
|
||||||
|
|
||||||
double operator()(size_t _valence) { return weights_[_valence]; }
|
double operator()(size_t _valence) override { return weights_[_valence]; }
|
||||||
|
|
||||||
/// \internal
|
/// \internal
|
||||||
struct compute_weight
|
struct compute_weight
|
||||||
|
|||||||
@@ -82,16 +82,16 @@ public:
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
CompositeSqrt3T() : Inherited() {};
|
CompositeSqrt3T() : Inherited() {};
|
||||||
CompositeSqrt3T(MeshType& _mesh) : Inherited(_mesh) {};
|
explicit CompositeSqrt3T(MeshType& _mesh) : Inherited(_mesh) {};
|
||||||
~CompositeSqrt3T() {}
|
~CompositeSqrt3T() {}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
const char *name() const { return "Uniform Composite Sqrt3"; }
|
const char *name() const override { return "Uniform Composite Sqrt3"; }
|
||||||
|
|
||||||
protected: // inherited interface
|
protected: // inherited interface
|
||||||
|
|
||||||
void apply_rules(void)
|
void apply_rules(void) override
|
||||||
{
|
{
|
||||||
Inherited::Tvv3();
|
Inherited::Tvv3();
|
||||||
Inherited::VF();
|
Inherited::VF();
|
||||||
@@ -117,7 +117,7 @@ protected:
|
|||||||
weights_.end(), compute_weight() );
|
weights_.end(), compute_weight() );
|
||||||
}
|
}
|
||||||
|
|
||||||
double operator()(size_t _valence) { return weights_[_valence]; }
|
double operator()(size_t _valence) override { return weights_[_valence]; }
|
||||||
|
|
||||||
/** \internal
|
/** \internal
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -106,7 +106,7 @@ public:
|
|||||||
{ init_weights(); }
|
{ init_weights(); }
|
||||||
|
|
||||||
|
|
||||||
LoopT( mesh_t& _m ) : parent_t(_m), _1over8( 1.0/8.0 ), _3over8( 3.0/8.0 )
|
explicit LoopT( mesh_t& _m ) : parent_t(_m), _1over8( 1.0/8.0 ), _3over8( 3.0/8.0 )
|
||||||
{ init_weights(); }
|
{ init_weights(); }
|
||||||
|
|
||||||
|
|
||||||
@@ -116,7 +116,7 @@ public:
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
|
|
||||||
const char *name() const { return "Uniform Loop"; }
|
const char *name() const override { return "Uniform Loop"; }
|
||||||
|
|
||||||
|
|
||||||
/// Pre-compute weights
|
/// Pre-compute weights
|
||||||
@@ -130,7 +130,7 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
|
||||||
bool prepare( mesh_t& _m )
|
bool prepare( mesh_t& _m ) override
|
||||||
{
|
{
|
||||||
_m.add_property( vp_pos_ );
|
_m.add_property( vp_pos_ );
|
||||||
_m.add_property( ep_pos_ );
|
_m.add_property( ep_pos_ );
|
||||||
@@ -138,7 +138,7 @@ protected:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool cleanup( mesh_t& _m )
|
bool cleanup( mesh_t& _m ) override
|
||||||
{
|
{
|
||||||
_m.remove_property( vp_pos_ );
|
_m.remove_property( vp_pos_ );
|
||||||
_m.remove_property( ep_pos_ );
|
_m.remove_property( ep_pos_ );
|
||||||
@@ -146,7 +146,7 @@ protected:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool subdivide( mesh_t& _m, size_t _n, const bool _update_points = true)
|
bool subdivide( mesh_t& _m, size_t _n, const bool _update_points = true) override
|
||||||
{
|
{
|
||||||
|
|
||||||
///TODO:Implement fixed positions
|
///TODO:Implement fixed positions
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ public:
|
|||||||
{ init_weights(); }
|
{ init_weights(); }
|
||||||
|
|
||||||
|
|
||||||
ModifiedButterflyT( mesh_t& _m) : parent_t(_m)
|
explicit ModifiedButterflyT( mesh_t& _m) : parent_t(_m)
|
||||||
{ init_weights(); }
|
{ init_weights(); }
|
||||||
|
|
||||||
|
|
||||||
@@ -117,7 +117,7 @@ public:
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
|
|
||||||
const char *name() const { return "Uniform Spectral"; }
|
const char *name() const override { return "Uniform Spectral"; }
|
||||||
|
|
||||||
|
|
||||||
/// Pre-compute weights
|
/// Pre-compute weights
|
||||||
@@ -158,7 +158,7 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
|
||||||
bool prepare( mesh_t& _m )
|
bool prepare( mesh_t& _m ) override
|
||||||
{
|
{
|
||||||
_m.add_property( vp_pos_ );
|
_m.add_property( vp_pos_ );
|
||||||
_m.add_property( ep_pos_ );
|
_m.add_property( ep_pos_ );
|
||||||
@@ -166,7 +166,7 @@ protected:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool cleanup( mesh_t& _m )
|
bool cleanup( mesh_t& _m ) override
|
||||||
{
|
{
|
||||||
_m.remove_property( vp_pos_ );
|
_m.remove_property( vp_pos_ );
|
||||||
_m.remove_property( ep_pos_ );
|
_m.remove_property( ep_pos_ );
|
||||||
@@ -174,7 +174,7 @@ protected:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool subdivide( MeshType& _m, size_t _n , const bool _update_points = true)
|
bool subdivide( MeshType& _m, size_t _n , const bool _update_points = true) override
|
||||||
{
|
{
|
||||||
|
|
||||||
///TODO:Implement fixed positions
|
///TODO:Implement fixed positions
|
||||||
|
|||||||
@@ -119,7 +119,7 @@ public:
|
|||||||
InterpolatingSqrt3LGT(void) : parent_t()
|
InterpolatingSqrt3LGT(void) : parent_t()
|
||||||
{ init_weights(); }
|
{ init_weights(); }
|
||||||
|
|
||||||
InterpolatingSqrt3LGT(MeshType &_m) : parent_t(_m)
|
explicit InterpolatingSqrt3LGT(MeshType &_m) : parent_t(_m)
|
||||||
{ init_weights(); }
|
{ init_weights(); }
|
||||||
|
|
||||||
virtual ~InterpolatingSqrt3LGT() {}
|
virtual ~InterpolatingSqrt3LGT() {}
|
||||||
@@ -128,7 +128,7 @@ public:
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
|
|
||||||
const char *name() const { return "Uniform Interpolating Sqrt3"; }
|
const char *name() const override { return "Uniform Interpolating Sqrt3"; }
|
||||||
|
|
||||||
/// Pre-compute weights
|
/// Pre-compute weights
|
||||||
void init_weights(size_t _max_valence=50)
|
void init_weights(size_t _max_valence=50)
|
||||||
@@ -170,7 +170,7 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
|
||||||
bool prepare( MeshType& _m )
|
bool prepare( MeshType& _m ) override
|
||||||
{
|
{
|
||||||
_m.request_edge_status();
|
_m.request_edge_status();
|
||||||
_m.add_property( fp_pos_ );
|
_m.add_property( fp_pos_ );
|
||||||
@@ -183,7 +183,7 @@ protected:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool cleanup( MeshType& _m )
|
bool cleanup( MeshType& _m ) override
|
||||||
{
|
{
|
||||||
_m.release_edge_status();
|
_m.release_edge_status();
|
||||||
_m.remove_property( fp_pos_ );
|
_m.remove_property( fp_pos_ );
|
||||||
@@ -193,7 +193,7 @@ protected:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool subdivide( MeshType& _m, size_t _n , const bool _update_points = true)
|
bool subdivide( MeshType& _m, size_t _n , const bool _update_points = true) override
|
||||||
{
|
{
|
||||||
|
|
||||||
///TODO:Implement fixed positions
|
///TODO:Implement fixed positions
|
||||||
|
|||||||
@@ -112,7 +112,7 @@ public:
|
|||||||
Sqrt3T(void) : parent_t(), _1over3( real_t(1.0/3.0) ), _1over27( real_t(1.0/27.0) )
|
Sqrt3T(void) : parent_t(), _1over3( real_t(1.0/3.0) ), _1over27( real_t(1.0/27.0) )
|
||||||
{ init_weights(); }
|
{ init_weights(); }
|
||||||
|
|
||||||
Sqrt3T(MeshType &_m) : parent_t(_m), _1over3( real_t(1.0/3.0) ), _1over27( real_t(1.0/27.0) )
|
explicit Sqrt3T(MeshType &_m) : parent_t(_m), _1over3( real_t(1.0/3.0) ), _1over27( real_t(1.0/27.0) )
|
||||||
{ init_weights(); }
|
{ init_weights(); }
|
||||||
|
|
||||||
virtual ~Sqrt3T() {}
|
virtual ~Sqrt3T() {}
|
||||||
@@ -121,7 +121,7 @@ public:
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
|
|
||||||
const char *name() const { return "Uniform Sqrt3"; }
|
const char *name() const override { return "Uniform Sqrt3"; }
|
||||||
|
|
||||||
|
|
||||||
/// Pre-compute weights
|
/// Pre-compute weights
|
||||||
@@ -135,7 +135,7 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
|
||||||
bool prepare( MeshType& _m )
|
bool prepare( MeshType& _m ) override
|
||||||
{
|
{
|
||||||
_m.request_edge_status();
|
_m.request_edge_status();
|
||||||
_m.add_property( vp_pos_ );
|
_m.add_property( vp_pos_ );
|
||||||
@@ -148,7 +148,7 @@ protected:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool cleanup( MeshType& _m )
|
bool cleanup( MeshType& _m ) override
|
||||||
{
|
{
|
||||||
_m.release_edge_status();
|
_m.release_edge_status();
|
||||||
_m.remove_property( vp_pos_ );
|
_m.remove_property( vp_pos_ );
|
||||||
@@ -157,7 +157,7 @@ protected:
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool subdivide( MeshType& _m, size_t _n , const bool _update_points = true)
|
bool subdivide( MeshType& _m, size_t _n , const bool _update_points = true) override
|
||||||
{
|
{
|
||||||
|
|
||||||
///TODO:Implement fixed positions
|
///TODO:Implement fixed positions
|
||||||
|
|||||||
@@ -152,7 +152,7 @@ public:
|
|||||||
{}
|
{}
|
||||||
#else
|
#else
|
||||||
/// Construct with a given \c HeapIterface.
|
/// Construct with a given \c HeapIterface.
|
||||||
HeapT(const HeapInterface &_interface)
|
explicit HeapT(const HeapInterface &_interface)
|
||||||
: HeapVector(), interface_(_interface)
|
: HeapVector(), interface_(_interface)
|
||||||
{}
|
{}
|
||||||
#endif
|
#endif
|
||||||
@@ -258,9 +258,9 @@ public:
|
|||||||
bool check()
|
bool check()
|
||||||
{
|
{
|
||||||
bool ok(true);
|
bool ok(true);
|
||||||
unsigned int i, j;
|
for (unsigned int i=0; i<size(); ++i)
|
||||||
for (i=0; i<size(); ++i)
|
|
||||||
{
|
{
|
||||||
|
unsigned int j;
|
||||||
if (((j=left(i))<size()) && interface_.greater(entry(i), entry(j)))
|
if (((j=left(i))<size()) && interface_.greater(entry(i), entry(j)))
|
||||||
{
|
{
|
||||||
omerr() << "Heap condition violated\n";
|
omerr() << "Heap condition violated\n";
|
||||||
@@ -351,12 +351,11 @@ HeapT<HeapEntry, HeapInterface>::
|
|||||||
downheap(size_t _idx)
|
downheap(size_t _idx)
|
||||||
{
|
{
|
||||||
const HeapEntry h = entry(_idx);
|
const HeapEntry h = entry(_idx);
|
||||||
size_t childIdx;
|
|
||||||
const size_t s = size();
|
const size_t s = size();
|
||||||
|
|
||||||
while(_idx < s)
|
while(_idx < s)
|
||||||
{
|
{
|
||||||
childIdx = left(_idx);
|
size_t childIdx = left(_idx);
|
||||||
if (childIdx >= s) break;
|
if (childIdx >= s) break;
|
||||||
|
|
||||||
if ((childIdx + 1 < s) && (interface_.less(entry(childIdx + 1), entry(childIdx))))
|
if ((childIdx + 1 < s) && (interface_.less(entry(childIdx + 1), entry(childIdx))))
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
/// Default constructor
|
/// Default constructor
|
||||||
StripifierT(Mesh& _mesh);
|
explicit StripifierT(Mesh& _mesh);
|
||||||
|
|
||||||
/// Destructor
|
/// Destructor
|
||||||
~StripifierT();
|
~StripifierT();
|
||||||
|
|||||||
@@ -100,11 +100,11 @@ public:
|
|||||||
TimerImplWin32(void);
|
TimerImplWin32(void);
|
||||||
~TimerImplWin32(void) { ; }
|
~TimerImplWin32(void) { ; }
|
||||||
|
|
||||||
virtual void reset(void);
|
virtual void reset(void) override;
|
||||||
virtual void start(void);
|
virtual void start(void) override;
|
||||||
virtual void stop(void);
|
virtual void stop(void) override;
|
||||||
virtual void cont(void);
|
virtual void cont(void) override;
|
||||||
virtual double seconds(void) const;
|
virtual double seconds(void) const override;
|
||||||
};
|
};
|
||||||
|
|
||||||
TimerImplWin32::TimerImplWin32(void)
|
TimerImplWin32::TimerImplWin32(void)
|
||||||
@@ -198,10 +198,10 @@ public:
|
|||||||
~TimerImplGToD()
|
~TimerImplGToD()
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
virtual void reset(void) { seconds_ = 0.0; }
|
virtual void reset(void) override { seconds_ = 0.0; }
|
||||||
virtual void start(void) { seconds_ = 0.0; gettimeofday( &start_, &tz_ ); }
|
virtual void start(void) override { seconds_ = 0.0; gettimeofday( &start_, &tz_ ); }
|
||||||
|
|
||||||
virtual void stop(void)
|
virtual void stop(void) override
|
||||||
{
|
{
|
||||||
gettimeofday( &stop_, &tz_ );
|
gettimeofday( &stop_, &tz_ );
|
||||||
|
|
||||||
@@ -209,9 +209,9 @@ public:
|
|||||||
seconds_ += (double)(stop_.tv_usec- start_.tv_usec)*1e-6;
|
seconds_ += (double)(stop_.tv_usec- start_.tv_usec)*1e-6;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void cont(void) { gettimeofday( &start_, &tz_); }
|
virtual void cont(void) override { gettimeofday( &start_, &tz_); }
|
||||||
|
|
||||||
virtual double seconds() const { return seconds_; }
|
virtual double seconds() const override { return seconds_; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
@@ -234,11 +234,11 @@ public:
|
|||||||
TimerImplStd() : freq_(clockticks),count_(0),start_(0) { reset(); }
|
TimerImplStd() : freq_(clockticks),count_(0),start_(0) { reset(); }
|
||||||
~TimerImplStd() { ; }
|
~TimerImplStd() { ; }
|
||||||
|
|
||||||
virtual void reset(void) { count_ = 0; }
|
virtual void reset(void) override { count_ = 0; }
|
||||||
virtual void start(void) { count_ = 0; start_ = clock(); }
|
virtual void start(void) override { count_ = 0; start_ = clock(); }
|
||||||
virtual void stop(void);
|
virtual void stop(void) override;
|
||||||
virtual void cont(void) { start_ = clock(); }
|
virtual void cont(void) override { start_ = clock(); }
|
||||||
virtual double seconds(void) const { return (double)count_/(double)freq_; }
|
virtual double seconds(void) const override { return (double)count_/(double)freq_; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
unsigned long freq_;
|
unsigned long freq_;
|
||||||
|
|||||||
@@ -37,183 +37,183 @@
|
|||||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
|
||||||
* *
|
* *
|
||||||
* ========================================================================= */
|
* ========================================================================= */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
//
|
//
|
||||||
// CLASS newClass
|
// CLASS newClass
|
||||||
//
|
//
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
|
|
||||||
#ifndef OPENMESH_VDPROGMESH_VHIERARCHYWINDOWS_HH
|
#ifndef OPENMESH_VDPROGMESH_VHIERARCHYWINDOWS_HH
|
||||||
#define OPENMESH_VDPROGMESH_VHIERARCHYWINDOWS_HH
|
#define OPENMESH_VDPROGMESH_VHIERARCHYWINDOWS_HH
|
||||||
|
|
||||||
|
|
||||||
//== INCLUDES =================================================================
|
//== INCLUDES =================================================================
|
||||||
|
|
||||||
#include <OpenMesh/Tools/VDPM/VHierarchy.hh>
|
#include <OpenMesh/Tools/VDPM/VHierarchy.hh>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
//== FORWARDDECLARATIONS ======================================================
|
//== FORWARDDECLARATIONS ======================================================
|
||||||
|
|
||||||
|
|
||||||
//== NAMESPACES ===============================================================
|
//== NAMESPACES ===============================================================
|
||||||
|
|
||||||
namespace OpenMesh {
|
namespace OpenMesh {
|
||||||
namespace VDPM {
|
namespace VDPM {
|
||||||
|
|
||||||
//== CLASS DEFINITION =========================================================
|
//== CLASS DEFINITION =========================================================
|
||||||
|
|
||||||
|
|
||||||
/** \todo VHierarchyWindow documentation
|
/** \todo VHierarchyWindow documentation
|
||||||
*/
|
*/
|
||||||
class VHierarchyWindow
|
class VHierarchyWindow
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
|
|
||||||
// reference of vertex hierarchy
|
// reference of vertex hierarchy
|
||||||
VHierarchy *vhierarchy_;
|
VHierarchy *vhierarchy_;
|
||||||
|
|
||||||
// bits buffer (byte units)
|
// bits buffer (byte units)
|
||||||
unsigned char *buffer_;
|
unsigned char *buffer_;
|
||||||
int buffer_min_;
|
int buffer_min_;
|
||||||
size_t buffer_max_;
|
size_t buffer_max_;
|
||||||
int current_pos_;
|
int current_pos_;
|
||||||
|
|
||||||
// window (byte units)
|
// window (byte units)
|
||||||
int window_min_;
|
int window_min_;
|
||||||
int window_max_;
|
int window_max_;
|
||||||
|
|
||||||
|
|
||||||
// # of right shift (bit units)
|
// # of right shift (bit units)
|
||||||
unsigned char n_shift_; // [0, 7]
|
unsigned char n_shift_; // [0, 7]
|
||||||
|
|
||||||
unsigned char flag8(unsigned char n_shift) const
|
unsigned char flag8(unsigned char n_shift) const
|
||||||
{ return 0x80 >> n_shift; }
|
{ return 0x80 >> n_shift; }
|
||||||
|
|
||||||
unsigned char flag8(VHierarchyNodeHandle _node_handle) const
|
unsigned char flag8(VHierarchyNodeHandle _node_handle) const
|
||||||
{
|
{
|
||||||
assert(_node_handle.idx() >= 0);
|
assert(_node_handle.idx() >= 0);
|
||||||
return 0x80 >> (unsigned int) (_node_handle.idx() % 8);
|
return 0x80 >> (unsigned int) (_node_handle.idx() % 8);
|
||||||
}
|
}
|
||||||
int byte_idx(VHierarchyNodeHandle _node_handle) const
|
int byte_idx(VHierarchyNodeHandle _node_handle) const
|
||||||
{
|
{
|
||||||
assert(_node_handle.idx() >= 0);
|
assert(_node_handle.idx() >= 0);
|
||||||
return _node_handle.idx() / 8;
|
return _node_handle.idx() / 8;
|
||||||
}
|
}
|
||||||
int buffer_idx(VHierarchyNodeHandle _node_handle) const
|
int buffer_idx(VHierarchyNodeHandle _node_handle) const
|
||||||
{ return byte_idx(_node_handle) - buffer_min_; }
|
{ return byte_idx(_node_handle) - buffer_min_; }
|
||||||
|
|
||||||
bool before_window(VHierarchyNodeHandle _node_handle) const
|
bool before_window(VHierarchyNodeHandle _node_handle) const
|
||||||
{ return (_node_handle.idx()/8 < window_min_) ? true : false; }
|
{ return (_node_handle.idx()/8 < window_min_) ? true : false; }
|
||||||
|
|
||||||
bool after_window(VHierarchyNodeHandle _node_handle) const
|
bool after_window(VHierarchyNodeHandle _node_handle) const
|
||||||
{ return (_node_handle.idx()/8 < window_max_) ? false : true; }
|
{ return (_node_handle.idx()/8 < window_max_) ? false : true; }
|
||||||
|
|
||||||
bool underflow(VHierarchyNodeHandle _node_handle) const
|
bool underflow(VHierarchyNodeHandle _node_handle) const
|
||||||
{ return (_node_handle.idx()/8 < buffer_min_) ? true : false; }
|
{ return (_node_handle.idx()/8 < buffer_min_) ? true : false; }
|
||||||
|
|
||||||
bool overflow(VHierarchyNodeHandle _node_handle) const
|
bool overflow(VHierarchyNodeHandle _node_handle) const
|
||||||
{ return (_node_handle.idx()/8 < int(buffer_max_) ) ? false : true; }
|
{ return (_node_handle.idx()/8 < int(buffer_max_) ) ? false : true; }
|
||||||
|
|
||||||
bool update_buffer(VHierarchyNodeHandle _node_handle);
|
bool update_buffer(VHierarchyNodeHandle _node_handle);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
VHierarchyWindow();
|
VHierarchyWindow();
|
||||||
VHierarchyWindow(VHierarchy &_vhierarchy);
|
explicit VHierarchyWindow(VHierarchy &_vhierarchy);
|
||||||
~VHierarchyWindow(void);
|
~VHierarchyWindow(void);
|
||||||
|
|
||||||
void set_vertex_hierarchy(VHierarchy &_vhierarchy)
|
void set_vertex_hierarchy(VHierarchy &_vhierarchy)
|
||||||
{ vhierarchy_ = &_vhierarchy; }
|
{ vhierarchy_ = &_vhierarchy; }
|
||||||
|
|
||||||
void begin()
|
void begin()
|
||||||
{
|
{
|
||||||
int new_window_min = window_min_;
|
int new_window_min = window_min_;
|
||||||
for (current_pos_=window_min_-buffer_min_;
|
for (current_pos_=window_min_-buffer_min_;
|
||||||
current_pos_ < window_size(); ++current_pos_)
|
current_pos_ < window_size(); ++current_pos_)
|
||||||
{
|
{
|
||||||
if (buffer_[current_pos_] == 0)
|
if (buffer_[current_pos_] == 0)
|
||||||
++new_window_min;
|
++new_window_min;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
n_shift_ = 0;
|
n_shift_ = 0;
|
||||||
while ((buffer_[current_pos_] & flag8(n_shift_)) == 0)
|
while ((buffer_[current_pos_] & flag8(n_shift_)) == 0)
|
||||||
++n_shift_;
|
++n_shift_;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
window_min_ = new_window_min;
|
window_min_ = new_window_min;
|
||||||
}
|
}
|
||||||
|
|
||||||
void next()
|
void next()
|
||||||
{
|
{
|
||||||
++n_shift_;
|
++n_shift_;
|
||||||
if (n_shift_ == 8)
|
if (n_shift_ == 8)
|
||||||
{
|
{
|
||||||
n_shift_ = 0;
|
n_shift_ = 0;
|
||||||
++current_pos_;
|
++current_pos_;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (current_pos_ < window_max_-buffer_min_)
|
while (current_pos_ < window_max_-buffer_min_)
|
||||||
{
|
{
|
||||||
if (buffer_[current_pos_] != 0) // if the current byte has non-zero bits
|
if (buffer_[current_pos_] != 0) // if the current byte has non-zero bits
|
||||||
{
|
{
|
||||||
while (n_shift_ != 8)
|
while (n_shift_ != 8)
|
||||||
{
|
{
|
||||||
if ((buffer_[current_pos_] & flag8(n_shift_)) != 0)
|
if ((buffer_[current_pos_] & flag8(n_shift_)) != 0)
|
||||||
return; // find 1 bit in the current byte
|
return; // find 1 bit in the current byte
|
||||||
++n_shift_;
|
++n_shift_;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
n_shift_ = 0;
|
n_shift_ = 0;
|
||||||
++current_pos_;
|
++current_pos_;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
bool end() { return !(current_pos_ < window_max_-buffer_min_); }
|
bool end() { return !(current_pos_ < window_max_-buffer_min_); }
|
||||||
|
|
||||||
int window_size() const { return window_max_ - window_min_; }
|
int window_size() const { return window_max_ - window_min_; }
|
||||||
size_t buffer_size() const { return buffer_max_ - buffer_min_; }
|
size_t buffer_size() const { return buffer_max_ - buffer_min_; }
|
||||||
|
|
||||||
VHierarchyNodeHandle node_handle()
|
VHierarchyNodeHandle node_handle()
|
||||||
{
|
{
|
||||||
return VHierarchyNodeHandle(8*(buffer_min_+current_pos_) + (int)n_shift_);
|
return VHierarchyNodeHandle(8*(buffer_min_+current_pos_) + (int)n_shift_);
|
||||||
}
|
}
|
||||||
|
|
||||||
void activate(VHierarchyNodeHandle _node_handle)
|
void activate(VHierarchyNodeHandle _node_handle)
|
||||||
{
|
{
|
||||||
update_buffer(_node_handle);
|
update_buffer(_node_handle);
|
||||||
buffer_[buffer_idx(_node_handle)] |= flag8(_node_handle);
|
buffer_[buffer_idx(_node_handle)] |= flag8(_node_handle);
|
||||||
window_min_ = std::min(window_min_, byte_idx(_node_handle));
|
window_min_ = std::min(window_min_, byte_idx(_node_handle));
|
||||||
window_max_ = std::max(window_max_, 1+byte_idx(_node_handle));
|
window_max_ = std::max(window_max_, 1+byte_idx(_node_handle));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void inactivate(VHierarchyNodeHandle _node_handle)
|
void inactivate(VHierarchyNodeHandle _node_handle)
|
||||||
{
|
{
|
||||||
if (is_active(_node_handle) != true) return;
|
if (is_active(_node_handle) != true) return;
|
||||||
buffer_[buffer_idx(_node_handle)] ^= flag8(_node_handle);
|
buffer_[buffer_idx(_node_handle)] ^= flag8(_node_handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool is_active(VHierarchyNodeHandle _node_handle) const
|
bool is_active(VHierarchyNodeHandle _node_handle) const
|
||||||
{
|
{
|
||||||
if (before_window(_node_handle) == true ||
|
if (before_window(_node_handle) == true ||
|
||||||
after_window(_node_handle) == true)
|
after_window(_node_handle) == true)
|
||||||
return false;
|
return false;
|
||||||
return ((buffer_[buffer_idx(_node_handle)] & flag8(_node_handle)) > 0);
|
return ((buffer_[buffer_idx(_node_handle)] & flag8(_node_handle)) > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void init(VHierarchyNodeHandleContainer &_roots);
|
void init(VHierarchyNodeHandleContainer &_roots);
|
||||||
void update_with_vsplit(VHierarchyNodeHandle _parent_handle);
|
void update_with_vsplit(VHierarchyNodeHandle _parent_handle);
|
||||||
void update_with_ecol(VHierarchyNodeHandle _parent_handle);
|
void update_with_ecol(VHierarchyNodeHandle _parent_handle);
|
||||||
};
|
};
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
} // namespace VDPM
|
} // namespace VDPM
|
||||||
} // namespace OpenMesh
|
} // namespace OpenMesh
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
#endif // OPENMESH_VDPROGMESH_VHIERARCHYWINDOWS_HH
|
#endif // OPENMESH_VDPROGMESH_VHIERARCHYWINDOWS_HH
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user