QtMaterialDialog.hh

00001 /*===========================================================================*\
00002  *                                                                           *
00003  *                              OpenFlipper                                  *
00004  *      Copyright (C) 2001-2009 by Computer Graphics Group, RWTH Aachen      *
00005  *                           www.openflipper.org                             *
00006  *                                                                           *
00007  *---------------------------------------------------------------------------*
00008  *  This file is part of OpenFlipper.                                        *
00009  *                                                                           *
00010  *  OpenFlipper is free software: you can redistribute it and/or modify      *
00011  *  it under the terms of the GNU Lesser General Public License as           *
00012  *  published by the Free Software Foundation, either version 3 of           *
00013  *  the License, or (at your option) any later version with the              *
00014  *  following exceptions:                                                    *
00015  *                                                                           *
00016  *  If other files instantiate templates or use macros                       *
00017  *  or inline functions from this file, or you compile this file and         *
00018  *  link it with other files to produce an executable, this file does        *
00019  *  not by itself cause the resulting executable to be covered by the        *
00020  *  GNU Lesser General Public License. This exception does not however       *
00021  *  invalidate any other reasons why the executable file might be            *
00022  *  covered by the GNU Lesser General Public License.                        *
00023  *                                                                           *
00024  *  OpenFlipper is distributed in the hope that it will be useful,           *
00025  *  but WITHOUT ANY WARRANTY; without even the implied warranty of           *
00026  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            *
00027  *  GNU Lesser General Public License for more details.                      *
00028  *                                                                           *
00029  *  You should have received a copy of the GNU LesserGeneral Public          *
00030  *  License along with OpenFlipper. If not,                                  *
00031  *  see <http://www.gnu.org/licenses/>.                                      *
00032  *                                                                           *
00033 \*===========================================================================*/
00034 
00035 /*===========================================================================*\
00036  *                                                                           *
00037  *   $Revision: 6743 $                                                       *
00038  *   $Author: moebius $                                                      *
00039  *   $Date: 2009-08-05 11:03:10 +0200 (Mi, 05. Aug 2009) $                   *
00040  *                                                                           *
00041 \*===========================================================================*/
00042 
00043 
00044 
00045 //=============================================================================
00046 //
00047 //  CLASS QtMaterialDialog
00048 //
00049 //=============================================================================
00050 
00051 
00052 #ifndef ACG_QTMATERIALDIALOG_HH
00053 #define ACG_QTMATERIALDIALOG_HH
00054 
00055 
00056 //== INCLUDES =================================================================
00057 
00058 
00059 #include "ui_QtMaterialDialogUi.hh"
00060 
00061 #include "../Math/VectorT.hh"
00062 #include "../GL/gl.hh"
00063 
00064 #include <QColor>
00065 #include <QDialog>
00066 
00067 //== FORWARDDECLARATIONS ======================================================
00068 
00069 
00070 namespace ACG {
00071   namespace SceneGraph {
00072     class MaterialNode;
00073     class BaseNode;
00074   }
00075 }
00076 
00077 
00078 //== NAMESPACE ================================================================
00079 
00080 
00081 namespace ACG {
00082 namespace QtWidgets {
00083 
00084 
00085 //== CLASS DEFINITION =========================================================
00086 
00087 
00088 class ACGDLLEXPORT QtMaterialDialog : public QDialog
00089 {
00090   Q_OBJECT
00091 
00092 public:
00093 
00094   QtMaterialDialog( QWidget                  * _parent,
00095                               SceneGraph::MaterialNode * _node );
00096 
00097   ~QtMaterialDialog() {}
00098 
00099 
00100 signals:
00101 
00102   void signalNodeChanged( ACG::SceneGraph::BaseNode * _node );
00103 
00104 private:
00105 
00106 
00107   QColor convertColor( Vec4f  _color);
00108   Vec4f  convertColor( QColor _color);
00109 
00110   void setButtonColor( QPushButton * _button,
00111                                  const Vec4f & _color );
00112 
00113 private slots:
00114 
00115   void changeBaseColor();
00116   void changeAmbientColor();
00117   void changeDiffuseColor();
00118   void changeSpecularColor();
00119   void changeShine(int _new);
00120   void changePointSize(int _new);
00121   void changeLineWidth(int _new);
00122   void changeRoundPoints(bool _b);
00123   void changeLineSmooth(bool _b);
00124   void changeBackfaceCulling(bool _b);
00125   void changeAlphaTest(bool _b);
00126   void changeAlphaValue(int _new);
00127   void changeBlending(bool _b);
00128   void changeBlendingParam1(const QString& _name);
00129   void changeBlendingParam2(const QString& _name);
00130   void changeColorMaterial(bool _b);
00131   void changeMultiSampling(bool _b);
00132 
00133   void changeActive(bool toggle);
00134 
00135   void enableProperty();
00136   void enableProperty(int i);
00137 
00138   QString paramToStr(GLenum param);
00139 
00140   void applyChanges();
00141   void undoChanges();
00142 
00143   void reject();
00144 
00145 private:
00146 
00147 
00148 
00149   unsigned int  applyProperties_;
00150 
00151   Vec4f    color_,            bak_color_,
00152            ambient_,          bak_ambient_,
00153            diffuse_,          bak_diffuse_,
00154            specular_,         bak_specular_;
00155   float    shine_,            bak_shine_;
00156   float    point_size_,       bak_point_size_;
00157   float    line_width_,       bak_line_width_;
00158   bool     round_points_,     bak_round_points_;
00159   bool     line_smooth_,      bak_line_smooth_;
00160   bool     backfaceCulling_,  bak_backfaceCulling_;
00161   bool     alphaTest_,        bak_alphaTest_;
00162   float    alphaValue_,       bak_alphaValue_;
00163   bool     blending_,         bak_blending_;
00164   GLenum   blendParam1_,      bak_blendParam1_;
00165   GLenum   blendParam2_,      bak_blendParam2_;
00166   bool     colorMaterial_,    bak_colorMaterial_;
00167   bool     multiSampling_,    bak_multiSampling_;
00168 
00169   bool     baseColorActive_,       bak_baseColorActive_;
00170   bool     materialActive_,        bak_materialActive_;
00171   bool     pointSizeActive_,       bak_pointSizeActive_;
00172   bool     lineWidthActive_,       bak_lineWidthActive_;
00173   bool     roundPointsActive_,     bak_roundPointsActive_;
00174   bool     lineSmoothActive_,      bak_lineSmoothActive_;
00175   bool     alphaTestActive_,       bak_alphaTestActive_;
00176   bool     blendingActive_,        bak_blendingActive_;
00177   bool     backfaceCullingActive_, bak_backfaceCullingActive_;
00178   bool     colorMaterialActive_,   bak_colorMaterialActive_;
00179   bool     multiSamplingActive_,    bak_multiSamplingActive_;
00180 
00181   SceneGraph::MaterialNode * node_;
00182 
00183   Ui::QtMaterialDialogUi ui_;
00184 
00185 };
00186 
00187 
00188 //=============================================================================
00189 } // namespace QtWidgets
00190 } // namespace ACG
00191 //=============================================================================
00192 #endif // ACG_QTMATERIALDIALOG_HH defined
00193 //=============================================================================
00194 

acg pic Project OpenFlipper, ©  Computer Graphics Group, RWTH Aachen. Documentation generated using doxygen .