00001
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00020
00021
#ifndef WINDOW3D_H
00022
#define WINDOW3D_H
00023
00024
#include <qtimer.h>
00025
#include <sstream>
00026
#include <qgl.h>
00027
#include "vrmlparser.h"
00028
#include "../primitives/vector3D.h"
00029
00030 const float TRA_INC = 0.2;
00031 const float ZOO_INC = 0.2;
00032 const int WIDTHOGL = 320;
00033 const int HEIGHTOGL = 320;
00034
00035
00045
00046
00048
00049 class Window3D :
public QGLWidget
00050 {
00051 Q_OBJECT
00052
private:
00055 QTimer *
timer;
00058 vector<Point3D*>
pointsList;
00061 vector<int>
referencesList;
00064 vector<Vector3D*>
normalsList;
00067 int nbPoints;
00070 int nbPolys;
00073 int oldX,
oldY;
00076 float angle[3];
00079 float tra[3];
00082 float zoom;
00085 int button;
00089 GLfloat
light1Position[4];
00092 GLfloat
light2Position[4];
00095 GLfloat
ambientLight[4];
00098 GLfloat
diffuseLight[4];
00101 GLfloat
specularLight[4];
00105 GLuint
model;
00106
00107
00108
00109
public:
00110
00116
Window3D( QWidget *parent,
char *name,
int timeInterval = 50);
00117
00120
virtual ~Window3D();
00121
00131
int load(
const int &nb_pts,
const int &nb_pls,
const vector<Point3D*> &L_pts,
const vector<int> &L_ref);
00132
00135
void clear();
00136
00139
void drawAxis();
00140
00150
int exportOGL(
int &nb_pts,
int &nb_pls, vector<Point3D*> &L_pts, vector<int> &L_ref);
00151
00155 inline bool isEmpty(){
return ((
nbPoints == 0) || (
nbPolys == 0));}
00156
00157
protected slots:
00158
00159
void timeOutSlot();
00160
00161
protected:
00162
00165
void initializeGL();
00166
00171
void resizeGL(
int width,
int height );
00172
00175
void paintGL();
00176
00179 GLuint
drawModel();
00180
00183
void rotate ();
00186
void translate ();
00187
00190
void scale ();
00191
00195
void mousePressEvent(QMouseEvent *event);
00196
00200
void wheelEvent( QWheelEvent * e );
00201
00205
void mouseMoveEvent(QMouseEvent *event);
00206
00210
void keyPressEvent( QKeyEvent *e );
00211
00214
void timeOut();
00215
00219
void closeEvent(QCloseEvent * );
00220
00221
00222 };
00223
00224
#endif
00225