Go to the documentation of this file.00001 #ifndef GLWIDGET_HPP_
00002 #define GLWIDGET_HPP_
00003
00004 #include <GL/glew.h>
00005
00006 #include <QGLWidget>
00007 #include <QtOpenGL>
00008 #include <QGLShaderProgram>
00009 #include <QGLShader>
00010 #include <QColor>
00011
00012 #include <vector>
00013
00014 #include "FlowData.h"
00015 #include "FlowGeometry.h"
00016 #include "Streamline.h"
00017
00024 class GLWidget : public QGLWidget
00025 {
00026 Q_OBJECT
00027
00028 private:
00029 bool showArrows;
00030 bool showStreamlines;
00031
00032 FlowData *data;
00033 FlowGeometry *geometry;
00034
00035 GLuint texTransfer, texArrow;
00036 GLuint texChannels[max_channels];
00037 QGLShaderProgram *shader, *arrowShader;
00038
00039 int curChannel;
00040 int xRot, yRot, zRot;
00041 QPoint lastPos;
00042
00043 vector<Streamline> lines;
00044 bool euler;
00045 bool glyph;
00046 float dsep;
00047 float dtest;
00048 float dt;
00049
00050 float rA,gA,bA,aA;
00051 float rS,gS,bS,aS;
00052
00053 int numArrows;
00054
00055 protected:
00059 void initializeGL();
00065 void resizeGL(int width, int height);
00069 void paintGL();
00073 void renderArrows();
00078 void renderStreamlines();
00083 void generateStreamline(vec3 seedingPoint);
00084
00090 vec3 calcEulerPos(vec3 pos);
00096 vec3 calcRungeKuttaPos(vec3 pos);
00097
00098 public:
00104 GLWidget(QWidget *parent = 0);
00109 virtual ~GLWidget();
00114 void loadData(const std::string & strFilename);
00115
00120 void setTransferValues(float *_values);
00121
00128 void setArrowColor(float r, float g, float b);
00129
00136 void setStreamColor(float r, float g, float b);
00137
00138 public slots:
00143 void saveScreenshot();
00144
00149 void channelChanged(int index);
00150
00155 void switchStreamlineState(bool state);
00160 void dtValueChanged(double dt);
00165 void dsepValueChanged(double);
00170 void dtestValueChanged(double);
00175 void interpolationMethodChanged(bool euler);
00180 void paintMethodChanged(bool glyph);
00181
00186 void switchArrowState(bool state);
00191 void numArrowChanged(int glyph);
00196 void alphaArrowChanged(int alpha);
00201 void alphaStreamChanged(int alpha);
00202
00203
00204 signals:
00205
00210 void numChannelsChanged(int channels);
00211 };
00212
00213 #endif