00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef _VEE_QT_H_
00021 #define _VEE_QT_H_
00022
00023 #include <vee_has_values.h>
00024 #include <vee_image.h>
00025 #include <vee_scene.h>
00026 #include <vee_vector3.h>
00027
00028 #include <vee_time.h>
00029
00030 #include <qgl.h>
00031 #include <qmenubar.h>
00032 #include <qobject.h>
00033
00034 #include <qevent.h>
00035 #include <qapplication.h>
00036
00037 #include <GL/gl.h>
00038 #include <GL/glu.h>
00039
00040 #include <vector>
00041
00042 class GEE_Geometry;
00043 class GEE_Engine;
00044 class GEE_GlDisplayLists;
00045 class GEE_GlMaterialBank;
00046 class GEE_GlRenderer;
00047 class GEE_HistoryAnimation;
00048 class GEE_World;
00049
00050 class VEE_GlRenderer;
00051 class VEE_GlTexture2DBank;
00052 class VEE_ValueWindow;
00053
00054 class VEE_Qt;
00055
00056 class QBoxLayout;
00057 class QImage;
00058
00059 enum VEE_GlRendererType {
00061 VEE_GL_PLAIN,
00063 VEE_GL_SL,
00065 VEE_GL_CG
00066 };
00067
00068
00069 class VEE_QtHidden : public QGLWidget, public VEE_HasValues
00070 {
00071 Q_OBJECT
00072 public:
00073
00074 friend class VEE_Qt;
00075
00076 enum UpdateType {
00077 UPDATE_USUAL,
00078 UPDATE_PSEUDO_THREADED,
00079 UPDATE_THREADED,
00080 UPDATE_SIZEOF
00081 };
00082
00083 VEE_QtHidden(VEE_Qt * host,
00084 VEE_SceneBox *box, QWidget *parent=0,
00085 const char *name=0,
00086 VEE_GlRendererType type = VEE_GL_SL);
00087 virtual ~VEE_QtHidden();
00088
00089 bool displaySolids() const;
00090
00091 GEE_Engine * geeEngine() { return m_geeEngine; }
00092
00093 GEE_GlMaterialBank * geeMaterials() { return m_geeMaterials; }
00094
00095 void setAutoRewind(bool autorewind);
00096 void useHistoryAnimation(bool use);
00097
00098
00099 public slots:
00100 virtual void reFresh();
00101
00102 signals:
00103 void status(float,int);
00104
00105 protected:
00106
00107 void updateGlCamera();
00108
00109 void mouseMoveEvent(QMouseEvent *m);
00110 void mousePressEvent(QMouseEvent *m);
00111
00112 virtual void enterEvent ( QEvent * );
00113
00114 virtual void initializeGL();
00115 virtual void resizeGL( int w, int h );
00116 virtual void paintGL();
00117
00118 virtual void preRender();
00119
00120 virtual void veeRender(bool clear = true);
00121
00122 void storeFrameToFile();
00123
00124
00125 void grab(QImage *);
00126
00127 VEE_Vector3 m_camPos;
00128 VEE_Vector3 m_camRot;
00129 VEE_Vector3 m_camAim;
00130 VEE_Vector3 m_camUp;
00131
00132 VEE_GlRenderer *m_veeGl;
00133
00134 GEE_GlMaterialBank *m_geeMaterials;
00135 GEE_GlRenderer *m_geeGl;
00136 GEE_GlDisplayLists *m_geeLists;
00137 GEE_Engine *m_geeEngine;
00138 GEE_HistoryAnimation *m_geeHistoryAnimation;
00139
00140 VEE_Time m_checkFpsTime;
00141 VEE_Time m_lastFrameTime;
00142 float m_lastFrameDuration;
00143 uint m_lastFrameCheckFrames;
00144
00145 float m_fixedRate;
00146 float m_playSpeed;
00147 uint m_frames;
00148 bool m_showFps;
00149 bool m_visualUpdate;
00150 bool m_calculusUpdate;
00151 bool m_showBoxes;
00152 bool m_pause;
00153 bool m_showNObj;
00154
00155 uint m_splitAt;
00156 uint m_collapseAt;
00157 uint m_maximumRecursion;
00158
00159 uint m_overSample;
00160 VEE_SceneBox *m_scene;
00161
00162 VEE_Qt *m_host;
00163
00164 class Internal;
00165 Internal * m_internal;
00166 };
00167
00170
00171 class VEE_Qt : public QWidget, public VEE_HasValues
00172 {
00173 Q_OBJECT
00174 public:
00175 VEE_Qt( VEE_SceneBox *box,
00176 VEE_GlRendererType type = VEE_GL_SL,
00177 QWidget *parent=0,
00178 const char *name=0 ,
00179 bool createGlWidget = true);
00180 virtual ~VEE_Qt();
00181
00182 virtual bool setValue(const char *, VEE_Value *);
00183
00184 void setFrameRate(float rate) { m_glWidget->m_fixedRate = rate; }
00185
00186 void setTreeThresholds(uint collapseAt, uint splitAt)
00187 { m_glWidget->m_collapseAt = collapseAt; m_glWidget->m_splitAt = splitAt; }
00188
00189 uint frames() const { return m_glWidget->m_frames; }
00190 VEE_GlRenderer *renderer() { return m_glWidget->m_veeGl; }
00191
00192 void setGlWidget(VEE_QtHidden *);
00193 VEE_QtHidden * getGlWidget() { return m_glWidget; }
00194
00195 void setFrameFile(const char *);
00196 void setScreenShotCount(int);
00197 void setScreenShotOverSample(int);
00198
00199 QMenuBar *menuBar() { return m_menu; }
00200
00201 void resizeGlWidget(int w, int h)
00202 { if(m_glWidget) m_glWidget->resize(w, h); }
00203
00204 float lastFrameDuration() const { return m_glWidget->m_lastFrameDuration;}
00205
00206 static void initImageIO();
00207
00208 int addKeyPoint(const VEE_Vector3 & loc, float azi, float ele);
00209 int addKeyPoint2(float x, float y, float z, float azi, float ele)
00210 { return addKeyPoint(VEE_Vector3(x, y, z), azi, ele); }
00211
00212 void setValueWindow(VEE_ValueWindow *vw) { m_valueWindow = vw; }
00213
00214 static void loadTextureDir(VEE_GlTexture2DBank *store,
00215 const QString &dirname);
00216
00217 public slots:
00218
00219 void keyPressEvent(QKeyEvent *k);
00220
00221 void toggleNObj();
00222 void togglePause();
00223 void toggleVisualUpdate();
00224 void toggleCalculusUpdate();
00225 void toggleShowBoxes();
00226 void toggleBlend();
00227 void togglePolygonMode();
00228 void toggleForceMode();
00229 void toggleForceBoxMode();
00230 void toggleTextureMode();
00231 void toggleAlign();
00232 void toggleTails();
00233 void toggleSolids();
00234 void toggleHistory();
00235 void toggleShaders();
00236
00237 void holdTime();
00238
00239 void useQuadTextures();
00240 void useTriTextures();
00241 void usePoints();
00242 void useLines();
00243 void useNothing();
00244
00245 void showStatus(float,int);
00246
00247 void nofade();
00248 void fadeLittle();
00249 void fadeMore();
00250 void fadeExtreme();
00251
00252 void resizeGlWidget(const QString &);
00253
00254 void screenshot();
00255 void screenshotLarge();
00256 void movieBegin();
00257 void movieEnd();
00258
00259 void paramsVisible();
00260
00261 void white();
00262 void black();
00263 void gray();
00264 void blue();
00265
00266 void newBlend();
00267 void additive();
00268 void subtractive();
00269 void usual();
00270
00271 void setRenderOrder(const QString &);
00272 void setUpdateType(const QString &);
00273
00274 void bgColorDialog();
00275
00276 void addKeyPoint();
00277 void selectKeyPoint(const QString &);
00278 void selectKeyPoint2(int);
00279
00280 void selectLights(const QString &);
00281
00282 void rewind();
00283
00284 void undo();
00285 void redo();
00286
00287 void saveGeeAs();
00288 void loadGee();
00289 void mergeGee();
00290 void fitGee();
00291
00292 void setAcceleration(const QString &);
00293
00294 void updateCameraAnimationsMenu();
00295 void setCameraAnimation(const QString &);
00296 protected:
00297
00298 void deliverBgColor(const VEE_Rgba & );
00299
00300 VEE_QtHidden *m_glWidget;
00301
00302 QMenuBar *m_menu;
00303
00304 QBoxLayout * m_layout;
00305
00306 class Internal;
00307 Internal *m_internal;
00308
00309 VEE_ValueWindow * m_valueWindow;
00310 };
00311
00314
00315
00316 class VEE_ImageIOQt : public VEE_ImageIO
00317 {
00318 public:
00319 VEE_ImageIOQt() {}
00320 virtual ~VEE_ImageIOQt() {}
00321
00322 virtual bool read(VEE_Image *image, const char *filename,
00323 int w, int h, int chans);
00324 virtual bool write(VEE_Image *image, const char *filename);
00325
00326
00327 };
00328
00329 #endif // _VEE_QT_H_