71 lines
1.7 KiB
C++
Executable File
71 lines
1.7 KiB
C++
Executable File
/* Copyright (C) 2013 Karl Phillip Buhr <karlphillip@gmail.com>
|
|
*
|
|
* This work is licensed under the Creative Commons Attribution-ShareAlike License.
|
|
* To view a copy of this license, visit:
|
|
* https://creativecommons.org/licenses/by-sa/2.5/legalcode
|
|
*
|
|
* Or to read the human-readable summary of the license:
|
|
* https://creativecommons.org/licenses/by-sa/2.5/
|
|
*/
|
|
#pragma once
|
|
#ifndef GLWINDGET_H
|
|
#define GLWINDGET_H
|
|
|
|
//Qt libs
|
|
#include <QGLWidget>
|
|
#include <QImage>
|
|
#include <QTime>
|
|
#include <QString>
|
|
#include "ocean.h"
|
|
|
|
class GLWidget : public QGLWidget
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
explicit GLWidget(QWidget* parent = 0);
|
|
virtual ~GLWidget();
|
|
|
|
/* OpenGL initialization, viewport resizing, and painting */
|
|
|
|
void initializeGL();
|
|
void paintGL();
|
|
void resizeGL( int width, int height);
|
|
|
|
void keyPressEvent(QKeyEvent *event);
|
|
void wheelEvent(QWheelEvent *event);
|
|
void mousePressEvent(QMouseEvent *event);
|
|
void mouseMoveEvent(QMouseEvent *event);
|
|
|
|
/* Helper functions */
|
|
void setXRotation(int angle);
|
|
void setYRotation(int angle);
|
|
void setZRotation(int angle);
|
|
|
|
void _view_ortho();
|
|
void _view_perspective();
|
|
static void repereScene3D(float l);
|
|
static void affiche_sol();
|
|
void _draw_text(double x, double y, double z, QString txt);
|
|
private:
|
|
|
|
int _width;
|
|
int _height;
|
|
QString framedir, spectredir;
|
|
QImage qt_frame;
|
|
QPoint last_pos;
|
|
double x_trans,y_trans,z_trans, distance;
|
|
double x_cam_eye, y_cam_eye, z_cam_eye,
|
|
x_cam_center, y_cam_center, z_cam_center,
|
|
x_cam_up, y_cam_up, z_cam_up;
|
|
bool activeZrotate;
|
|
double x_rot,y_rot,z_rot;
|
|
|
|
Ocean o1;
|
|
int _fps;
|
|
GLuint _texture;
|
|
QTime now;
|
|
protected slots:
|
|
void _tick();
|
|
};
|
|
#endif
|