#ifndef TETRAHEDRON_H
#define TETRAHEDRON_H

#include <QGLWidget>

class Tetrahedron : public QGLWidget
{
    Q_OBJECT

public:
    Tetrahedron(QWidget *parent = 0);
    QMovie *movie;
    QMovie *movie_object;
    //
    GLfloat debut_px;
    GLfloat debut_py;
    GLfloat debut_pz;
    GLfloat debut_rx;
    GLfloat debut_ry;
    GLfloat debut_rz;
    //
    GLfloat fin_px;
    GLfloat fin_py;
    GLfloat fin_pz;
    GLfloat fin_rx;
    GLfloat fin_ry;
    GLfloat fin_rz;
    //
    GLfloat delta_px;
    GLfloat delta_py;
    GLfloat delta_pz;
    GLfloat delta_rx;
    GLfloat delta_ry;
    GLfloat delta_rz;
    //
    GLfloat posanim_x;
    GLfloat posanim_y;
    GLfloat sizanim;
    GLfloat rotanim;
    int isdraw;
    //
    int x, y, z;
    GLfloat sizexleg;
    GLfloat ratioeffet;
    int hauteur_leg;
    GLfloat sizeyleg;
    GLfloat posxleg;
    GLfloat posyleg;
    GLfloat startx_legani;
    GLfloat starty_legani;
    GLfloat endx_legani;
    GLfloat endy_legani;
    float float_x, float_y, float_xb, float_yb;
    GLfloat elements[1500][3];
    GLfloat points[ 45 ][ 45 ][3];
    GLfloat oldpoints[ 45 ];
    int cptbuf;
    int bcle_render;
    int effetsup;
    GLfloat size_001;
    GLfloat size_002;
    GLfloat size_003;
    GLfloat size_004;
    GLfloat size_f_001;
    GLfloat size_f_002;
    int ismblur;
    int size_anim;
    int isdiapoanim;
    float wratioimg;
    int nbre_ani_slide;
    //
    GLfloat rotationX;
    GLfloat rotationY;
    GLfloat rotationZ;
    GLfloat deplacementX;
    GLfloat deplacementY;
    GLfloat zoom;
    GLfloat wg_percent;
    GLfloat wg_percent_fog;
    GLfloat wg_percent_slide;
    GLfloat wg_percent_trans;
    GLfloat start_opacity;
    GLfloat end_opacity;
    GLfloat delta_opacity;
    GLfloat start_fog_opacity;
    GLfloat end_fog_opacity;
    GLfloat delta_fog_opacity;
    //
    GLfloat size_factor;
    int affiche_grille;
    int type3D;
    int wg_qualite;
    long frame_encoding;
    int tool;
    int isfog;
    int progress;
    int isbackanim;
    int duree;
    int poursuite;
    int wg_duree;
    int fadele;
    int fadels;
    int long_effet;
    int bcle_tempo;
    int emptydiapo;
    QString path_fond;
    QString path_render;
    QString wg_tet_library;
    int iseffect;
    int wg_cpt_001;
    int wg_cpt_002;
    int is43;
    float wratiof;
    QString nameanim;
    QImage a;
    QImage d;
    QImage g;
    QImage h;
    QImage r;
    QImage r2;
    QImage e;
    QImage w;
    QImage null_img;
    QImage wg_puis_001;
    GLuint texture1;
    GLuint texture2;
    GLuint texture3;
    GLuint texture4;
    GLuint texture5;
    GLuint texture6;
    GLuint texture7;
    GLuint texture8;
    QFont myfont;
    QString wl_var_1;
    QString wl_var_2;
    QString wg_pathimg;
    QString wg_pathfond;
    QString wg_pathlegende;
    QString chemin_flocon;

    GLfloat fogcolor[4];
    int state_mode;
    int element;
    int max_diapo;
    int rotation_effet;

    GLfloat nombre_effet;
    GLfloat size_effet;
    GLfloat speed_effet;

    QAction *forme1;
    QAction *forme2;
    QAction *forme3;
    QAction *forme4;
    QAction *forme5;
    QAction *forme6;
    QAction *forme7;
    QAction *forme8;
    QAction *forme9;
    QAction *forme10;
    QAction *forme11;
    QAction *forme12;
    QAction *forme13;
    QAction *forme14;
    QAction *forme15;
    QAction *forme16;
    QAction *forme17;

    float w_x_p;
    float w_x_m;
    QImage t;
    QImage b;
    QImage q;
    QImage c;
    QImage f;
    QImage j;
protected:
    void paintGL();
    void mousePressEvent(QMouseEvent *event);
    void mouseMoveEvent(QMouseEvent *event);
    void wheelEvent(QWheelEvent *event);
    void contextMenuEvent(QContextMenuEvent *event);

public slots:
    void loadeffetsup(int);
    void sl_grille();
    void sl_charge_dessin(QString);
    void changeforme_1();
    void changeforme_2();
    void changeforme_3();
    void changeforme_4();
    void changeforme_5();
    void changeforme_6();
    void changeforme_7();
    void changeforme_8();
    void changeforme_9();
    void changeforme_10();
    void changeforme_15();
    void changeforme_16();
    void changeforme_17();
    void emitcopy();
    void emitpaste();
    void emitiedit();
    void emiteraser();
    void initializeGL();
    void change_fog_color();
    void sl_charge_image(QString, QString,QString);
    void grabframe(QString);
    void load_effet(QString);
    void sl_mark_deb();
    void sl_mark_fin();
    void resizeGL(int, int);
    void sl_change_fond(QString);
    void sl_brouillard(int);
    void sl_opacity(int);
    void sl_set_opacity();
    void sl_wait_stop();
    void sl_go_start();
    void sl_go_end();
    void sl_fond_color(int,int,int);
    void sl_fond_degrade(int,int,int,int,int,int,int);

signals:
    void updfrm(int);
    void c_copy();
    void c_paste();
    void c_iedit();
    void c_eraser();
    void chg_pos_legende();
    void sizep();
    void sizem();
    void loadback();

private slots:

private:
    void draw();
    QPoint lastPos;
};

#endif
