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_isovalue1;
00078 float m_isovalue2;
00080 float m_stepsize;
00082 int m_fpsTimer;
00084 int m_fps;
00086 int m_frames;
00088 QTime m_timer;
00090 bool m_isShader0;
00092 bool m_isShader1;
00094 bool m_isShader2;
00096 bool m_isShader3;
00098 bool m_isShader4;
00099
00100 protected:
00105 void initializeGL();
00106
00112 void resizeGL(
00113 const int _w,
00114 const int _h
00115 );
00118 void paintGL();
00119
00120
00121 private :
00122
00123 void creatNoise();
00124
00127 ngl::Matrix inverse(ngl::Matrix &M)const;
00128
00131 void loadTextureRaw(const char *filename);
00132
00134 void createTransferFunction();
00135
00140 void mouseMoveEvent (
00141 QMouseEvent * _event
00142 );
00143
00149 void mousePressEvent (
00150 QMouseEvent *_event
00151 );
00152
00158 void mouseReleaseEvent (
00159 QMouseEvent *_event
00160 );
00161
00164 void timerEvent(
00165 QTimerEvent *_event
00166 );
00167
00168
00169 public slots:
00173 void textureChanged(const int _index);
00174
00178 void setScale( const int _value );
00179
00183 void setIsovalue1 (const int _value );
00184
00188 void setIsovalue2 (const int _value );
00189
00193 void setStepsize (const int _value );
00194
00198 void isAxis(const bool _index);
00199
00203 void isBoundingBox(const bool _index);
00204
00208 void isShader0(const bool _index);
00209
00213 void isShader1(const bool _index);
00214
00215
00219 void isShader2(const bool _index);
00220
00221
00225 void isShader3(const bool _index);
00226
00227
00231 void isShader4(const bool _index);
00232 };
00233
00234 #endif