Commit 1433c79d authored by Jan Möbius's avatar Jan Möbius

Use autopointers

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@9665 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 3610cfc9
...@@ -43,22 +43,22 @@ ...@@ -43,22 +43,22 @@
#include "DecimaterInfo.hh" #include "DecimaterInfo.hh"
DecimaterInfo::DecimaterInfo(TriMesh* _mesh) : DecimaterInfo::DecimaterInfo(TriMesh* _mesh) :
decimater_(0), decimater_(),
normalDeviation_(false), normalDeviation_(false),
distance_(false), distance_(false),
roundness_(false) roundness_(false)
{ {
decimater_ = new DecimaterType( *_mesh ); decimater_ = std::tr1::shared_ptr< DecimaterType >( new DecimaterType( *_mesh ) );
decimater_->add( hModQuadric_priority ); decimater()->add( hModQuadric_priority );
decimater_->module( hModQuadric_priority ).unset_max_err(); decimater()->module( hModQuadric_priority ).unset_max_err();
} }
DecimaterInfo::~DecimaterInfo() { DecimaterInfo::~DecimaterInfo() {
if ( decimater_ ) // if ( decimater_ )
delete decimater_; // delete decimater_;
} }
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------------
...@@ -66,22 +66,22 @@ DecimaterInfo::~DecimaterInfo() { ...@@ -66,22 +66,22 @@ DecimaterInfo::~DecimaterInfo() {
void DecimaterInfo::removeConstraints(){ void DecimaterInfo::removeConstraints(){
decimater_->module( hModQuadric_priority ).unset_max_err(); decimater()->module( hModQuadric_priority ).unset_max_err();
//remove modules //remove modules
if ( normalDeviation_ ) { if ( normalDeviation_ ) {
decimater_->remove( hModNormalFlipping ); decimater()->remove( hModNormalFlipping );
normalDeviation_ = false; normalDeviation_ = false;
} }
if ( distance_ ) { if ( distance_ ) {
decimater_->remove( hModQuadric ); decimater()->remove( hModQuadric );
distance_ = false; distance_ = false;
} }
if ( roundness_ ) { if ( roundness_ ) {
decimater_->remove( hModRoundness ); decimater()->remove( hModRoundness );
roundness_ = false; roundness_ = false;
} }
...@@ -92,8 +92,8 @@ void DecimaterInfo::removeConstraints(){ ...@@ -92,8 +92,8 @@ void DecimaterInfo::removeConstraints(){
void DecimaterInfo::setDistanceConstraint( double _value ){ void DecimaterInfo::setDistanceConstraint( double _value ){
if ( decimater_->add( hModQuadric ) ) { if ( decimater()->add( hModQuadric ) ) {
decimater_->module( hModQuadric ).set_max_err( _value ); decimater()->module( hModQuadric ).set_max_err( _value );
distance_ = true; distance_ = true;
} }
} }
...@@ -103,8 +103,8 @@ void DecimaterInfo::setDistanceConstraint( double _value ){ ...@@ -103,8 +103,8 @@ void DecimaterInfo::setDistanceConstraint( double _value ){
void DecimaterInfo::setNormalDeviationConstraint( int _value ){ void DecimaterInfo::setNormalDeviationConstraint( int _value ){
if ( decimater_->add( hModNormalFlipping ) ) { if ( decimater()->add( hModNormalFlipping ) ) {
decimater_->module( hModNormalFlipping ).set_normal_deviation( _value ); decimater()->module( hModNormalFlipping ).set_normal_deviation( _value );
normalDeviation_ = true; normalDeviation_ = true;
} }
} }
...@@ -114,8 +114,8 @@ void DecimaterInfo::setNormalDeviationConstraint( int _value ){ ...@@ -114,8 +114,8 @@ void DecimaterInfo::setNormalDeviationConstraint( int _value ){
void DecimaterInfo::setRoundnessConstraint( double _value ){ void DecimaterInfo::setRoundnessConstraint( double _value ){
if ( decimater_->add( hModRoundness ) ) { if ( decimater()->add( hModRoundness ) ) {
decimater_->module( hModRoundness ).set_min_roundness( _value , true ); decimater()->module( hModRoundness ).set_min_roundness( _value , true );
roundness_ = true; roundness_ = true;
} }
} }
......
...@@ -79,11 +79,11 @@ class DecimaterInfo : public PerObjectData ...@@ -79,11 +79,11 @@ class DecimaterInfo : public PerObjectData
void setNormalDeviationConstraint( int _value ); void setNormalDeviationConstraint( int _value );
void setRoundnessConstraint( double _value ); void setRoundnessConstraint( double _value );
DecimaterType* decimater() { return decimater_; }; DecimaterType* decimater() { return decimater_.get(); };
private : private :
OpenMesh::Decimater::DecimaterT< TriMesh >* decimater_; std::tr1::shared_ptr< DecimaterType > decimater_;
bool normalDeviation_; bool normalDeviation_;
bool distance_; bool distance_;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment