00001 #ifndef __GL_WINDOW_H__
00002 #define __GL_WINDOW_H__
00003
00004
00012
00013
00014 #include "ngl/Camera.h"
00015 #include "ngl/Vector.h"
00016 #include "ngl/Colour.h"
00017 #include "ngl/SpotLight.h"
00018 #include "ngl/TransformStack.h"
00019 #include "ngl/Obj.h"
00020 #include "ngl/BBox.h"
00021 #include "ngl/Matrix.h"
00022 #include "Axis.h"
00023 #include "Plane.h"
00024
00025 #include <QtOpenGL>
00026 #include <QTime>
00027
00028 class GLWindow : public QGLWidget
00029 {
00030 Q_OBJECT
00031 public :
00032
00035 GLWindow(
00036 QWidget *_parent
00037 );
00038 ~GLWindow();
00039
00040
00041 private :
00043 int m_spinXFace;
00045 int m_spinYFace;
00047 bool m_rotate;
00049 int m_origX;
00051 int m_origY;
00053 ngl::Camera *m_cam;
00055 ngl::TransformStack m_transformStack;
00057 float m_scale;
00059 bool m_isBoundingBox;
00061 bool m_isAxis;
00063 bool m_isRayCasting;
00064 bool m_isViewAligned;
00066 ngl::BBox *m_bbox;
00068 Axis *m_axis;
00070 Plane *m_plane;
00072 ngl::Vector m_axisPos;
00074 int m_textureID;
00076 float m_depth;
00078 float m_min;
00080 float m_max;
00082 float m_isovalue1;
00084 float m_isovalue2;
00086 float m_stepsize;
00088 int m_fpsTimer;
00090 int m_fps;
00092 int m_frames;
00094 QTime m_timer;
00096 bool m_isShader0;
00098 bool m_isShader1;
00100 bool m_isShader2;
00102 bool m_isShader3;
00104 bool m_isShader4;
00105
00106 protected:
00111 void initializeGL();
00112
00118 void resizeGL(
00119 const int _w,
00120 const int _h
00121 );
00124 void paintGL();
00125
00126
00127 private :
00128
00129 void creatNoise();
00130
00133 ngl::Matrix inverse(ngl::Matrix &M)const;
00134
00137 void loadTextureRaw(const char *filename);
00138
00142 void findDepth( ngl::Matrix _modelViewMatrix);
00143
00145 void createTransferFunction();
00146
00151 void mouseMoveEvent (
00152 QMouseEvent * _event
00153 );
00154
00160 void mousePressEvent (
00161 QMouseEvent *_event
00162 );
00163
00169 void mouseReleaseEvent (
00170 QMouseEvent *_event
00171 );
00172
00175 void timerEvent(
00176 QTimerEvent *_event
00177 );
00178
00179
00180 public slots:
00184 void textureChanged(const int _index);
00185
00189 void setScale( const int _value );
00190
00194 void setIsovalue1 (const int _value );
00195
00199 void setIsovalue2 (const int _value );
00200
00204 void setStepsize (const int _value );
00205
00209 void isAxis(const bool _index);
00210
00214 void isBoundingBox(const bool _index);
00215
00219 void isShader0(const bool _index);
00220
00221
00225 void isShader1(const bool _index);
00226
00227
00231 void isShader2(const bool _index);
00232
00233
00237 void isShader3(const bool _index);
00238
00239
00243 void isShader4(const bool _index);
00244 };
00245
00246 #endif