Commit 7ae2a82c authored by David Bommes's avatar David Bommes

now compatible with flipper

-updated normals after smoothing
-add possibility for using fixed weights
-removed unnecessary garbage collection

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@11739 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 2e53f9a9
...@@ -46,7 +46,9 @@ ...@@ -46,7 +46,9 @@
SmootherObject::SmootherObject() : SmootherObject::SmootherObject() :
distance_(0.0f), distance_(0.0f),
respectFeatures_(false), respectFeatures_(false),
iterations_(0u) { iterations_(0u),
initialized_(false)
{
} }
SmootherObject::~SmootherObject() { SmootherObject::~SmootherObject() {
......
...@@ -70,12 +70,14 @@ class SmootherObject : public PerObjectData ...@@ -70,12 +70,14 @@ class SmootherObject : public PerObjectData
void distance(float _distance) { distance_ = _distance; } void distance(float _distance) { distance_ = _distance; }
void features(bool _features) { respectFeatures_ = _features; } void features(bool _features) { respectFeatures_ = _features; }
void iterations(uint _iterations) { iterations_ = _iterations; } void iterations(uint _iterations) { iterations_ = _iterations; }
void initialized(bool _initialized) { initialized_ = _initialized; }
SmoothingComponent component() { return component_; } SmoothingComponent component() { return component_; }
SmoothingContinuity continuity() { return continuity_; } SmoothingContinuity continuity() { return continuity_; }
float distance() { return distance_; } float distance() { return distance_; }
bool features() { return respectFeatures_; } bool features() { return respectFeatures_; }
uint iterations() { return iterations_; } uint iterations() { return iterations_; }
bool initialized() { return initialized_;}
private: private:
// Smoothing attributes // Smoothing attributes
...@@ -91,5 +93,8 @@ class SmootherObject : public PerObjectData ...@@ -91,5 +93,8 @@ class SmootherObject : public PerObjectData
// Iterations // Iterations
uint iterations_; uint iterations_;
// initialization necessary?
bool initialized_;
}; };
...@@ -191,7 +191,13 @@ slot_smooth() ...@@ -191,7 +191,13 @@ slot_smooth()
data->iterations(tool_->sB_iter->value()); data->iterations(tool_->sB_iter->value());
// Initialize smoother // Initialize smoother
smoother.initialize(component,continuity );
if(tool_->cbReinitialize->isChecked() || !data->initialized())
{
smoother.initialize(component,continuity );
data->initialized(true);
}
smoother.skip_features(data->features()); smoother.skip_features(data->features());
smoother.smooth( data->iterations() ); smoother.smooth( data->iterations() );
...@@ -199,7 +205,8 @@ slot_smooth() ...@@ -199,7 +205,8 @@ slot_smooth()
jobDescription += ") " + QString::number(tool_->sB_iter->value()) + " iterations"; jobDescription += ") " + QString::number(tool_->sB_iter->value()) + " iterations";
if (mesh != 0) if (mesh != 0)
mesh->garbage_collection(); // mesh->garbage_collection();
mesh->update_normals();
emit updatedObject( o_it->id(), UPDATE_GEOMETRY ); emit updatedObject( o_it->id(), UPDATE_GEOMETRY );
emit createBackup(o_it->id(), "Smoothing", UPDATE_GEOMETRY ); emit createBackup(o_it->id(), "Smoothing", UPDATE_GEOMETRY );
......
...@@ -182,25 +182,9 @@ ...@@ -182,25 +182,9 @@
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_6"> <layout class="QVBoxLayout" name="verticalLayout_6">
<item> <item>
<layout class="QVBoxLayout" name="verticalLayout_5"> <layout class="QGridLayout" name="gridLayout">
<item> <item row="0" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_3"> <layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QLabel" name="label3">
<property name="toolTip">
<string>number of smoothing iterations</string>
</property>
<property name="statusTip">
<string>number of smoothing iterations</string>
</property>
<property name="text">
<string>Iterations</string>
</property>
<property name="wordWrap">
<bool>false</bool>
</property>
</widget>
</item>
<item> <item>
<widget class="QSpinBox" name="sB_iter"> <widget class="QSpinBox" name="sB_iter">
<property name="toolTip"> <property name="toolTip">
...@@ -219,7 +203,33 @@ ...@@ -219,7 +203,33 @@
</item> </item>
</layout> </layout>
</item> </item>
<item> <item row="0" column="0">
<widget class="QLabel" name="label3">
<property name="toolTip">
<string>number of smoothing iterations</string>
</property>
<property name="statusTip">
<string>number of smoothing iterations</string>
</property>
<property name="text">
<string>Iterations</string>
</property>
<property name="wordWrap">
<bool>false</bool>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QCheckBox" name="cbReinitialize">
<property name="text">
<string>Re-Init Weights</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QPushButton" name="pB_smooth"> <widget class="QPushButton" name="pB_smooth">
<property name="enabled"> <property name="enabled">
<bool>true</bool> <bool>true</bool>
......
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