![]() |
rtVTK
0.6.0
|
00001 00002 /****************************************************************************** 00003 * Copyright (c) 2012, Grove City College 00004 * All rights reserved. 00005 * 00006 * Redistribution and use in source and binary forms, with or without 00007 * modification, are permitted provided that the following conditions are 00008 * met: 00009 * 00010 * * Redistributions of source code must retain the above copyright 00011 * notice, this list of conditions and the following disclaimer. 00012 * 00013 * * Redistributions in binary form must reproduce the above copyright 00014 * notice, this list of conditions and the following disclaimer in 00015 * the documentation and/or other materials provided with the 00016 * distribution. 00017 * 00018 * * Neither the name of Grove City College nor the names of its 00019 * contributors may be used to endorse or promote products derived 00020 * from this software without specific prior written permission. 00021 * 00022 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 00023 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 00024 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 00025 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 00026 * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 00027 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 00028 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 00029 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 00030 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00031 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 00032 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00033 * 00034 */ 00035 00036 00037 #ifndef glRenderer_glRenderer_h 00038 #define glRenderer_glRenderer_h 00039 00040 #include <string> 00041 using std::string; 00042 00043 #include <QObject> 00044 00045 #include <Core/Mesh.h> 00046 #include <Core/Types.h> 00047 00048 #include <Math/Math.h> 00049 00050 00052 // Forward declarations 00053 00054 class QCheckBox; 00055 class QFrame; 00056 class QGridLayout; 00057 class QLabel; 00058 class QRadioButton; 00059 class QSlider; 00060 class QSpacerItem; 00061 class QWidget; 00062 00063 namespace uiCore 00064 { 00065 00066 class Camera; 00067 00068 } 00069 00070 00071 namespace rtVTK 00072 { 00073 00075 // Forward declarations 00076 00077 class MainWindow; 00078 00079 00081 // Using declarations 00082 00083 using uiCore::Camera; 00084 00085 using Core::Mesh; 00086 00087 using MathF::Point; 00088 00089 00091 // Class definition 00092 00097 class glRenderer : public QObject 00098 { 00099 // NOTE(ejq) - commenting this line out is dangerous; see 00100 // 00101 // http://doc.qt.nokia.com/latest/qobject.html#Q_OBJECT 00102 // 00103 // for more 00104 00105 Q_OBJECT 00106 00107 public: 00108 glRenderer( MainWindow const *, 00109 const Camera&, 00110 const Mesh&, 00111 QWidget*); 00112 00113 ~glRenderer(); 00114 00116 void init(); 00117 00119 void render(); 00120 00122 void resize(uint, uint); 00123 00124 signals: 00125 void sgnlRender(); 00126 00127 public slots: 00128 00129 void slotSetShowPivot(bool); 00130 00131 void slotSetDrawLines(bool); 00132 void slotSetLineWidth(int); 00133 00134 void slotSetDrawOpaque(bool); 00135 void slotSetAlpha(int); 00136 00137 private: 00139 void initLight(const Point&); 00140 00142 void disableLight(); 00143 00145 void drawWireframe(); 00146 00147 uint w; 00148 uint h; 00149 00151 const Camera& camera; 00152 00154 const Mesh& mesh; 00155 00157 bool showPivot; 00159 bool drawLines; 00160 float lwidth; 00161 float lscale; 00162 00164 bool drawOpaque; 00165 float alpha; 00166 float ascale; 00167 00169 00170 QGridLayout* glayout_glRenderer; 00171 QLabel* lbl_rendering; 00172 00173 QFrame* hline0; 00174 00175 QCheckBox* cb_drawLines; 00176 QLabel* lbl_lwidth; 00177 QSlider* hslider_lwidth; 00178 00179 QCheckBox* cb_drawOpaque; 00180 QLabel* lbl_alpha; 00181 QSlider* hslider_alpha; 00182 00183 QFrame* hline1; 00184 00185 QCheckBox* cb_showPivot; 00186 00187 QSpacerItem* vspacer_spacer; 00189 }; // class glRenderer 00190 00191 } // namespace rtVTK 00192 00193 #endif // glRenderer_glRenderer_h