1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-14 13:30:48 +03:00

0031757: Visualization - Prebuild BVH for Select3D_SensitiveEntity in separate threads

- Added a new mode in SelectMgr_ViewerSelector for computing BVH for Select3D_SensitiveEntity in background which can be activated via method SelectMgr_ViewerSelector::SetToPrebuildBVH(). Default behavior has not been changed.
- New class SelectMgr_BVHThreadPool manages background processing of BVH building queue.
- Added Select3D_SensitiveEntity::ToBuildBVH() method that checks if BVH (if it used) is in invalidated state. Defined this method for all standard classes inherited from Select3D_SensitiveEntity.
This commit is contained in:
age
2020-09-08 14:44:21 +03:00
committed by bugmaster
parent ee3280a94f
commit 6a2fb7a1d1
22 changed files with 589 additions and 6 deletions

View File

@@ -70,6 +70,9 @@ public:
//! transformation is set, it will be applied
Standard_EXPORT virtual Select3D_BndBox3d BoundingBox() Standard_OVERRIDE;
//! Returns TRUE if BVH tree is in invalidated state
virtual Standard_Boolean ToBuildBVH() const Standard_OVERRIDE { return Standard_False; }
//! Dumps the content of me into the stream
Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE;

View File

@@ -191,6 +191,20 @@ void Select3D_SensitiveCircle::BVH()
}
}
//=======================================================================
// function : ToBuildBVH
// purpose :
//=======================================================================
Standard_Boolean Select3D_SensitiveCircle::ToBuildBVH() const
{
if (mySensType != Select3D_TOS_BOUNDARY)
{
return Standard_False;
}
return Select3D_SensitivePoly::ToBuildBVH();
}
//=======================================================================
// function : Matches
// purpose : Checks whether the circle overlaps current selecting volume

View File

@@ -81,6 +81,9 @@ public:
//! Builds BVH tree for a circle's edge segments if needed
Standard_EXPORT virtual void BVH() Standard_OVERRIDE;
//! Returns TRUE if BVH tree is in invalidated state
Standard_EXPORT virtual Standard_Boolean ToBuildBVH() const Standard_OVERRIDE;
protected:
//! Calculates distance from the 3d projection of used-picked screen point

View File

@@ -81,6 +81,9 @@ public:
//! Builds BVH tree for a sensitive if needed
virtual void BVH() {}
//! Returns TRUE if BVH tree is in invalidated state
virtual Standard_Boolean ToBuildBVH() const { return Standard_True; }
//! Clears up all resources and memory
virtual void Clear() { Set (Handle(SelectMgr_EntityOwner)()); }

View File

@@ -70,6 +70,9 @@ public:
//! Builds BVH tree for the face
Standard_EXPORT virtual void BVH() Standard_OVERRIDE;
//! Returns TRUE if BVH tree is in invalidated state
virtual Standard_Boolean ToBuildBVH() const Standard_OVERRIDE { return myFacePoints->ToBuildBVH(); }
//! Returns the amount of sub-entities (points or planar convex polygons)
Standard_EXPORT virtual Standard_Integer NbSubElements() const Standard_OVERRIDE;

View File

@@ -50,6 +50,9 @@ public:
//! transformation is set, it will be applied
Standard_EXPORT virtual Select3D_BndBox3d BoundingBox() Standard_OVERRIDE;
//! Returns TRUE if BVH tree is in invalidated state
virtual Standard_Boolean ToBuildBVH() const Standard_OVERRIDE { return Standard_False; }
//! Dumps the content of me into the stream
Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE;

View File

@@ -62,6 +62,9 @@ public:
//! transformation is set, it will be applied
Standard_EXPORT virtual Select3D_BndBox3d BoundingBox() Standard_OVERRIDE;
//! Returns TRUE if BVH tree is in invalidated state
virtual Standard_Boolean ToBuildBVH() const Standard_OVERRIDE { return Standard_False; }
public:
//! changes the start Point of the Segment;

View File

@@ -75,6 +75,9 @@ public:
//! but element by element
Standard_EXPORT virtual void BVH() Standard_OVERRIDE;
//! Returns TRUE if BVH tree is in invalidated state
virtual Standard_Boolean ToBuildBVH() const Standard_OVERRIDE { return myContent.IsDirty(); }
//! Sets the method (builder) used to construct BVH.
void SetBuilder (const Handle(Select3D_BVHBuilder3d)& theBuilder) { myContent.SetBuilder (theBuilder); }

View File

@@ -62,6 +62,9 @@ public:
//! will be applied
Standard_EXPORT virtual Select3D_BndBox3d BoundingBox() Standard_OVERRIDE;
//! Returns TRUE if BVH tree is in invalidated state
virtual Standard_Boolean ToBuildBVH() const Standard_OVERRIDE { return Standard_False; }
//! Returns the amount of points
virtual Standard_Integer NbSubElements() const Standard_OVERRIDE { return 3; }