00001 #pragma once 00002 00003 #include <QtCore/QDataStream> 00004 #include <QtGui/QWidget> 00005 #include <QtGui/QMouseEvent> 00006 #include <QtGui/QWheelEvent> 00007 #include <QtGui/QKeyEvent> 00008 #include <Qt/qmetatype.h> 00009 #include "GLee.h" 00010 #include <QtOpenGL/QGLWidget> 00011 #include "VisTexture3D.hpp" 00012 #include "VisDrawSlice.hpp" 00013 #include "VisVolRenderer.hpp" 00014 #include <QtCore/QVector> 00015 #include "VisScreenCap.hpp" 00016 00020 class Renderwindow : public QGLWidget 00021 { 00022 Q_OBJECT 00023 00024 public: 00028 Renderwindow(QWidget *parent = 0); 00029 00033 void setData (QString data); 00034 00038 Texture3D* getData() { return myData; } 00039 00044 void setActSlice(int plane, int pos); 00045 00049 void changeRenderMode ( bool volumetric ); 00050 00054 void updateTransfer (float* tData); 00055 00059 void setTransfer (unsigned int size, float* transfer); 00060 00064 void triggerLight (bool on) { renderer->triggerLight(on); update(); } 00065 00069 void triggerNPR (bool on) { renderer->triggerNPR(on); update(); } 00070 00074 void setUpperLight (QColor); 00075 00079 void setLowerLight (QColor); 00080 00084 void updateLightVector (V3f lightVec); 00085 00089 void captureScreen (); 00090 00091 protected: 00092 00093 Plane3f calcPlane(); 00094 void initializeGL(); 00095 void resizeGL(int width, int height); 00096 void paintGL(); 00097 void resizeEvent(QResizeEvent *evt); 00098 void mousePressEvent(QMouseEvent *evt); 00099 void mouseMoveEvent(QMouseEvent *evt); 00100 void mouseReleaseEvent(QMouseEvent *evt); 00101 void wheelEvent(QWheelEvent *evt); 00102 00103 private: 00104 00105 int plane; 00106 double pos; 00107 bool isVolumetric; 00108 bool mousePressedL; 00109 bool mousePressedR; 00110 bool mousePressedM; 00111 float* lastPos; 00112 VolRenderer* renderer; 00113 00114 bool loaded; 00115 00116 float near_plane; 00117 Texture3D* myData; 00118 M44f rotationStack; 00119 M44f lightRotation; 00120 00121 float zoomFactor; 00122 float tx; 00123 float ty; 00124 };