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 "Ray.h"
00022 #include "Axis.h"
00023 #include "Plane.h"
00024
00025 #include <QtOpenGL>
00026
00027
00028 class GLWindow : public QGLWidget
00029 {
00030 Q_OBJECT
00031 public :
00032
00035 GLWindow(
00036 QWidget *_parent
00037 );
00038 ~GLWindow();
00039
00040 private :
00042 int m_spinXFace;
00044 int m_spinYFace;
00046 bool m_rotate;
00048 int m_origX;
00050 int m_origY;
00052 ngl::TransformStack m_transformStack;
00054 ngl::Camera *m_cam;
00056 Plane *m_Plane;
00058 ngl::BBox *m_bbox;
00060 Axis *m_axis;
00062 ngl::Colour m_colour;
00064 ngl::Vector m_axisPos;
00066 bool m_animate;
00068 int m_rayUpdateTimer;
00070 float m_length;
00072 int m_hitNum;
00074 int m_textureID;
00076 bool m_isX;
00077 bool m_isY;
00078 bool m_isZ;
00079 bool m_isDia;
00081 bool m_isSlice;
00083 bool m_isBoundingBox;
00085 bool m_isAxis;
00087 int nMax;
00089 int m_transferFunID;
00091 ngl::Vector v0;
00092 ngl::Vector v1;
00093 ngl::Vector v2;
00095 float m_scale;
00097 std::vector<Plane> m_PlaneArrayPX;
00098 std::vector<Plane> m_PlaneArrayNX;
00099 std::vector<Plane> m_PlaneArrayPY;
00100 std::vector<Plane> m_PlaneArrayNY;
00101 std::vector<Plane> m_PlaneArrayPZ;
00102 std::vector<Plane> m_PlaneArrayNZ;
00104 std::vector <Ray> m_rays;
00105 float stepsize;
00106
00107 protected:
00108
00113 void initializeGL();
00119 void resizeGL(
00120 const int _w,
00121 const int _h
00122 );
00125 void paintGL();
00126
00127 private :
00130 void positiveXArray();
00131 void positiveYArray();
00132 void positiveZArray();
00133 void negativeXArray();
00134 void negativeYArray();
00135 void negativeZArray();
00137 void findAxis(ngl::Vector _dir);
00139 void update();
00141 void loadTextureRaw(const char *filename);
00143 void makeMarbleTexture(float amp, float strength);
00145 void buildRay();
00146
00151
00152 void mouseMoveEvent (
00153 QMouseEvent * _event
00154 );
00160
00161 void mousePressEvent (
00162 QMouseEvent *_event
00163 );
00164
00170 void mouseReleaseEvent (
00171 QMouseEvent *_event
00172 );
00175 void timerEvent(
00176 QTimerEvent *_event
00177 );
00178
00179
00180 public slots:
00184 void reset();
00185
00189 void textureChanged(const int _index);
00190
00194 void transferF1(const bool _index);
00195
00199 void transferF2(const bool _index);
00200
00204 void transferF3(const bool _index);
00205
00206
00210 void axisIsX(const bool _index);
00211
00215 void axisIsY(const bool _index);
00216
00220 void axisIsZ(const bool _index);
00221
00225 void axisIsDia(const bool _index);
00226
00230 void isAxis(const bool _index);
00231
00235 void isBoundingBox(const bool _index);
00236
00240 void isSlice(const bool _index);
00241
00245 void toggleAnimation();
00246
00253 void setColour(
00254 const float _r,
00255 const float _g,
00256 const float _b
00257 );
00258
00262 void setScale( const int _value );
00263
00264 };
00265
00266 #endif