00001 #ifndef RAYTRACEDRENDERER_H
00002 #define RAYTRACEDRENDERER_H
00003
00004 #include <QObject>
00005 #include <QtOpenGL>
00006
00007
00008
00009
00010
00011
00012 class RaytracedRenderer : public QObject
00013 {
00014 Q_OBJECT
00015
00016 private:
00017
00019
00020
00022
00023
00026 QGLFramebufferObject *m_pFrontSidesFBO;
00027 QGLFramebufferObject *m_pBackSidesFBO;
00028 QGLFramebufferObject *m_pRayCastFBO;
00029
00030 QGLShaderProgram m_qPosIsColorShader;
00031 QGLShaderProgram m_qRaytraceShader;
00032 QGLShaderProgram m_qDrawResultShader;
00033
00034 bool m_bInitialized;
00035 bool m_bRedraw;
00036 int m_iHeight;
00037 int m_iWidth;
00038 int m_iMode;
00039 int m_iSteps;
00040 bool m_bFixedLowSteps;
00041 bool m_bAllowFixedLowSteps;
00042 bool m_bProgressiveRefinement;
00043 bool m_bShadingEnabled;
00044 float m_fFBOSizeFactor;
00045
00046 float m_fClipXLeft;
00047 float m_fClipXRight;
00048 float m_fClipYTop;
00049 float m_fClipYBottom;
00050 float m_fClipZBack;
00051 float m_fClipZFront;
00053
00056 void itlDrawColorCube();
00058 public:
00059
00061 static RaytracedRenderer *instance();
00062
00064 RaytracedRenderer();
00065
00067 void initialize();
00068
00070 void render();
00071
00073 void preRender();
00074
00076 void resize(int w, int h);
00077
00078 public slots:
00081 void setMode(int iMode) { m_iMode = iMode; }
00082 void setSteps(int iSteps) { m_iSteps = iSteps; }
00083 void setClippingValues(float fXLeft, float fXRight, float fYTop, float fYBottom, float fZBack, float fZFront);
00084 void setRedraw() { m_bRedraw = true;}
00085 void setShadingEnabled(bool b) { m_bShadingEnabled = b; }
00086 void setFixedLowSteps();
00087 void unsetFixedLowSteps();
00088
00089 void setAllowFixedLowSteps(bool allow) { m_bAllowFixedLowSteps = allow;}
00090 void setProgressiveRefinement(bool bActive) { m_bProgressiveRefinement = bActive; }
00091 void saveRenderedImageToFile(QString filename);
00092
00093 void setFBOSize(int iSelected);
00095 };
00096
00097 #endif // RAYTRACEDRENDERER_H