Commit 352b52d7 authored by Christopher Tenter's avatar Christopher Tenter

use pointsize from material dialog for spheres

parent ae3e8975
Pipeline #2117 passed with stage
in 78 minutes and 35 seconds
......@@ -126,8 +126,8 @@ QtMaterialDialog::QtMaterialDialog( QWidget * _parent,
ui_.shininessSlider->setValue((int)shine_);
ui_.shininessBox->setValue((int)shine_);
ui_.pointSizeSpinBox->setValue((int)point_size_);
ui_.lineWidthSpinBox->setValue((int)line_width_);
ui_.pointSizeSpinBox->setValue(point_size_);
ui_.lineWidthSpinBox->setValue(line_width_);
ui_.roundPointsCheckBox->setChecked(round_points_);
ui_.lineSmoothCheckBox->setChecked(line_smooth_);
ui_.backfaceCulling->setChecked( backfaceCulling_ );
......@@ -166,8 +166,8 @@ QtMaterialDialog::QtMaterialDialog( QWidget * _parent,
connect( ui_.overlayColorButton, SIGNAL( clicked() ), this, SLOT( enableProperty() ) );
connect( ui_.shininessSlider, SIGNAL( sliderPressed() ), this, SLOT( enableProperty() ) );
connect( ui_.shininessBox, SIGNAL( valueChanged(int) ), this, SLOT( enableProperty(int) ) );
connect( ui_.pointSizeSpinBox, SIGNAL( valueChanged(int) ), this, SLOT( enableProperty(int) ) );
connect( ui_.lineWidthSpinBox, SIGNAL( valueChanged(int) ), this, SLOT( enableProperty(int) ) );
connect( ui_.pointSizeSpinBox, SIGNAL( valueChanged(double) ), this, SLOT( enableProperty(double) ) );
connect( ui_.lineWidthSpinBox, SIGNAL( valueChanged(double) ), this, SLOT( enableProperty(double) ) );
connect( ui_.roundPointsCheckBox, SIGNAL( pressed() ), this, SLOT( enableProperty() ) );
connect( ui_.lineSmoothCheckBox, SIGNAL( pressed() ), this, SLOT( enableProperty() ) );
connect( ui_.backfaceCulling, SIGNAL( pressed() ), this, SLOT( enableProperty() ) );
......@@ -189,10 +189,10 @@ QtMaterialDialog::QtMaterialDialog( QWidget * _parent,
connect( ui_.shininessSlider, SIGNAL( valueChanged(int) ),
this, SLOT( changeShine(int) ) );
connect( ui_.pointSizeSpinBox, SIGNAL( valueChanged(int) ),
this, SLOT( changePointSize(int) ) );
connect( ui_.lineWidthSpinBox, SIGNAL( valueChanged(int) ),
this, SLOT( changeLineWidth(int) ) );
connect( ui_.pointSizeSpinBox, SIGNAL( valueChanged(double) ),
this, SLOT( changePointSize(double) ) );
connect( ui_.lineWidthSpinBox, SIGNAL( valueChanged(double) ),
this, SLOT( changeLineWidth(double) ) );
connect( ui_.roundPointsCheckBox, SIGNAL( toggled(bool) ),
this, SLOT( changeRoundPoints(bool) ) );
connect( ui_.lineSmoothCheckBox, SIGNAL( toggled(bool) ),
......@@ -531,9 +531,9 @@ QtMaterialDialog::changeShine(int _new)
void
QtMaterialDialog::changePointSize(int _new)
QtMaterialDialog::changePointSize(double _new)
{
point_size_ = _new;
point_size_ = float(_new);
applyChanges();
}
......@@ -542,9 +542,9 @@ QtMaterialDialog::changePointSize(int _new)
void
QtMaterialDialog::changeLineWidth(int _new)
QtMaterialDialog::changeLineWidth(double _new)
{
line_width_ = _new;
line_width_ = float(_new);
applyChanges();
}
......@@ -749,6 +749,32 @@ QtMaterialDialog::enableProperty(int /*i*/)
else if (sender() == ui_.multiSampling) ui_.multiSamplingActive->setChecked( true );
}
//-----------------------------------------------------------------------------
void
QtMaterialDialog::enableProperty(double d)
{
if (sender() == ui_.baseColorButton) ui_.baseColorActive->setChecked(true);
else if (sender() == ui_.ambientColorButton) ui_.materialActive->setChecked(true);
else if (sender() == ui_.diffuseColorButton) ui_.materialActive->setChecked(true);
else if (sender() == ui_.specularColorButton) ui_.materialActive->setChecked(true);
else if (sender() == ui_.overlayColorButton) ui_.materialActive->setChecked(true);
else if (sender() == ui_.shininessSlider) ui_.materialActive->setChecked(true);
else if (sender() == ui_.shininessBox) ui_.materialActive->setChecked(true);
else if (sender() == ui_.pointSizeSpinBox) ui_.pointSizeActive->setChecked(true);
else if (sender() == ui_.lineWidthSpinBox) ui_.lineWidthActive->setChecked(true);
else if (sender() == ui_.roundPointsCheckBox) ui_.roundPointsActive->setChecked(true);
else if (sender() == ui_.lineSmoothCheckBox) ui_.lineSmoothActive->setChecked(true);
else if (sender() == ui_.backfaceCulling) ui_.backfaceCullingActive->setChecked(true);
else if (sender() == ui_.alphaTest) ui_.alphaTestActive->setChecked(true);
else if (sender() == ui_.blending) ui_.blendingActive->setChecked(true);
else if (sender() == ui_.colorMaterial) ui_.colorMaterialActive->setChecked(true);
else if (sender() == ui_.multiSampling) ui_.multiSamplingActive->setChecked(true);
}
//-----------------------------------------------------------------------------
void
......
......@@ -125,8 +125,8 @@ private slots:
void changeSpecularColor(QColor _newColor);
void changeOverlayColor(QColor _newColor);
void changeShine(int _new);
void changePointSize(int _new);
void changeLineWidth(int _new);
void changePointSize(double _new);
void changeLineWidth(double _new);
void changeRoundPoints(bool _b);
void changeLineSmooth(bool _b);
void changeBackfaceCulling(bool _b);
......@@ -142,6 +142,7 @@ private slots:
void enableProperty();
void enableProperty(int i);
void enableProperty(double d);
QString paramToStr(GLenum param);
......
......@@ -34,7 +34,16 @@
<string>Material</string>
</property>
<layout class="QGridLayout" name="MaterialBoxLayout">
<property name="margin">
<property name="leftMargin">
<number>9</number>
</property>
<property name="topMargin">
<number>9</number>
</property>
<property name="rightMargin">
<number>9</number>
</property>
<property name="bottomMargin">
<number>9</number>
</property>
<property name="spacing">
......@@ -68,7 +77,16 @@
</item>
<item row="1" column="1">
<layout class="QGridLayout" name="ColorButtonLayout">
<property name="margin">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<property name="spacing">
......@@ -295,7 +313,16 @@
<string>Thickness</string>
</property>
<layout class="QGridLayout" name="ThicknessBoxLayout">
<property name="margin">
<property name="leftMargin">
<number>9</number>
</property>
<property name="topMargin">
<number>9</number>
</property>
<property name="rightMargin">
<number>9</number>
</property>
<property name="bottomMargin">
<number>9</number>
</property>
<property name="spacing">
......@@ -306,29 +333,53 @@
<property name="spacing">
<number>6</number>
</property>
<property name="margin">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<layout class="QGridLayout" name="PointLayout">
<property name="margin">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<property name="spacing">
<number>6</number>
</property>
<item row="0" column="0">
<widget class="QSpinBox" name="pointSizeSpinBox">
<widget class="QDoubleSpinBox" name="pointSizeSpinBox">
<property name="alignment">
<set>Qt::AlignRight</set>
</property>
<property name="minimum">
<double>0.010000000000000</double>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QSpinBox" name="lineWidthSpinBox">
<widget class="QDoubleSpinBox" name="lineWidthSpinBox">
<property name="alignment">
<set>Qt::AlignRight</set>
</property>
<property name="minimum">
<double>0.010000000000000</double>
</property>
</widget>
</item>
<item row="0" column="1">
......@@ -772,7 +823,16 @@ back is visible should be rendered.</string>
<property name="spacing">
<number>6</number>
</property>
<property name="margin">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
......
......@@ -312,14 +312,14 @@ draw(GLState& _state, const DrawModes::DrawMode& _drawMode)
else
_state.set_color( color );
sphere_->draw(_state, polyline_.vertex_radius(), (Vec3f)polyline_.point(i));
sphere_->draw(_state, _state.point_size(), (Vec3f)polyline_.point(i));
}
}
else
{
_state.set_color( color );
for(unsigned int i=0; i<polyline_.n_vertices(); ++i)
sphere_->draw(_state, polyline_.vertex_radius(), (Vec3f)polyline_.point(i));
sphere_->draw(_state, _state.point_size(), (Vec3f)polyline_.point(i));
}
}
// draw vertices as spheres with constant size on screen
......@@ -1043,7 +1043,7 @@ getRenderObjects(ACG::IRenderer* _renderer, ACG::GLState& _state , const ACG::S
{
if (polyline_.vertex_selected(i))
{
double radius = polyline_.vertex_radius();
double radius = _state.point_size();
if (screenScale)
{
// compute radius in 3D
......@@ -1065,7 +1065,7 @@ getRenderObjects(ACG::IRenderer* _renderer, ACG::GLState& _state , const ACG::S
{
if (!polyline_.vertex_selections_available() || !polyline_.vertex_selected(i))
{
double radius = polyline_.vertex_radius();
double radius = _state.point_size();
if (screenScale)
{
// compute radius in 3D
......
......@@ -999,7 +999,7 @@ me_insert( QMouseEvent* _event )
cur_polyline_obj_->line()->set_vertex_radius(PluginFunctions::sceneRadius()*0.012);
cur_polyline_obj_->lineNode()->drawMode(ACG::SceneGraph::DrawModes::DrawMode::getFromDescription("Points (as Spheres)") | ACG::SceneGraph::DrawModes::WIREFRAME);
cur_polyline_obj_->lineNode()->drawMode(ACG::SceneGraph::DrawModes::DrawMode::getFromDescription("Points (as Spheres, constant screen size)") | ACG::SceneGraph::DrawModes::WIREFRAME);
cur_polyline_obj_->line()->add_point((PolyLine::Point) hit_point);
......
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