61 #include "QtMaterialDialog.hh"
62 #include "../Scenegraph/MaterialNode.hh"
75 QtMaterialDialog::QtMaterialDialog( QWidget * _parent,
84 color_ = bak_color_ = node_->base_color();
85 ambient_ = bak_ambient_ = node_->ambient_color();
86 diffuse_ = bak_diffuse_ = node_->diffuse_color();
87 specular_ = bak_specular_ = node_->specular_color();
88 overlay_ = bak_overlay_ = node_->overlay_color();
89 shine_ = bak_shine_ = node_->shininess();
90 point_size_ = bak_point_size_ = node_->point_size();
91 line_width_ = bak_line_width_ = node_->line_width();
92 round_points_ = bak_round_points_ = node_->round_points();
93 line_smooth_ = bak_line_smooth_ = node_->line_smooth();
94 backfaceCulling_ = bak_backfaceCulling_ = node_->backface_culling();
95 alphaTest_ = bak_alphaTest_ = node_->alpha_test();
96 alphaValue_ = bak_alphaValue_ = node_->alpha_value();
97 blending_ = bak_blending_ = node_->blending();
98 blendParam1_ = bak_blendParam1_ = node_->blending_param1();
99 blendParam2_ = bak_blendParam2_ = node_->blending_param2();
100 colorMaterial_ = bak_colorMaterial_ = node_->colorMaterial();
101 multiSampling_ = bak_multiSampling_ = node_->multiSampling();
115 if( round_points_ || line_smooth_)
117 ui_.alphaTest->setEnabled(
false);
118 ui_.alpha ->setEnabled(
false);
121 setButtonColor( ui_.baseColorButton, color_ );
122 setButtonColor( ui_.ambientColorButton, ambient_ );
123 setButtonColor( ui_.diffuseColorButton, diffuse_ );
124 setButtonColor( ui_.specularColorButton, specular_ );
125 setButtonColor( ui_.overlayColorButton, overlay_ );
127 ui_.shininessSlider->setValue((
int)shine_);
128 ui_.shininessBox->setValue((
int)shine_);
129 ui_.pointSizeSpinBox->setValue(point_size_);
130 ui_.lineWidthSpinBox->setValue(line_width_);
131 ui_.roundPointsCheckBox->setChecked(round_points_);
132 ui_.lineSmoothCheckBox->setChecked(line_smooth_);
133 ui_.backfaceCulling->setChecked( backfaceCulling_ );
134 ui_.alphaTest->setChecked( alphaTest_ );
135 ui_.alpha->setValue((
int) (alphaValue_ * 100.0f) );
136 ui_.colorMaterial->setChecked( colorMaterial_ );
137 ui_.multiSampling->setChecked( multiSampling_ );
138 ui_.blending->setChecked( blending_ );
140 for (
int i=0; i < ui_.blendParam1->count(); i++)
141 if ( ui_.blendParam1->itemText(i) == paramToStr(blendParam1_) )
142 ui_.blendParam1->setCurrentIndex( i );
144 for (
int i=0; i < ui_.blendParam2->count(); i++)
145 if ( ui_.blendParam2->itemText(i) == paramToStr(blendParam2_) )
146 ui_.blendParam2->setCurrentIndex( i );
148 applyProperties_ = node_->applyProperties();
150 ui_.baseColorActive->setChecked( baseColorActive_ );
151 ui_.materialActive->setChecked( materialActive_ );
152 ui_.pointSizeActive->setChecked( pointSizeActive_ );
153 ui_.lineWidthActive->setChecked( lineWidthActive_ );
154 ui_.roundPointsActive->setChecked( roundPointsActive_ );
155 ui_.lineSmoothActive->setChecked( lineSmoothActive_ );
156 ui_.alphaTestActive->setChecked( alphaTestActive_ );
157 ui_.blendingActive->setChecked( blendingActive_ );
158 ui_.backfaceCullingActive->setChecked( backfaceCullingActive_ );
159 ui_.colorMaterialActive->setChecked( colorMaterialActive_ );
160 ui_.multiSamplingActive->setChecked( multiSamplingActive_ );
162 connect( ui_.baseColorButton, SIGNAL( clicked() ),
this, SLOT( enableProperty() ) );
163 connect( ui_.ambientColorButton, SIGNAL( clicked() ),
this, SLOT( enableProperty() ) );
164 connect( ui_.diffuseColorButton, SIGNAL( clicked() ),
this, SLOT( enableProperty() ) );
165 connect( ui_.specularColorButton, SIGNAL( clicked() ),
this, SLOT( enableProperty() ) );
166 connect( ui_.overlayColorButton, SIGNAL( clicked() ),
this, SLOT( enableProperty() ) );
167 connect( ui_.shininessSlider, SIGNAL( sliderPressed() ),
this, SLOT( enableProperty() ) );
168 connect( ui_.shininessBox, SIGNAL( valueChanged(
int) ),
this, SLOT( enableProperty(
int) ) );
169 connect( ui_.pointSizeSpinBox, SIGNAL( valueChanged(
double) ),
this, SLOT( enableProperty(
double) ) );
170 connect( ui_.lineWidthSpinBox, SIGNAL( valueChanged(
double) ),
this, SLOT( enableProperty(
double) ) );
171 connect( ui_.roundPointsCheckBox, SIGNAL( pressed() ),
this, SLOT( enableProperty() ) );
172 connect( ui_.lineSmoothCheckBox, SIGNAL( pressed() ),
this, SLOT( enableProperty() ) );
173 connect( ui_.backfaceCulling, SIGNAL( pressed() ),
this, SLOT( enableProperty() ) );
174 connect( ui_.alphaTest, SIGNAL( pressed() ),
this, SLOT( enableProperty() ) );
175 connect( ui_.blending, SIGNAL( pressed() ),
this, SLOT( enableProperty() ) );
176 connect( ui_.colorMaterial, SIGNAL( pressed() ),
this, SLOT( enableProperty() ) );
177 connect( ui_.multiSampling, SIGNAL( pressed() ),
this, SLOT( enableProperty() ) );
179 connect( ui_.baseColorButton, SIGNAL( colorChanged(QColor) ),
180 this, SLOT( changeBaseColor(QColor) ) );
181 connect( ui_.ambientColorButton, SIGNAL( colorChanged(QColor) ),
182 this, SLOT( changeAmbientColor(QColor) ) );
183 connect( ui_.diffuseColorButton, SIGNAL( colorChanged(QColor) ),
184 this, SLOT( changeDiffuseColor(QColor) ) );
185 connect( ui_.specularColorButton, SIGNAL( colorChanged(QColor) ),
186 this, SLOT( changeSpecularColor(QColor) ) );
187 connect( ui_.overlayColorButton, SIGNAL( colorChanged(QColor) ),
188 this, SLOT( changeOverlayColor(QColor) ) );
189 connect( ui_.shininessSlider, SIGNAL( valueChanged(
int) ),
190 this, SLOT( changeShine(
int) ) );
192 connect( ui_.pointSizeSpinBox, SIGNAL( valueChanged(
double) ),
193 this, SLOT( changePointSize(
double) ) );
194 connect( ui_.lineWidthSpinBox, SIGNAL( valueChanged(
double) ),
195 this, SLOT( changeLineWidth(
double) ) );
196 connect( ui_.roundPointsCheckBox, SIGNAL( toggled(
bool) ),
197 this, SLOT( changeRoundPoints(
bool) ) );
198 connect( ui_.lineSmoothCheckBox, SIGNAL( toggled(
bool) ),
199 this, SLOT( changeLineSmooth(
bool) ) );
200 connect( ui_.backfaceCulling, SIGNAL( toggled(
bool) ),
201 this, SLOT( changeBackfaceCulling(
bool) ) );
202 connect( ui_.alphaTest, SIGNAL( toggled(
bool) ),
203 this, SLOT( changeAlphaTest(
bool) ) );
204 connect( ui_.alpha, SIGNAL( valueChanged(
int) ),
205 this, SLOT( changeAlphaValue(
int) ) );
206 connect( ui_.colorMaterial, SIGNAL( toggled(
bool) ),
207 this, SLOT( changeColorMaterial(
bool) ) );
208 connect( ui_.multiSampling, SIGNAL( toggled(
bool) ),
209 this, SLOT( changeMultiSampling(
bool) ) );
210 connect( ui_.blending, SIGNAL( toggled(
bool) ),
211 this, SLOT( changeBlending(
bool) ) );
212 connect( ui_.blendParam1, SIGNAL( currentIndexChanged(
const QString&) ),
213 this, SLOT( changeBlendingParam1(
const QString&) ) );
214 connect( ui_.blendParam2, SIGNAL( currentIndexChanged(
const QString&) ),
215 this, SLOT( changeBlendingParam2(
const QString&) ) );
218 connect( ui_.baseColorActive, SIGNAL( toggled(
bool) ),
219 this, SLOT( changeActive(
bool) ) );
220 connect( ui_.materialActive, SIGNAL( toggled(
bool) ),
221 this, SLOT( changeActive(
bool) ) );
222 connect( ui_.pointSizeActive, SIGNAL( toggled(
bool) ),
223 this, SLOT( changeActive(
bool) ) );
224 connect( ui_.lineWidthActive, SIGNAL( toggled(
bool) ),
225 this, SLOT( changeActive(
bool) ) );
226 connect( ui_.roundPointsActive, SIGNAL( toggled(
bool) ),
227 this, SLOT( changeActive(
bool) ) );
228 connect( ui_.lineSmoothActive, SIGNAL( toggled(
bool) ),
229 this, SLOT( changeActive(
bool) ) );
230 connect( ui_.alphaTestActive, SIGNAL( toggled(
bool) ),
231 this, SLOT( changeActive(
bool) ) );
232 connect( ui_.blendingActive, SIGNAL( toggled(
bool) ),
233 this, SLOT( changeActive(
bool) ) );
234 connect( ui_.backfaceCullingActive, SIGNAL( toggled(
bool) ),
235 this, SLOT( changeActive(
bool) ) );
236 connect( ui_.colorMaterialActive, SIGNAL( toggled(
bool) ),
237 this, SLOT( changeActive(
bool) ) );
238 connect( ui_.multiSamplingActive, SIGNAL( toggled(
bool) ),
239 this, SLOT( changeActive(
bool) ) );
241 connect( ui_.alphaTest, SIGNAL( toggled(
bool) ),
242 ui_.alpha, SLOT( setEnabled(
bool) ) );
243 connect( ui_.blending, SIGNAL( toggled(
bool) ),
244 ui_.blendParam1, SLOT( setEnabled(
bool) ) );
245 connect( ui_.blending, SIGNAL( toggled(
bool) ),
246 ui_.blendParam2, SLOT( setEnabled(
bool) ) );
249 ui_.alpha->setEnabled( ui_.alphaTest->isChecked() );
250 ui_.blendParam1->setEnabled( ui_.blending->isChecked() );
251 ui_.blendParam2->setEnabled( ui_.blending->isChecked() );
253 ui_.baseColorActive->setChecked(baseColorActive_);
254 ui_.materialActive->setChecked(materialActive_);
255 ui_.pointSizeActive->setChecked(pointSizeActive_);
256 ui_.lineWidthActive->setChecked(lineWidthActive_);
257 ui_.roundPointsActive->setChecked(roundPointsActive_);
258 ui_.lineWidthActive->setChecked(lineWidthActive_);
259 ui_.alphaTestActive->setChecked(alphaTestActive_);
260 ui_.blendingActive->setChecked(blendingActive_);
261 ui_.backfaceCullingActive->setChecked(backfaceCullingActive_);
262 ui_.colorMaterialActive->setChecked(colorMaterialActive_);
263 ui_.multiSamplingActive->setChecked(multiSamplingActive_);
265 connect( ui_.okButton, SIGNAL( clicked() ),
266 this, SLOT( accept() ) );
267 connect( ui_.cancelButton, SIGNAL( clicked() ),
268 this, SLOT( reject() ) );
270 layout()->setSizeConstraint( QLayout::SetFixedSize );
279 const Vec4f& _color )
281 _button->setColor( convertColor( _color ) );
289 QtMaterialDialog::convertColor(
Vec4f _color)
291 return QColor ((
int)(_color[0]*255.0),
292 (
int)(_color[1]*255.0),
293 (
int)(_color[2]*255.0),
294 (
int)(_color[3]*255.0));
302 QtMaterialDialog::convertColor( QColor _color)
304 return Vec4f (_color.redF(),
314 void QtMaterialDialog::reject()
324 void QtMaterialDialog::applyChanges()
327 unsigned int properties = 0;
341 node_->applyProperties(properties);
343 node_->set_base_color(color_);
344 node_->set_ambient_color(ambient_);
345 node_->set_diffuse_color(diffuse_);
346 node_->set_specular_color(specular_);
347 node_->set_overlay_color(overlay_);
348 node_->set_shininess(shine_);
349 node_->set_point_size(point_size_);
350 node_->set_line_width(line_width_);
351 node_->set_round_points(round_points_);
352 node_->set_line_smooth(line_smooth_);
355 node_->enable_backface_culling();
357 node_->disable_backface_culling();
360 node_->enable_alpha_test( alphaValue_ );
362 node_->disable_alpha_test();
365 node_->enable_blending( blendParam1_, blendParam2_ );
367 node_->disable_blending();
369 if ( colorMaterial_ )
370 node_->enable_color_material();
372 node_->disable_color_material();
374 if ( multiSampling_ )
375 node_->enable_multisampling();
377 node_->disable_multisampling();
385 setButtonColor( ui_.diffuseColorButton, diffuse_ );
386 setButtonColor( ui_.ambientColorButton, ambient_ );
387 setButtonColor( ui_.specularColorButton, specular_ );
388 setButtonColor( ui_.overlayColorButton, overlay_ );
389 setButtonColor( ui_.baseColorButton, color_ );
391 emit signalNodeChanged(node_);
398 void QtMaterialDialog::undoChanges()
401 unsigned int properties = 0;
415 node_->applyProperties(properties);
417 node_->set_base_color(bak_color_);
418 node_->set_ambient_color(bak_ambient_);
419 node_->set_diffuse_color(bak_diffuse_);
420 node_->set_specular_color(bak_specular_);
421 node_->set_overlay_color(bak_overlay_);
422 node_->set_shininess(bak_shine_);
423 node_->set_point_size(bak_point_size_);
424 node_->set_line_width(bak_line_width_);
425 node_->set_round_points(bak_round_points_);
426 node_->set_line_smooth(bak_line_smooth_);
428 if(bak_backfaceCulling_)
429 node_->enable_backface_culling();
431 node_->disable_backface_culling();
434 node_->enable_alpha_test( bak_alphaValue_ );
436 node_->disable_alpha_test();
439 node_->enable_blending( bak_blendParam1_, bak_blendParam2_ );
441 node_->disable_blending();
443 if ( bak_colorMaterial_ )
444 node_->enable_color_material();
446 node_->disable_color_material();
448 if ( bak_multiSampling_ )
449 node_->enable_multisampling();
451 node_->disable_multisampling();
453 setButtonColor( ui_.diffuseColorButton, diffuse_ );
454 setButtonColor( ui_.ambientColorButton, ambient_ );
455 setButtonColor( ui_.specularColorButton, specular_ );
456 setButtonColor( ui_.overlayColorButton, overlay_ );
457 setButtonColor( ui_.baseColorButton, color_ );
459 emit signalNodeChanged(node_);
466 void QtMaterialDialog::changeDiffuseColor(QColor _newColor)
468 diffuse_ = convertColor( _newColor );
470 if (diffuse_[3] < 1.0f)
472 ui_.blending->setCheckState(Qt::Checked);
482 void QtMaterialDialog::changeAmbientColor(QColor _newColor)
484 ambient_ = convertColor( _newColor );
493 void QtMaterialDialog::changeSpecularColor(QColor _newColor)
495 specular_ = convertColor( _newColor );
502 void QtMaterialDialog::changeOverlayColor(QColor _newColor)
504 overlay_ = convertColor( _newColor );
512 void QtMaterialDialog::changeBaseColor(QColor _newColor)
514 color_ = convertColor( _newColor );
523 QtMaterialDialog::changeShine(
int _new)
534 QtMaterialDialog::changePointSize(
double _new)
536 point_size_ = float(_new);
545 QtMaterialDialog::changeLineWidth(
double _new)
547 line_width_ = float(_new);
556 QtMaterialDialog::changeRoundPoints(
bool _b)
558 round_points_ = (bool)_b;
561 bool b2 = _b || round_points_;
564 changeAlphaTest(
true);
565 changeAlphaValue(50);
566 ui_.alpha ->setValue(50);
568 ui_.alphaTest->setEnabled(!b2);
569 ui_.alpha ->setEnabled(!b2);
570 ui_.alphaTest->setChecked( b2);
579 QtMaterialDialog::changeLineSmooth(
bool _b)
581 line_smooth_ = (bool)_b;
584 bool b2 = _b || round_points_;
587 changeAlphaTest(
true);
588 changeAlphaValue(50);
589 ui_.alpha ->setValue(50);
591 ui_.alphaTest->setEnabled(!b2);
592 ui_.alpha ->setEnabled(!b2);
593 ui_.alphaTest->setChecked( b2);
602 QtMaterialDialog::changeBackfaceCulling(
bool _b)
604 backfaceCulling_ = (bool)_b;
612 QtMaterialDialog::changeAlphaTest(
bool _b)
614 alphaTest_ = (bool)_b;
621 QtMaterialDialog::changeColorMaterial(
bool _b)
623 colorMaterial_ = (bool)_b;
630 QtMaterialDialog::changeMultiSampling(
bool _b)
632 multiSampling_ = (bool)_b;
639 QtMaterialDialog::changeAlphaValue(
int _new)
641 alphaValue_ = float(_new) / 100.0f;
649 QtMaterialDialog::changeBlending(
bool _b)
651 blending_ = (bool)_b;
658 QtMaterialDialog::changeBlendingParam1(
const QString& _name)
660 if (_name ==
"GL_ZERO") blendParam1_ = GL_ZERO;
661 else if (_name ==
"GL_ONE") blendParam1_ = GL_ONE;
662 else if (_name ==
"GL_SRC_COLOR") blendParam1_ = GL_SRC_COLOR;
663 else if (_name ==
"GL_ONE_MINUS_SRC_COLOR") blendParam1_ = GL_ONE_MINUS_SRC_COLOR;
664 else if (_name ==
"GL_DST_COLOR") blendParam1_ = GL_DST_COLOR;
665 else if (_name ==
"GL_ONE_MINUS_DST_COLOR") blendParam1_ = GL_ONE_MINUS_DST_COLOR;
666 else if (_name ==
"GL_SRC_ALPHA") blendParam1_ = GL_SRC_ALPHA;
667 else if (_name ==
"GL_ONE_MINUS_SRC_ALPHA") blendParam1_ = GL_ONE_MINUS_SRC_ALPHA;
668 else if (_name ==
"GL_DST_ALPHA") blendParam1_ = GL_DST_ALPHA;
669 else if (_name ==
"GL_ONE_MINUS_DST_ALPHA") blendParam1_ = GL_ONE_MINUS_DST_ALPHA;
670 else if (_name ==
"GL_CONSTANT_COLOR") blendParam1_ = GL_CONSTANT_COLOR;
671 else if (_name ==
"GL_ONE_MINUS_CONSTANT_COLOR") blendParam1_ = GL_ONE_MINUS_CONSTANT_COLOR;
672 else if (_name ==
"GL_CONSTANT_ALPHA") blendParam1_ = GL_CONSTANT_ALPHA;
673 else if (_name ==
"GL_ONE_MINUS_CONSTANT_ALPHA") blendParam1_ = GL_ONE_MINUS_CONSTANT_ALPHA;
675 std::cerr <<
"Blending Param unknown!" << std::endl;
685 QtMaterialDialog::changeBlendingParam2(
const QString& _name)
687 if (_name ==
"GL_ZERO") blendParam2_ = GL_ZERO;
688 else if (_name ==
"GL_ONE") blendParam2_ = GL_ONE;
689 else if (_name ==
"GL_SRC_COLOR") blendParam2_ = GL_SRC_COLOR;
690 else if (_name ==
"GL_ONE_MINUS_SRC_COLOR") blendParam2_ = GL_ONE_MINUS_SRC_COLOR;
691 else if (_name ==
"GL_DST_COLOR") blendParam2_ = GL_DST_COLOR;
692 else if (_name ==
"GL_ONE_MINUS_DST_COLOR") blendParam2_ = GL_ONE_MINUS_DST_COLOR;
693 else if (_name ==
"GL_SRC_ALPHA") blendParam2_ = GL_SRC_ALPHA;
694 else if (_name ==
"GL_ONE_MINUS_SRC_ALPHA") blendParam2_ = GL_ONE_MINUS_SRC_ALPHA;
695 else if (_name ==
"GL_DST_ALPHA") blendParam2_ = GL_DST_ALPHA;
696 else if (_name ==
"GL_ONE_MINUS_DST_ALPHA") blendParam2_ = GL_ONE_MINUS_DST_ALPHA;
697 else if (_name ==
"GL_CONSTANT_COLOR") blendParam2_ = GL_CONSTANT_COLOR;
698 else if (_name ==
"GL_ONE_MINUS_CONSTANT_COLOR") blendParam2_ = GL_ONE_MINUS_CONSTANT_COLOR;
699 else if (_name ==
"GL_CONSTANT_ALPHA") blendParam2_ = GL_CONSTANT_ALPHA;
700 else if (_name ==
"GL_ONE_MINUS_CONSTANT_ALPHA") blendParam2_ = GL_ONE_MINUS_CONSTANT_ALPHA;
702 std::cerr <<
"Blending Param unknown!" << std::endl;
712 QtMaterialDialog::changeActive(
bool )
715 baseColorActive_ = ui_.baseColorActive->isChecked();
716 materialActive_ = ui_.materialActive->isChecked();
717 pointSizeActive_ = ui_.pointSizeActive->isChecked();
718 lineWidthActive_ = ui_.lineWidthActive->isChecked();
719 roundPointsActive_ = ui_.roundPointsActive->isChecked();
720 lineSmoothActive_ = ui_.lineSmoothActive->isChecked();
721 blendingActive_ = ui_.blendingActive->isChecked();
722 backfaceCullingActive_ = ui_.backfaceCullingActive->isChecked();
723 colorMaterialActive_ = ui_.colorMaterialActive->isChecked();
724 multiSamplingActive_ = ui_.multiSamplingActive->isChecked();
732 QtMaterialDialog::enableProperty(
int )
734 if (sender() == ui_.baseColorButton) ui_.baseColorActive->setChecked(
true );
735 else if (sender() == ui_.ambientColorButton) ui_.materialActive->setChecked(
true );
736 else if (sender() == ui_.diffuseColorButton) ui_.materialActive->setChecked(
true );
737 else if (sender() == ui_.specularColorButton) ui_.materialActive->setChecked(
true );
738 else if (sender() == ui_.overlayColorButton) ui_.materialActive->setChecked(
true );
739 else if (sender() == ui_.shininessSlider) ui_.materialActive->setChecked(
true );
740 else if (sender() == ui_.shininessBox) ui_.materialActive->setChecked(
true );
741 else if (sender() == ui_.pointSizeSpinBox) ui_.pointSizeActive->setChecked(
true );
742 else if (sender() == ui_.lineWidthSpinBox) ui_.lineWidthActive->setChecked(
true );
743 else if (sender() == ui_.roundPointsCheckBox) ui_.roundPointsActive->setChecked(
true );
744 else if (sender() == ui_.lineSmoothCheckBox) ui_.lineSmoothActive->setChecked(
true );
745 else if (sender() == ui_.backfaceCulling) ui_.backfaceCullingActive->setChecked(
true );
746 else if (sender() == ui_.alphaTest) ui_.alphaTestActive->setChecked(
true );
747 else if (sender() == ui_.blending) ui_.blendingActive->setChecked(
true );
748 else if (sender() == ui_.colorMaterial) ui_.colorMaterialActive->setChecked(
true );
749 else if (sender() == ui_.multiSampling) ui_.multiSamplingActive->setChecked(
true );
756 QtMaterialDialog::enableProperty(
double d)
759 if (sender() == ui_.baseColorButton) ui_.baseColorActive->setChecked(
true);
760 else if (sender() == ui_.ambientColorButton) ui_.materialActive->setChecked(
true);
761 else if (sender() == ui_.diffuseColorButton) ui_.materialActive->setChecked(
true);
762 else if (sender() == ui_.specularColorButton) ui_.materialActive->setChecked(
true);
763 else if (sender() == ui_.overlayColorButton) ui_.materialActive->setChecked(
true);
764 else if (sender() == ui_.shininessSlider) ui_.materialActive->setChecked(
true);
765 else if (sender() == ui_.shininessBox) ui_.materialActive->setChecked(
true);
766 else if (sender() == ui_.pointSizeSpinBox) ui_.pointSizeActive->setChecked(
true);
767 else if (sender() == ui_.lineWidthSpinBox) ui_.lineWidthActive->setChecked(
true);
768 else if (sender() == ui_.roundPointsCheckBox) ui_.roundPointsActive->setChecked(
true);
769 else if (sender() == ui_.lineSmoothCheckBox) ui_.lineSmoothActive->setChecked(
true);
770 else if (sender() == ui_.backfaceCulling) ui_.backfaceCullingActive->setChecked(
true);
771 else if (sender() == ui_.alphaTest) ui_.alphaTestActive->setChecked(
true);
772 else if (sender() == ui_.blending) ui_.blendingActive->setChecked(
true);
773 else if (sender() == ui_.colorMaterial) ui_.colorMaterialActive->setChecked(
true);
774 else if (sender() == ui_.multiSampling) ui_.multiSamplingActive->setChecked(
true);
781 QtMaterialDialog::enableProperty()
784 if (sender() == ui_.baseColorButton) ui_.baseColorActive->setChecked(
true );
785 else if (sender() == ui_.ambientColorButton) ui_.materialActive->setChecked(
true );
786 else if (sender() == ui_.diffuseColorButton) ui_.materialActive->setChecked(
true );
787 else if (sender() == ui_.specularColorButton) ui_.materialActive->setChecked(
true );
788 else if (sender() == ui_.overlayColorButton) ui_.materialActive->setChecked(
true );
789 else if (sender() == ui_.shininessSlider) ui_.materialActive->setChecked(
true );
790 else if (sender() == ui_.shininessBox) ui_.materialActive->setChecked(
true );
791 else if (sender() == ui_.pointSizeSpinBox) ui_.pointSizeActive->setChecked(
true );
792 else if (sender() == ui_.lineWidthSpinBox) ui_.lineWidthActive->setChecked(
true );
793 else if (sender() == ui_.roundPointsCheckBox) ui_.roundPointsActive->setChecked(
true );
794 else if (sender() == ui_.lineSmoothCheckBox) ui_.lineSmoothActive->setChecked(
true );
795 else if (sender() == ui_.backfaceCulling) ui_.backfaceCullingActive->setChecked(
true );
796 else if (sender() == ui_.alphaTest) ui_.alphaTestActive->setChecked(
true );
797 else if (sender() == ui_.blending) ui_.blendingActive->setChecked(
true );
798 else if (sender() == ui_.colorMaterial) ui_.colorMaterialActive->setChecked(
true );
799 else if (sender() == ui_.multiSampling) ui_.multiSamplingActive->setChecked(
true );
805 QString QtMaterialDialog::paramToStr(GLenum _param)
807 if (_param == GL_ZERO)
return "GL_ZERO";
808 else if (_param == GL_ONE)
return "GL_ONE";
809 else if (_param == GL_SRC_COLOR)
return "GL_SRC_COLOR";
810 else if (_param == GL_ONE_MINUS_SRC_COLOR)
return "GL_ONE_MINUS_SRC_COLOR";
811 else if (_param == GL_DST_COLOR)
return "GL_DST_COLOR";
812 else if (_param == GL_ONE_MINUS_DST_COLOR)
return "GL_ONE_MINUS_DST_COLOR";
813 else if (_param == GL_SRC_ALPHA)
return "GL_SRC_ALPHA";
814 else if (_param == GL_ONE_MINUS_SRC_ALPHA)
return "GL_ONE_MINUS_SRC_ALPHA";
815 else if (_param == GL_DST_ALPHA)
return "GL_DST_ALPHA";
816 else if (_param == GL_ONE_MINUS_DST_ALPHA)
return "GL_ONE_MINUS_DST_ALPHA";
817 else if (_param == GL_CONSTANT_COLOR)
return "GL_CONSTANT_COLOR";
818 else if (_param == GL_ONE_MINUS_CONSTANT_COLOR)
return "GL_ONE_MINUS_CONSTANT_COLOR";
819 else if (_param == GL_CONSTANT_ALPHA)
return "GL_CONSTANT_ALPHA";
820 else if (_param == GL_ONE_MINUS_CONSTANT_ALPHA)
return "GL_ONE_MINUS_CONSTANT_ALPHA";
822 return "UNKOWN PARAM";
Namespace providing different geometric functions concerning angles.
draw smooth lines using glLine()
VectorT< float, 4 > Vec4f
apply material (ambient, diffuse, specular, shininess)
draw smooth (round) points using glPoint()
ACG::SceneGraph::MaterialNode MaterialNode
Materialnode.
Color Material ( Only when a drawmode using shading and lighting is enabled )