00001 #ifndef GLView_H
00002 #define GLView_H
00003
00004 #include "glew/glew.h"
00005
00006 #include <QGLWidget>
00007
00008 const int getNextPowerOfTwo(const int number);
00009
00010 struct VolumeDesc
00011 {
00012 bool hasChanged;
00013 GLuint volumeTexture;
00014 GLuint realWidth, realHeight, realDepth;
00015 GLuint width, height, depth;
00016 GLuint xOffset, yOffset, zOffset;
00017 GLfloat xNormOffset, yNormOffset, zNormOffset;
00018 GLfloat xNormLength, yNormLength, zNormLength;
00019 GLuint maxSideLength;
00020 GLfloat stepDist;
00021
00022 VolumeDesc();
00023 void set(GLuint realWidth, GLuint realHeight, GLuint realDepth);
00024 };
00025
00026 struct TransferFunctionDesc
00027 {
00028 bool hasChanged;
00029 unsigned int *transferFunction;
00030
00031 TransferFunctionDesc();
00032 ~TransferFunctionDesc();
00033 void set(unsigned int *transferFunction, int length);
00034 };
00035
00036 struct StateDesc
00037 {
00038 bool shaderChanged;
00039 int shaderIndex;
00040
00041 StateDesc();
00042 void setShaderIndex(int shaderIndex);
00043 };
00044
00045 class GLView
00046 {
00047 public:
00048 GLView();
00049
00050 void setData(QGLWidget *parent, VolumeDesc *volumeDesc, TransferFunctionDesc *transferFunctionDesc, StateDesc *stateDesc);
00051
00052 virtual void initializeGL() = 0;
00053 virtual void uninitializeGL() = 0;
00054 virtual void paintGL() = 0;
00055 virtual void resizeGL(int width, int height) = 0;
00056 virtual void mousePressEvent(QMouseEvent *event) = 0;
00057 virtual void mouseMoveEvent(QMouseEvent *event) = 0;
00058 virtual void wheelEvent(QWheelEvent *event) = 0;
00059
00060 protected:
00061 QGLWidget *parent;
00062 VolumeDesc *volumeDesc;
00063 TransferFunctionDesc *transferFunctionDesc;
00064 StateDesc *stateDesc;
00065
00066 private:
00067 };
00068
00069 #endif // GLView_H