34 #ifndef VIEWPORTWIDGET_H
35 #define VIEWPORTWIDGET_H
41 #include <QtGui/QWidget>
42 #include <QtGui/QMouseEvent>
43 #include <QtGui/QMessageBox>
45 #include <QtGui/QColor>
46 #include <QtCore/QString>
48 #if (OGRE_PLATFORM == OGRE_PLATFORM_WIN32)
51 #include <OgrePanelOverlayElement.h>
52 #include <OgreTextAreaOverlayElement.h>
59 #define VF_MAIN_VIEWPORT 0x1
65 #define VF_ORIENTATION_VIEWPORT 0x2
167 ViewportWidget ( QWidget *parent = 0,
unsigned int stageIndex = 1,
bool fullscreen =
false,
bool stereo =
false,
int width = 1024,
int height = 768 );
187 virtual QPaintEngine * paintEngine ()
const;
194 unsigned int getStageIndex ();
201 void setStageIndex (
unsigned int stageIndex );
208 void setViewMode (
bool viewMode );
213 void frameSelectedObjects ();
221 void setFog (
bool enabled,
float density );
228 QColor getFogColor ();
235 void setFogColor (
const QColor &color );
242 QColor getBackgroundColor ();
249 void setBackgroundColor (
const QColor &color );
258 void setFullscreen (
bool fullscreen,
int width,
int height );
272 void getStereoParameters(
float &rttWidth,
float &rttHeight,
273 float &eyeDist,
float &fOffsetMultiplier,
274 float &nearClip,
float &farClip,
float &fov,
float &focalLength );
288 void setStereoParameters(
const unsigned int rttWidth,
const unsigned int rttHeight,
289 const float eyeDist,
const float fOffsetMultiplier,
290 const float nearClip,
const float farClip,
const float fov,
const float focalLength );
297 void setStereo (
bool enable );
304 void setOverlayOnly (
bool enable );
319 int getTriangleCount ();
337 Ogre::RenderWindow* getRenderWindow();
355 void setImage (
unsigned int stageIndex, Ogre::TexturePtr image );
367 void setWireframe (
bool wireframe );
375 void setBackfaceCulling (
bool backfaceCulling );
380 void toggleOrigin ();
385 void toggleCenterPoint ();
390 void toggleOrientationIndicator ();
399 void screenCapture ();
409 void objectSelected (
const QString &objectName,
bool toggle );
432 void renderingTriggered();
441 virtual void resizeEvent ( QResizeEvent *event );
448 virtual void paintEvent ( QPaintEvent *event );
455 virtual void mousePressEvent ( QMouseEvent *event );
462 virtual void mouseMoveEvent ( QMouseEvent *event );
469 virtual void mouseReleaseEvent ( QMouseEvent *event );
476 virtual void wheelEvent ( QWheelEvent *event );
484 Ogre::String createUniqueName (
const QString &objectName );
490 bool createdefaultShaders ();
499 Ogre::HighLevelGpuProgramPtr compileShader (
const Ogre::String &code, Ogre::GpuProgramType type,
const Ogre::String &nameSuffix );
506 bool createRenderWindow ();
511 void initializeResources ();
517 void createViewportObjects ();
523 void createOverlays ();
540 Ogre::MaterialPtr createColorMaterial (
const Ogre::String &group,
const Ogre::String &name,
const Ogre::ColourValue &color,
bool wireframe =
false );
567 Ogre::SceneNode * getClickedSceneNode (
const QPointF &mousePosition );