![]() |
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 rlRenderer_rlRenderer_h 00038 #define rlRenderer_rlRenderer_h 00039 00040 #include <string> 00041 using std::string; 00042 00043 #include <vector> 00044 using std::vector; 00045 00046 #include <GL/glew.h> 00047 00048 #include <QObject> 00049 00050 #include <Core/Types.h> 00051 00052 #include <RL/RayLogger.h> 00053 #include <RL/rl.h> 00054 00055 00057 // Forward declarations 00058 00059 class QCheckBox; 00060 class QColor; 00061 class QFormLayout; 00062 class QFrame; 00063 class QGraphicsView; 00064 class QGridLayout; 00065 class QHBoxLayout; 00066 class QLabel; 00067 class QPushButton; 00068 class QScrollArea; 00069 class QShortcut; 00070 class QSlider; 00071 class QSpacerItem; 00072 class QSpinBox; 00073 class QVBoxLayout; 00074 00075 namespace uiCore 00076 { 00077 00078 class Camera; 00079 00080 } // namespace uiCore 00081 00082 namespace Core 00083 { 00084 00085 class Mesh; 00086 00087 } // namespace Core 00088 00089 00090 namespace rtVTK 00091 { 00092 00094 // Forward declarations 00095 00096 class MainWindow; 00097 00098 00100 // Using declarations 00101 00102 using uiCore::Camera; 00103 00104 using Core::Mesh; 00105 00106 00108 // Class definition 00109 00114 class rlRenderer : public QObject 00115 { 00116 Q_OBJECT 00117 00118 public: 00119 rlRenderer( MainWindow *const, 00120 const Camera&, 00121 const Mesh&, 00122 QWidget*); 00123 // QGridLayout*); 00124 00125 ~rlRenderer(); 00126 00128 void init(); 00129 00131 void render(); 00132 00134 void resize(int, int); 00135 00136 signals: 00137 void sgnlRender(); 00138 00139 public slots: 00140 void slotDepth(int); 00141 00142 void slotAdvanceTree(); 00143 void slotRegressTree(); 00144 void slotSeek(bool); 00145 00146 void slotOpenFile(); 00147 void slotCloseFile(); 00148 00149 void slotShowAdvancedSettings(); 00150 void slotHideAdvancedSettings(); 00151 00152 void slotShowArrowheads(bool); 00153 void slotShowEyeSphere(bool); 00154 00155 void slotSaveTree(); 00156 void slotClearTree(); 00157 void slotViewSavedTrees(bool); 00158 00159 void slotStepSlider(int); 00160 void slotStepSpinBox(int); 00161 00162 void slotHeightSlider(int); 00163 void slotHeightSpinBox(int); 00164 00165 void slotRadiusSlider(int); 00166 void slotRadiusSpinBox(int); 00167 00168 00170 // @name Rays 00172 void slotShowEye(bool); 00173 void slotShowShadow(bool); 00174 void slotShowRefl(bool); 00175 void slotShowTrans(bool); 00176 void slotShowDiffuse(bool); 00177 void slotRayTimer(); 00179 00181 // Helper functions and data members 00182 00183 private: 00185 void setupUI(); 00186 void retranslateUI(); 00187 00189 void setRay(const string&); 00190 00192 void envSetup(); 00193 00195 void envDestroy(); 00196 00198 void camSetup(); 00199 00201 void graphicsSetup(QGraphicsView*, QColor); 00202 00204 void drawRay(const rl::Ray&); 00205 00207 const Camera& cam; 00208 00210 const Mesh& mesh; 00211 00213 rl::RayLogger& rlRayLogger; 00214 00215 vector<rl::Tree> savedTrees; 00216 uint savedTreesMaxDepth; 00217 00218 rl::Tree currTree; 00219 rl::Ray ray; 00220 00221 uint w; 00222 uint h; 00223 00225 QShortcut* openFileShortcut; 00226 00228 MainWindow *const mw; 00229 00232 bool showArrowheads, showCamera, showSavedTrees; 00234 00236 float length, step, height, base; 00238 00240 float stepScale, heightScale, baseScale; 00242 bool seek; 00245 bool showEye, showShadow, showRefl, showTrans, showDiffuse; 00247 00250 uint slices, stacks; 00252 GLUquadricObj* obj; 00253 00256 // NOTE(cpg) - begin cut-and-paste from generated code (see NOTES) 00257 QWidget *sa_contents; 00258 QLabel *lbl_rayTypes; 00259 QCheckBox *cb_eyeRays; 00260 QCheckBox *cb_shadowRays; 00261 QCheckBox *cb_rflRays; 00262 QCheckBox *cb_rfrRays; 00263 QCheckBox *cb_diffuseRays; 00264 QGraphicsView *gv_eyeRays; 00265 QGraphicsView *gv_shadowRays; 00266 QGraphicsView *gv_rflRays; 00267 QGraphicsView *gv_rfrRays; 00268 QGraphicsView *gv_diffuseRays; 00269 QLabel *lbl_rayDepth; 00270 QSpinBox *sb_rayDepth; 00271 QFrame *hline0; 00272 QLabel *lbl_treeNavigation; 00273 QPushButton *pb_previous; 00274 QPushButton *pb_next; 00275 QCheckBox *cb_seek; 00276 QFrame *hline1; 00277 QLabel *lbl_fileControl; 00278 QPushButton *pb_openFile; 00279 QPushButton *pb_closeFile; 00280 QFrame *hline2; 00281 QPushButton *pb_showAdvancedSettings; 00282 QFrame *frame_advancedSettings; 00283 QLabel *lbl_savedTrees; 00284 QPushButton *pb_saveTree; 00285 QPushButton *pb_clearTrees; 00286 QCheckBox *cb_viewSavedTrees; 00287 QFrame *hline3; 00288 QLabel *lbl_rendering; 00289 QCheckBox *cb_displayCamera; 00290 QCheckBox *cb_displayArrowheads; 00291 QLabel *lbl_stepSize; 00292 QSpinBox *sb_stepSize; 00293 QSlider *hslider_stepSize; 00294 QLabel *lbl_coneHeight; 00295 QSpinBox *sb_coneHeight; 00296 QSlider *hslider_coneHeight; 00297 QLabel *lbl_baseRadius; 00298 QSpinBox *sb_baseRadius; 00299 QSlider *hslider_baseRadius; 00300 QPushButton *pb_hideAdvancedSettings; 00301 QFrame *hline4; 00302 // NOTE(cpg) - end cut-and-paste from generated code (see NOTES) 00303 00305 00306 }; // class rlRenderer 00307 00308 } // namespace rtVTK 00309 00310 #endif // rlRenderer_rlRenderer_h