From: vsr Date: Thu, 19 Mar 2020 09:02:12 +0000 (+0300) Subject: Adapting for OCCT dev (7.5) X-Git-Tag: V9_5_0a2~6 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=8655326573284d57c84e92a9c64d95be50a62273;p=modules%2Fgui.git Adapting for OCCT dev (7.5) --- diff --git a/src/OCCViewer/OCCViewer_LightSourceDlg.cxx b/src/OCCViewer/OCCViewer_LightSourceDlg.cxx index 91bf4ea5b..1464e4a30 100644 --- a/src/OCCViewer/OCCViewer_LightSourceDlg.cxx +++ b/src/OCCViewer/OCCViewer_LightSourceDlg.cxx @@ -286,14 +286,16 @@ void OCCViewer_LightSourceDlg::initParam( bool theIsDefault ) aLight = myModel->getViewer3d()->DefinedLight(); if ( aLight->Type() == V3d_DIRECTIONAL ) { myDirLight = Handle(V3d_DirectionalLight)::DownCast( aLight ); - myPosLight = new V3d_PositionalLight( myModel->getViewer3d(), 0, 0, 0 ); + myPosLight = new V3d_PositionalLight( gp_Pnt(0, 0, 0) ); + myModel->getViewer3d()->AddLight( myPosLight ); myDirType->setChecked( true ); myStackedLayout->setCurrentIndex(0); break; } if ( aLight->Type() == V3d_POSITIONAL ) { myPosLight = Handle(V3d_PositionalLight)::DownCast( aLight ); - myDirLight = new V3d_DirectionalLight( myModel->getViewer3d() ); + myDirLight = new V3d_DirectionalLight(); + myModel->getViewer3d()->AddLight( myDirLight ); myPosType->setChecked( true ); myStackedLayout->setCurrentIndex(1); break; diff --git a/src/OCCViewer/OCCViewer_ViewModel.cxx b/src/OCCViewer/OCCViewer_ViewModel.cxx index 0acca6fc5..0e546e195 100644 --- a/src/OCCViewer/OCCViewer_ViewModel.cxx +++ b/src/OCCViewer/OCCViewer_ViewModel.cxx @@ -1142,11 +1142,14 @@ void OCCViewer_Viewer::setDefaultLights() double aDz = SUIT_Session::session()->resourceMgr()->doubleValue( "OCCViewer", "light_dz", -1.0 ); Handle(V3d_DirectionalLight) aLight = - new V3d_DirectionalLight( myV3dViewer, V3d_Zneg, OCCViewer::color( aColor ).Name(), Standard_True ); + new V3d_DirectionalLight( V3d_Zneg, OCCViewer::color( aColor ).Name(), Standard_True ); + myV3dViewer->AddLight( aLight ); if( !( aDx == 0 && aDy == 0 && aDz == 0 ) ) aLight->SetDirection( aDx, aDy, aDz ); myV3dViewer->SetLightOn( aLight ); - myV3dViewer->SetLightOn( new V3d_AmbientLight( myV3dViewer ) ); + Handle(V3d_AmbientLight) ambLight = new V3d_AmbientLight(); + myV3dViewer->AddLight( ambLight ); + myV3dViewer->SetLightOn( ambLight ); } /*! diff --git a/src/OCCViewer/OCCViewer_ViewWindow.cxx b/src/OCCViewer/OCCViewer_ViewWindow.cxx index a5826fd38..9387f70d8 100644 --- a/src/OCCViewer/OCCViewer_ViewWindow.cxx +++ b/src/OCCViewer/OCCViewer_ViewWindow.cxx @@ -2973,14 +2973,16 @@ void OCCViewer_ViewWindow::setVisualParameters( const QString& parameters ) } Quantity_Color aColor = Quantity_Color( cR, cG, cB, Quantity_TOC_RGB ); if( aType == V3d_DIRECTIONAL ) { - Handle(V3d_DirectionalLight) aLight = new V3d_DirectionalLight( myModel->getViewer3d() ); + Handle(V3d_DirectionalLight) aLight = new V3d_DirectionalLight(); + myModel->getViewer3d()->AddLight( aLight ); aLight->SetDirection( aX, aY, aZ ); aLight->SetColor( aColor ); aLight->SetHeadlight( isHeadlight ); myModel->getViewer3d()->SetLightOn( aLight ); } else if( aType == V3d_POSITIONAL ) { - Handle(V3d_PositionalLight) aLight = new V3d_PositionalLight( myModel->getViewer3d(), aX, aY, aZ, aColor.Name() ); + Handle(V3d_PositionalLight) aLight = new V3d_PositionalLight( gp_Pnt(aX, aY, aZ), aColor.Name() ); + myModel->getViewer3d()->AddLight( aLight ); aLight->SetHeadlight( isHeadlight ); myModel->getViewer3d()->SetLightOn( aLight ); }