Open CASCADE Technology  7.3.0
Data Structures | Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes

OpenGl_BVHTreeSelector Class Reference

BVHTreeSelector class provides a possibility to store parameters of view volume, such as its vertices and equations, and contains methods detecting if given AABB overlaps view volume. More...

#include <OpenGl_BVHTreeSelector.hxx>

Data Structures

struct  CullingContext
 Auxiliary structure holding non-persistent culling options. More...
 

Public Member Functions

 OpenGl_BVHTreeSelector ()
 Creates an empty selector object with parallel projection type by default. More...
 
void SetViewVolume (const Handle< Graphic3d_Camera > &theCamera)
 Retrieves view volume's planes equations and its vertices from projection and world-view matrices. More...
 
void SetViewportSize (Standard_Integer theViewportWidth, Standard_Integer theViewportHeight, Standard_Real theResolutionRatio)
 
void SetCullingDistance (CullingContext &theCtx, Standard_Real theDistance) const
 Setup distance culling. More...
 
void SetCullingSize (CullingContext &theCtx, Standard_Real theSize) const
 Setup size culling. More...
 
void CacheClipPtsProjections ()
 Caches view volume's vertices projections along its normals and AABBs dimensions. Must be called at the beginning of each BVH tree traverse loop. More...
 
bool IsCulled (const CullingContext &theCtx, const OpenGl_Vec3d &theMinPt, const OpenGl_Vec3d &theMaxPt) const
 Checks whether given AABB should be entirely culled or not. More...
 
const Handle< Graphic3d_Camera > & Camera () const
 Return the camera definition. More...
 
const OpenGl_Mat4dProjectionMatrix () const
 Returns current projection matrix. More...
 
const OpenGl_Mat4dWorldViewMatrix () const
 Returns current world view transformation matrix. More...
 
Standard_Integer ViewportWidth () const
 
Standard_Integer ViewportHeight () const
 
const Graphic3d_WorldViewProjStateWorldViewProjState () const
 Returns state of current world view projection transformation matrices. More...
 

Protected Types

enum  {
  Plane_Top, Plane_Bottom, Plane_Left, Plane_Right,
  Plane_Near, Plane_Far, PlanesNB
}
 Enumerates planes of view volume. More...
 
enum  {
  ClipVert_LeftTopNear, ClipVert_LeftBottomNear, ClipVert_RightTopNear, ClipVert_RightBottomNear,
  ClipVert_LeftTopFar, ClipVert_LeftBottomFar, ClipVert_RightTopFar, ClipVert_RightBottomFar,
  ClipVerticesNB
}
 Enumerates vertices of view volume. More...
 

Protected Member Functions

Standard_Real SignedPlanePointDistance (const OpenGl_Vec4d &theNormal, const OpenGl_Vec4d &thePnt)
 Calculates signed distance from plane to point. More...
 
bool isFullOut (const OpenGl_Vec3d &theMinPt, const OpenGl_Vec3d &theMaxPt) const
 Detects if AABB overlaps view volume using separating axis theorem (SAT). More...
 
bool isTooDistant (const CullingContext &theCtx, const OpenGl_Vec3d &theMinPt, const OpenGl_Vec3d &theMaxPt) const
 Returns TRUE if given AABB should be discarded by distance culling criterion. More...
 
bool isTooSmall (const CullingContext &theCtx, const OpenGl_Vec3d &theMinPt, const OpenGl_Vec3d &theMaxPt) const
 Returns TRUE if given AABB should be discarded by size culling criterion. More...
 

Protected Attributes

OpenGl_Vec4d myClipPlanes [PlanesNB]
 Plane equations. More...
 
OpenGl_Vec4d myClipVerts [ClipVerticesNB]
 Vertices. More...
 
Handle< Graphic3d_CameramyCamera
 camera definition More...
 
Standard_Real myMaxClipProjectionPts [PlanesNB]
 Max view volume's vertices projections onto its normals. More...
 
Standard_Real myMinClipProjectionPts [PlanesNB]
 Min view volume's vertices projections onto its normals. More...
 
Standard_Real myMaxOrthoProjectionPts [3]
 Max view volume's vertices projections onto normalized dimensions of AABB. More...
 
Standard_Real myMinOrthoProjectionPts [3]
 Min view volume's vertices projections onto normalized dimensions of AABB. More...
 
Standard_Boolean myIsProjectionParallel
 
OpenGl_Mat4d myProjectionMat
 
OpenGl_Mat4d myWorldViewMat
 
Standard_Integer myViewportWidth
 
Standard_Integer myViewportHeight
 
Graphic3d_WorldViewProjState myWorldViewProjState
 State of world view projection matrices. More...
 
Graphic3d_Vec3d myCamEye
 camera eye position for distance culling More...
 
Graphic3d_Vec3d myCamDir
 camera direction for size culling More...
 
Standard_Real myCamScale
 camera scale for size culling More...
 
Standard_Real myPixelSize
 pixel size for size culling More...
 

Detailed Description

BVHTreeSelector class provides a possibility to store parameters of view volume, such as its vertices and equations, and contains methods detecting if given AABB overlaps view volume.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
protected

Enumerates planes of view volume.

Enumerator
Plane_Top 
Plane_Bottom 
Plane_Left 
Plane_Right 
Plane_Near 
Plane_Far 
PlanesNB 

◆ anonymous enum

anonymous enum
protected

Enumerates vertices of view volume.

Enumerator
ClipVert_LeftTopNear 
ClipVert_LeftBottomNear 
ClipVert_RightTopNear 
ClipVert_RightBottomNear 
ClipVert_LeftTopFar 
ClipVert_LeftBottomFar 
ClipVert_RightTopFar 
ClipVert_RightBottomFar 
ClipVerticesNB 

Constructor & Destructor Documentation

◆ OpenGl_BVHTreeSelector()

OpenGl_BVHTreeSelector::OpenGl_BVHTreeSelector ( )

Creates an empty selector object with parallel projection type by default.

Member Function Documentation

◆ CacheClipPtsProjections()

void OpenGl_BVHTreeSelector::CacheClipPtsProjections ( )

Caches view volume's vertices projections along its normals and AABBs dimensions. Must be called at the beginning of each BVH tree traverse loop.

◆ Camera()

const Handle< Graphic3d_Camera >& OpenGl_BVHTreeSelector::Camera ( ) const
inline

Return the camera definition.

◆ IsCulled()

bool OpenGl_BVHTreeSelector::IsCulled ( const CullingContext theCtx,
const OpenGl_Vec3d theMinPt,
const OpenGl_Vec3d theMaxPt 
) const
inline

Checks whether given AABB should be entirely culled or not.

Parameters
theCtx[in] culling properties
theMinPt[in] maximum point of AABB
theMaxPt[in] minimum point of AABB
Returns
Standard_True, if AABB is in viewing area, Standard_False otherwise

◆ isFullOut()

bool OpenGl_BVHTreeSelector::isFullOut ( const OpenGl_Vec3d theMinPt,
const OpenGl_Vec3d theMaxPt 
) const
inlineprotected

Detects if AABB overlaps view volume using separating axis theorem (SAT).

Parameters
theMinPt[in] maximum point of AABB.
theMaxPt[in] minimum point of AABB.
Returns
FALSE, if AABB is in viewing area, TRUE otherwise.

◆ isTooDistant()

bool OpenGl_BVHTreeSelector::isTooDistant ( const CullingContext theCtx,
const OpenGl_Vec3d theMinPt,
const OpenGl_Vec3d theMaxPt 
) const
inlineprotected

Returns TRUE if given AABB should be discarded by distance culling criterion.

◆ isTooSmall()

bool OpenGl_BVHTreeSelector::isTooSmall ( const CullingContext theCtx,
const OpenGl_Vec3d theMinPt,
const OpenGl_Vec3d theMaxPt 
) const
inlineprotected

Returns TRUE if given AABB should be discarded by size culling criterion.

◆ ProjectionMatrix()

const OpenGl_Mat4d& OpenGl_BVHTreeSelector::ProjectionMatrix ( ) const
inline

Returns current projection matrix.

◆ SetCullingDistance()

void OpenGl_BVHTreeSelector::SetCullingDistance ( CullingContext theCtx,
Standard_Real  theDistance 
) const

Setup distance culling.

◆ SetCullingSize()

void OpenGl_BVHTreeSelector::SetCullingSize ( CullingContext theCtx,
Standard_Real  theSize 
) const

Setup size culling.

◆ SetViewportSize()

void OpenGl_BVHTreeSelector::SetViewportSize ( Standard_Integer  theViewportWidth,
Standard_Integer  theViewportHeight,
Standard_Real  theResolutionRatio 
)

◆ SetViewVolume()

void OpenGl_BVHTreeSelector::SetViewVolume ( const Handle< Graphic3d_Camera > &  theCamera)

Retrieves view volume's planes equations and its vertices from projection and world-view matrices.

◆ SignedPlanePointDistance()

Standard_Real OpenGl_BVHTreeSelector::SignedPlanePointDistance ( const OpenGl_Vec4d theNormal,
const OpenGl_Vec4d thePnt 
)
protected

Calculates signed distance from plane to point.

Parameters
theNormal[in] the plane's normal.
thePnt[in]

◆ ViewportHeight()

Standard_Integer OpenGl_BVHTreeSelector::ViewportHeight ( ) const
inline

◆ ViewportWidth()

Standard_Integer OpenGl_BVHTreeSelector::ViewportWidth ( ) const
inline

◆ WorldViewMatrix()

const OpenGl_Mat4d& OpenGl_BVHTreeSelector::WorldViewMatrix ( ) const
inline

Returns current world view transformation matrix.

◆ WorldViewProjState()

const Graphic3d_WorldViewProjState& OpenGl_BVHTreeSelector::WorldViewProjState ( ) const
inline

Returns state of current world view projection transformation matrices.

Field Documentation

◆ myCamDir

Graphic3d_Vec3d OpenGl_BVHTreeSelector::myCamDir
protected

camera direction for size culling

◆ myCamera

Handle< Graphic3d_Camera > OpenGl_BVHTreeSelector::myCamera
protected

camera definition

◆ myCamEye

Graphic3d_Vec3d OpenGl_BVHTreeSelector::myCamEye
protected

camera eye position for distance culling

◆ myCamScale

Standard_Real OpenGl_BVHTreeSelector::myCamScale
protected

camera scale for size culling

◆ myClipPlanes

OpenGl_Vec4d OpenGl_BVHTreeSelector::myClipPlanes[PlanesNB]
protected

Plane equations.

◆ myClipVerts

OpenGl_Vec4d OpenGl_BVHTreeSelector::myClipVerts[ClipVerticesNB]
protected

Vertices.

◆ myIsProjectionParallel

Standard_Boolean OpenGl_BVHTreeSelector::myIsProjectionParallel
protected

◆ myMaxClipProjectionPts

Standard_Real OpenGl_BVHTreeSelector::myMaxClipProjectionPts[PlanesNB]
protected

Max view volume's vertices projections onto its normals.

◆ myMaxOrthoProjectionPts

Standard_Real OpenGl_BVHTreeSelector::myMaxOrthoProjectionPts[3]
protected

Max view volume's vertices projections onto normalized dimensions of AABB.

◆ myMinClipProjectionPts

Standard_Real OpenGl_BVHTreeSelector::myMinClipProjectionPts[PlanesNB]
protected

Min view volume's vertices projections onto its normals.

◆ myMinOrthoProjectionPts

Standard_Real OpenGl_BVHTreeSelector::myMinOrthoProjectionPts[3]
protected

Min view volume's vertices projections onto normalized dimensions of AABB.

◆ myPixelSize

Standard_Real OpenGl_BVHTreeSelector::myPixelSize
protected

pixel size for size culling

◆ myProjectionMat

OpenGl_Mat4d OpenGl_BVHTreeSelector::myProjectionMat
protected

◆ myViewportHeight

Standard_Integer OpenGl_BVHTreeSelector::myViewportHeight
protected

◆ myViewportWidth

Standard_Integer OpenGl_BVHTreeSelector::myViewportWidth
protected

◆ myWorldViewMat

OpenGl_Mat4d OpenGl_BVHTreeSelector::myWorldViewMat
protected

◆ myWorldViewProjState

Graphic3d_WorldViewProjState OpenGl_BVHTreeSelector::myWorldViewProjState
protected

State of world view projection matrices.


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