00001 #ifndef GLWIDGET_HPP_
00002 #define GLWIDGET_HPP_
00003
00004 #include <GL/glew.h>
00005
00006 #include <QGLWidget>
00007 #include <QtOpenGL>
00008 #include <QGLShaderProgram>
00009 #include <QGLShader>
00010 #include <QColor>
00011
00012 #include "Volume.h"
00013
00020 class GLWidget : public QGLWidget
00021 {
00022 Q_OBJECT
00023
00024 private:
00025 Volume *volume;
00026 unsigned short sliceNum;
00027 unsigned short sizeX, sizeY, sizeZ;
00028 unsigned short dimX, dimY;
00029 int direction;
00030 float *transferData;
00031 GLuint transf, slice, texFront, texBack, FBFront, FBBack;
00032 QGLShaderProgram *shader;
00033 QGLShaderProgram *rayShader;
00034 float stepSize;
00035 int renderMode;
00036 bool light;
00037 bool f2bMode;
00038 bool perspProj;
00039
00040 float xPlane, yPlane, zPlane;
00041
00042 bool showVolume;
00043 int xRot, yRot, zRot;
00044 QPoint lastPos;
00045
00049 void initSliceTexture();
00053 void initTransferTexture();
00057 void drawSlice();
00061 void drawBoundingBox();
00065 void createFBOs();
00073 void drawVolume();
00074
00075 protected:
00079 void initializeGL();
00085 void resizeGL(int width, int height);
00089 void paintGL();
00090
00095 void mousePressEvent(QMouseEvent *event);
00100 void mouseMoveEvent(QMouseEvent *event);
00101
00102 public:
00108 GLWidget(QWidget *parent = 0);
00113 virtual ~GLWidget();
00118 void loadData(const std::string & strFilename);
00123 void saveScreenshot();
00128 void setTransferValues(float *_values);
00129
00130 public slots:
00135 void updateSlice(int _value);
00140 void setSliceDirection(int _dir);
00145 void setRenderMode(int _mode);
00150 void setVolumeRenderMode(int _mode);
00155 void setLight(int _state);
00160 void setStepSize(double _stepSize);
00165 void setCompositingMode(bool _f2b);
00170 void setProjection(int _proj);
00175 void setXPlane(int _xPlane);
00180 void setYPlane(int _yPlane);
00185 void setZPlane(int _zPlane);
00189 void resetSettings();
00190
00191 signals:
00197 void rangeChanged(int _min, int _max);
00198 };
00199
00200 #endif