53 #include "QtMaterialDialog.hh" 54 #include "../Scenegraph/MaterialNode.hh" 69 QtMaterialDialog::QtMaterialDialog( QWidget * _parent,
78 color_ = bak_color_ = node_->base_color();
79 ambient_ = bak_ambient_ = node_->ambient_color();
80 diffuse_ = bak_diffuse_ = node_->diffuse_color();
81 specular_ = bak_specular_ = node_->specular_color();
82 overlay_ = bak_overlay_ = node_->overlay_color();
83 shine_ = bak_shine_ = node_->shininess();
84 point_size_ = bak_point_size_ = node_->point_size();
85 line_width_ = bak_line_width_ = node_->line_width();
86 round_points_ = bak_round_points_ = node_->round_points();
87 line_smooth_ = bak_line_smooth_ = node_->line_smooth();
88 backfaceCulling_ = bak_backfaceCulling_ = node_->backface_culling();
89 alphaTest_ = bak_alphaTest_ = node_->alpha_test();
90 alphaValue_ = bak_alphaValue_ = node_->alpha_value();
91 blending_ = bak_blending_ = node_->blending();
92 blendParam1_ = bak_blendParam1_ = node_->blending_param1();
93 blendParam2_ = bak_blendParam2_ = node_->blending_param2();
94 colorMaterial_ = bak_colorMaterial_ = node_->colorMaterial();
95 multiSampling_ = bak_multiSampling_ = node_->multiSampling();
97 baseColorActive_ = bak_baseColorActive_ = node_->applyProperties() & SceneGraph::MaterialNode::BaseColor;
98 materialActive_ = bak_materialActive_ = node_->applyProperties() & SceneGraph::MaterialNode::Material;
99 pointSizeActive_ = bak_pointSizeActive_ = node_->applyProperties() & SceneGraph::MaterialNode::PointSize;
100 lineWidthActive_ = bak_lineWidthActive_ = node_->applyProperties() & SceneGraph::MaterialNode::LineWidth;
101 roundPointsActive_ = bak_roundPointsActive_ = node_->applyProperties() & SceneGraph::MaterialNode::RoundPoints;
102 lineSmoothActive_ = bak_lineSmoothActive_ = node_->applyProperties() & SceneGraph::MaterialNode::LineSmooth;
103 alphaTestActive_ = bak_alphaTestActive_ = node_->applyProperties() & SceneGraph::MaterialNode::AlphaTest;
104 blendingActive_ = bak_blendingActive_ = node_->applyProperties() & SceneGraph::MaterialNode::Blending;
105 backfaceCullingActive_ = bak_backfaceCullingActive_ = node_->applyProperties() & SceneGraph::MaterialNode::BackFaceCulling;
106 colorMaterialActive_ = bak_colorMaterialActive_ = node_->applyProperties() & SceneGraph::MaterialNode::ColorMaterial;
107 multiSamplingActive_ = bak_multiSamplingActive_ = node_->applyProperties() & SceneGraph::MaterialNode::MultiSampling;
109 if( round_points_ || line_smooth_)
111 ui_.alphaTest->setEnabled(
false);
112 ui_.alpha ->setEnabled(
false);
115 setButtonColor( ui_.baseColorButton, color_ );
116 setButtonColor( ui_.ambientColorButton, ambient_ );
117 setButtonColor( ui_.diffuseColorButton, diffuse_ );
118 setButtonColor( ui_.specularColorButton, specular_ );
119 setButtonColor( ui_.overlayColorButton, overlay_ );
121 ui_.shininessSlider->setValue((
int)shine_);
122 ui_.shininessBox->setValue((
int)shine_);
123 ui_.pointSizeSpinBox->setValue(point_size_);
124 ui_.lineWidthSpinBox->setValue(line_width_);
125 ui_.roundPointsCheckBox->setChecked(round_points_);
126 ui_.lineSmoothCheckBox->setChecked(line_smooth_);
127 ui_.backfaceCulling->setChecked( backfaceCulling_ );
128 ui_.alphaTest->setChecked( alphaTest_ );
129 ui_.alpha->setValue((
int) (alphaValue_ * 100.0f) );
130 ui_.colorMaterial->setChecked( colorMaterial_ );
131 ui_.multiSampling->setChecked( multiSampling_ );
132 ui_.blending->setChecked( blending_ );
134 for (
int i=0; i < ui_.blendParam1->count(); i++)
135 if ( ui_.blendParam1->itemText(i) == paramToStr(blendParam1_) )
136 ui_.blendParam1->setCurrentIndex( i );
138 for (
int i=0; i < ui_.blendParam2->count(); i++)
139 if ( ui_.blendParam2->itemText(i) == paramToStr(blendParam2_) )
140 ui_.blendParam2->setCurrentIndex( i );
142 applyProperties_ = node_->applyProperties();
144 ui_.baseColorActive->setChecked( baseColorActive_ );
145 ui_.materialActive->setChecked( materialActive_ );
146 ui_.pointSizeActive->setChecked( pointSizeActive_ );
147 ui_.lineWidthActive->setChecked( lineWidthActive_ );
148 ui_.roundPointsActive->setChecked( roundPointsActive_ );
149 ui_.lineSmoothActive->setChecked( lineSmoothActive_ );
150 ui_.alphaTestActive->setChecked( alphaTestActive_ );
151 ui_.blendingActive->setChecked( blendingActive_ );
152 ui_.backfaceCullingActive->setChecked( backfaceCullingActive_ );
153 ui_.colorMaterialActive->setChecked( colorMaterialActive_ );
154 ui_.multiSamplingActive->setChecked( multiSamplingActive_ );
156 connect( ui_.baseColorButton, SIGNAL( clicked() ),
this, SLOT( enableProperty() ) );
157 connect( ui_.ambientColorButton, SIGNAL( clicked() ),
this, SLOT( enableProperty() ) );
158 connect( ui_.diffuseColorButton, SIGNAL( clicked() ),
this, SLOT( enableProperty() ) );
159 connect( ui_.specularColorButton, SIGNAL( clicked() ),
this, SLOT( enableProperty() ) );
160 connect( ui_.overlayColorButton, SIGNAL( clicked() ),
this, SLOT( enableProperty() ) );
161 connect( ui_.shininessSlider, SIGNAL( sliderPressed() ),
this, SLOT( enableProperty() ) );
162 connect( ui_.shininessBox, SIGNAL( valueChanged(
int) ),
this, SLOT( enableProperty(
int) ) );
163 connect( ui_.pointSizeSpinBox, SIGNAL( valueChanged(
double) ),
this, SLOT( enableProperty(
double) ) );
164 connect( ui_.lineWidthSpinBox, SIGNAL( valueChanged(
double) ),
this, SLOT( enableProperty(
double) ) );
165 connect( ui_.roundPointsCheckBox, SIGNAL( pressed() ),
this, SLOT( enableProperty() ) );
166 connect( ui_.lineSmoothCheckBox, SIGNAL( pressed() ),
this, SLOT( enableProperty() ) );
167 connect( ui_.backfaceCulling, SIGNAL( pressed() ),
this, SLOT( enableProperty() ) );
168 connect( ui_.alphaTest, SIGNAL( pressed() ),
this, SLOT( enableProperty() ) );
169 connect( ui_.blending, SIGNAL( pressed() ),
this, SLOT( enableProperty() ) );
170 connect( ui_.colorMaterial, SIGNAL( pressed() ),
this, SLOT( enableProperty() ) );
171 connect( ui_.multiSampling, SIGNAL( pressed() ),
this, SLOT( enableProperty() ) );
173 connect( ui_.baseColorButton, SIGNAL( colorChanged(QColor) ),
174 this, SLOT( changeBaseColor(QColor) ) );
175 connect( ui_.ambientColorButton, SIGNAL( colorChanged(QColor) ),
176 this, SLOT( changeAmbientColor(QColor) ) );
177 connect( ui_.diffuseColorButton, SIGNAL( colorChanged(QColor) ),
178 this, SLOT( changeDiffuseColor(QColor) ) );
179 connect( ui_.specularColorButton, SIGNAL( colorChanged(QColor) ),
180 this, SLOT( changeSpecularColor(QColor) ) );
181 connect( ui_.overlayColorButton, SIGNAL( colorChanged(QColor) ),
182 this, SLOT( changeOverlayColor(QColor) ) );
183 connect( ui_.shininessSlider, SIGNAL( valueChanged(
int) ),
184 this, SLOT( changeShine(
int) ) );
186 connect( ui_.pointSizeSpinBox, SIGNAL( valueChanged(
double) ),
187 this, SLOT( changePointSize(
double) ) );
188 connect( ui_.lineWidthSpinBox, SIGNAL( valueChanged(
double) ),
189 this, SLOT( changeLineWidth(
double) ) );
190 connect( ui_.roundPointsCheckBox, SIGNAL( toggled(
bool) ),
191 this, SLOT( changeRoundPoints(
bool) ) );
192 connect( ui_.lineSmoothCheckBox, SIGNAL( toggled(
bool) ),
193 this, SLOT( changeLineSmooth(
bool) ) );
194 connect( ui_.backfaceCulling, SIGNAL( toggled(
bool) ),
195 this, SLOT( changeBackfaceCulling(
bool) ) );
196 connect( ui_.alphaTest, SIGNAL( toggled(
bool) ),
197 this, SLOT( changeAlphaTest(
bool) ) );
198 connect( ui_.alpha, SIGNAL( valueChanged(
int) ),
199 this, SLOT( changeAlphaValue(
int) ) );
200 connect( ui_.colorMaterial, SIGNAL( toggled(
bool) ),
201 this, SLOT( changeColorMaterial(
bool) ) );
202 connect( ui_.multiSampling, SIGNAL( toggled(
bool) ),
203 this, SLOT( changeMultiSampling(
bool) ) );
204 connect( ui_.blending, SIGNAL( toggled(
bool) ),
205 this, SLOT( changeBlending(
bool) ) );
206 connect( ui_.blendParam1, SIGNAL( currentIndexChanged(
const QString&) ),
207 this, SLOT( changeBlendingParam1(
const QString&) ) );
208 connect( ui_.blendParam2, SIGNAL( currentIndexChanged(
const QString&) ),
209 this, SLOT( changeBlendingParam2(
const QString&) ) );
212 connect( ui_.baseColorActive, SIGNAL( toggled(
bool) ),
213 this, SLOT( changeActive(
bool) ) );
214 connect( ui_.materialActive, SIGNAL( toggled(
bool) ),
215 this, SLOT( changeActive(
bool) ) );
216 connect( ui_.pointSizeActive, SIGNAL( toggled(
bool) ),
217 this, SLOT( changeActive(
bool) ) );
218 connect( ui_.lineWidthActive, SIGNAL( toggled(
bool) ),
219 this, SLOT( changeActive(
bool) ) );
220 connect( ui_.roundPointsActive, SIGNAL( toggled(
bool) ),
221 this, SLOT( changeActive(
bool) ) );
222 connect( ui_.lineSmoothActive, SIGNAL( toggled(
bool) ),
223 this, SLOT( changeActive(
bool) ) );
224 connect( ui_.alphaTestActive, SIGNAL( toggled(
bool) ),
225 this, SLOT( changeActive(
bool) ) );
226 connect( ui_.blendingActive, SIGNAL( toggled(
bool) ),
227 this, SLOT( changeActive(
bool) ) );
228 connect( ui_.backfaceCullingActive, SIGNAL( toggled(
bool) ),
229 this, SLOT( changeActive(
bool) ) );
230 connect( ui_.colorMaterialActive, SIGNAL( toggled(
bool) ),
231 this, SLOT( changeActive(
bool) ) );
232 connect( ui_.multiSamplingActive, SIGNAL( toggled(
bool) ),
233 this, SLOT( changeActive(
bool) ) );
235 connect( ui_.alphaTest, SIGNAL( toggled(
bool) ),
236 ui_.alpha, SLOT( setEnabled(
bool) ) );
237 connect( ui_.blending, SIGNAL( toggled(
bool) ),
238 ui_.blendParam1, SLOT( setEnabled(
bool) ) );
239 connect( ui_.blending, SIGNAL( toggled(
bool) ),
240 ui_.blendParam2, SLOT( setEnabled(
bool) ) );
243 ui_.alpha->setEnabled( ui_.alphaTest->isChecked() );
244 ui_.blendParam1->setEnabled( ui_.blending->isChecked() );
245 ui_.blendParam2->setEnabled( ui_.blending->isChecked() );
247 ui_.baseColorActive->setChecked(baseColorActive_);
248 ui_.materialActive->setChecked(materialActive_);
249 ui_.pointSizeActive->setChecked(pointSizeActive_);
250 ui_.lineWidthActive->setChecked(lineWidthActive_);
251 ui_.roundPointsActive->setChecked(roundPointsActive_);
252 ui_.lineWidthActive->setChecked(lineWidthActive_);
253 ui_.alphaTestActive->setChecked(alphaTestActive_);
254 ui_.blendingActive->setChecked(blendingActive_);
255 ui_.backfaceCullingActive->setChecked(backfaceCullingActive_);
256 ui_.colorMaterialActive->setChecked(colorMaterialActive_);
257 ui_.multiSamplingActive->setChecked(multiSamplingActive_);
259 connect( ui_.okButton, SIGNAL( clicked() ),
260 this, SLOT( accept() ) );
261 connect( ui_.cancelButton, SIGNAL( clicked() ),
262 this, SLOT( reject() ) );
264 layout()->setSizeConstraint( QLayout::SetFixedSize );
273 const Vec4f& _color )
275 _button->setColor( convertColor( _color ) );
283 QtMaterialDialog::convertColor(
Vec4f _color)
285 return QColor ((
int)(_color[0]*255.0),
286 (
int)(_color[1]*255.0),
287 (
int)(_color[2]*255.0),
288 (
int)(_color[3]*255.0));
296 QtMaterialDialog::convertColor( QColor _color)
298 return Vec4f (_color.redF(),
308 void QtMaterialDialog::reject()
318 void QtMaterialDialog::applyChanges()
321 unsigned int properties = 0;
323 if (baseColorActive_) properties = properties | SceneGraph::MaterialNode::BaseColor;
324 if (materialActive_) properties = properties | SceneGraph::MaterialNode::Material;
325 if (pointSizeActive_) properties = properties | SceneGraph::MaterialNode::PointSize;
326 if (lineWidthActive_) properties = properties | SceneGraph::MaterialNode::LineWidth;
327 if (roundPointsActive_) properties = properties | SceneGraph::MaterialNode::RoundPoints;
328 if (lineSmoothActive_) properties = properties | SceneGraph::MaterialNode::LineSmooth;
329 if (alphaTestActive_) properties = properties | SceneGraph::MaterialNode::AlphaTest;
330 if (blendingActive_) properties = properties | SceneGraph::MaterialNode::Blending;
331 if (backfaceCullingActive_) properties = properties | SceneGraph::MaterialNode::BackFaceCulling;
332 if (colorMaterialActive_) properties = properties | SceneGraph::MaterialNode::ColorMaterial;
333 if (multiSamplingActive_) properties = properties | SceneGraph::MaterialNode::MultiSampling;
335 node_->applyProperties(properties);
337 node_->set_base_color(color_);
338 node_->set_ambient_color(ambient_);
339 node_->set_diffuse_color(diffuse_);
340 node_->set_specular_color(specular_);
341 node_->set_overlay_color(overlay_);
342 node_->set_shininess(shine_);
343 node_->set_point_size(point_size_);
344 node_->set_line_width(line_width_);
345 node_->set_round_points(round_points_);
346 node_->set_line_smooth(line_smooth_);
349 node_->enable_backface_culling();
351 node_->disable_backface_culling();
354 node_->enable_alpha_test( alphaValue_ );
356 node_->disable_alpha_test();
359 node_->enable_blending( blendParam1_, blendParam2_ );
361 node_->disable_blending();
363 if ( colorMaterial_ )
364 node_->enable_color_material();
366 node_->disable_color_material();
368 if ( multiSampling_ )
369 node_->enable_multisampling();
371 node_->disable_multisampling();
379 setButtonColor( ui_.diffuseColorButton, diffuse_ );
380 setButtonColor( ui_.ambientColorButton, ambient_ );
381 setButtonColor( ui_.specularColorButton, specular_ );
382 setButtonColor( ui_.overlayColorButton, overlay_ );
383 setButtonColor( ui_.baseColorButton, color_ );
385 emit signalNodeChanged(node_);
392 void QtMaterialDialog::undoChanges()
395 unsigned int properties = 0;
397 if (bak_baseColorActive_) properties = properties | SceneGraph::MaterialNode::BaseColor;
398 if (bak_materialActive_) properties = properties | SceneGraph::MaterialNode::Material;
399 if (bak_pointSizeActive_) properties = properties | SceneGraph::MaterialNode::PointSize;
400 if (bak_lineWidthActive_) properties = properties | SceneGraph::MaterialNode::LineWidth;
401 if (bak_roundPointsActive_) properties = properties | SceneGraph::MaterialNode::RoundPoints;
402 if (bak_lineSmoothActive_) properties = properties | SceneGraph::MaterialNode::LineSmooth;
403 if (bak_alphaTestActive_) properties = properties | SceneGraph::MaterialNode::AlphaTest;
404 if (bak_blendingActive_) properties = properties | SceneGraph::MaterialNode::Blending;
405 if (bak_backfaceCullingActive_) properties = properties | SceneGraph::MaterialNode::BackFaceCulling;
406 if (bak_colorMaterialActive_) properties = properties | SceneGraph::MaterialNode::ColorMaterial;
407 if (bak_multiSampling_) properties = properties | SceneGraph::MaterialNode::MultiSampling;
409 node_->applyProperties(properties);
411 node_->set_base_color(bak_color_);
412 node_->set_ambient_color(bak_ambient_);
413 node_->set_diffuse_color(bak_diffuse_);
414 node_->set_specular_color(bak_specular_);
415 node_->set_overlay_color(bak_overlay_);
416 node_->set_shininess(bak_shine_);
417 node_->set_point_size(bak_point_size_);
418 node_->set_line_width(bak_line_width_);
419 node_->set_round_points(bak_round_points_);
420 node_->set_line_smooth(bak_line_smooth_);
422 if(bak_backfaceCulling_)
423 node_->enable_backface_culling();
425 node_->disable_backface_culling();
428 node_->enable_alpha_test( bak_alphaValue_ );
430 node_->disable_alpha_test();
433 node_->enable_blending( bak_blendParam1_, bak_blendParam2_ );
435 node_->disable_blending();
437 if ( bak_colorMaterial_ )
438 node_->enable_color_material();
440 node_->disable_color_material();
442 if ( bak_multiSampling_ )
443 node_->enable_multisampling();
445 node_->disable_multisampling();
447 setButtonColor( ui_.diffuseColorButton, diffuse_ );
448 setButtonColor( ui_.ambientColorButton, ambient_ );
449 setButtonColor( ui_.specularColorButton, specular_ );
450 setButtonColor( ui_.overlayColorButton, overlay_ );
451 setButtonColor( ui_.baseColorButton, color_ );
453 emit signalNodeChanged(node_);
460 void QtMaterialDialog::changeDiffuseColor(QColor _newColor)
462 diffuse_ = convertColor( _newColor );
464 if (diffuse_[3] < 1.0f)
466 ui_.blending->setCheckState(Qt::Checked);
476 void QtMaterialDialog::changeAmbientColor(QColor _newColor)
478 ambient_ = convertColor( _newColor );
487 void QtMaterialDialog::changeSpecularColor(QColor _newColor)
489 specular_ = convertColor( _newColor );
496 void QtMaterialDialog::changeOverlayColor(QColor _newColor)
498 overlay_ = convertColor( _newColor );
506 void QtMaterialDialog::changeBaseColor(QColor _newColor)
508 color_ = convertColor( _newColor );
517 QtMaterialDialog::changeShine(
int _new)
528 QtMaterialDialog::changePointSize(
double _new)
530 point_size_ = float(_new);
539 QtMaterialDialog::changeLineWidth(
double _new)
541 line_width_ = float(_new);
550 QtMaterialDialog::changeRoundPoints(
bool _b)
552 round_points_ = (bool)_b;
555 bool b2 = _b || round_points_;
558 changeAlphaTest(
true);
559 changeAlphaValue(50);
560 ui_.alpha ->setValue(50);
562 ui_.alphaTest->setEnabled(!b2);
563 ui_.alpha ->setEnabled(!b2);
564 ui_.alphaTest->setChecked( b2);
573 QtMaterialDialog::changeLineSmooth(
bool _b)
575 line_smooth_ = (bool)_b;
578 bool b2 = _b || round_points_;
581 changeAlphaTest(
true);
582 changeAlphaValue(50);
583 ui_.alpha ->setValue(50);
585 ui_.alphaTest->setEnabled(!b2);
586 ui_.alpha ->setEnabled(!b2);
587 ui_.alphaTest->setChecked( b2);
596 QtMaterialDialog::changeBackfaceCulling(
bool _b)
598 backfaceCulling_ = (bool)_b;
606 QtMaterialDialog::changeAlphaTest(
bool _b)
608 alphaTest_ = (bool)_b;
615 QtMaterialDialog::changeColorMaterial(
bool _b)
617 colorMaterial_ = (bool)_b;
624 QtMaterialDialog::changeMultiSampling(
bool _b)
626 multiSampling_ = (bool)_b;
633 QtMaterialDialog::changeAlphaValue(
int _new)
635 alphaValue_ = float(_new) / 100.0f;
643 QtMaterialDialog::changeBlending(
bool _b)
645 blending_ = (bool)_b;
652 QtMaterialDialog::changeBlendingParam1(
const QString& _name)
654 if (_name ==
"GL_ZERO") blendParam1_ = GL_ZERO;
655 else if (_name ==
"GL_ONE") blendParam1_ = GL_ONE;
656 else if (_name ==
"GL_SRC_COLOR") blendParam1_ = GL_SRC_COLOR;
657 else if (_name ==
"GL_ONE_MINUS_SRC_COLOR") blendParam1_ = GL_ONE_MINUS_SRC_COLOR;
658 else if (_name ==
"GL_DST_COLOR") blendParam1_ = GL_DST_COLOR;
659 else if (_name ==
"GL_ONE_MINUS_DST_COLOR") blendParam1_ = GL_ONE_MINUS_DST_COLOR;
660 else if (_name ==
"GL_SRC_ALPHA") blendParam1_ = GL_SRC_ALPHA;
661 else if (_name ==
"GL_ONE_MINUS_SRC_ALPHA") blendParam1_ = GL_ONE_MINUS_SRC_ALPHA;
662 else if (_name ==
"GL_DST_ALPHA") blendParam1_ = GL_DST_ALPHA;
663 else if (_name ==
"GL_ONE_MINUS_DST_ALPHA") blendParam1_ = GL_ONE_MINUS_DST_ALPHA;
664 else if (_name ==
"GL_CONSTANT_COLOR") blendParam1_ = GL_CONSTANT_COLOR;
665 else if (_name ==
"GL_ONE_MINUS_CONSTANT_COLOR") blendParam1_ = GL_ONE_MINUS_CONSTANT_COLOR;
666 else if (_name ==
"GL_CONSTANT_ALPHA") blendParam1_ = GL_CONSTANT_ALPHA;
667 else if (_name ==
"GL_ONE_MINUS_CONSTANT_ALPHA") blendParam1_ = GL_ONE_MINUS_CONSTANT_ALPHA;
669 std::cerr <<
"Blending Param unknown!" << std::endl;
679 QtMaterialDialog::changeBlendingParam2(
const QString& _name)
681 if (_name ==
"GL_ZERO") blendParam2_ = GL_ZERO;
682 else if (_name ==
"GL_ONE") blendParam2_ = GL_ONE;
683 else if (_name ==
"GL_SRC_COLOR") blendParam2_ = GL_SRC_COLOR;
684 else if (_name ==
"GL_ONE_MINUS_SRC_COLOR") blendParam2_ = GL_ONE_MINUS_SRC_COLOR;
685 else if (_name ==
"GL_DST_COLOR") blendParam2_ = GL_DST_COLOR;
686 else if (_name ==
"GL_ONE_MINUS_DST_COLOR") blendParam2_ = GL_ONE_MINUS_DST_COLOR;
687 else if (_name ==
"GL_SRC_ALPHA") blendParam2_ = GL_SRC_ALPHA;
688 else if (_name ==
"GL_ONE_MINUS_SRC_ALPHA") blendParam2_ = GL_ONE_MINUS_SRC_ALPHA;
689 else if (_name ==
"GL_DST_ALPHA") blendParam2_ = GL_DST_ALPHA;
690 else if (_name ==
"GL_ONE_MINUS_DST_ALPHA") blendParam2_ = GL_ONE_MINUS_DST_ALPHA;
691 else if (_name ==
"GL_CONSTANT_COLOR") blendParam2_ = GL_CONSTANT_COLOR;
692 else if (_name ==
"GL_ONE_MINUS_CONSTANT_COLOR") blendParam2_ = GL_ONE_MINUS_CONSTANT_COLOR;
693 else if (_name ==
"GL_CONSTANT_ALPHA") blendParam2_ = GL_CONSTANT_ALPHA;
694 else if (_name ==
"GL_ONE_MINUS_CONSTANT_ALPHA") blendParam2_ = GL_ONE_MINUS_CONSTANT_ALPHA;
696 std::cerr <<
"Blending Param unknown!" << std::endl;
706 QtMaterialDialog::changeActive(
bool )
709 baseColorActive_ = ui_.baseColorActive->isChecked();
710 materialActive_ = ui_.materialActive->isChecked();
711 pointSizeActive_ = ui_.pointSizeActive->isChecked();
712 lineWidthActive_ = ui_.lineWidthActive->isChecked();
713 roundPointsActive_ = ui_.roundPointsActive->isChecked();
714 lineSmoothActive_ = ui_.lineSmoothActive->isChecked();
715 blendingActive_ = ui_.blendingActive->isChecked();
716 backfaceCullingActive_ = ui_.backfaceCullingActive->isChecked();
717 colorMaterialActive_ = ui_.colorMaterialActive->isChecked();
718 multiSamplingActive_ = ui_.multiSamplingActive->isChecked();
726 QtMaterialDialog::enableProperty(
int )
728 if (sender() == ui_.baseColorButton) ui_.baseColorActive->setChecked(
true );
729 else if (sender() == ui_.ambientColorButton) ui_.materialActive->setChecked(
true );
730 else if (sender() == ui_.diffuseColorButton) ui_.materialActive->setChecked(
true );
731 else if (sender() == ui_.specularColorButton) ui_.materialActive->setChecked(
true );
732 else if (sender() == ui_.overlayColorButton) ui_.materialActive->setChecked(
true );
733 else if (sender() == ui_.shininessSlider) ui_.materialActive->setChecked(
true );
734 else if (sender() == ui_.shininessBox) ui_.materialActive->setChecked(
true );
735 else if (sender() == ui_.pointSizeSpinBox) ui_.pointSizeActive->setChecked(
true );
736 else if (sender() == ui_.lineWidthSpinBox) ui_.lineWidthActive->setChecked(
true );
737 else if (sender() == ui_.roundPointsCheckBox) ui_.roundPointsActive->setChecked(
true );
738 else if (sender() == ui_.lineSmoothCheckBox) ui_.lineSmoothActive->setChecked(
true );
739 else if (sender() == ui_.backfaceCulling) ui_.backfaceCullingActive->setChecked(
true );
740 else if (sender() == ui_.alphaTest) ui_.alphaTestActive->setChecked(
true );
741 else if (sender() == ui_.blending) ui_.blendingActive->setChecked(
true );
742 else if (sender() == ui_.colorMaterial) ui_.colorMaterialActive->setChecked(
true );
743 else if (sender() == ui_.multiSampling) ui_.multiSamplingActive->setChecked(
true );
750 QtMaterialDialog::enableProperty(
double d)
753 if (sender() == ui_.baseColorButton) ui_.baseColorActive->setChecked(
true);
754 else if (sender() == ui_.ambientColorButton) ui_.materialActive->setChecked(
true);
755 else if (sender() == ui_.diffuseColorButton) ui_.materialActive->setChecked(
true);
756 else if (sender() == ui_.specularColorButton) ui_.materialActive->setChecked(
true);
757 else if (sender() == ui_.overlayColorButton) ui_.materialActive->setChecked(
true);
758 else if (sender() == ui_.shininessSlider) ui_.materialActive->setChecked(
true);
759 else if (sender() == ui_.shininessBox) ui_.materialActive->setChecked(
true);
760 else if (sender() == ui_.pointSizeSpinBox) ui_.pointSizeActive->setChecked(
true);
761 else if (sender() == ui_.lineWidthSpinBox) ui_.lineWidthActive->setChecked(
true);
762 else if (sender() == ui_.roundPointsCheckBox) ui_.roundPointsActive->setChecked(
true);
763 else if (sender() == ui_.lineSmoothCheckBox) ui_.lineSmoothActive->setChecked(
true);
764 else if (sender() == ui_.backfaceCulling) ui_.backfaceCullingActive->setChecked(
true);
765 else if (sender() == ui_.alphaTest) ui_.alphaTestActive->setChecked(
true);
766 else if (sender() == ui_.blending) ui_.blendingActive->setChecked(
true);
767 else if (sender() == ui_.colorMaterial) ui_.colorMaterialActive->setChecked(
true);
768 else if (sender() == ui_.multiSampling) ui_.multiSamplingActive->setChecked(
true);
775 QtMaterialDialog::enableProperty()
778 if (sender() == ui_.baseColorButton) ui_.baseColorActive->setChecked(
true );
779 else if (sender() == ui_.ambientColorButton) ui_.materialActive->setChecked(
true );
780 else if (sender() == ui_.diffuseColorButton) ui_.materialActive->setChecked(
true );
781 else if (sender() == ui_.specularColorButton) ui_.materialActive->setChecked(
true );
782 else if (sender() == ui_.overlayColorButton) ui_.materialActive->setChecked(
true );
783 else if (sender() == ui_.shininessSlider) ui_.materialActive->setChecked(
true );
784 else if (sender() == ui_.shininessBox) ui_.materialActive->setChecked(
true );
785 else if (sender() == ui_.pointSizeSpinBox) ui_.pointSizeActive->setChecked(
true );
786 else if (sender() == ui_.lineWidthSpinBox) ui_.lineWidthActive->setChecked(
true );
787 else if (sender() == ui_.roundPointsCheckBox) ui_.roundPointsActive->setChecked(
true );
788 else if (sender() == ui_.lineSmoothCheckBox) ui_.lineSmoothActive->setChecked(
true );
789 else if (sender() == ui_.backfaceCulling) ui_.backfaceCullingActive->setChecked(
true );
790 else if (sender() == ui_.alphaTest) ui_.alphaTestActive->setChecked(
true );
791 else if (sender() == ui_.blending) ui_.blendingActive->setChecked(
true );
792 else if (sender() == ui_.colorMaterial) ui_.colorMaterialActive->setChecked(
true );
793 else if (sender() == ui_.multiSampling) ui_.multiSamplingActive->setChecked(
true );
799 QString QtMaterialDialog::paramToStr(GLenum _param)
801 if (_param == GL_ZERO)
return "GL_ZERO";
802 else if (_param == GL_ONE)
return "GL_ONE";
803 else if (_param == GL_SRC_COLOR)
return "GL_SRC_COLOR";
804 else if (_param == GL_ONE_MINUS_SRC_COLOR)
return "GL_ONE_MINUS_SRC_COLOR";
805 else if (_param == GL_DST_COLOR)
return "GL_DST_COLOR";
806 else if (_param == GL_ONE_MINUS_DST_COLOR)
return "GL_ONE_MINUS_DST_COLOR";
807 else if (_param == GL_SRC_ALPHA)
return "GL_SRC_ALPHA";
808 else if (_param == GL_ONE_MINUS_SRC_ALPHA)
return "GL_ONE_MINUS_SRC_ALPHA";
809 else if (_param == GL_DST_ALPHA)
return "GL_DST_ALPHA";
810 else if (_param == GL_ONE_MINUS_DST_ALPHA)
return "GL_ONE_MINUS_DST_ALPHA";
811 else if (_param == GL_CONSTANT_COLOR)
return "GL_CONSTANT_COLOR";
812 else if (_param == GL_ONE_MINUS_CONSTANT_COLOR)
return "GL_ONE_MINUS_CONSTANT_COLOR";
813 else if (_param == GL_CONSTANT_ALPHA)
return "GL_CONSTANT_ALPHA";
814 else if (_param == GL_ONE_MINUS_CONSTANT_ALPHA)
return "GL_ONE_MINUS_CONSTANT_ALPHA";
816 return "UNKOWN PARAM";
Namespace providing different geometric functions concerning angles.
ACG::SceneGraph::MaterialNode MaterialNode
Materialnode.