From a6964ce627eb1f61c8a8c0d519c32768bfb1946c Mon Sep 17 00:00:00 2001 From: kgv Date: Thu, 4 Dec 2014 14:52:49 +0300 Subject: [PATCH] 0025511: Visualization - drop redundant viewer option V3d_View::Transparency() Visual3d_ViewManager, activate texturing by default. Update Qt sample --- samples/qt/VoxelDemo/src/Viewer.cpp | 1 - src/AIS/AIS_InteractiveContext.cxx | 43 ++++++----------------- src/Graphic3d/Graphic3d_GraphicDriver.cdl | 6 ---- src/OpenGl/OpenGl_GraphicDriver.hxx | 1 - src/OpenGl/OpenGl_GraphicDriver_7.cxx | 7 ---- src/OpenGl/OpenGl_View.cxx | 2 +- src/OpenGl/OpenGl_Workspace.cxx | 10 ------ src/OpenGl/OpenGl_Workspace.hxx | 2 -- src/OpenGl/OpenGl_Workspace_5.cxx | 4 +-- src/V3d/V3d_Plane.cxx | 1 - src/V3d/V3d_View.cdl | 11 ------ src/V3d/V3d_View.cxx | 2 -- src/V3d/V3d_View_2.cxx | 13 ------- src/Visual3d/Visual3d_ContextView.cxx | 2 +- src/Visual3d/Visual3d_View.cdl | 9 ----- src/Visual3d/Visual3d_View.cxx | 17 --------- src/Visual3d/Visual3d_ViewManager.cdl | 19 ---------- src/Visual3d/Visual3d_ViewManager.cxx | 21 +---------- 18 files changed, 15 insertions(+), 156 deletions(-) diff --git a/samples/qt/VoxelDemo/src/Viewer.cpp b/samples/qt/VoxelDemo/src/Viewer.cpp index 43bbae4b30..f71805b23f 100644 --- a/samples/qt/VoxelDemo/src/Viewer.cpp +++ b/samples/qt/VoxelDemo/src/Viewer.cpp @@ -51,7 +51,6 @@ Viewer::Viewer(QWidget* parent):QWidget(parent) myView->MustBeResized(); myView->SetSurfaceDetail(V3d_TEX_NONE); - myView->SetTransparency(Standard_True); myView->SetSize(10000.0); myView->SetZSize(10000.0); myView->SetViewMappingDefault(); diff --git a/src/AIS/AIS_InteractiveContext.cxx b/src/AIS/AIS_InteractiveContext.cxx index ecb4eaa007..45e354e7cf 100644 --- a/src/AIS/AIS_InteractiveContext.cxx +++ b/src/AIS/AIS_InteractiveContext.cxx @@ -16,9 +16,6 @@ // Modified by XAB & Serguei Dec 97 (angle &deviation coeffts) -#define BUC60577 //GG_101099 Enable to compute correctly -// transparency with more than one object in the view. - #define BUC60632 //GG 15/03/00 Add protection on SetDisplayMode() // method, compute only authorized presentation. @@ -450,9 +447,7 @@ void AIS_InteractiveContext::Display(const Handle(AIS_InteractiveObject)& anIObj } } } - - if(anIObj->IsTransparent() && !myMainVwr->Viewer()->Transparency()) - myMainVwr->Viewer()->SetTransparency(Standard_True); + if(updateviewer) myMainVwr->Update(); } @@ -460,11 +455,7 @@ void AIS_InteractiveContext::Display(const Handle(AIS_InteractiveObject)& anIObj else { myLocalContexts(myCurLocalIndex)->Display(anIObj,DispMode,anIObj->AcceptShapeDecomposition(),SelMode); - - if(anIObj->IsTransparent() && !myMainVwr->Viewer()->Transparency()) - myMainVwr->Viewer()->SetTransparency(Standard_True); - - + if(updateviewer) myMainVwr->Update(); } } @@ -1585,9 +1576,7 @@ void AIS_InteractiveContext::SetDisplayMode(const Handle(AIS_InteractiveObject)& if(STATUS->IsSubIntensityOn()){ myMainPM->Color(anIObj,mySubIntensity,aMode); } - if(anIObj->IsTransparent() && !myMainVwr->Viewer()->Transparency()) - myMainVwr->Viewer()->SetTransparency(Standard_True); - + if(updateviewer) myMainVwr->Update(); } anIObj->SetDisplayMode(aMode); @@ -2159,18 +2148,17 @@ void AIS_InteractiveContext::SetTransparency(const Handle(AIS_InteractiveObject) if(!anIObj->HasInteractiveContext()) anIObj->SetContext(this); -#ifdef BUC60577 //right optimization - if(!anIObj->IsTransparent() && aValue<=0.05) return; -#else -// if(!anIObj->IsTransparent() && aValue<=0.05) return; -#endif + if (!anIObj->IsTransparent() + && aValue <= 0.05) + { + return; + } + if(aValue<=0.05){ UnsetTransparency(anIObj,updateviewer); return; } - - if(!myMainVwr->Viewer()->Transparency()) - myMainVwr->Viewer()->SetTransparency(Standard_True); + anIObj->SetTransparency(aValue); if(anIObj->RecomputeEveryPrs()) anIObj->Redisplay(); @@ -2209,17 +2197,6 @@ void AIS_InteractiveContext::UnsetTransparency(const Handle(AIS_InteractiveObjec anIObj->SetRecomputeOk(); } - // To Unset transparency in the viewer, if no other object is transparent ...(Speed) - AIS_DataMapIteratorOfDataMapOfIOStatus It(myObjects); - Standard_Boolean FoundTransp(Standard_False); - for(;It.More() && !FoundTransp ;It.Next()){ - if(It.Key()->IsTransparent()) - FoundTransp = Standard_True; - } - if(!FoundTransp) - myMainVwr->Viewer()->SetTransparency(Standard_False); - - if(updateviewer) UpdateCurrentViewer(); } diff --git a/src/Graphic3d/Graphic3d_GraphicDriver.cdl b/src/Graphic3d/Graphic3d_GraphicDriver.cdl index ef0273030d..8203a5806b 100644 --- a/src/Graphic3d/Graphic3d_GraphicDriver.cdl +++ b/src/Graphic3d/Graphic3d_GraphicDriver.cdl @@ -261,12 +261,6 @@ is is deferred; ---Purpose: call_togl_setvisualisation - Transparency ( me : mutable; - ACView : CView from Graphic3d; - AFlag : Boolean from Standard ) - is deferred; - ---Purpose: call_togl_transparency - View ( me : mutable; ACView : in out CView from Graphic3d ) returns Boolean from Standard diff --git a/src/OpenGl/OpenGl_GraphicDriver.hxx b/src/OpenGl/OpenGl_GraphicDriver.hxx index 3895f64331..9df98f1767 100644 --- a/src/OpenGl/OpenGl_GraphicDriver.hxx +++ b/src/OpenGl/OpenGl_GraphicDriver.hxx @@ -167,7 +167,6 @@ public: Standard_EXPORT void SetClipPlanes (const Graphic3d_CView& theCView); Standard_EXPORT void SetCamera (const Graphic3d_CView& theCView); Standard_EXPORT void SetVisualisation (const Graphic3d_CView& ACView); - Standard_EXPORT void Transparency (const Graphic3d_CView& ACView, const Standard_Boolean AFlag); Standard_EXPORT Standard_Boolean View (Graphic3d_CView& ACView); Standard_EXPORT void Environment (const Graphic3d_CView& ACView); Standard_EXPORT void ZBufferTriedronSetup (const Quantity_NameOfColor XColor = Quantity_NOC_RED, const Quantity_NameOfColor YColor = Quantity_NOC_GREEN, const Quantity_NameOfColor ZColor = Quantity_NOC_BLUE1, const Standard_Real SizeRatio = 0.8, const Standard_Real AxisDiametr = 0.05, const Standard_Integer NbFacettes = 12); diff --git a/src/OpenGl/OpenGl_GraphicDriver_7.cxx b/src/OpenGl/OpenGl_GraphicDriver_7.cxx index ab44eb4ba5..5f40749b39 100644 --- a/src/OpenGl/OpenGl_GraphicDriver_7.cxx +++ b/src/OpenGl/OpenGl_GraphicDriver_7.cxx @@ -470,13 +470,6 @@ void OpenGl_GraphicDriver::SetVisualisation (const Graphic3d_CView& ACView) } } -void OpenGl_GraphicDriver::Transparency (const Graphic3d_CView& ACView, const Standard_Boolean AFlag) -{ - const OpenGl_CView *aCView = (const OpenGl_CView *)ACView.ptrView; - if (aCView) - aCView->WS->UseTransparency(AFlag); -} - // ======================================================================= // function : InvalidateBVHData // purpose : diff --git a/src/OpenGl/OpenGl_View.cxx b/src/OpenGl/OpenGl_View.cxx index 1e409ed7eb..4dce50224c 100644 --- a/src/OpenGl/OpenGl_View.cxx +++ b/src/OpenGl/OpenGl_View.cxx @@ -54,7 +54,7 @@ static const GLdouble THE_IDENTITY_MATRIX[4][4] = OpenGl_View::OpenGl_View (const CALL_DEF_VIEWCONTEXT &AContext, OpenGl_StateCounter* theCounter) -: mySurfaceDetail(Visual3d_TOD_NONE), +: mySurfaceDetail(Visual3d_TOD_ALL), myBackfacing(0), myBgTexture(myDefaultBgTexture), myBgGradient(myDefaultBgGradient), diff --git a/src/OpenGl/OpenGl_Workspace.cxx b/src/OpenGl/OpenGl_Workspace.cxx index 2bfcd3b3a6..ad95d7d180 100644 --- a/src/OpenGl/OpenGl_Workspace.cxx +++ b/src/OpenGl/OpenGl_Workspace.cxx @@ -156,7 +156,6 @@ OpenGl_Workspace::OpenGl_Workspace (const Handle(OpenGl_GraphicDriver)& theDrive myTransientDrawToFront (Standard_True), myBackBufferRestored (Standard_False), myIsImmediateDrawn (Standard_False), - myUseTransparency (Standard_False), myUseZBuffer (Standard_False), myUseDepthTest (Standard_True), myUseGLLight (Standard_True), @@ -255,15 +254,6 @@ Standard_Boolean OpenGl_Workspace::Activate() return Standard_True; } -// ======================================================================= -// function : UseTransparency -// purpose : call_togl_transparency -// ======================================================================= -void OpenGl_Workspace::UseTransparency (const Standard_Boolean theFlag) -{ - myUseTransparency = theFlag; -} - //======================================================================= //function : ResetAppliedAspect //purpose : Sets default values of GL parameters in accordance with default aspects diff --git a/src/OpenGl/OpenGl_Workspace.hxx b/src/OpenGl/OpenGl_Workspace.hxx index 0479381c8a..6c5d4ae6b2 100644 --- a/src/OpenGl/OpenGl_Workspace.hxx +++ b/src/OpenGl/OpenGl_Workspace.hxx @@ -184,7 +184,6 @@ public: Image_PixMap& theImage, const Graphic3d_BufferType& theBufferType); - void UseTransparency (const Standard_Boolean theFlag); Standard_Boolean& UseZBuffer() { return myUseZBuffer; } Standard_Boolean& UseDepthTest() { return myUseDepthTest; } Standard_Boolean& UseGLLight() { return myUseGLLight; } @@ -664,7 +663,6 @@ protected: //! @name protected fields Standard_Boolean myTransientDrawToFront; //!< optimization flag for immediate mode (to render directly to the front buffer) Standard_Boolean myBackBufferRestored; Standard_Boolean myIsImmediateDrawn; //!< flag indicates that immediate mode buffer contains some data - Standard_Boolean myUseTransparency; Standard_Boolean myUseZBuffer; Standard_Boolean myUseDepthTest; Standard_Boolean myUseGLLight; diff --git a/src/OpenGl/OpenGl_Workspace_5.cxx b/src/OpenGl/OpenGl_Workspace_5.cxx index fed57817e8..71d47b6cea 100644 --- a/src/OpenGl/OpenGl_Workspace_5.cxx +++ b/src/OpenGl/OpenGl_Workspace_5.cxx @@ -119,7 +119,7 @@ void OpenGl_Workspace::updateMaterial (const int theFlag) NamedStatus |= OPENGL_NS_2NDPASSNEED; } - if (myUseTransparency && aProps->trans != 1.0f) + if (aProps->trans != 1.0f) { // render transparent myMatTmp.Diffuse.a() = aProps->trans; @@ -295,7 +295,7 @@ const OpenGl_AspectFace* OpenGl_Workspace::AspectFace (const Standard_Boolean th ? TelCullNone : (TelCullMode )AspectFace_set->CullingMode(); if (aCullingMode != TelCullNone - && myUseTransparency && !(NamedStatus & OPENGL_NS_2NDPASSDO)) + && !(NamedStatus & OPENGL_NS_2NDPASSDO)) { // disable culling in case of translucent shading aspect if (AspectFace_set->IntFront().trans != 1.0f) diff --git a/src/V3d/V3d_Plane.cxx b/src/V3d/V3d_Plane.cxx index 26269a8f6e..9af803b87e 100755 --- a/src/V3d/V3d_Plane.cxx +++ b/src/V3d/V3d_Plane.cxx @@ -70,7 +70,6 @@ void V3d_Plane::Display (const Handle(V3d_View)& theView, Graphic3d_MaterialAspect aPlastic (Graphic3d_NOM_PLASTIC); aPlastic.SetColor (theColor); aPlastic.SetTransparency (0.5); - theView->SetTransparency (Standard_True); anAsp->SetFrontMaterial (aPlastic); anAsp->SetInteriorStyle (Aspect_IS_HATCH); anAsp->SetHatchStyle (Aspect_HS_GRID_DIAGONAL_WIDE); diff --git a/src/V3d/V3d_View.cdl b/src/V3d/V3d_View.cdl index bdb30dd514..a1a8a6ddba 100644 --- a/src/V3d/V3d_View.cdl +++ b/src/V3d/V3d_View.cdl @@ -35,8 +35,6 @@ -- -> Add SetProjModel() method. -- VKH - 15/11/99 : G004 -- -> Add method Dump() --- GG - IMP210200 --- -> Add Transparency() method -- THA - 17/08/00 Thomas HARTL -- -> Add Print method (works only under Windows). -- GG - IMP231100 @@ -415,10 +413,6 @@ is ---Level: Public ---Purpose: Returns TRUE when the light is active in this view. - SetTransparency( me : mutable ; AnActivity : Boolean = Standard_False); - ---Level: Public - ---Purpose: Activate/Deactivate the transparency in this view. - SetImmediateUpdate(me: mutable; theImmediateUpdate: Boolean from Standard) returns Boolean from Standard; ---Purpose: sets the immediate update mode and returns the previous one. @@ -1141,10 +1135,6 @@ is ---Level: Public -- purpose: return the current environment texture used - Transparency(me) returns Boolean from Standard; - ---Level: Public - ---Purpose: Returns the transparency activity. - Visualization ( me ) returns TypeOfVisualization from V3d; ---Level: Public ---Purpose: Returns the current visualisation mode. @@ -1638,7 +1628,6 @@ fields MyGridEchoStructure : Structure from Graphic3d; MyGridEchoGroup : Group from Graphic3d; - MyTransparencyFlag : Boolean from Standard; myImmediateUpdate: Boolean from Standard is protected; myXscreenAxis : Vector from Graphic3d; diff --git a/src/V3d/V3d_View.cxx b/src/V3d/V3d_View.cxx index 9eb2e8d5c9..5d16ad0e9a 100644 --- a/src/V3d/V3d_View.cxx +++ b/src/V3d/V3d_View.cxx @@ -251,8 +251,6 @@ V3d_View::V3d_View(const Handle(V3d_Viewer)& VM, const V3d_TypeOfView Type ) : aCamera->SetProjectionType ((Type == V3d_ORTHOGRAPHIC) ? Graphic3d_Camera::Projection_Orthographic : Graphic3d_Camera::Projection_Perspective); - - MyTransparencyFlag = Standard_False; } //============================================================================= diff --git a/src/V3d/V3d_View_2.cxx b/src/V3d/V3d_View_2.cxx index 723ff90117..c1a41ffd22 100644 --- a/src/V3d/V3d_View_2.cxx +++ b/src/V3d/V3d_View_2.cxx @@ -21,7 +21,6 @@ -------------------------------- 00-09-92 : GG ; Creation. 24-12-97 : FMN ; Suppression de GEOMLITE - 21-02-00 : GG ; Add Transparency() method 23-11-00 : GG ; Add IsActiveLight() and IsActivePlane() methods ************************************************************************/ @@ -102,18 +101,6 @@ void V3d_View::SetLightOff( ) { } -void V3d_View::SetTransparency(const Standard_Boolean AnActivity) { - - MyTransparencyFlag = AnActivity; - MyView->SetTransparency(AnActivity); -} - - -Standard_Boolean V3d_View::Transparency() const { - - return MyTransparencyFlag; -} - void V3d_View::InitActiveLights() { myActiveLightsIterator.Initialize(MyActiveLights); } diff --git a/src/Visual3d/Visual3d_ContextView.cxx b/src/Visual3d/Visual3d_ContextView.cxx index c5c211745f..84f0448e08 100644 --- a/src/Visual3d/Visual3d_ContextView.cxx +++ b/src/Visual3d/Visual3d_ContextView.cxx @@ -57,7 +57,7 @@ MyModel (Visual3d_TOM_NONE), MyVisual (Visual3d_TOV_WIREFRAME), MyLights (), MyTextureEnv(), -MySurfaceDetail(Visual3d_TOD_NONE), +MySurfaceDetail(Visual3d_TOD_ALL), myClipPlanes() { } diff --git a/src/Visual3d/Visual3d_View.cdl b/src/Visual3d/Visual3d_View.cdl index 919d791e62..30db5d4c63 100644 --- a/src/Visual3d/Visual3d_View.cdl +++ b/src/Visual3d/Visual3d_View.cdl @@ -1045,15 +1045,6 @@ is -- or insufficient memory. -- Warning: Works only under Windows. - SetTransparency ( me : mutable; - AFlag : Boolean from Standard ) - is static; - ---Level: Advanced - ---Purpose: if is Standard_True then the transparency - -- is managed in the view . - -- Default Standard_False - ---Category: Internal methods - ZBufferIsActivated ( me ) returns Boolean from Standard is static; diff --git a/src/Visual3d/Visual3d_View.cxx b/src/Visual3d/Visual3d_View.cxx index 29710e9d0b..05b0f49fc0 100644 --- a/src/Visual3d/Visual3d_View.cxx +++ b/src/Visual3d/Visual3d_View.cxx @@ -805,7 +805,6 @@ void Visual3d_View::Activate() { myGraphicDriver->ActivateView (MyCView); myGraphicDriver->Background (MyCView); - myGraphicDriver->Transparency (MyCView, myViewManager->Transparency()); MyCView.Active = 1; @@ -1800,22 +1799,6 @@ Standard_Boolean Visual3d_View::ZBufferIsActivated() const return MyCView.Context.ZBufferActivity != 0; // 0 or 1 => forced by the programmer } -// ======================================================================= -// function : SetTransparency -// purpose : -// ======================================================================= -void Visual3d_View::SetTransparency (const Standard_Boolean theActivity) -{ - if (IsDeleted() - || !IsDefined() - || !IsActive()) - { - return; - } - - myGraphicDriver->Transparency (MyCView, theActivity); -} - // ======================================================================= // function : SetZBufferActivity // purpose : diff --git a/src/Visual3d/Visual3d_ViewManager.cdl b/src/Visual3d/Visual3d_ViewManager.cdl index aadee62c90..967611b88e 100644 --- a/src/Visual3d/Visual3d_ViewManager.cdl +++ b/src/Visual3d/Visual3d_ViewManager.cdl @@ -411,24 +411,6 @@ is -- if is displayed in and TOS_COMPUTED. ---Category: Private methods - Transparency ( me ) - returns Boolean from Standard - is static; - ---Level: Advanced - ---Purpose: Returns Standard_True if the transparency - -- is activated in all activated views. - -- Default Standard_False - ---Category: Internal methods - - SetTransparency ( me : mutable; - AFlag : Boolean from Standard ) - is static; - ---Level: Advanced - ---Purpose: if is Standard_True then the transparency - -- is managed. - -- Default Standard_False - ---Category: Internal methods - ZBufferAuto ( me ) returns Boolean from Standard is static; @@ -473,7 +455,6 @@ fields -- advanced MyZBufferAuto : Boolean from Standard; - MyTransparency : Boolean from Standard; -- Z layer indexes myLayerIds : MapOfInteger from TColStd; diff --git a/src/Visual3d/Visual3d_ViewManager.cxx b/src/Visual3d/Visual3d_ViewManager.cxx index 9943b824ab..1ac96a3d98 100644 --- a/src/Visual3d/Visual3d_ViewManager.cxx +++ b/src/Visual3d/Visual3d_ViewManager.cxx @@ -83,8 +83,7 @@ Visual3d_ViewManager::Visual3d_ViewManager (const Handle(Graphic3d_GraphicDriver Graphic3d_StructureManager (theDriver), MyDefinedView (), MyViewGenId (View_IDMIN+((View_IDMIN+View_IDMAX)/(Visual3d_ViewManager::Limit ()))*(Visual3d_ViewManager::CurrentId ()-1),View_IDMIN+((View_IDMIN+View_IDMAX)/(Visual3d_ViewManager::Limit ()))*Visual3d_ViewManager::CurrentId ()-1), -MyZBufferAuto (Standard_False), -MyTransparency (Standard_False) +MyZBufferAuto (Standard_False) { // default layer is always presented in display layer sequence // it can not be removed @@ -558,24 +557,6 @@ void Visual3d_ViewManager::UnIdentification (const Standard_Integer aViewId) MyViewGenId.Free(aViewId); } -void Visual3d_ViewManager::SetTransparency (const Standard_Boolean AFlag) -{ - if (MyTransparency && AFlag) return; - if (! MyTransparency && ! AFlag) return; - - for(int i=1; i<=MyDefinedView.Length(); i++) - { - (MyDefinedView.Value(i))->SetTransparency(AFlag); - } - - MyTransparency = AFlag; -} - -Standard_Boolean Visual3d_ViewManager::Transparency () const -{ - return (MyTransparency); -} - void Visual3d_ViewManager::SetZBufferAuto (const Standard_Boolean AFlag) { if (MyZBufferAuto && AFlag) return;