00001 #pragma once
00002 #include <Inventor/ViewerComponents/Qt/QtEventToSoEvent.h>
00003 #include <Inventor/ViewerComponents/Qt/QML/RenderArea.h>
00004
00005 class SceneInteractor;
00006
00007 namespace openinventor {
00008 namespace inventor {
00009 namespace viewercomponents {
00010 namespace qt {
00011 namespace qml {
00012
00026 class QTVIEWERCOMPONENTS_API RenderAreaInteractive : public RenderArea
00027 {
00028
00029 public:
00038 enum ClippingPlanesAdjustMode
00039 {
00040 AUTO,
00041 MANUAL
00042 };
00043
00047 RenderAreaInteractive();
00048
00052 virtual ~RenderAreaInteractive();
00053
00054
00055
00056
00057 void setSceneGraph( SoNode* sceneGraph ) override;
00058
00070 void setClippingPlanesAdjustMode( ClippingPlanesAdjustMode mode );
00071
00075 ClippingPlanesAdjustMode getClippingPlanesAdjustMode();
00076
00080 virtual SceneInteractor* getSceneInteractor() const;
00081
00086 virtual void viewAll( const SbViewportRegion& viewport );
00087
00093 virtual void viewAxis( const SbVec3f& direction, const SbVec3f& up );
00094
00098 virtual void activateStereo( bool activated );
00099
00103 virtual bool isStereoSupported() const;
00104
00108 void setStereoCameraOffset( float offset );
00109
00113 void setStereoCameraBalance( float balance );
00114
00122 SbBool processEvent( const SoEvent* event );
00123
00131 SbBool processEvents( const std::vector<const SoEvent*>& eventList );
00132
00133 private:
00134 RenderAreaInteractive( bool buildRootSceneGraph );
00135
00140 SoRenderAreaCore::RenderStatus render() override;
00141
00150 void mousePressEvent( QMouseEvent* event ) override;
00151
00156 void mouseReleaseEvent( QMouseEvent* event ) override;
00157
00162 void mouseMoveEvent( QMouseEvent* event ) override;
00163
00167 void hoverMoveEvent( QHoverEvent* event ) override;
00168
00173 void wheelEvent( QWheelEvent* event ) override;
00174
00178 void keyPressEvent( QKeyEvent* event ) override;
00179
00183 void keyReleaseEvent( QKeyEvent* event ) override;
00184
00188 virtual void enterEvent( QEvent* event );
00189
00193 virtual void leaveEvent( QEvent* event );
00194
00198 void mouseDoubleClickEvent( QMouseEvent* event ) override;
00199
00204 bool event( QEvent* qevent ) override;
00205
00209 void buildSceneGraph();
00210
00211 void createRenderAreaCore( SbVec2i32 region ) override;
00212
00213 SceneInteractor* m_rootSceneGraph;
00214
00215 private:
00216 void init( bool buildRootSceneGraph );
00217
00218 void startRender( SiRenderArea::RenderEventArg& arg );
00219
00224 static SbBool s_abortRenderCallback( SoAction* action, void* );
00225
00226 SoGroup* m_appSceneGraph;
00227 ClippingPlanesAdjustMode m_clippingMode;
00228
00229 QtEventToSoEvent m_eventbuilder;
00230
00231 bool m_isDragging;
00232 };
00233
00234 }
00235 }
00236 }
00237 }
00238 }
00239