FlowVis 1.0

FlowVis/RenderWidget.h

00001 #ifndef RENDERWIDGET_H
00002 #define RENDERWIDGET_H
00003 
00004 #include "commonGL.h"
00005 //#include <gl.h>
00006 #include <QGLWidget>
00007 #include <vector>
00008 #include <queue>
00009 #include "Framework/FlowData.h"
00010 #include "shader.h"
00011 #include "Streamline.h"
00012 #include "LayerRenderable.h"
00013 
00014 using std::vector;
00015 using std::queue;
00016 
00026 
00027 class RenderWidget : public QGLWidget
00028 {
00029         Q_OBJECT
00030 
00031 public:
00032         RenderWidget(QWidget *parent=NULL);
00033         ~RenderWidget();
00034 
00046         int heightForWidth(int w) const;
00047 
00048 protected:
00049 
00059         void initializeGL();
00060 
00073         void resizeGL(int w, int h);
00074 
00084         void paintGL();
00085 
00086 
00087 private:
00088 
00089         const double PI;
00090 
00091         float* xdata;
00092         float* ydata;
00093 
00094         LayerRenderable* testLayer;
00095         LayerRenderable* testarrowLayer;
00096         GLuint testTransferTexture;
00097         int textureSize;
00098         int textureWidth;
00099         int textureHeight;
00100         int arrowCount;
00101 
00102         QVector<LayerRenderable*> layers;
00103         QVector<Shader*> shaders;
00104         GLuint* textures;
00105         int channelCount;
00106         GLuint* disp_lists;
00107         Shader *simple;
00108         Shader *arrows;
00109         Shader *slines;
00110         Shader *sltexture;
00111 
00112         float arrowSize;
00113         float d_sep_val;
00114         float d_sep;
00115         float d_test_val;
00116         float d_test;
00117         float dt;
00118         int sl_num_samples;
00119         vector<Streamline*> streamlines;
00120 
00121         int integration_mode;
00122         static const int EULER = 0;
00123         static const int RK2 = 1;
00124         static const int RK4 = 2;
00125 
00126         int streamline_mode;
00127         static const int NORMAL = 0;
00128         static const int TAPERING = 1;
00129         static const int GLYPH = 2;
00130         static const int TEXTURE = 3;
00131 
00143         void initArrows(int n, float aspect);
00144 
00152         void generateNormalStreamlineList();
00153 
00161         void generateTaperingStreamlineList();
00162 
00170         void generateGlyphStreamlineList();
00171 
00179         void generateTextureStreamlineList();
00180 
00191         float getSLIntensityForRank(int rank, int function_type);
00192 
00202         void initGlew();
00203 
00214         void loadData(std::string filename);
00215 
00227         void loadChannels(FlowData* dataset);
00228 
00236         void computeStreamlines();
00237 
00250         Streamline* calculateStreamline(vec3* seed, int gridWidth, int gridHeight, vector<vec3>** grid);
00251 
00263         void gridAddAt(vector<vec3>* grid, int gridwidth, int gridheight, vec3 pos);
00264 
00278         bool gridAroundOkay(vector<vec3>* grid, int gridwidth, int gridheight, vec3 pos, queue<vec3>* lastones);
00279 
00293         float minGridDistance(vector<vec3>* grid, int gridwidth, int gridheight, vec3 pos, queue<vec3>* lastones);
00294 
00305         bool distanceOkay(vec3 from, vec3 to);
00306 
00317         vec3 getNextEulerPoint(vec3 sample_point, bool backward);
00318 
00329         vec3 getNextRungeKutta2Point(vec3 sample_point, bool backward);
00330 
00341         vec3 getNextRungeKutta4Point(vec3 sample_point, bool backward);
00342 
00352         void printGLError();
00353         
00354 signals:
00355 
00366         void dataLoaded(int channels);
00367 
00379         void emitSettingValues(int value, int slider);
00380 
00381 public slots:
00391         void loadDataFile();
00392 
00404         void layerChannelChanged(int channel, int layer);
00405 
00417         void layerTypeChanged(int type, int layer);
00418 
00430         void layerTransferImageChanged(const QImage& image, int layer);
00431 
00442         void layerAdd(int layer);
00443 
00455         void layerMove(int layer,int newPos);
00456 
00457 
00468         void layerRemove(int layer);
00469 
00481         void settingsSliderChanged(int value,int slider);
00482 
00493         void settingsSLModeChanged(int value);
00494 
00504         void settingsSLCompute();
00505 
00516         void settingsSLInverpolationChanged(int value);
00517 
00527         void settingsEmitSliderValue(int slider);
00528 };
00529 
00530 #endif // RENDERWIDGET_H
 All Classes Functions Variables Friends