Go to the documentation of this file.00001 #ifndef VOLUMERENDERER_H
00002 #define VOLUMERENDERER_H
00003
00004 #include <QtGui>
00005 #include <QtOpenGL>
00006 #include <QGLWidget>
00007
00008 #include "GL/glext.h"
00009
00010 #include "arthurwidgets.h"
00011
00012 #include "Volume.h"
00013 #include "renderingoptions.h"
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00059 class VolumeRenderer : public QGLWidget
00060 {
00061 Q_OBJECT
00062
00063 public:
00069 VolumeRenderer(QWidget *parent = 0);
00070
00075 ~VolumeRenderer();
00076
00082
00083
00089
00090
00091 QSize minimumSizeHint() const;
00092 QSize sizeHint() const;
00093
00094 public:
00095 void setVolume(Volume* volume);
00096 void setTransfer();
00097 void setRenderingOptions(RenderingOptions *options);
00098
00099 public slots:
00105 void setGradientStops(const QGradientStops &stops);
00106 public slots:
00107 void setXRotation(int angle);
00108 void setYRotation(int angle);
00109 void setZRotation(int angle);
00110
00111 signals:
00112 void xRotationChanged(int angle);
00113 void yRotationChanged(int angle);
00114 void zRotationChanged(int angle);
00115
00116 protected:
00117 virtual void initializeGL();
00118 virtual void paintGL();
00119 virtual void resizeGL(int width, int height);
00120 void mousePressEvent(QMouseEvent *event);
00121 void mouseMoveEvent(QMouseEvent *event);
00122
00123 private:
00124 QGradientStops m_stops;
00126 QImage *image;
00128 QImage transferLUT;
00136 QRgb transfer(float value);
00137
00139
00143 void updateTransfer();
00144 private:
00145 int xRot;
00146 int yRot;
00147 int zRot;
00148 QPoint lastPos;
00149 private:
00150 QGLShaderProgram *program;
00151 int vertexLocation, texCoordLocation;
00152 int n0Location, uLocation, vLocation;
00153 int NLocation, volumeSizeLocation, volumeResolutionLocation;
00154 int samplerLocation;
00155 int lightColorLocation;
00156 int ambientColorLocation;
00157 int diffuseColorLocation;
00158 int specularColorLocation;
00159 int specularExponentLocation;
00160 int transferLocation;
00161 int k1Location, k2Location;
00162
00163 int width, height;
00164
00165 Volume *volume;
00166 RenderingOptions *options;
00167 GLuint textureName;
00168 GLuint transferTextureName;
00169
00170 PFNGLTEXIMAGE3DEXTPROC glTexImage3DEXT1;
00171 PFNGLACTIVETEXTUREPROC glActiveTextureEXT1;
00172
00173 };
00174
00175 #endif // VOLUMERENDERER_H