mantaflow  0.10
A framework for fluid simulation
glwidget.h
Go to the documentation of this file.
1 
2 /******************************************************************************
3  *
4  * MantaFlow fluid solver framework
5  * Copyright 2011 Tobias Pfaff, Nils Thuerey
6  *
7  * This program is free software, distributed under the terms of the
8  * GNU General Public License (GPL)
9  * http://www.gnu.org/licenses
10  *
11  * QT OpenGL widget
12  *
13  ******************************************************************************/
14 
15 #ifndef _GLWIDGET_H__
16 #define _GLWIDGET_H__
17 
18 #include <QGLWidget>
19 #include <QtOpenGL>
20 #include "vectorbase.h"
21 
22 namespace Manta {
23 
24 class GLWidget : public QGLWidget {
25 Q_OBJECT
26 
27 public:
28  GLWidget(QWidget *parent = NULL);
29  ~GLWidget();
30 
31  QSize minimumSizeHint() const;
32  QSize sizeHint() const;
33 
34  void mousePressEvent(QMouseEvent *e);
35  void mouseMoveEvent(QMouseEvent *e);
36  void mouseReleaseEvent(QMouseEvent *e);
37  void wheelEvent(QWheelEvent *e);
38  void screenshot(QString file);
39 
40  void setCamPos(Vec3 pos) { mCamPos = pos; }
41  void setCamRot(Vec3 pos) { mRotX = pos.x; mRotY = pos.y; }
42 
43 public slots:
44  void setViewport(const Vec3i& gridsize);
45  void keyPressEvent(QKeyEvent* e);
46  void keyReleaseEvent(QKeyEvent* e);
47  void windowSize(int w, int h);
48 
49 signals:
50  void paintSub();
51  void clickLine(QPoint pos, float p0, float p1,float p2, float q0, float q1, float q2);
52  void painterEvent(int e, int param=0);
53 
54 protected:
55  bool keyProcess(int key, int mod, bool down);
56  void timerEvent(QTimerEvent* e);
57  void initializeGL();
58  void resizeGL(int w, int h);
59  void paintGL();
60  void updatePlane(int plane);
61 
62  enum MoveDir { None = 0, MoveLeft, MoveRight, MoveUp, MoveDown, MoveIn, MoveOut, MoveDirNum };
63 
64  bool mMoveState[MoveDirNum];
65  bool mMoveFast;
66  QPoint mAnchor, mDownPos;
67  Vec3 mCamPos;
68  float mRotX, mRotY;
69  Vec3i mGridsize;
70  int mPlaneDim, mPlane;
71 
72  int mScreenshotNumber;
73  int mWidth, mHeight;
74 };
75 
76 } // namespace
77 
78 #endif
79 
80 
Definition: commonkernels.h:22
Definition: glwidget.h:24
Basic inlined vector class.
Definition: vectorbase.h:71