1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-21 10:13:43 +03:00

0032725: Visualization - Graphic3d_Structure::SetDisplayPriority() should use public enumeration Graphic3d_DisplayPriority

Added new enumeration Graphic3d_DisplayPriority.
Graphic3d_Layer now defines a fixed-length array of priorities.
Properties Graphic3d_CStructure::Id, Priority, PreviousPriority have been wrapped into methods.
This commit is contained in:
kgv 2021-12-08 15:55:11 +03:00 committed by smoskvin
parent e3dae4a9f3
commit e463b2f685
39 changed files with 237 additions and 233 deletions

View File

@ -188,7 +188,6 @@ void AIS_Axis::Compute (const Handle(PrsMgr_PresentationManager)& ,
const Standard_Integer ) const Standard_Integer )
{ {
thePrs->SetInfiniteState (myInfiniteState); thePrs->SetInfiniteState (myInfiniteState);
thePrs->SetDisplayPriority (5);
if (!myIsXYZAxis) if (!myIsXYZAxis)
{ {
GeomAdaptor_Curve curv (myComponent); GeomAdaptor_Curve curv (myComponent);

View File

@ -76,8 +76,6 @@ void AIS_Circle::Compute (const Handle(PrsMgr_PresentationManager)& ,
const Handle(Prs3d_Presentation)& thePrs, const Handle(Prs3d_Presentation)& thePrs,
const Standard_Integer ) const Standard_Integer )
{ {
thePrs->SetDisplayPriority (5);
if (myCircleIsArc) { ComputeArc (thePrs); } if (myCircleIsArc) { ComputeArc (thePrs); }
else { ComputeCircle (thePrs); } else { ComputeCircle (thePrs); }
} }

View File

@ -882,11 +882,11 @@ Standard_Boolean AIS_InteractiveContext::IsDisplayed (const Handle(AIS_Interacti
//function : DisplayPriority //function : DisplayPriority
//purpose : //purpose :
//======================================================================= //=======================================================================
Standard_Integer AIS_InteractiveContext::DisplayPriority (const Handle(AIS_InteractiveObject)& theIObj) const Graphic3d_DisplayPriority AIS_InteractiveContext::DisplayPriority (const Handle(AIS_InteractiveObject)& theIObj) const
{ {
if (theIObj.IsNull()) if (theIObj.IsNull())
{ {
return -1; return Graphic3d_DisplayPriority_INVALID;
} }
const Handle(AIS_GlobalStatus)* aStatus = myObjects.Seek (theIObj); const Handle(AIS_GlobalStatus)* aStatus = myObjects.Seek (theIObj);
@ -901,7 +901,7 @@ Standard_Integer AIS_InteractiveContext::DisplayPriority (const Handle(AIS_Inter
: 0); : 0);
return myMainPM->DisplayPriority (theIObj, aDispMode); return myMainPM->DisplayPriority (theIObj, aDispMode);
} }
return 0; return Graphic3d_DisplayPriority_INVALID;
} }
//======================================================================= //=======================================================================
@ -909,7 +909,7 @@ Standard_Integer AIS_InteractiveContext::DisplayPriority (const Handle(AIS_Inter
//purpose : //purpose :
//======================================================================= //=======================================================================
void AIS_InteractiveContext::SetDisplayPriority (const Handle(AIS_InteractiveObject)& theIObj, void AIS_InteractiveContext::SetDisplayPriority (const Handle(AIS_InteractiveObject)& theIObj,
const Standard_Integer thePriority) const Graphic3d_DisplayPriority thePriority)
{ {
if (theIObj.IsNull()) if (theIObj.IsNull())
{ {

View File

@ -276,10 +276,15 @@ public: //! @name highlighting management
public: //! @name object presence management (View affinity, Layer, Priority) public: //! @name object presence management (View affinity, Layer, Priority)
//! Returns the display priority of the Object. //! Returns the display priority of the Object.
Standard_EXPORT Standard_Integer DisplayPriority (const Handle(AIS_InteractiveObject)& theIObj) const; Standard_EXPORT Graphic3d_DisplayPriority DisplayPriority (const Handle(AIS_InteractiveObject)& theIObj) const;
//! Sets the display priority of the seen parts presentation of the Object. //! Sets the display priority of the seen parts presentation of the Object.
Standard_EXPORT void SetDisplayPriority (const Handle(AIS_InteractiveObject)& theIObj, const Standard_Integer thePriority); Standard_EXPORT void SetDisplayPriority (const Handle(AIS_InteractiveObject)& theIObj,
const Graphic3d_DisplayPriority thePriority);
Standard_DEPRECATED("Deprecated since OCCT7.7, Graphic3d_DisplayPriority should be passed instead of integer number to SetDisplayPriority()")
void SetDisplayPriority (const Handle(AIS_InteractiveObject)& theIObj,
const Standard_Integer thePriority) { SetDisplayPriority (theIObj, (Graphic3d_DisplayPriority )thePriority); }
//! Get Z layer id set for displayed interactive object. //! Get Z layer id set for displayed interactive object.
Standard_EXPORT Graphic3d_ZLayerId GetZLayer (const Handle(AIS_InteractiveObject)& theIObj) const; Standard_EXPORT Graphic3d_ZLayerId GetZLayer (const Handle(AIS_InteractiveObject)& theIObj) const;

View File

@ -69,8 +69,6 @@ void AIS_Line::Compute (const Handle(PrsMgr_PresentationManager)&,
const Handle(Prs3d_Presentation)& thePrs, const Handle(Prs3d_Presentation)& thePrs,
const Standard_Integer ) const Standard_Integer )
{ {
thePrs->SetDisplayPriority (5);
if (!myLineIsSegment) { ComputeInfiniteLine (thePrs); } if (!myLineIsSegment) { ComputeInfiniteLine (thePrs); }
else { ComputeSegmentLine (thePrs); } else { ComputeSegmentLine (thePrs); }
} }

View File

@ -153,7 +153,6 @@ void AIS_PlaneTrihedron::Compute (const Handle(PrsMgr_PresentationManager)& ,
const Handle(Prs3d_Presentation)& thePrs, const Handle(Prs3d_Presentation)& thePrs,
const Standard_Integer ) const Standard_Integer )
{ {
thePrs->SetDisplayPriority (5);
// drawing axis in X direction // drawing axis in X direction
gp_Pnt first, last; gp_Pnt first, last;
Standard_Real value = myDrawer->DatumAspect()->AxisLength(Prs3d_DatumParts_XAxis); Standard_Real value = myDrawer->DatumAspect()->AxisLength(Prs3d_DatumParts_XAxis);

View File

@ -121,22 +121,21 @@ void AIS_Shape::Compute (const Handle(PrsMgr_PresentationManager)& ,
const Handle(Prs3d_Presentation)& thePrs, const Handle(Prs3d_Presentation)& thePrs,
const Standard_Integer theMode) const Standard_Integer theMode)
{ {
if (myshape.IsNull()) if (myshape.IsNull()
|| (myshape.ShapeType() == TopAbs_COMPOUND && myshape.NbChildren() == 0))
{ {
return; return;
} }
// wire,edge,vertex -> pas de HLR + priorite display superieure // wire,edge,vertex -> pas de HLR + priorite display superieure
const Standard_Integer aShapeType = (Standard_Integer )myshape.ShapeType(); if (myshape.ShapeType() >= TopAbs_WIRE
if (aShapeType > 4 && aShapeType < 8) && myshape.ShapeType() <= TopAbs_VERTEX)
{ {
// TopAbs_WIRE -> 7, TopAbs_EDGE -> 8, TopAbs_VERTEX -> 9 (Graphic3d_DisplayPriority_Highlight)
const Standard_Integer aPrior = (Standard_Integer )Graphic3d_DisplayPriority_Above1
+ (Standard_Integer )myshape.ShapeType() - TopAbs_WIRE;
thePrs->SetVisual (Graphic3d_TOS_ALL); thePrs->SetVisual (Graphic3d_TOS_ALL);
thePrs->SetDisplayPriority (aShapeType + 2); thePrs->SetDisplayPriority ((Graphic3d_DisplayPriority )aPrior);
}
// Shape vide -> Assemblage vide.
if (myshape.ShapeType() == TopAbs_COMPOUND && myshape.NbChildren() == 0)
{
return;
} }
if (IsInfinite()) if (IsInfinite())
@ -238,7 +237,7 @@ void AIS_Shape::computeHlrPresentation (const Handle(Graphic3d_Camera)& theProje
case TopAbs_EDGE: case TopAbs_EDGE:
case TopAbs_WIRE: case TopAbs_WIRE:
{ {
thePrs->SetDisplayPriority (4); thePrs->SetDisplayPriority (Graphic3d_DisplayPriority_Below);
StdPrs_WFShape::Add (thePrs, theShape, theDrawer); StdPrs_WFShape::Add (thePrs, theShape, theDrawer);
return; return;
} }

View File

@ -349,24 +349,20 @@ void AIS_TexturedShape::Compute (const Handle(PrsMgr_PresentationManager)& ,
const Handle(Prs3d_Presentation)& thePrs, const Handle(Prs3d_Presentation)& thePrs,
const Standard_Integer theMode) const Standard_Integer theMode)
{ {
if (myshape.IsNull()) if (myshape.IsNull()
|| (myshape.ShapeType() == TopAbs_COMPOUND && myshape.NbChildren() == 0))
{ {
return; return;
} }
if (myshape.ShapeType() > TopAbs_FACE && myshape.ShapeType() < TopAbs_SHAPE) if (myshape.ShapeType() >= TopAbs_WIRE
&& myshape.ShapeType() <= TopAbs_VERTEX)
{ {
// TopAbs_WIRE -> 7, TopAbs_EDGE -> 8, TopAbs_VERTEX -> 9 (Graphic3d_DisplayPriority_Highlight)
const Standard_Integer aPrior = (Standard_Integer )Graphic3d_DisplayPriority_Above1
+ (Standard_Integer )myshape.ShapeType() - TopAbs_WIRE;
thePrs->SetVisual (Graphic3d_TOS_ALL); thePrs->SetVisual (Graphic3d_TOS_ALL);
thePrs->SetDisplayPriority (myshape.ShapeType() + 2); thePrs->SetDisplayPriority ((Graphic3d_DisplayPriority )aPrior);
}
if (myshape.ShapeType() == TopAbs_COMPOUND)
{
TopExp_Explorer anExplor (myshape, TopAbs_VERTEX);
if (!anExplor.More())
{
return;
}
} }
if (IsInfinite()) if (IsInfinite())

View File

@ -64,6 +64,7 @@ Graphic3d_CView.hxx
Graphic3d_DataStructureManager.cxx Graphic3d_DataStructureManager.cxx
Graphic3d_DataStructureManager.hxx Graphic3d_DataStructureManager.hxx
Graphic3d_DiagnosticInfo.hxx Graphic3d_DiagnosticInfo.hxx
Graphic3d_DisplayPriority.hxx
Graphic3d_FrameStats.cxx Graphic3d_FrameStats.cxx
Graphic3d_FrameStats.hxx Graphic3d_FrameStats.hxx
Graphic3d_FrameStatsCounter.hxx Graphic3d_FrameStatsCounter.hxx
@ -139,7 +140,6 @@ Graphic3d_ShaderVariable.lxx
Graphic3d_StereoMode.hxx Graphic3d_StereoMode.hxx
Graphic3d_Structure.cxx Graphic3d_Structure.cxx
Graphic3d_Structure.hxx Graphic3d_Structure.hxx
Graphic3d_Structure.pxx
Graphic3d_StructureDefinitionError.hxx Graphic3d_StructureDefinitionError.hxx
Graphic3d_StructureManager.cxx Graphic3d_StructureManager.cxx
Graphic3d_StructureManager.hxx Graphic3d_StructureManager.hxx

View File

@ -14,7 +14,6 @@
#include <Graphic3d_CStructure.hxx> #include <Graphic3d_CStructure.hxx>
#include "Graphic3d_Structure.pxx"
#include <Graphic3d_StructureManager.hxx> #include <Graphic3d_StructureManager.hxx>
#include <Graphic3d_TransModeFlags.hxx> #include <Graphic3d_TransModeFlags.hxx>
#include <Graphic3d_GraphicDriver.hxx> #include <Graphic3d_GraphicDriver.hxx>
@ -27,11 +26,11 @@ IMPLEMENT_STANDARD_RTTIEXT(Graphic3d_CStructure,Standard_Transient)
//purpose : //purpose :
//============================================================================= //=============================================================================
Graphic3d_CStructure::Graphic3d_CStructure (const Handle(Graphic3d_StructureManager)& theManager) Graphic3d_CStructure::Graphic3d_CStructure (const Handle(Graphic3d_StructureManager)& theManager)
: Priority (Structure_MAX_PRIORITY / 2), : myGraphicDriver (theManager->GraphicDriver()),
PreviousPriority (Structure_MAX_PRIORITY / 2), myId (-1),
//
myGraphicDriver (theManager->GraphicDriver()),
myZLayer (Graphic3d_ZLayerId_Default), myZLayer (Graphic3d_ZLayerId_Default),
myPriority (Graphic3d_DisplayPriority_Normal),
myPreviousPriority(Graphic3d_DisplayPriority_Normal),
myIsCulled (Standard_True), myIsCulled (Standard_True),
myBndBoxClipCheck(Standard_True), myBndBoxClipCheck(Standard_True),
myHasGroupTrsf (Standard_False), myHasGroupTrsf (Standard_False),
@ -45,7 +44,7 @@ Graphic3d_CStructure::Graphic3d_CStructure (const Handle(Graphic3d_StructureMana
IsMutable (Standard_False), IsMutable (Standard_False),
Is2dText (Standard_False) Is2dText (Standard_False)
{ {
Id = myGraphicDriver->NewIdentification(); myId = myGraphicDriver->NewIdentification();
} }
//======================================================================= //=======================================================================
@ -62,10 +61,10 @@ void Graphic3d_CStructure::DumpJson (Standard_OStream& theOStream, Standard_Inte
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, aGroup.get()) OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, aGroup.get())
} }
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, Id) OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myId)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myZLayer) OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myZLayer)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, Priority) OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myPriority)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, PreviousPriority) OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myPreviousPriority)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, IsInfinite) OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, IsInfinite)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, stick) OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, stick)

View File

@ -16,6 +16,7 @@
#define _Graphic3d_CStructure_HeaderFile #define _Graphic3d_CStructure_HeaderFile
#include <Graphic3d_BndBox3d.hxx> #include <Graphic3d_BndBox3d.hxx>
#include <Graphic3d_DisplayPriority.hxx>
#include <Graphic3d_Group.hxx> #include <Graphic3d_Group.hxx>
#include <Graphic3d_PresentationAttributes.hxx> #include <Graphic3d_PresentationAttributes.hxx>
#include <Graphic3d_SequenceOfGroup.hxx> #include <Graphic3d_SequenceOfGroup.hxx>
@ -139,6 +140,21 @@ public:
//! highlight flag is set to true //! highlight flag is set to true
const Handle(Graphic3d_PresentationAttributes)& HighlightStyle() const { return myHighlightStyle; } const Handle(Graphic3d_PresentationAttributes)& HighlightStyle() const { return myHighlightStyle; }
//! Return structure id (generated by Graphic3d_GraphicDriver::NewIdentification() during structure construction).
Standard_Integer Identification() const { return myId; }
//! Return structure display priority.
Graphic3d_DisplayPriority Priority() const { return myPriority; }
//! Set structure display priority.
void SetPriority (Graphic3d_DisplayPriority thePriority) { myPriority = thePriority; }
//! Return previous structure display priority.
Graphic3d_DisplayPriority PreviousPriority() const { return myPreviousPriority; }
//! Set previous structure display priority.
void SetPreviousPriority (Graphic3d_DisplayPriority thePriority) { myPreviousPriority = thePriority; }
public: public:
//! Returns FALSE if the structure hits the current view volume, otherwise returns TRUE. //! Returns FALSE if the structure hits the current view volume, otherwise returns TRUE.
@ -184,8 +200,7 @@ public:
//! Highlights structure with the given style //! Highlights structure with the given style
virtual void GraphicHighlight (const Handle(Graphic3d_PresentationAttributes)& theStyle) = 0; virtual void GraphicHighlight (const Handle(Graphic3d_PresentationAttributes)& theStyle) = 0;
//! Unhighlights the structure and invalidates pointer to structure's highlight //! Unhighlights the structure and invalidates pointer to structure's highlight style
//! style
virtual void GraphicUnhighlight() = 0; virtual void GraphicUnhighlight() = 0;
//! Create shadow link to this structure //! Create shadow link to this structure
@ -207,10 +222,6 @@ public:
Handle(Graphic3d_ViewAffinity) ViewAffinity; //!< view affinity mask Handle(Graphic3d_ViewAffinity) ViewAffinity; //!< view affinity mask
Standard_Integer Id;
Standard_Integer Priority;
Standard_Integer PreviousPriority;
protected: protected:
//! Create empty structure. //! Create empty structure.
@ -226,7 +237,10 @@ protected:
Handle(Graphic3d_SequenceOfHClipPlane) myClipPlanes; Handle(Graphic3d_SequenceOfHClipPlane) myClipPlanes;
Handle(Graphic3d_PresentationAttributes) myHighlightStyle; //! Current highlight style; is set only if highlight flag is true Handle(Graphic3d_PresentationAttributes) myHighlightStyle; //! Current highlight style; is set only if highlight flag is true
Standard_Integer myId;
Graphic3d_ZLayerId myZLayer; Graphic3d_ZLayerId myZLayer;
Graphic3d_DisplayPriority myPriority;
Graphic3d_DisplayPriority myPreviousPriority;
mutable Standard_Boolean myIsCulled; //!< A status specifying is structure needs to be rendered after BVH tree traverse mutable Standard_Boolean myIsCulled; //!< A status specifying is structure needs to be rendered after BVH tree traverse
Standard_Boolean myBndBoxClipCheck; //!< Flag responsible for checking of bounding box clipping before drawing of object Standard_Boolean myBndBoxClipCheck; //!< Flag responsible for checking of bounding box clipping before drawing of object

View File

@ -959,8 +959,8 @@ Standard_Boolean Graphic3d_CView::IsDisplayed (const Handle(Graphic3d_Structure)
// purpose : // purpose :
// ======================================================================= // =======================================================================
void Graphic3d_CView::ChangePriority (const Handle(Graphic3d_Structure)& theStructure, void Graphic3d_CView::ChangePriority (const Handle(Graphic3d_Structure)& theStructure,
const Standard_Integer /*theOldPriority*/, const Graphic3d_DisplayPriority /*theOldPriority*/,
const Standard_Integer theNewPriority) const Graphic3d_DisplayPriority theNewPriority)
{ {
if (!IsActive() if (!IsActive()
|| !IsDisplayed (theStructure)) || !IsDisplayed (theStructure))

View File

@ -212,8 +212,8 @@ private:
//! Changes the display priority of the structure. //! Changes the display priority of the structure.
Standard_EXPORT void ChangePriority (const Handle(Graphic3d_Structure)& theStructure, Standard_EXPORT void ChangePriority (const Handle(Graphic3d_Structure)& theStructure,
const Standard_Integer theOldPriority, const Graphic3d_DisplayPriority theOldPriority,
const Standard_Integer theNewPriority); const Graphic3d_DisplayPriority theNewPriority);
//! Change Z layer of already displayed structure in the view. //! Change Z layer of already displayed structure in the view.
Standard_EXPORT void ChangeZLayer (const Handle(Graphic3d_Structure)& theStructure, Standard_EXPORT void ChangeZLayer (const Handle(Graphic3d_Structure)& theStructure,
@ -551,7 +551,7 @@ private:
//! Adds the structure to display lists of the view. //! Adds the structure to display lists of the view.
virtual void displayStructure (const Handle(Graphic3d_CStructure)& theStructure, virtual void displayStructure (const Handle(Graphic3d_CStructure)& theStructure,
const Standard_Integer thePriority) = 0; const Graphic3d_DisplayPriority thePriority) = 0;
//! Erases the structure from display lists of the view. //! Erases the structure from display lists of the view.
virtual void eraseStructure (const Handle(Graphic3d_CStructure)& theStructure) = 0; virtual void eraseStructure (const Handle(Graphic3d_CStructure)& theStructure) = 0;
@ -562,7 +562,7 @@ private:
//! Changes the priority of a structure within its Z layer in the specified view. //! Changes the priority of a structure within its Z layer in the specified view.
virtual void changePriority (const Handle(Graphic3d_CStructure)& theCStructure, virtual void changePriority (const Handle(Graphic3d_CStructure)& theCStructure,
const Standard_Integer theNewPriority) = 0; const Graphic3d_DisplayPriority theNewPriority) = 0;
protected: protected:

View File

@ -0,0 +1,40 @@
// Copyright (c) 1995-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _Graphic3d_DisplayPriority_HeaderFile
#define _Graphic3d_DisplayPriority_HeaderFile
#include <Standard_Integer.hxx>
//! Structure priority - range (do not change this range!).
//! Values are between 0 and 10, with 5 used by default.
//! A structure of priority 10 is displayed the last and appears over the others (considering depth test).
enum Graphic3d_DisplayPriority
{
Graphic3d_DisplayPriority_INVALID = -1,
Graphic3d_DisplayPriority_Bottom = 0,
Graphic3d_DisplayPriority_AlmostBottom = 1,
Graphic3d_DisplayPriority_Below3 = 2,
Graphic3d_DisplayPriority_Below2 = 3,
Graphic3d_DisplayPriority_Below = 4,
Graphic3d_DisplayPriority_Normal = 5,
Graphic3d_DisplayPriority_Above = 6,
Graphic3d_DisplayPriority_Above1 = 7,
Graphic3d_DisplayPriority_Above2 = 8,
Graphic3d_DisplayPriority_Highlight = 9,
Graphic3d_DisplayPriority_Topmost = 10,
};
enum { Graphic3d_DisplayPriority_NB = Graphic3d_DisplayPriority_Topmost - Graphic3d_DisplayPriority_Bottom + 1 };
#endif // _Graphic3d_DisplayPriority_HeaderFile

View File

@ -38,7 +38,7 @@ Graphic3d_GraphicDriver::Graphic3d_GraphicDriver (const Handle(Aspect_DisplayCon
aSettings.SetEnableDepthWrite (Standard_False); aSettings.SetEnableDepthWrite (Standard_False);
aSettings.SetClearDepth (Standard_False); aSettings.SetClearDepth (Standard_False);
aSettings.SetPolygonOffset (Graphic3d_PolygonOffset()); aSettings.SetPolygonOffset (Graphic3d_PolygonOffset());
Handle(Graphic3d_Layer) aLayer = new Graphic3d_Layer (Graphic3d_ZLayerId_BotOSD, 1, Handle(Select3D_BVHBuilder3d)()); Handle(Graphic3d_Layer) aLayer = new Graphic3d_Layer (Graphic3d_ZLayerId_BotOSD, Handle(Select3D_BVHBuilder3d)());
aLayer->SetLayerSettings (aSettings); aLayer->SetLayerSettings (aSettings);
myLayers.Append (aLayer); myLayers.Append (aLayer);
myLayerIds.Bind (aLayer->LayerId(), aLayer); myLayerIds.Bind (aLayer->LayerId(), aLayer);
@ -54,7 +54,7 @@ Graphic3d_GraphicDriver::Graphic3d_GraphicDriver (const Handle(Aspect_DisplayCon
aSettings.SetEnableDepthWrite (Standard_True); aSettings.SetEnableDepthWrite (Standard_True);
aSettings.SetClearDepth (Standard_False); aSettings.SetClearDepth (Standard_False);
aSettings.SetPolygonOffset (Graphic3d_PolygonOffset()); aSettings.SetPolygonOffset (Graphic3d_PolygonOffset());
Handle(Graphic3d_Layer) aLayer = new Graphic3d_Layer (Graphic3d_ZLayerId_Default, 1, Handle(Select3D_BVHBuilder3d)()); Handle(Graphic3d_Layer) aLayer = new Graphic3d_Layer (Graphic3d_ZLayerId_Default, Handle(Select3D_BVHBuilder3d)());
aLayer->SetLayerSettings (aSettings); aLayer->SetLayerSettings (aSettings);
myLayers.Append (aLayer); myLayers.Append (aLayer);
myLayerIds.Bind (aLayer->LayerId(), aLayer); myLayerIds.Bind (aLayer->LayerId(), aLayer);
@ -70,7 +70,7 @@ Graphic3d_GraphicDriver::Graphic3d_GraphicDriver (const Handle(Aspect_DisplayCon
aSettings.SetEnableDepthWrite (Standard_True); aSettings.SetEnableDepthWrite (Standard_True);
aSettings.SetClearDepth (Standard_False); aSettings.SetClearDepth (Standard_False);
aSettings.SetPolygonOffset (Graphic3d_PolygonOffset()); aSettings.SetPolygonOffset (Graphic3d_PolygonOffset());
Handle(Graphic3d_Layer) aLayer = new Graphic3d_Layer (Graphic3d_ZLayerId_Top, 1, Handle(Select3D_BVHBuilder3d)()); Handle(Graphic3d_Layer) aLayer = new Graphic3d_Layer (Graphic3d_ZLayerId_Top, Handle(Select3D_BVHBuilder3d)());
aLayer->SetLayerSettings (aSettings); aLayer->SetLayerSettings (aSettings);
myLayers.Append (aLayer); myLayers.Append (aLayer);
myLayerIds.Bind (aLayer->LayerId(), aLayer); myLayerIds.Bind (aLayer->LayerId(), aLayer);
@ -86,7 +86,7 @@ Graphic3d_GraphicDriver::Graphic3d_GraphicDriver (const Handle(Aspect_DisplayCon
aSettings.SetEnableDepthWrite (Standard_True); aSettings.SetEnableDepthWrite (Standard_True);
aSettings.SetClearDepth (Standard_True); aSettings.SetClearDepth (Standard_True);
aSettings.SetPolygonOffset (Graphic3d_PolygonOffset()); aSettings.SetPolygonOffset (Graphic3d_PolygonOffset());
Handle(Graphic3d_Layer) aLayer = new Graphic3d_Layer (Graphic3d_ZLayerId_Topmost, 1, Handle(Select3D_BVHBuilder3d)()); Handle(Graphic3d_Layer) aLayer = new Graphic3d_Layer (Graphic3d_ZLayerId_Topmost, Handle(Select3D_BVHBuilder3d)());
aLayer->SetLayerSettings (aSettings); aLayer->SetLayerSettings (aSettings);
myLayers.Append (aLayer); myLayers.Append (aLayer);
myLayerIds.Bind (aLayer->LayerId(), aLayer); myLayerIds.Bind (aLayer->LayerId(), aLayer);
@ -102,7 +102,7 @@ Graphic3d_GraphicDriver::Graphic3d_GraphicDriver (const Handle(Aspect_DisplayCon
aSettings.SetEnableDepthWrite (Standard_False); aSettings.SetEnableDepthWrite (Standard_False);
aSettings.SetClearDepth (Standard_False); aSettings.SetClearDepth (Standard_False);
aSettings.SetPolygonOffset (Graphic3d_PolygonOffset()); aSettings.SetPolygonOffset (Graphic3d_PolygonOffset());
Handle(Graphic3d_Layer) aLayer = new Graphic3d_Layer (Graphic3d_ZLayerId_TopOSD, 1, Handle(Select3D_BVHBuilder3d)()); Handle(Graphic3d_Layer) aLayer = new Graphic3d_Layer (Graphic3d_ZLayerId_TopOSD, Handle(Select3D_BVHBuilder3d)());
aLayer->SetLayerSettings (aSettings); aLayer->SetLayerSettings (aSettings);
myLayers.Append (aLayer); myLayers.Append (aLayer);
myLayerIds.Bind (aLayer->LayerId(), aLayer); myLayerIds.Bind (aLayer->LayerId(), aLayer);
@ -192,7 +192,7 @@ void Graphic3d_GraphicDriver::InsertLayerBefore (const Graphic3d_ZLayerId theNew
Standard_ASSERT_RAISE (!myLayerIds.IsBound (theNewLayerId), Standard_ASSERT_RAISE (!myLayerIds.IsBound (theNewLayerId),
"Graphic3d_GraphicDriver::InsertLayerBefore, Layer with theLayerId already exists"); "Graphic3d_GraphicDriver::InsertLayerBefore, Layer with theLayerId already exists");
Handle(Graphic3d_Layer) aNewLayer = new Graphic3d_Layer (theNewLayerId, 1, Handle(Select3D_BVHBuilder3d)()); Handle(Graphic3d_Layer) aNewLayer = new Graphic3d_Layer (theNewLayerId, Handle(Select3D_BVHBuilder3d)());
aNewLayer->SetLayerSettings (theSettings); aNewLayer->SetLayerSettings (theSettings);
Handle(Graphic3d_Layer) anOtherLayer; Handle(Graphic3d_Layer) anOtherLayer;
@ -228,7 +228,7 @@ void Graphic3d_GraphicDriver::InsertLayerAfter (const Graphic3d_ZLayerId theNewL
Standard_ASSERT_RAISE (!myLayerIds.IsBound (theNewLayerId), Standard_ASSERT_RAISE (!myLayerIds.IsBound (theNewLayerId),
"Graphic3d_GraphicDriver::InsertLayerAfter, Layer with theLayerId already exists"); "Graphic3d_GraphicDriver::InsertLayerAfter, Layer with theLayerId already exists");
Handle(Graphic3d_Layer) aNewLayer = new Graphic3d_Layer (theNewLayerId, 1, Handle(Select3D_BVHBuilder3d)()); Handle(Graphic3d_Layer) aNewLayer = new Graphic3d_Layer (theNewLayerId, Handle(Select3D_BVHBuilder3d)());
aNewLayer->SetLayerSettings (theSettings); aNewLayer->SetLayerSettings (theSettings);
Handle(Graphic3d_Layer) anOtherLayer; Handle(Graphic3d_Layer) anOtherLayer;

View File

@ -27,7 +27,6 @@
#include <Graphic3d_GroupDefinitionError.hxx> #include <Graphic3d_GroupDefinitionError.hxx>
#include <Graphic3d_ShaderProgram.hxx> #include <Graphic3d_ShaderProgram.hxx>
#include <Graphic3d_Structure.hxx> #include <Graphic3d_Structure.hxx>
#include "Graphic3d_Structure.pxx"
#include <Graphic3d_StructureManager.hxx> #include <Graphic3d_StructureManager.hxx>
#include <Graphic3d_Text.hxx> #include <Graphic3d_Text.hxx>
#include <Graphic3d_TextureMap.hxx> #include <Graphic3d_TextureMap.hxx>

View File

@ -23,10 +23,8 @@ IMPLEMENT_STANDARD_RTTIEXT(Graphic3d_Layer, Standard_Transient)
// purpose : // purpose :
// ======================================================================= // =======================================================================
Graphic3d_Layer::Graphic3d_Layer (Graphic3d_ZLayerId theId, Graphic3d_Layer::Graphic3d_Layer (Graphic3d_ZLayerId theId,
Standard_Integer theNbPriorities,
const Handle(Select3D_BVHBuilder3d)& theBuilder) const Handle(Select3D_BVHBuilder3d)& theBuilder)
: myArray (0, theNbPriorities - 1), : myNbStructures (0),
myNbStructures (0),
myNbStructuresNotCulled (0), myNbStructuresNotCulled (0),
myLayerId (theId), myLayerId (theId),
myBVHPrimitivesTrsfPers (theBuilder), myBVHPrimitivesTrsfPers (theBuilder),
@ -50,16 +48,16 @@ Graphic3d_Layer::~Graphic3d_Layer()
// purpose : // purpose :
// ======================================================================= // =======================================================================
void Graphic3d_Layer::Add (const Graphic3d_CStructure* theStruct, void Graphic3d_Layer::Add (const Graphic3d_CStructure* theStruct,
Standard_Integer thePriority, Graphic3d_DisplayPriority thePriority,
Standard_Boolean isForChangePriority) Standard_Boolean isForChangePriority)
{ {
const Standard_Integer anIndex = Min (Max (thePriority, 0), myArray.Length() - 1); const Standard_Integer anIndex = Min (Max (thePriority, Graphic3d_DisplayPriority_Bottom), Graphic3d_DisplayPriority_Topmost);
if (theStruct == NULL) if (theStruct == NULL)
{ {
return; return;
} }
myArray (anIndex).Add (theStruct); myArray[anIndex].Add (theStruct);
if (theStruct->IsAlwaysRendered()) if (theStruct->IsAlwaysRendered())
{ {
theStruct->MarkAsNotCulled(); theStruct->MarkAsNotCulled();
@ -87,19 +85,18 @@ void Graphic3d_Layer::Add (const Graphic3d_CStructure* theStruct,
// purpose : // purpose :
// ======================================================================= // =======================================================================
bool Graphic3d_Layer::Remove (const Graphic3d_CStructure* theStruct, bool Graphic3d_Layer::Remove (const Graphic3d_CStructure* theStruct,
Standard_Integer& thePriority, Graphic3d_DisplayPriority& thePriority,
Standard_Boolean isForChangePriority) Standard_Boolean isForChangePriority)
{ {
if (theStruct == NULL) if (theStruct == NULL)
{ {
thePriority = -1; thePriority = Graphic3d_DisplayPriority_INVALID;
return false; return false;
} }
const Standard_Integer aNbPriorities = myArray.Length(); for (Standard_Integer aPriorityIter = Graphic3d_DisplayPriority_Bottom; aPriorityIter <= Graphic3d_DisplayPriority_Topmost; ++aPriorityIter)
for (Standard_Integer aPriorityIter = 0; aPriorityIter < aNbPriorities; ++aPriorityIter)
{ {
Graphic3d_IndexedMapOfStructure& aStructures = myArray (aPriorityIter); Graphic3d_IndexedMapOfStructure& aStructures = myArray[aPriorityIter];
const Standard_Integer anIndex = aStructures.FindIndex (theStruct); const Standard_Integer anIndex = aStructures.FindIndex (theStruct);
if (anIndex == 0) if (anIndex == 0)
{ {
@ -133,11 +130,11 @@ bool Graphic3d_Layer::Remove (const Graphic3d_CStructure* theStruct,
} }
} }
--myNbStructures; --myNbStructures;
thePriority = aPriorityIter; thePriority = (Graphic3d_DisplayPriority )aPriorityIter;
return true; return true;
} }
thePriority = -1; thePriority = Graphic3d_DisplayPriority_INVALID;
return false; return false;
} }
@ -203,9 +200,9 @@ Bnd_Box Graphic3d_Layer::BoundingBox (Standard_Integer theViewId,
// Recompute layer bounding box // Recompute layer bounding box
myBoundingBox[aBoxId].SetVoid(); myBoundingBox[aBoxId].SetVoid();
for (Graphic3d_ArrayOfIndexedMapOfStructure::Iterator aMapIter (myArray); aMapIter.More(); aMapIter.Next()) for (Standard_Integer aPriorIter = Graphic3d_DisplayPriority_Bottom; aPriorIter <= Graphic3d_DisplayPriority_Topmost; ++aPriorIter)
{ {
const Graphic3d_IndexedMapOfStructure& aStructures = aMapIter.Value(); const Graphic3d_IndexedMapOfStructure& aStructures = myArray[aPriorIter];
for (Graphic3d_IndexedMapOfStructure::Iterator aStructIter (aStructures); aStructIter.More(); aStructIter.Next()) for (Graphic3d_IndexedMapOfStructure::Iterator aStructIter (aStructures); aStructIter.More(); aStructIter.Next())
{ {
const Graphic3d_CStructure* aStructure = aStructIter.Value(); const Graphic3d_CStructure* aStructure = aStructIter.Value();
@ -344,9 +341,9 @@ Standard_Real Graphic3d_Layer::considerZoomPersistenceObjects (Standard_Integer
const Graphic3d_Mat4d& aWorldViewMat = theCamera->OrientationMatrix(); const Graphic3d_Mat4d& aWorldViewMat = theCamera->OrientationMatrix();
Standard_Real aMaxCoef = -std::numeric_limits<double>::max(); Standard_Real aMaxCoef = -std::numeric_limits<double>::max();
for (Graphic3d_ArrayOfIndexedMapOfStructure::Iterator aMapIter (myArray); aMapIter.More(); aMapIter.Next()) for (Standard_Integer aPriorIter = Graphic3d_DisplayPriority_Bottom; aPriorIter <= Graphic3d_DisplayPriority_Topmost; ++aPriorIter)
{ {
const Graphic3d_IndexedMapOfStructure& aStructures = aMapIter.Value(); const Graphic3d_IndexedMapOfStructure& aStructures = myArray[aPriorIter];
for (Graphic3d_IndexedMapOfStructure::Iterator aStructIter (aStructures); aStructIter.More(); aStructIter.Next()) for (Graphic3d_IndexedMapOfStructure::Iterator aStructIter (aStructures); aStructIter.More(); aStructIter.Next())
{ {
const Graphic3d_CStructure* aStructure = aStructIter.Value(); const Graphic3d_CStructure* aStructure = aStructIter.Value();
@ -463,9 +460,9 @@ void Graphic3d_Layer::updateBVH() const
myBVHPrimitivesTrsfPers.Clear(); myBVHPrimitivesTrsfPers.Clear();
myAlwaysRenderedMap.Clear(); myAlwaysRenderedMap.Clear();
myIsBVHPrimitivesNeedsReset = Standard_False; myIsBVHPrimitivesNeedsReset = Standard_False;
for (Graphic3d_ArrayOfIndexedMapOfStructure::Iterator aMapIter (myArray); aMapIter.More(); aMapIter.Next()) for (Standard_Integer aPriorIter = Graphic3d_DisplayPriority_Bottom; aPriorIter <= Graphic3d_DisplayPriority_Topmost; ++aPriorIter)
{ {
const Graphic3d_IndexedMapOfStructure& aStructures = aMapIter.Value(); const Graphic3d_IndexedMapOfStructure& aStructures = myArray[aPriorIter];
for (Graphic3d_IndexedMapOfStructure::Iterator aStructIter (aStructures); aStructIter.More(); aStructIter.Next()) for (Graphic3d_IndexedMapOfStructure::Iterator aStructIter (aStructures); aStructIter.More(); aStructIter.Next())
{ {
const Graphic3d_CStructure* aStruct = aStructIter.Value(); const Graphic3d_CStructure* aStruct = aStructIter.Value();
@ -655,20 +652,13 @@ void Graphic3d_Layer::UpdateCulling (Standard_Integer theViewId,
// ======================================================================= // =======================================================================
Standard_Boolean Graphic3d_Layer::Append (const Graphic3d_Layer& theOther) Standard_Boolean Graphic3d_Layer::Append (const Graphic3d_Layer& theOther)
{ {
// the source priority list shouldn't have more priorities
const Standard_Integer aNbPriorities = theOther.NbPriorities();
if (aNbPriorities > NbPriorities())
{
return Standard_False;
}
// add all structures to destination priority list // add all structures to destination priority list
for (Standard_Integer aPriorityIter = 0; aPriorityIter < aNbPriorities; ++aPriorityIter) for (Standard_Integer aPriorityIter = Graphic3d_DisplayPriority_Bottom; aPriorityIter <= Graphic3d_DisplayPriority_Topmost; ++aPriorityIter)
{ {
const Graphic3d_IndexedMapOfStructure& aStructures = theOther.myArray (aPriorityIter); const Graphic3d_IndexedMapOfStructure& aStructures = theOther.myArray[aPriorityIter];
for (Graphic3d_IndexedMapOfStructure::Iterator aStructIter (aStructures); aStructIter.More(); aStructIter.Next()) for (Graphic3d_IndexedMapOfStructure::Iterator aStructIter (aStructures); aStructIter.More(); aStructIter.Next())
{ {
Add (aStructIter.Value(), aPriorityIter); Add (aStructIter.Value(), (Graphic3d_DisplayPriority )aPriorityIter);
} }
} }
@ -688,9 +678,9 @@ void Graphic3d_Layer::SetLayerSettings (const Graphic3d_ZLayerSettings& theSetti
return; return;
} }
for (Graphic3d_ArrayOfIndexedMapOfStructure::Iterator aMapIter (myArray); aMapIter.More(); aMapIter.Next()) for (Standard_Integer aPriorIter = Graphic3d_DisplayPriority_Bottom; aPriorIter <= Graphic3d_DisplayPriority_Topmost; ++aPriorIter)
{ {
Graphic3d_IndexedMapOfStructure& aStructures = aMapIter.ChangeValue(); Graphic3d_IndexedMapOfStructure& aStructures = myArray[aPriorIter];
for (Graphic3d_IndexedMapOfStructure::Iterator aStructIter (aStructures); aStructIter.More(); aStructIter.Next()) for (Graphic3d_IndexedMapOfStructure::Iterator aStructIter (aStructures); aStructIter.More(); aStructIter.Next())
{ {
Graphic3d_CStructure* aStructure = const_cast<Graphic3d_CStructure* >(aStructIter.Value()); Graphic3d_CStructure* aStructure = const_cast<Graphic3d_CStructure* >(aStructIter.Value());
@ -712,10 +702,9 @@ void Graphic3d_Layer::DumpJson (Standard_OStream& theOStream, Standard_Integer t
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myNbStructures) OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myNbStructures)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myNbStructuresNotCulled) OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myNbStructuresNotCulled)
const Standard_Integer aNbPriorities = myArray.Length(); for (Standard_Integer aPriorityIter = Graphic3d_DisplayPriority_Bottom; aPriorityIter <= Graphic3d_DisplayPriority_Topmost; ++aPriorityIter)
for (Standard_Integer aPriorityIter = 0; aPriorityIter < aNbPriorities; ++aPriorityIter)
{ {
const Graphic3d_IndexedMapOfStructure& aStructures = myArray (aPriorityIter); const Graphic3d_IndexedMapOfStructure& aStructures = myArray[aPriorityIter];
for (Graphic3d_IndexedMapOfStructure::Iterator aStructIter (aStructures); aStructIter.More(); aStructIter.Next()) for (Graphic3d_IndexedMapOfStructure::Iterator aStructIter (aStructures); aStructIter.More(); aStructIter.Next())
{ {
const Graphic3d_CStructure* aStructure = aStructIter.Value(); const Graphic3d_CStructure* aStructure = aStructIter.Value();

View File

@ -16,6 +16,7 @@
#include <Graphic3d_BvhCStructureSet.hxx> #include <Graphic3d_BvhCStructureSet.hxx>
#include <Graphic3d_BvhCStructureSetTrsfPers.hxx> #include <Graphic3d_BvhCStructureSetTrsfPers.hxx>
#include <Graphic3d_DisplayPriority.hxx>
#include <Graphic3d_Camera.hxx> #include <Graphic3d_Camera.hxx>
#include <Graphic3d_ZLayerId.hxx> #include <Graphic3d_ZLayerId.hxx>
#include <Graphic3d_ZLayerSettings.hxx> #include <Graphic3d_ZLayerSettings.hxx>
@ -24,11 +25,13 @@
#include <NCollection_IndexedMap.hxx> #include <NCollection_IndexedMap.hxx>
#include <NCollection_Sequence.hxx> #include <NCollection_Sequence.hxx>
#include <array>
//! Defines index map of structures. //! Defines index map of structures.
typedef NCollection_IndexedMap<const Graphic3d_CStructure*> Graphic3d_IndexedMapOfStructure; typedef NCollection_IndexedMap<const Graphic3d_CStructure*> Graphic3d_IndexedMapOfStructure;
//! Defines array of indexed maps of structures. //! Defines array of indexed maps of structures.
typedef NCollection_Array1<Graphic3d_IndexedMapOfStructure> Graphic3d_ArrayOfIndexedMapOfStructure; typedef std::array<Graphic3d_IndexedMapOfStructure, Graphic3d_DisplayPriority_NB> Graphic3d_ArrayOfIndexedMapOfStructure;
class Graphic3d_CullingTool; class Graphic3d_CullingTool;
@ -40,7 +43,6 @@ public:
//! Initializes associated priority list and layer properties //! Initializes associated priority list and layer properties
Standard_EXPORT Graphic3d_Layer (Graphic3d_ZLayerId theId, Standard_EXPORT Graphic3d_Layer (Graphic3d_ZLayerId theId,
Standard_Integer theNbPriorities,
const Handle(Select3D_BVHBuilder3d)& theBuilder); const Handle(Select3D_BVHBuilder3d)& theBuilder);
//! Destructor. //! Destructor.
@ -49,10 +51,10 @@ public:
//! Return layer id. //! Return layer id.
Graphic3d_ZLayerId LayerId() const { return myLayerId; } Graphic3d_ZLayerId LayerId() const { return myLayerId; }
//! Returns BVH tree builder for frustom culling. //! Returns BVH tree builder for frustum culling.
const Handle(Select3D_BVHBuilder3d)& FrustumCullingBVHBuilder() const { return myBVHPrimitivesTrsfPers.Builder(); } const Handle(Select3D_BVHBuilder3d)& FrustumCullingBVHBuilder() const { return myBVHPrimitivesTrsfPers.Builder(); }
//! Assigns BVH tree builder for frustom culling. //! Assigns BVH tree builder for frustum culling.
void SetFrustumCullingBVHBuilder (const Handle(Select3D_BVHBuilder3d)& theBuilder) { myBVHPrimitivesTrsfPers.SetBuilder (theBuilder); } void SetFrustumCullingBVHBuilder (const Handle(Select3D_BVHBuilder3d)& theBuilder) { myBVHPrimitivesTrsfPers.SetBuilder (theBuilder); }
//! Return true if layer was marked with immediate flag. //! Return true if layer was marked with immediate flag.
@ -65,12 +67,12 @@ public:
Standard_EXPORT void SetLayerSettings (const Graphic3d_ZLayerSettings& theSettings); Standard_EXPORT void SetLayerSettings (const Graphic3d_ZLayerSettings& theSettings);
Standard_EXPORT void Add (const Graphic3d_CStructure* theStruct, Standard_EXPORT void Add (const Graphic3d_CStructure* theStruct,
Standard_Integer thePriority, Graphic3d_DisplayPriority thePriority,
Standard_Boolean isForChangePriority = Standard_False); Standard_Boolean isForChangePriority = Standard_False);
//! Remove structure and returns its priority, if the structure is not found, method returns negative value //! Remove structure and returns its priority, if the structure is not found, method returns negative value
Standard_EXPORT bool Remove (const Graphic3d_CStructure* theStruct, Standard_EXPORT bool Remove (const Graphic3d_CStructure* theStruct,
Standard_Integer& thePriority, Graphic3d_DisplayPriority& thePriority,
Standard_Boolean isForChangePriority = Standard_False); Standard_Boolean isForChangePriority = Standard_False);
//! @return the number of structures //! @return the number of structures
@ -80,7 +82,7 @@ public:
Standard_Integer NbStructuresNotCulled() const { return myNbStructuresNotCulled; } Standard_Integer NbStructuresNotCulled() const { return myNbStructuresNotCulled; }
//! Returns the number of available priority levels //! Returns the number of available priority levels
Standard_Integer NbPriorities() const { return myArray.Length(); } Standard_Integer NbPriorities() const { return Graphic3d_DisplayPriority_NB; }
//! Append layer of acceptable type (with similar number of priorities or less). //! Append layer of acceptable type (with similar number of priorities or less).
//! Returns Standard_False if the list can not be accepted. //! Returns Standard_False if the list can not be accepted.
@ -89,6 +91,9 @@ public:
//! Returns array of structures. //! Returns array of structures.
const Graphic3d_ArrayOfIndexedMapOfStructure& ArrayOfStructures() const { return myArray; } const Graphic3d_ArrayOfIndexedMapOfStructure& ArrayOfStructures() const { return myArray; }
//! Returns structures for specified priority.
const Graphic3d_IndexedMapOfStructure& Structures (Graphic3d_DisplayPriority thePriority) const { return myArray[thePriority]; }
//! Marks BVH tree for given priority list as dirty and //! Marks BVH tree for given priority list as dirty and
//! marks primitive set for rebuild. //! marks primitive set for rebuild.
Standard_EXPORT void InvalidateBVHData(); Standard_EXPORT void InvalidateBVHData();

View File

@ -27,8 +27,6 @@
#include <Graphic3d_StructureManager.hxx> #include <Graphic3d_StructureManager.hxx>
#include <Quantity_Color.hxx> #include <Quantity_Color.hxx>
#include "Graphic3d_Structure.pxx"
#include <Standard_Dump.hxx> #include <Standard_Dump.hxx>
#include <stdio.h> #include <stdio.h>
@ -133,7 +131,7 @@ void Graphic3d_Structure::Remove()
} }
// Destruction of me in the graphic library // Destruction of me in the graphic library
const Standard_Integer aStructId = myCStructure->Id; const Standard_Integer aStructId = myCStructure->Identification();
myCStructure->GraphicDriver()->RemoveIdentification(aStructId); myCStructure->GraphicDriver()->RemoveIdentification(aStructId);
myCStructure->GraphicDriver()->RemoveStructure (myCStructure); myCStructure->GraphicDriver()->RemoveStructure (myCStructure);
myCStructure.Nullify(); myCStructure.Nullify();
@ -164,25 +162,25 @@ void Graphic3d_Structure::Display()
//function : SetDisplayPriority //function : SetDisplayPriority
//purpose : //purpose :
//============================================================================= //=============================================================================
void Graphic3d_Structure::SetDisplayPriority (const Standard_Integer thePriority) void Graphic3d_Structure::SetDisplayPriority (const Graphic3d_DisplayPriority thePriority)
{ {
if (IsDeleted() if (IsDeleted()
|| thePriority == myCStructure->Priority) || thePriority == myCStructure->Priority())
{ {
return; return;
} }
myCStructure->PreviousPriority = myCStructure->Priority; Graphic3d_PriorityDefinitionError_Raise_if ((thePriority > Graphic3d_DisplayPriority_Topmost)
myCStructure->Priority = thePriority; || (thePriority < Graphic3d_DisplayPriority_Bottom),
if (myCStructure->Priority != myCStructure->PreviousPriority)
{
Graphic3d_PriorityDefinitionError_Raise_if ((myCStructure->Priority > Structure_MAX_PRIORITY)
|| (myCStructure->Priority < Structure_MIN_PRIORITY),
"Bad value for StructurePriority"); "Bad value for StructurePriority");
myCStructure->SetPreviousPriority (myCStructure->Priority());
myCStructure->SetPriority (thePriority);
if (myCStructure->Priority() != myCStructure->PreviousPriority())
{
if (myCStructure->stick) if (myCStructure->stick)
{ {
myStructureManager->ChangeDisplayPriority (this, myCStructure->PreviousPriority, myCStructure->Priority); myStructureManager->ChangeDisplayPriority (this, myCStructure->PreviousPriority(), myCStructure->Priority());
} }
} }
} }
@ -194,16 +192,16 @@ void Graphic3d_Structure::SetDisplayPriority (const Standard_Integer thePriority
void Graphic3d_Structure::ResetDisplayPriority() void Graphic3d_Structure::ResetDisplayPriority()
{ {
if (IsDeleted() if (IsDeleted()
|| myCStructure->Priority == myCStructure->PreviousPriority) || myCStructure->Priority() == myCStructure->PreviousPriority())
{ {
return; return;
} }
const Standard_Integer aPriority = myCStructure->Priority; const Graphic3d_DisplayPriority aPriority = myCStructure->Priority();
myCStructure->Priority = myCStructure->PreviousPriority; myCStructure->SetPriority (myCStructure->PreviousPriority());
if (myCStructure->stick) if (myCStructure->stick)
{ {
myStructureManager->ChangeDisplayPriority (this, aPriority, myCStructure->Priority); myStructureManager->ChangeDisplayPriority (this, aPriority, myCStructure->Priority());
} }
} }
@ -237,10 +235,8 @@ void Graphic3d_Structure::Highlight (const Handle(Graphic3d_PresentationAttribut
return; return;
} }
SetDisplayPriority (Structure_MAX_PRIORITY - 1); SetDisplayPriority (Graphic3d_DisplayPriority_Highlight);
myCStructure->GraphicHighlight (theStyle); myCStructure->GraphicHighlight (theStyle);
if (!theToUpdateMgr) if (!theToUpdateMgr)
{ {
return; return;

View File

@ -76,7 +76,23 @@ public:
Standard_EXPORT virtual void Display(); Standard_EXPORT virtual void Display();
//! Returns the current display priority for this structure. //! Returns the current display priority for this structure.
Standard_Integer DisplayPriority() const { return myCStructure->Priority; } Graphic3d_DisplayPriority DisplayPriority() const { return myCStructure->Priority(); }
//! Modifies the order of displaying the structure.
//! Values are between 0 and 10.
//! Structures are drawn according to their display priorities in ascending order.
//! A structure of priority 10 is displayed the last and appears over the others.
//! The default value is 5.
//! Warning: If structure is displayed then the SetDisplayPriority method erases it and displays with the new priority.
//! Raises Graphic3d_PriorityDefinitionError if Priority is greater than 10 or a negative value.
Standard_EXPORT void SetDisplayPriority (const Graphic3d_DisplayPriority thePriority);
Standard_DEPRECATED("Deprecated since OCCT7.7, Graphic3d_DisplayPriority should be passed instead of integer number to SetDisplayPriority()")
void SetDisplayPriority (const Standard_Integer thePriority) { SetDisplayPriority ((Graphic3d_DisplayPriority )thePriority); }
//! Reset the current priority of the structure to the previous priority.
//! Warning: If structure is displayed then the SetDisplayPriority() method erases it and displays with the previous priority.
Standard_EXPORT void ResetDisplayPriority();
//! Erases this structure in all the views of the visualiser. //! Erases this structure in all the views of the visualiser.
virtual void Erase() { erase(); } virtual void Erase() { erase(); }
@ -106,28 +122,6 @@ public:
if (!myCStructure.IsNull()) { myCStructure->IsInfinite = theToSet ? 1 : 0; } if (!myCStructure.IsNull()) { myCStructure->IsInfinite = theToSet ? 1 : 0; }
} }
//! Modifies the order of displaying the structure.
//! Values are between 0 and 10.
//! Structures are drawn according to their display priorities
//! in ascending order.
//! A structure of priority 10 is displayed the last and appears over the others.
//! The default value is 5.
//! Category: Methods to modify the class definition
//! Warning: If <me> is displayed then the SetDisplayPriority
//! method erase <me> and display <me> with the
//! new priority.
//! Raises PriorityDefinitionError if <Priority> is
//! greater than 10 or a negative value.
Standard_EXPORT void SetDisplayPriority (const Standard_Integer Priority);
//! Reset the current priority of the structure to the
//! previous priority.
//! Category: Methods to modify the class definition
//! Warning: If <me> is displayed then the SetDisplayPriority
//! method erase <me> and display <me> with the
//! previous priority.
Standard_EXPORT void ResetDisplayPriority();
//! Set Z layer ID for the structure. The Z layer mechanism //! Set Z layer ID for the structure. The Z layer mechanism
//! allows to display structures presented in higher layers in overlay //! allows to display structures presented in higher layers in overlay
//! of structures in lower layers by switching off z buffer depth //! of structures in lower layers by switching off z buffer depth
@ -411,7 +405,7 @@ public:
} }
//! Returns the identification number of this structure. //! Returns the identification number of this structure.
Standard_Integer Identification() const { return myCStructure->Id; } Standard_Integer Identification() const { return myCStructure->Identification(); }
//! Prints information about the network associated //! Prints information about the network associated
//! with the structure <AStructure>. //! with the structure <AStructure>.

View File

@ -1,23 +0,0 @@
// Copyright (c) 1995-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef STRUCTURE_PXX_INCLUDED
#define STRUCTURE_PXX_INCLUDED
// structure priority : range (do not change this range !)
// call_togl_displaystructure, CALL_DEF_VIEW, MajView ...
#define Structure_MAX_PRIORITY 10
#define Structure_MIN_PRIORITY 0
#endif

View File

@ -420,8 +420,8 @@ void Graphic3d_StructureManager::SetTransform (const Handle(Graphic3d_Structure)
// purpose : // purpose :
// ======================================================================== // ========================================================================
void Graphic3d_StructureManager::ChangeDisplayPriority (const Handle(Graphic3d_Structure)& theStructure, void Graphic3d_StructureManager::ChangeDisplayPriority (const Handle(Graphic3d_Structure)& theStructure,
const Standard_Integer theOldPriority, const Graphic3d_DisplayPriority theOldPriority,
const Standard_Integer theNewPriority) const Graphic3d_DisplayPriority theNewPriority)
{ {
for (Graphic3d_IndexedMapOfView::Iterator aViewIt (myDefinedViews); aViewIt.More(); aViewIt.Next()) for (Graphic3d_IndexedMapOfView::Iterator aViewIt (myDefinedViews); aViewIt.More(); aViewIt.Next())
{ {

View File

@ -112,7 +112,9 @@ public:
Standard_EXPORT virtual void SetTransform (const Handle(Graphic3d_Structure)& theStructure, const Handle(TopLoc_Datum3D)& theTrsf); Standard_EXPORT virtual void SetTransform (const Handle(Graphic3d_Structure)& theStructure, const Handle(TopLoc_Datum3D)& theTrsf);
//! Changes the display priority of the structure <AStructure>. //! Changes the display priority of the structure <AStructure>.
Standard_EXPORT virtual void ChangeDisplayPriority (const Handle(Graphic3d_Structure)& theStructure, const Standard_Integer theOldPriority, const Standard_Integer theNewPriority); Standard_EXPORT virtual void ChangeDisplayPriority (const Handle(Graphic3d_Structure)& theStructure,
const Graphic3d_DisplayPriority theOldPriority,
const Graphic3d_DisplayPriority theNewPriority);
//! Change Z layer for structure. The Z layer mechanism allows to display structures in higher //! Change Z layer for structure. The Z layer mechanism allows to display structures in higher
//! layers in overlay of structures in lower layers. //! layers in overlay of structures in lower layers.

View File

@ -1051,7 +1051,7 @@ void MeshVS_Mesh::HilightSelected ( const Handle(PrsMgr_PresentationManager)& th
if ( IsNeedToRedisplay ) if ( IsNeedToRedisplay )
{ {
aSelectionPrs->SetDisplayPriority(9); aSelectionPrs->SetDisplayPriority (Graphic3d_DisplayPriority_Highlight);
aSelectionPrs->Display(); aSelectionPrs->Display();
} }

View File

@ -743,7 +743,7 @@ void OpenGl_GraphicDriver::SetZLayerSettings (const Graphic3d_ZLayerId theLayerI
Handle(Graphic3d_CStructure) OpenGl_GraphicDriver::CreateStructure (const Handle(Graphic3d_StructureManager)& theManager) Handle(Graphic3d_CStructure) OpenGl_GraphicDriver::CreateStructure (const Handle(Graphic3d_StructureManager)& theManager)
{ {
Handle(OpenGl_Structure) aStructure = new OpenGl_Structure (theManager); Handle(OpenGl_Structure) aStructure = new OpenGl_Structure (theManager);
myMapOfStructure.Bind (aStructure->Id, aStructure.operator->()); myMapOfStructure.Bind (aStructure->Identification(), aStructure.operator->());
return aStructure; return aStructure;
} }
@ -754,12 +754,12 @@ Handle(Graphic3d_CStructure) OpenGl_GraphicDriver::CreateStructure (const Handle
void OpenGl_GraphicDriver::RemoveStructure (Handle(Graphic3d_CStructure)& theCStructure) void OpenGl_GraphicDriver::RemoveStructure (Handle(Graphic3d_CStructure)& theCStructure)
{ {
OpenGl_Structure* aStructure = NULL; OpenGl_Structure* aStructure = NULL;
if (!myMapOfStructure.Find (theCStructure->Id, aStructure)) if (!myMapOfStructure.Find (theCStructure->Identification(), aStructure))
{ {
return; return;
} }
myMapOfStructure.UnBind (theCStructure->Id); myMapOfStructure.UnBind (theCStructure->Identification());
aStructure->Release (GetSharedContext()); aStructure->Release (GetSharedContext());
theCStructure.Nullify(); theCStructure.Nullify();
} }

View File

@ -156,9 +156,8 @@ struct OpenGl_GlobalLayerSettings
//purpose : Constructor //purpose : Constructor
//======================================================================= //=======================================================================
OpenGl_LayerList::OpenGl_LayerList (const Standard_Integer theNbPriorities) OpenGl_LayerList::OpenGl_LayerList()
: myBVHBuilder (new BVH_LinearBuilder<Standard_Real, 3> (BVH_Constants_LeafNodeSizeSingle, BVH_Constants_MaxTreeDepth)), : myBVHBuilder (new BVH_LinearBuilder<Standard_Real, 3> (BVH_Constants_LeafNodeSizeSingle, BVH_Constants_MaxTreeDepth)),
myNbPriorities (theNbPriorities),
myNbStructures (0), myNbStructures (0),
myImmediateNbStructures (0), myImmediateNbStructures (0),
myModifStateOfRaytraceable (0) myModifStateOfRaytraceable (0)
@ -201,7 +200,7 @@ void OpenGl_LayerList::InsertLayerBefore (const Graphic3d_ZLayerId theNewLayerId
return; return;
} }
Handle(Graphic3d_Layer) aNewLayer = new Graphic3d_Layer (theNewLayerId, myNbPriorities, myBVHBuilder); Handle(Graphic3d_Layer) aNewLayer = new Graphic3d_Layer (theNewLayerId, myBVHBuilder);
aNewLayer->SetLayerSettings (theSettings); aNewLayer->SetLayerSettings (theSettings);
Handle(Graphic3d_Layer) anOtherLayer; Handle(Graphic3d_Layer) anOtherLayer;
@ -239,7 +238,7 @@ void OpenGl_LayerList::InsertLayerAfter (const Graphic3d_ZLayerId theNewLayerId,
return; return;
} }
Handle(Graphic3d_Layer) aNewLayer = new Graphic3d_Layer (theNewLayerId, myNbPriorities, myBVHBuilder); Handle(Graphic3d_Layer) aNewLayer = new Graphic3d_Layer (theNewLayerId, myBVHBuilder);
aNewLayer->SetLayerSettings (theSettings); aNewLayer->SetLayerSettings (theSettings);
Handle(Graphic3d_Layer) anOtherLayer; Handle(Graphic3d_Layer) anOtherLayer;
@ -294,7 +293,7 @@ void OpenGl_LayerList::RemoveLayer (const Graphic3d_ZLayerId theLayerId)
void OpenGl_LayerList::AddStructure (const OpenGl_Structure* theStruct, void OpenGl_LayerList::AddStructure (const OpenGl_Structure* theStruct,
const Graphic3d_ZLayerId theLayerId, const Graphic3d_ZLayerId theLayerId,
const Standard_Integer thePriority, const Graphic3d_DisplayPriority thePriority,
Standard_Boolean isForChangePriority) Standard_Boolean isForChangePriority)
{ {
// add structure to associated layer, // add structure to associated layer,
@ -324,7 +323,7 @@ void OpenGl_LayerList::RemoveStructure (const OpenGl_Structure* theStructure)
const Handle(Graphic3d_Layer)* aLayerPtr = myLayerIds.Seek (aLayerId); const Handle(Graphic3d_Layer)* aLayerPtr = myLayerIds.Seek (aLayerId);
const Handle(Graphic3d_Layer)& aLayer = aLayerPtr != NULL ? *aLayerPtr : myLayerIds.Find (Graphic3d_ZLayerId_Default); const Handle(Graphic3d_Layer)& aLayer = aLayerPtr != NULL ? *aLayerPtr : myLayerIds.Find (Graphic3d_ZLayerId_Default);
Standard_Integer aPriority = -1; Graphic3d_DisplayPriority aPriority = Graphic3d_DisplayPriority_INVALID;
// remove structure from associated list // remove structure from associated list
// if the structure is not found there, // if the structure is not found there,
@ -396,7 +395,7 @@ void OpenGl_LayerList::ChangeLayer (const OpenGl_Structure* theStructure,
const Handle(Graphic3d_Layer)* aLayerPtr = myLayerIds.Seek (theOldLayerId); const Handle(Graphic3d_Layer)* aLayerPtr = myLayerIds.Seek (theOldLayerId);
const Handle(Graphic3d_Layer)& aLayer = aLayerPtr != NULL ? *aLayerPtr : myLayerIds.Find (Graphic3d_ZLayerId_Default); const Handle(Graphic3d_Layer)& aLayer = aLayerPtr != NULL ? *aLayerPtr : myLayerIds.Find (Graphic3d_ZLayerId_Default);
Standard_Integer aPriority = -1; Graphic3d_DisplayPriority aPriority = Graphic3d_DisplayPriority_INVALID;
// take priority and remove structure from list found by <theOldLayerId> // take priority and remove structure from list found by <theOldLayerId>
// if the structure is not found there, scan through all other layers // if the structure is not found there, scan through all other layers
@ -460,13 +459,12 @@ void OpenGl_LayerList::ChangeLayer (const OpenGl_Structure* theStructure,
//======================================================================= //=======================================================================
void OpenGl_LayerList::ChangePriority (const OpenGl_Structure* theStructure, void OpenGl_LayerList::ChangePriority (const OpenGl_Structure* theStructure,
const Graphic3d_ZLayerId theLayerId, const Graphic3d_ZLayerId theLayerId,
const Standard_Integer theNewPriority) const Graphic3d_DisplayPriority theNewPriority)
{ {
const Handle(Graphic3d_Layer)* aLayerPtr = myLayerIds.Seek (theLayerId); const Handle(Graphic3d_Layer)* aLayerPtr = myLayerIds.Seek (theLayerId);
const Handle(Graphic3d_Layer)& aLayer = aLayerPtr != NULL ? *aLayerPtr : myLayerIds.Find (Graphic3d_ZLayerId_Default); const Handle(Graphic3d_Layer)& aLayer = aLayerPtr != NULL ? *aLayerPtr : myLayerIds.Find (Graphic3d_ZLayerId_Default);
Standard_Integer anOldPriority = -1; Graphic3d_DisplayPriority anOldPriority = Graphic3d_DisplayPriority_INVALID;
if (aLayer->Remove (theStructure, anOldPriority, Standard_True)) if (aLayer->Remove (theStructure, anOldPriority, Standard_True))
{ {
--myNbStructures; --myNbStructures;
@ -664,9 +662,9 @@ void OpenGl_LayerList::renderLayer (const Handle(OpenGl_Workspace)& theWorkspace
// render priority list // render priority list
const Standard_Integer aViewId = theWorkspace->View()->Identification(); const Standard_Integer aViewId = theWorkspace->View()->Identification();
for (Graphic3d_ArrayOfIndexedMapOfStructure::Iterator aMapIter (theLayer.ArrayOfStructures()); aMapIter.More(); aMapIter.Next()) for (Standard_Integer aPriorityIter = Graphic3d_DisplayPriority_Bottom; aPriorityIter <= Graphic3d_DisplayPriority_Topmost; ++aPriorityIter)
{ {
const Graphic3d_IndexedMapOfStructure& aStructures = aMapIter.Value(); const Graphic3d_IndexedMapOfStructure& aStructures = theLayer.Structures ((Graphic3d_DisplayPriority )aPriorityIter);
for (OpenGl_Structure::StructIterator aStructIter (aStructures); aStructIter.More(); aStructIter.Next()) for (OpenGl_Structure::StructIterator aStructIter (aStructures); aStructIter.More(); aStructIter.Next())
{ {
const OpenGl_Structure* aStruct = aStructIter.Value(); const OpenGl_Structure* aStruct = aStructIter.Value();
@ -1250,7 +1248,6 @@ void OpenGl_LayerList::DumpJson (Standard_OStream& theOStream, Standard_Integer
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, aLayerId.get()) OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, aLayerId.get())
} }
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myNbPriorities)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myNbStructures) OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myNbStructures)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myImmediateNbStructures) OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myImmediateNbStructures)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myModifStateOfRaytraceable) OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myModifStateOfRaytraceable)

View File

@ -36,13 +36,13 @@ class OpenGl_LayerList
public: public:
//! Constructor //! Constructor
Standard_EXPORT OpenGl_LayerList (const Standard_Integer theNbPriorities); Standard_EXPORT OpenGl_LayerList();
//! Destructor //! Destructor
Standard_EXPORT virtual ~OpenGl_LayerList(); Standard_EXPORT virtual ~OpenGl_LayerList();
//! Method returns the number of available priorities //! Method returns the number of available priorities
Standard_Integer NbPriorities() const { return myNbPriorities; } Standard_Integer NbPriorities() const { return Graphic3d_DisplayPriority_NB; }
//! Number of displayed structures //! Number of displayed structures
Standard_Integer NbStructures() const { return myNbStructures; } Standard_Integer NbStructures() const { return myNbStructures; }
@ -68,7 +68,7 @@ public:
//! to default bottom-level layer. //! to default bottom-level layer.
Standard_EXPORT void AddStructure (const OpenGl_Structure* theStruct, Standard_EXPORT void AddStructure (const OpenGl_Structure* theStruct,
const Graphic3d_ZLayerId theLayerId, const Graphic3d_ZLayerId theLayerId,
const Standard_Integer thePriority, const Graphic3d_DisplayPriority thePriority,
Standard_Boolean isForChangePriority = Standard_False); Standard_Boolean isForChangePriority = Standard_False);
//! Remove structure from structure list and return its previous priority //! Remove structure from structure list and return its previous priority
@ -84,7 +84,7 @@ public:
//! Changes structure priority within its ZLayer //! Changes structure priority within its ZLayer
Standard_EXPORT void ChangePriority (const OpenGl_Structure* theStructure, Standard_EXPORT void ChangePriority (const OpenGl_Structure* theStructure,
const Graphic3d_ZLayerId theLayerId, const Graphic3d_ZLayerId theLayerId,
const Standard_Integer theNewPriority); const Graphic3d_DisplayPriority theNewPriority);
//! Returns reference to the layer with given ID. //! Returns reference to the layer with given ID.
OpenGl_Layer& Layer (const Graphic3d_ZLayerId theLayerId) { return *myLayerIds.Find (theLayerId); } OpenGl_Layer& Layer (const Graphic3d_ZLayerId theLayerId) { return *myLayerIds.Find (theLayerId); }
@ -120,10 +120,10 @@ public:
//! Returns structure modification state (for ray-tracing). //! Returns structure modification state (for ray-tracing).
Standard_Size ModificationStateOfRaytracable() const { return myModifStateOfRaytraceable; } Standard_Size ModificationStateOfRaytracable() const { return myModifStateOfRaytraceable; }
//! Returns BVH tree builder for frustom culling. //! Returns BVH tree builder for frustum culling.
const Handle(Select3D_BVHBuilder3d)& FrustumCullingBVHBuilder() const { return myBVHBuilder; } const Handle(Select3D_BVHBuilder3d)& FrustumCullingBVHBuilder() const { return myBVHBuilder; }
//! Assigns BVH tree builder for frustom culling. //! Assigns BVH tree builder for frustum culling.
Standard_EXPORT void SetFrustumCullingBVHBuilder (const Handle(Select3D_BVHBuilder3d)& theBuilder); Standard_EXPORT void SetFrustumCullingBVHBuilder (const Handle(Select3D_BVHBuilder3d)& theBuilder);
//! Dumps the content of me into the stream //! Dumps the content of me into the stream
@ -203,9 +203,8 @@ protected:
NCollection_List<Handle(Graphic3d_Layer)> myLayers; NCollection_List<Handle(Graphic3d_Layer)> myLayers;
NCollection_DataMap<Graphic3d_ZLayerId, Handle(Graphic3d_Layer)> myLayerIds; NCollection_DataMap<Graphic3d_ZLayerId, Handle(Graphic3d_Layer)> myLayerIds;
Handle(Select3D_BVHBuilder3d) myBVHBuilder; //!< BVH tree builder for frustom culling Handle(Select3D_BVHBuilder3d) myBVHBuilder; //!< BVH tree builder for frustum culling
Standard_Integer myNbPriorities;
Standard_Integer myNbStructures; Standard_Integer myNbStructures;
Standard_Integer myImmediateNbStructures; //!< number of structures within immediate layers Standard_Integer myImmediateNbStructures; //!< number of structures within immediate layers

View File

@ -39,7 +39,6 @@
#include <OSD_Parallel.hxx> #include <OSD_Parallel.hxx>
#include <Standard_CLocaleSentry.hxx> #include <Standard_CLocaleSentry.hxx>
#include "../Graphic3d/Graphic3d_Structure.pxx"
#include "../Textures/Textures_EnvLUT.pxx" #include "../Textures/Textures_EnvLUT.pxx"
namespace namespace
@ -109,7 +108,6 @@ OpenGl_View::OpenGl_View (const Handle(Graphic3d_StructureManager)& theMgr,
myCaps (theCaps), myCaps (theCaps),
myWasRedrawnGL (Standard_False), myWasRedrawnGL (Standard_False),
myToShowGradTrihedron (false), myToShowGradTrihedron (false),
myZLayers (Structure_MAX_PRIORITY - Structure_MIN_PRIORITY + 1),
myStateCounter (theCounter), myStateCounter (theCounter),
myCurrLightSourceState (theCounter->Increment()), myCurrLightSourceState (theCounter->Increment()),
myLightsRevision (0), myLightsRevision (0),
@ -880,7 +878,7 @@ void OpenGl_View::FBOChangeViewport (const Handle(Standard_Transient)& theFbo,
//purpose : //purpose :
//======================================================================= //=======================================================================
void OpenGl_View::displayStructure (const Handle(Graphic3d_CStructure)& theStructure, void OpenGl_View::displayStructure (const Handle(Graphic3d_CStructure)& theStructure,
const Standard_Integer thePriority) const Graphic3d_DisplayPriority thePriority)
{ {
const OpenGl_Structure* aStruct = static_cast<const OpenGl_Structure*> (theStructure.get()); const OpenGl_Structure* aStruct = static_cast<const OpenGl_Structure*> (theStructure.get());
const Graphic3d_ZLayerId aZLayer = aStruct->ZLayer(); const Graphic3d_ZLayerId aZLayer = aStruct->ZLayer();
@ -916,7 +914,7 @@ void OpenGl_View::changeZLayer (const Handle(Graphic3d_CStructure)& theStructure
//purpose : //purpose :
//======================================================================= //=======================================================================
void OpenGl_View::changePriority (const Handle(Graphic3d_CStructure)& theStructure, void OpenGl_View::changePriority (const Handle(Graphic3d_CStructure)& theStructure,
const Standard_Integer theNewPriority) const Graphic3d_DisplayPriority theNewPriority)
{ {
const Graphic3d_ZLayerId aLayerId = theStructure->ZLayer(); const Graphic3d_ZLayerId aLayerId = theStructure->ZLayer();
const OpenGl_Structure* aStruct = static_cast<const OpenGl_Structure*> (theStructure.get()); const OpenGl_Structure* aStruct = static_cast<const OpenGl_Structure*> (theStructure.get());

View File

@ -403,7 +403,7 @@ private:
//! Adds the structure to display lists of the view. //! Adds the structure to display lists of the view.
Standard_EXPORT virtual void displayStructure (const Handle(Graphic3d_CStructure)& theStructure, Standard_EXPORT virtual void displayStructure (const Handle(Graphic3d_CStructure)& theStructure,
const Standard_Integer thePriority) Standard_OVERRIDE; const Graphic3d_DisplayPriority thePriority) Standard_OVERRIDE;
//! Erases the structure from display lists of the view. //! Erases the structure from display lists of the view.
Standard_EXPORT virtual void eraseStructure (const Handle(Graphic3d_CStructure)& theStructure) Standard_OVERRIDE; Standard_EXPORT virtual void eraseStructure (const Handle(Graphic3d_CStructure)& theStructure) Standard_OVERRIDE;
@ -414,7 +414,7 @@ private:
//! Changes the priority of a structure within its Z layer in the specified view. //! Changes the priority of a structure within its Z layer in the specified view.
Standard_EXPORT virtual void changePriority (const Handle(Graphic3d_CStructure)& theCStructure, Standard_EXPORT virtual void changePriority (const Handle(Graphic3d_CStructure)& theCStructure,
const Standard_Integer theNewPriority) Standard_OVERRIDE; const Graphic3d_DisplayPriority theNewPriority) Standard_OVERRIDE;
private: private:

View File

@ -121,10 +121,10 @@ Standard_Boolean OpenGl_View::updateRaytraceGeometry (const RaytraceUpdateMode
continue; continue;
} }
const Graphic3d_ArrayOfIndexedMapOfStructure& aStructArray = aLayer->ArrayOfStructures(); for (Standard_Integer aPriorityIter = Graphic3d_DisplayPriority_Bottom; aPriorityIter <= Graphic3d_DisplayPriority_Topmost; ++aPriorityIter)
for (Standard_Integer anIndex = 0; anIndex < aStructArray.Length(); ++anIndex)
{ {
for (OpenGl_Structure::StructIterator aStructIt (aStructArray.Value (anIndex)); aStructIt.More(); aStructIt.Next()) const Graphic3d_IndexedMapOfStructure& aStructures = aLayer->Structures ((Graphic3d_DisplayPriority )aPriorityIter);
for (OpenGl_Structure::StructIterator aStructIt (aStructures); aStructIt.More(); aStructIt.Next())
{ {
const OpenGl_Structure* aStructure = aStructIt.Value(); const OpenGl_Structure* aStructure = aStructIt.Value();
@ -136,7 +136,7 @@ Standard_Boolean OpenGl_View::updateRaytraceGeometry (const RaytraceUpdateMode
} }
else if (aStructure->IsVisible() && myRaytraceParameters.GlobalIllumination) else if (aStructure->IsVisible() && myRaytraceParameters.GlobalIllumination)
{ {
aNonRaytraceIDs.insert (aStructure->highlight ? aStructure->Id : -aStructure->Id); aNonRaytraceIDs.insert (aStructure->highlight ? aStructure->Identification() : -aStructure->Identification());
} }
} }
else if (theMode == OpenGl_GUM_PREPARE) else if (theMode == OpenGl_GUM_PREPARE)

View File

@ -210,7 +210,7 @@ void PrsMgr_PresentationManager::Unhighlight (const Handle(PrsMgr_PresentableObj
// ======================================================================= // =======================================================================
void PrsMgr_PresentationManager::SetDisplayPriority (const Handle(PrsMgr_PresentableObject)& thePrsObj, void PrsMgr_PresentationManager::SetDisplayPriority (const Handle(PrsMgr_PresentableObject)& thePrsObj,
const Standard_Integer theMode, const Standard_Integer theMode,
const Standard_Integer theNewPrior) const const Graphic3d_DisplayPriority theNewPrior) const
{ {
if (thePrsObj->ToPropagateVisualState()) if (thePrsObj->ToPropagateVisualState())
{ {
@ -231,15 +231,15 @@ void PrsMgr_PresentationManager::SetDisplayPriority (const Handle(PrsMgr_Present
// function : DisplayPriority // function : DisplayPriority
// purpose : // purpose :
// ======================================================================= // =======================================================================
Standard_Integer PrsMgr_PresentationManager::DisplayPriority (const Handle(PrsMgr_PresentableObject)& thePrsObj, Graphic3d_DisplayPriority PrsMgr_PresentationManager::DisplayPriority (const Handle(PrsMgr_PresentableObject)& thePrsObj,
const Standard_Integer theMode) const const Standard_Integer theMode) const
{ {
if (thePrsObj->ToPropagateVisualState()) if (thePrsObj->ToPropagateVisualState())
{ {
for (PrsMgr_ListOfPresentableObjectsIter anIter(thePrsObj->Children()); anIter.More(); anIter.Next()) for (PrsMgr_ListOfPresentableObjectsIter anIter(thePrsObj->Children()); anIter.More(); anIter.Next())
{ {
Standard_Integer aPriority = DisplayPriority(anIter.Value(), theMode); Graphic3d_DisplayPriority aPriority = DisplayPriority(anIter.Value(), theMode);
if (aPriority != 0) if (aPriority != Graphic3d_DisplayPriority_INVALID)
{ {
return aPriority; return aPriority;
} }
@ -249,7 +249,7 @@ Standard_Integer PrsMgr_PresentationManager::DisplayPriority (const Handle(PrsMg
const Handle(PrsMgr_Presentation) aPrs = Presentation (thePrsObj, theMode); const Handle(PrsMgr_Presentation) aPrs = Presentation (thePrsObj, theMode);
return !aPrs.IsNull() return !aPrs.IsNull()
? aPrs->DisplayPriority() ? aPrs->DisplayPriority()
: 0; : Graphic3d_DisplayPriority_INVALID;
} }
// ======================================================================= // =======================================================================
@ -697,7 +697,7 @@ void PrsMgr_PresentationManager::UpdateHighlightTrsf (const Handle(V3d_Viewer)&
} }
Handle(TopLoc_Datum3D) aTrsf = theObj->LocalTransformationGeom(); Handle(TopLoc_Datum3D) aTrsf = theObj->LocalTransformationGeom();
const Standard_Integer aParentId = aPrs->CStructure()->Id; const Standard_Integer aParentId = aPrs->CStructure()->Identification();
updatePrsTransformation (myImmediateList, aParentId, aTrsf); updatePrsTransformation (myImmediateList, aParentId, aTrsf);
if (!myViewDependentImmediateList.IsEmpty()) if (!myViewDependentImmediateList.IsEmpty())
@ -709,7 +709,7 @@ void PrsMgr_PresentationManager::UpdateHighlightTrsf (const Handle(V3d_Viewer)&
if (aView->IsComputed (aParentId, aViewDepParentPrs)) if (aView->IsComputed (aParentId, aViewDepParentPrs))
{ {
updatePrsTransformation (myViewDependentImmediateList, updatePrsTransformation (myViewDependentImmediateList,
aViewDepParentPrs->CStructure()->Id, aViewDepParentPrs->CStructure()->Identification(),
aTrsf); aTrsf);
} }
} }

View File

@ -66,12 +66,13 @@ public:
//! Sets the display priority theNewPrior of the //! Sets the display priority theNewPrior of the
//! presentable object thePrsObject in this framework with the display mode theMode. //! presentable object thePrsObject in this framework with the display mode theMode.
Standard_EXPORT void SetDisplayPriority (const Handle(PrsMgr_PresentableObject)& thePrsObject, const Standard_Integer theMode, const Standard_Integer theNewPrior) const; Standard_EXPORT void SetDisplayPriority (const Handle(PrsMgr_PresentableObject)& thePrsObject,
const Standard_Integer theMode,
const Graphic3d_DisplayPriority theNewPrior) const;
//! Returns the display priority of the presentable object //! Returns the display priority of the presentable object
//! thePrsObject in this framework with the display mode theMode. //! thePrsObject in this framework with the display mode theMode.
Standard_EXPORT Standard_Integer DisplayPriority (const Handle(PrsMgr_PresentableObject)& thePrsObject, const Standard_Integer theMode) const; Standard_EXPORT Graphic3d_DisplayPriority DisplayPriority (const Handle(PrsMgr_PresentableObject)& thePrsObject, const Standard_Integer theMode) const;
//! Set Z layer ID for all presentations of the object. //! Set Z layer ID for all presentations of the object.
Standard_EXPORT void SetZLayer (const Handle(PrsMgr_PresentableObject)& thePrsObject, const Graphic3d_ZLayerId theLayerId); Standard_EXPORT void SetZLayer (const Handle(PrsMgr_PresentableObject)& thePrsObject, const Graphic3d_ZLayerId theLayerId);

View File

@ -1301,7 +1301,7 @@ void SelectMgr_ViewerSelector::DisplaySensitive (const Handle(V3d_View)& theView
for (Graphic3d_SequenceOfStructure::Iterator aStructIter (myStructs); aStructIter.More(); aStructIter.Next()) for (Graphic3d_SequenceOfStructure::Iterator aStructIter (myStructs); aStructIter.More(); aStructIter.Next())
{ {
Handle(Graphic3d_Structure)& aStruct = aStructIter.ChangeValue(); Handle(Graphic3d_Structure)& aStruct = aStructIter.ChangeValue();
aStruct->SetDisplayPriority (10); aStruct->SetDisplayPriority (Graphic3d_DisplayPriority_Topmost);
aStruct->Display(); aStruct->Display();
} }
@ -1348,7 +1348,7 @@ void SelectMgr_ViewerSelector::DisplaySensitive (const Handle(SelectMgr_Selectio
SelectMgr::ComputeSensitivePrs (aStruct, theSel, theTrsf, Handle(Graphic3d_TransformPers)()); SelectMgr::ComputeSensitivePrs (aStruct, theSel, theTrsf, Handle(Graphic3d_TransformPers)());
myStructs.Append (aStruct); myStructs.Append (aStruct);
myStructs.Last()->SetDisplayPriority (10); myStructs.Last()->SetDisplayPriority (Graphic3d_DisplayPriority_Topmost);
myStructs.Last()->Display(); myStructs.Last()->Display();
theView->Update(); theView->Update();

View File

@ -103,7 +103,7 @@ void V3d_CircularGrid::SetColors (const Quantity_Color& aColor, const Quantity_C
void V3d_CircularGrid::Display () void V3d_CircularGrid::Display ()
{ {
myStructure->SetDisplayPriority (1); myStructure->SetDisplayPriority (Graphic3d_DisplayPriority_AlmostBottom);
myStructure->Display(); myStructure->Display();
UpdateDisplay(); UpdateDisplay();
} }

View File

@ -86,7 +86,7 @@ void V3d_Plane::Display (const Handle(V3d_View)& theView,
aPrims->AddVertex ( aSize,-aSize, anOffset); aPrims->AddVertex ( aSize,-aSize, anOffset);
aGroup->AddPrimitiveArray(aPrims); aGroup->AddPrimitiveArray(aPrims);
myGraphicStructure->SetDisplayPriority (0); myGraphicStructure->SetDisplayPriority (Graphic3d_DisplayPriority_Bottom);
myGraphicStructure->Display(); myGraphicStructure->Display();
Update(); Update();
} }

View File

@ -104,7 +104,7 @@ void V3d_RectangularGrid::SetColors (const Quantity_Color& aColor, const Quantit
void V3d_RectangularGrid::Display () void V3d_RectangularGrid::Display ()
{ {
myStructure->SetDisplayPriority (1); myStructure->SetDisplayPriority (Graphic3d_DisplayPriority_AlmostBottom);
myStructure->Display(); myStructure->Display();
UpdateDisplay(); UpdateDisplay();
} }

View File

@ -255,7 +255,7 @@ void V3d_Trihedron::Display (const V3d_View& theView)
myStructure = new TrihedronStructure (theView.Viewer()->StructureManager(), this); myStructure = new TrihedronStructure (theView.Viewer()->StructureManager(), this);
myStructure->SetTransformPersistence (myTransformPers); myStructure->SetTransformPersistence (myTransformPers);
myStructure->SetZLayer (Graphic3d_ZLayerId_Topmost); myStructure->SetZLayer (Graphic3d_ZLayerId_Topmost);
myStructure->SetDisplayPriority (9); myStructure->SetDisplayPriority (Graphic3d_DisplayPriority_Highlight);
myStructure->SetInfiniteState (Standard_True); myStructure->SetInfiniteState (Standard_True);
myStructure->CStructure()->ViewAffinity = new Graphic3d_ViewAffinity(); myStructure->CStructure()->ViewAffinity = new Graphic3d_ViewAffinity();
myStructure->CStructure()->ViewAffinity->SetVisible (Standard_False); myStructure->CStructure()->ViewAffinity->SetVisible (Standard_False);

View File

@ -6548,16 +6548,16 @@ static int VPriority (Draw_Interpretor& theDI,
} }
TCollection_AsciiString aLastArg (theArgs[theArgNum - 1]); TCollection_AsciiString aLastArg (theArgs[theArgNum - 1]);
Standard_Integer aPriority = -1; Standard_Integer aPriority = Graphic3d_DisplayPriority_INVALID;
Standard_Integer aNbArgs = theArgNum; Standard_Integer aNbArgs = theArgNum;
if (aLastArg.IsIntegerValue()) if (aLastArg.IsIntegerValue())
{ {
aPriority = aLastArg.IntegerValue(); aPriority = aLastArg.IntegerValue();
--aNbArgs; --aNbArgs;
if (aPriority < 0 || aPriority > 10) if (aPriority < Graphic3d_DisplayPriority_Bottom || aPriority > Graphic3d_DisplayPriority_Topmost)
{ {
Message::SendFail() << "Syntax error: the specified display priority value '" << aLastArg Message::SendFail() << "Syntax error: the specified display priority value '" << aLastArg
<< "' is outside the valid range [0..10]"; << "' is outside the valid range [" << Graphic3d_DisplayPriority_Bottom << ".." << Graphic3d_DisplayPriority_Topmost << "]";
return 1; return 1;
} }
} }
@ -6589,13 +6589,13 @@ static int VPriority (Draw_Interpretor& theDI,
return 1; return 1;
} }
if (aPriority < 1) if (aPriority == Graphic3d_DisplayPriority_INVALID)
{ {
theDI << aContext->DisplayPriority (anIObj) << " "; theDI << aContext->DisplayPriority (anIObj) << " ";
} }
else else
{ {
aContext->SetDisplayPriority (anIObj, aPriority); aContext->SetDisplayPriority (anIObj, (Graphic3d_DisplayPriority )aPriority);
} }
} }
return 0; return 0;

View File

@ -240,7 +240,7 @@ void XCAFPrs_AISObject::Compute (const Handle(PrsMgr_PresentationManager)& thePr
if (XCAFPrs::GetViewNameMode()) if (XCAFPrs::GetViewNameMode())
{ {
// Displaying Name attributes // Displaying Name attributes
thePrs->SetDisplayPriority (10); thePrs->SetDisplayPriority (Graphic3d_DisplayPriority_Topmost);
DisplayText (myLabel, thePrs, Attributes()->DimensionAspect()->TextAspect(), TopLoc_Location());//no location DisplayText (myLabel, thePrs, Attributes()->DimensionAspect()->TextAspect(), TopLoc_Location());//no location
} }
} }