00001 #ifndef VSTUDIORENDERER_H 00002 #define VSTUDIORENDERER_H 00003 00004 /****************************************************************************\ 00005 * REQUIRED HEADERS * 00006 \****************************************************************************/ 00007 00008 //QT 00009 #include <QSettings> 00010 //OWN 00011 #include "PerformanceOverlay.h" 00012 #include "CGLSurface.h" 00013 #include "Definitions.h" 00014 #include "Memory/mmgr.h" 00015 #include "Display/Camera/CCamera.h" 00016 #include "Display/Camera/CSceneCtrl.h" 00017 #include "Display/Light/CLight.h" 00018 #include "Volume.h" 00019 00020 /****************************************************************************\ 00021 * DEFINITIONS * 00022 \****************************************************************************/ 00023 00024 class VStudio; 00025 class QMenu; 00026 class QAction; 00027 00028 /****************************************************************************\ 00029 * CLASS * 00030 \****************************************************************************/ 00031 class VStudioRenderer : public CGLSurface 00032 { 00033 Q_OBJECT 00034 00035 /**************************************************************************\ 00036 * PUBLIC CLASS FUNCTIONS * 00037 \**************************************************************************/ 00038 public: 00039 00040 VStudioRenderer(VStudio * const control,QGLFormat & requestFormat,QWidget *parent = 0); 00041 ~VStudioRenderer(); 00042 00043 void OpenState(QSettings & openFile); 00044 void SaveState(QSettings & saveFile); 00045 00046 bool GetOpenglInfo(OpenGLInfo &); 00047 float GetViewAspect(){return viewportWidth/(float)viewportHeight;} 00048 00049 00050 void EnableLog(bool tf){bDoLog = tf;} 00051 00052 void SetLight(TSmartPointer<CLight> light); 00053 void SetVolume(TSmartPointer<CVolume> volume); 00054 void SetBGColor(float r,float g,float b, float a); 00055 00056 TSmartPointer<CVolume> const GetCurrentVolume(){return pRenderVolume;} 00057 00058 /**************************************************************************\ 00059 * PROTECTED CLASS FUNCTIONS * 00060 \**************************************************************************/ 00061 protected: 00062 00063 virtual void onResize(); 00064 virtual void onInitialize(); 00065 virtual void onFinishRendering(); 00066 virtual void onAnimate(); 00067 00068 virtual void onLOG(const char *); 00069 virtual void onLOG(QString&); 00070 00071 virtual void contextMenuEvent(QContextMenuEvent *); 00072 virtual void keyPressEvent(QKeyEvent *event); 00073 virtual void keyReleaseEvent(QKeyEvent *event); 00074 virtual void mouseDoubleClickEvent(QMouseEvent * event); 00075 00076 void RenderScene(); 00077 void RenderOverlay(QPainter * painter); 00078 00079 /**************************************************************************\ 00080 * PUBLIC SIGNALS * 00081 \**************************************************************************/ 00082 signals: 00083 00084 void Maximize(); 00085 00086 /**************************************************************************\ 00087 * PUBLIC SLOTS * 00088 \**************************************************************************/ 00089 public slots: 00090 00091 void ShowLight(); 00092 void SelectBGColor(); 00093 void ShowPerformance(); 00094 void ToggleThread(); 00095 void ToggleTransform(); 00096 void SaveSnapshot(); 00097 00098 /**************************************************************************\ 00099 * PRIVATE CLASS FUNCTIONS * 00100 \**************************************************************************/ 00101 private: 00102 00103 //drawing after all Setup done 00104 void onDraw(); 00105 void onOverlayDraw(QPainter * painter); 00106 00107 //log OpenGL Errors of last frame 00108 void ReportErrors(); 00109 00110 /**************************************************************************\ 00111 * PRIVATE CLASS MEMBERS * 00112 \**************************************************************************/ 00113 private: 00114 00115 //reference to vStudio 00116 VStudio * const pControl; 00117 00118 //camera 00119 TSmartPointer<CCamera> spCam; 00120 TSmartPointer<CSceneCtrl> spCamControl; 00121 00122 //light 00123 TSmartPointer<CLight> spLight; 00124 00125 //volume 00126 CVolume * oldVolume; 00127 TSmartPointer<CVolume> pRenderVolume; 00128 00129 //logging 00130 bool bDoLog; 00131 00132 //contextmenu 00133 QMenu * contextMenu; 00134 QAction * setBGColorA; 00135 QAction * showLightA; 00136 QAction * showPerformanceA; 00137 QAction * enableThreadA; 00138 QAction * snapShotA; 00139 QAction * transformMC; 00140 00141 //display state 00142 QColor bgColor; 00143 bool showPerf; 00144 bool backupHeadLight; 00145 PerformanceOverlay * perfOverlay; 00146 bool bTransformModel; 00147 00148 bool bHighQuality; 00149 }; 00150 00151 #endif // VSTUDIORENDERER_H