1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-04 18:06:22 +03:00

0025511: Visualization - drop redundant viewer option V3d_View::Transparency()

Visual3d_ViewManager, activate texturing by default.

Update Qt sample
This commit is contained in:
kgv 2014-12-04 14:52:49 +03:00 committed by bugmaster
parent 21087d914b
commit a6964ce627
18 changed files with 15 additions and 156 deletions

View File

@ -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();

View File

@ -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();
}

View File

@ -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

View File

@ -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);

View File

@ -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 :

View File

@ -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),

View File

@ -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

View File

@ -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;

View File

@ -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)

View File

@ -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);

View File

@ -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 <t-hartl@muenchen.matra-dtv.fr>
-- -> 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;

View File

@ -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;
}
//=============================================================================

View File

@ -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);
}

View File

@ -57,7 +57,7 @@ MyModel (Visual3d_TOM_NONE),
MyVisual (Visual3d_TOV_WIREFRAME),
MyLights (),
MyTextureEnv(),
MySurfaceDetail(Visual3d_TOD_NONE),
MySurfaceDetail(Visual3d_TOD_ALL),
myClipPlanes()
{
}

View File

@ -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 <AFlag> is Standard_True then the transparency
-- is managed in the view <me>.
-- Default Standard_False
---Category: Internal methods
ZBufferIsActivated ( me )
returns Boolean from Standard
is static;

View File

@ -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 :

View File

@ -411,24 +411,6 @@ is
-- if <AStructure> is displayed in <AProjector> 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 <AFlag> 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;

View File

@ -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;