Open CASCADE Technology  7.2.0
Data Structures | Public Types | Public Member Functions
SelectMgr_SelectableObjectSet Class Reference

The purpose of this class is to organize all selectable objects into data structure, allowing to build set of BVH trees for each transformation persistence subclass of selectable objects. This allow to minify number of updates for BVH trees - for example 2D persistent object subclass depends only on camera's projection and the corresponding BVH tree needs to be updated when camera's projection parameters change, while another tree for non-persistent objects can be left unchanged in this case. More...

#include <SelectMgr_SelectableObjectSet.hxx>

Data Structures

class  Iterator
 Class to iterate sequentually over all objects from every subset. More...
 

Public Types

enum  BVHSubset { BVHSubset_3d, BVHSubset_3dPersistent, BVHSubset_2dPersistent, BVHSubsetNb }
 This enumeration declares names for subsets of selectable objects. Each subset has independent BVH tree. The class maintains subsets of selectable objects by their persistence flag. This allows to restric rebuilding of the trees for particular subset when the camera change does not implicitly require it: More...
 

Public Member Functions

 SelectMgr_SelectableObjectSet ()
 Creates new empty objects set and initializes BVH tree builders for each subset. More...
 
virtual ~SelectMgr_SelectableObjectSet ()
 Releases resources of selectable object set. More...
 
Standard_Boolean Append (const Handle< SelectMgr_SelectableObject > &theObject)
 Adds the new selectable object to the set. The selectable object is placed into one of the predefined subsets depending on its persistence type. After adding an object, this method marks the corresponding BVH tree for rebuild. More...
 
Standard_Boolean Remove (const Handle< SelectMgr_SelectableObject > &theObject)
 Removes the selectable object from the set. The selectable object is removed from the subset it has been placed into. After removing an object, this method marks the corresponding BVH tree for rebuild. More...
 
void ChangeSubset (const Handle< SelectMgr_SelectableObject > &theObject)
 Performs necessary updates when object's persistence types changes. This method should be called right after changing transformation persistence flags of the objects and before updating BVH tree - to provide up-to-date state of the object set. More...
 
void UpdateBVH (const Handle< Graphic3d_Camera > &theCamera, const Graphic3d_Mat4d &theProjectionMat, const Graphic3d_Mat4d &theWorldViewMat, const Graphic3d_WorldViewProjState &theViewState, const Standard_Integer theViewportWidth, const Standard_Integer theViewportHeight)
 Updates outdated BVH trees and remembers the last state of the camera view-projection matrices and viewport (window) dimensions. More...
 
void MarkDirty ()
 Marks every BVH subset for update. More...
 
Standard_Boolean Contains (const Handle< SelectMgr_SelectableObject > &theObject) const
 Returns true if this objects set contains theObject given. More...
 
Standard_Boolean IsEmpty () const
 Returns true if the object set does not contain any selectable objects. More...
 
Standard_Boolean IsEmpty (const BVHSubset theSubset) const
 Returns true if the specified object subset is empty. More...
 
const Handle< SelectMgr_SelectableObject > & GetObjectById (const BVHSubset theSubset, const Standard_Integer theIndex) const
 Returns object from subset theSubset by theIndex given. The method allows to get selectable object referred by the index of an element of the subset's BVH tree. More...
 
const opencascade::handle< BVH_Tree< Standard_Real, 3 > > & BVH (const BVHSubset theSubset) const
 Returns computed BVH for the theSubset given. More...
 

Detailed Description

The purpose of this class is to organize all selectable objects into data structure, allowing to build set of BVH trees for each transformation persistence subclass of selectable objects. This allow to minify number of updates for BVH trees - for example 2D persistent object subclass depends only on camera's projection and the corresponding BVH tree needs to be updated when camera's projection parameters change, while another tree for non-persistent objects can be left unchanged in this case.

Member Enumeration Documentation

◆ BVHSubset

This enumeration declares names for subsets of selectable objects. Each subset has independent BVH tree. The class maintains subsets of selectable objects by their persistence flag. This allows to restric rebuilding of the trees for particular subset when the camera change does not implicitly require it:

  • BVHSubset_3d refers to the subset of normal world-space 3D objects. Associated BVH tree does not depend on the camera's state at all. This subset uses binned BVH builder with 32 bins and 1 element per leaf.
  • BVHSubset_3dPersistent refers to the subset of 3D persistent selectable objects (rotate, pan, zoom persistence). Associated BVH tree needs to be updated when either the camera's projection and position change. This subset uses linear BVH builder with 32 levels of depth and 1 element per leaf.
  • BVHSubset_2dPersistent refers to the subset of 2D persistent selectable objects. Associated BVH tree needs to be updated only when camera's projection changes. Bounding volumes for this object subclass is represented directly in eye space coordinates. This subset uses linear BVH builder with 32 levels of depth and 1 element per leaf.
Enumerator
BVHSubset_3d 
BVHSubset_3dPersistent 
BVHSubset_2dPersistent 
BVHSubsetNb 

Constructor & Destructor Documentation

◆ SelectMgr_SelectableObjectSet()

SelectMgr_SelectableObjectSet::SelectMgr_SelectableObjectSet ( )

Creates new empty objects set and initializes BVH tree builders for each subset.

◆ ~SelectMgr_SelectableObjectSet()

virtual SelectMgr_SelectableObjectSet::~SelectMgr_SelectableObjectSet ( )
inlinevirtual

Releases resources of selectable object set.

Member Function Documentation

◆ Append()

Standard_Boolean SelectMgr_SelectableObjectSet::Append ( const Handle< SelectMgr_SelectableObject > &  theObject)

Adds the new selectable object to the set. The selectable object is placed into one of the predefined subsets depending on its persistence type. After adding an object, this method marks the corresponding BVH tree for rebuild.

Returns
true if selectable object is added, otherwise returns false (selectable object is already in the set).

◆ BVH()

const opencascade::handle<BVH_Tree<Standard_Real, 3> >& SelectMgr_SelectableObjectSet::BVH ( const BVHSubset  theSubset) const
inline

Returns computed BVH for the theSubset given.

◆ ChangeSubset()

void SelectMgr_SelectableObjectSet::ChangeSubset ( const Handle< SelectMgr_SelectableObject > &  theObject)

Performs necessary updates when object's persistence types changes. This method should be called right after changing transformation persistence flags of the objects and before updating BVH tree - to provide up-to-date state of the object set.

◆ Contains()

Standard_Boolean SelectMgr_SelectableObjectSet::Contains ( const Handle< SelectMgr_SelectableObject > &  theObject) const
inline

Returns true if this objects set contains theObject given.

◆ GetObjectById()

const Handle< SelectMgr_SelectableObject >& SelectMgr_SelectableObjectSet::GetObjectById ( const BVHSubset  theSubset,
const Standard_Integer  theIndex 
) const
inline

Returns object from subset theSubset by theIndex given. The method allows to get selectable object referred by the index of an element of the subset's BVH tree.

◆ IsEmpty() [1/2]

Standard_Boolean SelectMgr_SelectableObjectSet::IsEmpty ( void  ) const
inline

Returns true if the object set does not contain any selectable objects.

◆ IsEmpty() [2/2]

Standard_Boolean SelectMgr_SelectableObjectSet::IsEmpty ( const BVHSubset  theSubset) const
inline

Returns true if the specified object subset is empty.

◆ MarkDirty()

void SelectMgr_SelectableObjectSet::MarkDirty ( )

Marks every BVH subset for update.

◆ Remove()

Standard_Boolean SelectMgr_SelectableObjectSet::Remove ( const Handle< SelectMgr_SelectableObject > &  theObject)

Removes the selectable object from the set. The selectable object is removed from the subset it has been placed into. After removing an object, this method marks the corresponding BVH tree for rebuild.

Returns
true if selectable object is removed, otherwise returns false (selectable object is not in the set).

◆ UpdateBVH()

void SelectMgr_SelectableObjectSet::UpdateBVH ( const Handle< Graphic3d_Camera > &  theCamera,
const Graphic3d_Mat4d theProjectionMat,
const Graphic3d_Mat4d theWorldViewMat,
const Graphic3d_WorldViewProjState theViewState,
const Standard_Integer  theViewportWidth,
const Standard_Integer  theViewportHeight 
)

Updates outdated BVH trees and remembers the last state of the camera view-projection matrices and viewport (window) dimensions.


The documentation for this class was generated from the following file: