]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
OCCT 6.9.0 compatibility (OCCT stereo render integrated in IR-2015-06-25)
authorimn <imn@opencascade.com>
Fri, 17 Jul 2015 14:15:09 +0000 (17:15 +0300)
committerimn <imn@opencascade.com>
Fri, 17 Jul 2015 14:15:09 +0000 (17:15 +0300)
src/LightApp/LightApp_Application.cxx
src/OCCViewer/OCCViewer_ViewFrame.cxx
src/OCCViewer/OCCViewer_ViewFrame.h
src/OCCViewer/OCCViewer_ViewModel.cxx
src/OCCViewer/OCCViewer_ViewModel.h
src/OCCViewer/OCCViewer_ViewWindow.cxx
src/OCCViewer/OCCViewer_ViewWindow.h

index f046da319bafb0b694825a2c7b3cdc74f3303ca3..7c611635098e88035b995bd12c9c130e2b7bc4bf 100644 (file)
@@ -1538,6 +1538,7 @@ SUIT_ViewManager* LightApp_Application::createViewManager( const QString& vmType
                            resMgr->booleanValue( "3DViewer", "relative_size", vm->trihedronRelative() ));
     vm->setInteractionStyle( resMgr->integerValue( "3DViewer", "navigation_mode", vm->interactionStyle() ) );
     vm->setProjectionType( resMgr->integerValue( "OCCViewer", "projection_mode", vm->projectionType() ) );
+  #if OCC_VERSION_LARGE > 0x06090000
     vm->setStereoType( resMgr->integerValue( "OCCViewer", "stereo_type", vm->stereoType() ) );
     vm->setAnaglyphFilter( resMgr->integerValue( "OCCViewer", "anaglyph_filter", vm->anaglyphFilter() ) );
     vm->setStereographicFocus( resMgr->integerValue( "OCCViewer", "focus_type", vm->stereographicFocusType() ),
@@ -1548,6 +1549,7 @@ SUIT_ViewManager* LightApp_Application::createViewManager( const QString& vmType
     vm->setReverseStereo( resMgr->booleanValue( "OCCViewer", "reverse_stereo", vm->isReverseStereo() ) );
     vm->setVSync( resMgr->booleanValue( "OCCViewer", "enable_vsync", vm->isVSync() ) );
     vm->setQuadBufferSupport( resMgr->booleanValue( "OCCViewer", "enable_quad_buffer_support", vm->isQuadBufferSupport() ) );
+  #endif
     vm->setZoomingStyle( resMgr->integerValue( "3DViewer", "zooming_mode", vm->zoomingStyle() ) );
     vm->enablePreselection( resMgr->booleanValue( "OCCViewer", "enable_preselection", vm->isPreselectionEnabled() ) );
     vm->enableSelection(    resMgr->booleanValue( "OCCViewer", "enable_selection",    vm->isSelectionEnabled() ) );
@@ -2350,7 +2352,7 @@ void LightApp_Application::createPreferences( LightApp_Preferences* pref )
   anIndicesList << 0                       << 1;
   pref->setItemProperty( "strings", aValuesList,   occProjMode );
   pref->setItemProperty( "indexes", anIndicesList, occProjMode );
-
+#if OCC_VERSION_LARGE > 0x06090000
   // .... -> Stereo group
   int stereoGroup = pref->addPreference( tr( "PREF_GROUP_STEREO" ), occGroup);
   pref->setItemProperty( "columns", 2, stereoGroup );
@@ -2421,7 +2423,7 @@ void LightApp_Application::createPreferences( LightApp_Preferences* pref )
   // .... -> Enable quad-buffer support
   pref->addPreference( tr( "PREF_ENABLE_QUAD_BUFFER_SUPPORT" ), stereoGroup,
                       LightApp_Preferences::Bool, "OCCViewer", "enable_quad_buffer_support" );
-
+#endif
   // ... "Background" group <<start>>
   int bgGroup = pref->addPreference( tr( "PREF_VIEWER_BACKGROUND" ), occGroup );
   //  pref->setItemProperty( "columns", 2, bgGroup );
@@ -3126,7 +3128,7 @@ void LightApp_Application::preferencesChanged( const QString& sec, const QString
     }
   }
 #endif
-
+#if OCC_VERSION_LARGE > 0x06090000
 #ifndef DISABLE_OCCVIEWER
   if ( sec == QString( "OCCViewer" ) && param == QString( "stereo_type" ) )
   {
@@ -3263,7 +3265,7 @@ void LightApp_Application::preferencesChanged( const QString& sec, const QString
     }
   }
 #endif
-
+#endif
   if ( sec == QString( "3DViewer" ) && param == QString( "zooming_mode" ) )
   {
     int mode = resMgr->integerValue( "3DViewer", "zooming_mode", 0 );
index 5907af309539dc23729ca01787f1d5220be3329d..23945aeadd0b3f330f74178b32985b54c08890a2 100644 (file)
@@ -327,7 +327,7 @@ void OCCViewer_ViewFrame::setProjectionType( int t)
     aView->setProjectionType(t);
   }
 }
-
+#if OCC_VERSION_LARGE > 0x06090000
 //**************************************************************************************
 int OCCViewer_ViewFrame::stereoType() const
 {
@@ -437,7 +437,7 @@ void OCCViewer_ViewFrame::setQuadBufferSupport( bool t)
     aView->setQuadBufferSupport(t);
   }
 }
-
+#endif
 //**************************************************************************************
 void OCCViewer_ViewFrame::setZoomingStyle( const int i ) 
 { 
index 1e56502dafe66bae1ec913ba1aa1a7c8e5acf0e2..8fd06d6c51ee060c6373c09bc721f2ca38c1917c 100644 (file)
@@ -72,7 +72,7 @@ public:
 
   virtual int projectionType() const;
   virtual void setProjectionType( int );
-
+#if OCC_VERSION_LARGE > 0x06090000
   virtual int stereoType() const;
   virtual void setStereoType( const int );
 
@@ -95,7 +95,7 @@ public:
 
   virtual bool isQuadBufferSupport() const;
   virtual void setQuadBufferSupport( const bool );
-
+#endif
   virtual int  zoomingStyle() const { return getView(MAIN_VIEW)->zoomingStyle(); }
   virtual void setZoomingStyle( const int );
 
index 1195d82b2ecbd86120686d28e8ed41aa1e5a37e4..f94fbba33c8a2642a3b9e8d872263647f1fd1f87 100755 (executable)
@@ -169,7 +169,7 @@ OCCViewer_Viewer::OCCViewer_Viewer( bool DisplayTrihedron)
 
   // set projection type to orthographic
   myProjectionType = 0;
-
+#if OCC_VERSION_LARGE > 0x06090000
   // set stereo parameters
   myStereoType = 0;
   myAnaglyphFilter = 0;
@@ -180,7 +180,7 @@ OCCViewer_Viewer::OCCViewer_Viewer( bool DisplayTrihedron)
   myInterocularDistanceType = 1;
   myStereographicFocusValue = 1.0;
   myInterocularDistanceValue = 0.05;
-
+#endif
   //set clipping color and texture to standard
   myClippingColor = QColor( 50, 50, 50 );
   myDefaultTextureUsed = true;
@@ -245,6 +245,7 @@ void OCCViewer_Viewer::initView( OCCViewer_ViewWindow* view )
     view->initSketchers();
     view->setInteractionStyle( interactionStyle() );
     view->setProjectionType( projectionType() );
+#if OCC_VERSION_LARGE > 0x06090000
     view->setStereoType( stereoType() );
     view->setAnaglyphFilter( anaglyphFilter() );
     view->setStereographicFocus( stereographicFocusType(), stereographicFocusValue() );
@@ -252,6 +253,7 @@ void OCCViewer_Viewer::initView( OCCViewer_ViewWindow* view )
     view->setReverseStereo( isReverseStereo() );
     view->setVSync( isVSync() );
     view->setQuadBufferSupport( isQuadBufferSupport() );
+#endif
     view->setZoomingStyle( zoomingStyle() );
     view->enablePreselection( isPreselectionEnabled() );
     view->enableSelection( isSelectionEnabled() );
@@ -542,7 +544,7 @@ void OCCViewer_Viewer::setProjectionType( const int theType )
     }
   }
 }
-
+#if OCC_VERSION_LARGE > 0x06090000
 /*!
   \return stereo type
 */
@@ -758,7 +760,7 @@ void OCCViewer_Viewer::setQuadBufferSupport( const bool theEnable )
       win->setQuadBufferSupport( theEnable );
   }
 }
-
+#endif
 /*!
   \return zooming style
 */
index 04fd3d53ecb5ddaa97aa9adf4b40278c23674fb1..191e41760e89c1e7caa4588ba30a7e645e3b6b5c 100755 (executable)
@@ -143,7 +143,7 @@ public:
 
   int                             projectionType() const;
   void                            setProjectionType( const int );
-
+#if OCC_VERSION_LARGE > 0x06090000
   int                             stereoType() const;
   void                            setStereoType( const int );
 
@@ -166,7 +166,7 @@ public:
 
   bool                            isQuadBufferSupport() const;
   void                            setQuadBufferSupport( const bool );
-
+#endif
   int                             zoomingStyle() const;
   void                            setZoomingStyle( const int );
 
@@ -243,10 +243,12 @@ protected:
   int                             myInteractionStyle;
   int                             myZoomingStyle;
   int                             myProjectionType;
+#if OCC_VERSION_LARGE > 0x06090000
   int                             myStereoType;
   int                             myAnaglyphFilter;
   int                             myStereographicFocusType;
   int                             myInterocularDistanceType;
+#endif
 
   double                          myStereographicFocusValue;
   double                          myInterocularDistanceValue;
@@ -255,9 +257,11 @@ protected:
   bool                            mySelectionEnabled;
   bool                            myMultiSelectionEnabled;
   bool                            myIsRelative;
+#if OCC_VERSION_LARGE > 0x06090000
   bool                            myToReverseStereo;
   bool                            myVSyncMode;
   bool                            myQuadBufferSupport;
+#endif
 
   int                             myTopLayerId;
 
index aeb42a107fdff58ae90857b4048098019a56ff8e..31e415c4ea503d682c1876bf8d51335aed41ccc5 100755 (executable)
 #include <Graphic3d_MapOfStructure.hxx>
 #include <Graphic3d_Structure.hxx>
 #include <Graphic3d_ExportFormat.hxx>
+#if OCC_VERSION_LARGE > 0x06090000
 #include <Graphic3d_StereoMode.hxx>
 #include <Graphic3d_RenderingParams.hxx>
+#endif
 
 
 #include <Visual3d_View.hxx>
@@ -1300,7 +1302,7 @@ void OCCViewer_ViewWindow::createActions()
   aAction->setCheckable(true);
   //connect(aAction, SIGNAL(toggled(bool)), this, SLOT(onProjectionType()));
   toolMgr()->registerAction( aAction, PerspectiveId );
-
+#if OCC_VERSION_LARGE > 0x06090000
   // - stereo projection
   aAction = new QtxAction(tr("MNU_STEREO_MODE"), aResMgr->loadPixmap( "OCCViewer", tr( "ICON_OCCVIEWER_STEREO" ) ),
                           tr( "MNU_STEREO_MODE" ), 0, this);
@@ -1308,12 +1310,14 @@ void OCCViewer_ViewWindow::createActions()
   aAction->setCheckable(true);
   toolMgr()->registerAction( aAction, StereoId );
   //connect(aAction, SIGNAL(toggled(bool)), this, SLOT(onProjectionType()));
-
+#endif
   // - add exclusive action group
   QActionGroup* aProjectionGroup = new QActionGroup( this );
   aProjectionGroup->addAction( toolMgr()->action( OrthographicId ) );
   aProjectionGroup->addAction( toolMgr()->action( PerspectiveId ) );
+#if OCC_VERSION_LARGE > 0x06090000
   aProjectionGroup->addAction( toolMgr()->action( StereoId ) );
+#endif
   connect(aProjectionGroup, SIGNAL(triggered(QAction*)), this, SLOT(onProjectionType()));
 
   // Reset
@@ -1650,8 +1654,10 @@ void OCCViewer_ViewWindow::onProjectionType()
     setProjectionType( Orthographic);
   if (toolMgr()->action( PerspectiveId )->isChecked())
     setProjectionType( Perspective);
+#if OCC_VERSION_LARGE > 0x06090000
   if (toolMgr()->action( StereoId )->isChecked())
     setProjectionType( Stereo);
+#endif
   emit vpTransformationFinished( PROJECTION );
 }
 
@@ -2824,6 +2830,7 @@ void OCCViewer_ViewWindow::setProjectionType( int mode )
       myModel->setProjectionType(Orthographic);
       aCamera->SetProjectionType ( Graphic3d_Camera::Projection_Orthographic );
     }
+  #if OCC_VERSION_LARGE > 0x06090000
     if (mode == Stereo) {
       aCamera->SetProjectionType ( Graphic3d_Camera::Projection_Stereo );
       SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
@@ -2833,21 +2840,29 @@ void OCCViewer_ViewWindow::setProjectionType( int mode )
       setVSync( aResMgr->booleanValue( "OCCViewer", "enable_vsync", true ) );
       setQuadBufferSupport( aResMgr->booleanValue( "OCCViewer", "enable_quad_buffer_support", false ) );
     }
+  #endif
     aView3d->Redraw();
     onViewFitAll();
   }
   // update action state if method is called outside
   QtxAction* anOrthographicAction = dynamic_cast<QtxAction*>( toolMgr()->action( OrthographicId ) );
   QtxAction* aPerspectiveAction = dynamic_cast<QtxAction*>( toolMgr()->action( PerspectiveId ) );
+#if OCC_VERSION_LARGE > 0x06090000
   QtxAction* aStereoAction = dynamic_cast<QtxAction*>( toolMgr()->action( StereoId ) );
+#endif
   if ( mode == Orthographic && !anOrthographicAction->isChecked() ) {
          anOrthographicAction->setChecked( true );
+    #if OCC_VERSION_LARGE > 0x06090000
          aStereoAction->setChecked( false );
+    #endif
   }
   if ( mode == Perspective && !aPerspectiveAction->isChecked() ) {
          aPerspectiveAction->setChecked( true );
+    #if OCC_VERSION_LARGE > 0x06090000
          aStereoAction->setChecked( false );
+    #endif
   }
+#if OCC_VERSION_LARGE > 0x06090000
   if ( mode == Stereo ) {
     aStereoAction->setChecked( true );
     if ( anOrthographicAction->isEnabled() ) {
@@ -2863,8 +2878,10 @@ void OCCViewer_ViewWindow::setProjectionType( int mode )
     if ( aPerspectiveAction->isEnabled() ) {
       aPerspectiveAction->setEnabled( false );
       aPerspectiveAction->setChecked( true );
+    #if OCC_VERSION_LARGE > 0x06090000
       if ( isQuadBufferSupport() && !isOpenGlStereoSupport() && stereoType() == QuadBuffer )
         SUIT_MessageBox::warning( 0, tr( "WRN_WARNING" ),  tr( "WRN_SUPPORT_QUAD_BUFFER" ) );
+    #endif
     }
     else {
       aPerspectiveAction->setEnabled( true );
@@ -2879,6 +2896,7 @@ void OCCViewer_ViewWindow::setProjectionType( int mode )
     if ( !aPerspectiveAction->isEnabled() )
       aPerspectiveAction->setEnabled( true );
   }
+#endif
 }
 
 int OCCViewer_ViewWindow::projectionType() const
@@ -2891,12 +2909,15 @@ int OCCViewer_ViewWindow::projectionType() const
       mode = Perspective;
     if (aCamera->ProjectionType() == Graphic3d_Camera::Projection_Orthographic)
       mode = Orthographic;
+  #if OCC_VERSION_LARGE > 0x06090000
     if (aCamera->ProjectionType() == Graphic3d_Camera::Projection_Stereo)
       mode = Stereo;
+  #endif
   }
   return mode;
 }
 
+#if OCC_VERSION_LARGE > 0x06090000
 void OCCViewer_ViewWindow::setStereoType( int type )
 {
   Handle(V3d_View) aView3d = myViewPort->getView();
@@ -3072,7 +3093,7 @@ bool OCCViewer_ViewWindow::isQuadBufferSupport() const
   }
   return enable;
 }
-
+#endif
 bool OCCViewer_ViewWindow::isOpenGlStereoSupport() const
 {
   GLboolean support[1];
index 08f4202e36ebe299ccb832e69027767a49de7a94..5a1ef0424a7c0ac954566e7ade1f0373d199101c 100755 (executable)
@@ -216,7 +216,7 @@ public:
  
   virtual int                     projectionType() const;
   virtual void                    setProjectionType( int );
-
+#if OCC_VERSION_LARGE > 0x06090000
   virtual int                     stereoType() const;
   virtual void                    setStereoType( const int );
 
@@ -239,7 +239,7 @@ public:
 
   virtual bool                    isQuadBufferSupport() const;
   virtual void                    setQuadBufferSupport( const bool );
-
+#endif
   void setTransformEnabled( const OperationType, const bool );
   bool transformEnabled( const OperationType ) const;