Flow Visualization 1.0

FlowRenderer.h

00001 #ifndef FLOWRENDERER_H
00002 #define FLOWRENDERER_H
00003 
00004 #include <QtOpenGL>
00005 
00007 class FlowRenderer : public QObject
00008 {
00009     Q_OBJECT
00010 
00011 private:
00012     GLuint m_gliArrowTexture;
00013     GLuint m_gliStreamlinesTexture;
00014     GLuint m_gliStreamlinesGlyphsTexture;
00015     GLuint m_gliGlyphTexture;
00016 
00017     bool m_bShowArrowTexture;
00018     bool m_bShowStreamlinesTexture;
00019 
00020     bool m_bGLThingsInitialized;
00021 
00022     int m_iColorCoding;
00023     int m_iStreamlinesMode; 
00024     int m_iStreamlineWidth;
00025         int m_iStreamlineTexturingMode; 
00026         int m_iStreamlineTexturingPeriodLength; 
00027     int m_iRenderWidth;
00028     int m_iRenderHeight;
00029 
00030     float m_fStreamlines_dsep;
00031     float m_fStreamlines_dtest;
00032     float m_fStreamlines_dstep;
00033     bool m_bUseTapering;
00034     bool m_bUseGlyphs;
00035 
00036     QGLShaderProgram m_ShaderProgram;
00037 
00038     void checkInitialized();
00039 
00040 public slots:
00041     void updateArrowTexture();
00042     void updateStreamlinesTexture();
00043 
00044     void render();
00045 
00046     void setColorCoding(int i) { m_iColorCoding = i; }
00047     void setShowArrows(bool b) { m_bShowArrowTexture = b; }
00048     void setShowStreamlines(bool b) { m_bShowStreamlinesTexture = b; }
00049     void setStreamlinesMode(int i) {m_iStreamlinesMode = i;}
00050     void setDsep(double f) { m_fStreamlines_dsep = f; emit DsepChanged(f);}
00051     void setDtest(double f) { m_fStreamlines_dtest = f; emit DtestChanged(f); }
00052     void setDstep(double f) { m_fStreamlines_dstep = f; emit DstepChanged(f); }
00053     void setUseTapering(bool b) { m_bUseTapering = b; emit UseTaperingChanged(b); }
00054     void setStreamlineWidth(int i) { m_iStreamlineWidth = i; emit StreamlineWidthChanged(i); }
00055     void setRenderSize(int w, int h) { m_iRenderWidth = w; m_iRenderHeight = h; }
00056     void setStreamlineTexturingMode(int i) { m_iStreamlineTexturingMode = i; emit StreamlineTexturingModeChanged(i);}
00057     void setStreamlineTexturingPeriodLength(int i) { m_iStreamlineTexturingPeriodLength = i;  emit StreamlineTexturingPeriodLengthChanged(i);}
00058     void setUseGlyphs(bool b) { m_bUseGlyphs = b; emit UseGlyphsChanged(b); }
00059 
00060 signals:
00061     void DsepChanged(double f);
00062     void DtestChanged(double f);
00063     void DstepChanged(double f);
00064     void UseTaperingChanged(bool b);
00065     void UseGlyphsChanged(bool b);
00066     void StreamlineWidthChanged(int i);
00067     void StreamlineTexturingModeChanged(int i);
00068     void StreamlineTexturingPeriodLengthChanged(int i);
00069 
00070 public:
00071     static FlowRenderer *instance();
00072     FlowRenderer();
00073 };
00074 
00075 #endif // FLOWRENDERER_H