Open CASCADE Technology Reference Manual 8.0.0
Loading...
Searching...
No Matches
Data Structures | Public Member Functions | Protected Types | Protected Attributes
Graphic3d_CullingTool Class Reference

Graphic3d_CullingTool 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 <Graphic3d_CullingTool.hxx>

Data Structures

struct  CullingContext
 Auxiliary structure holding non-persistent culling options. More...
 
struct  Plane
 Auxiliary structure representing 3D plane. More...
 

Public Member Functions

 Graphic3d_CullingTool ()
 Creates an empty selector object with parallel projection type by default.
 
void SetViewVolume (const occ::handle< Graphic3d_Camera > &theCamera, const NCollection_Mat4< double > &theModelWorld=NCollection_Mat4< double >())
 Retrieves view volume's planes equations and its vertices from projection and world-view matrices.
 
void SetViewportSize (int theViewportWidth, int theViewportHeight, double theResolutionRatio)
 
void SetCullingDistance (CullingContext &theCtx, double theDistance) const
 Setup distance culling.
 
void SetCullingSize (CullingContext &theCtx, double theSize) const
 Setup size culling.
 
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.
 
bool IsCulled (const CullingContext &theCtx, const NCollection_Vec3< double > &theMinPnt, const NCollection_Vec3< double > &theMaxPnt, bool *theIsInside=nullptr) const
 Checks whether given AABB should be entirely culled or not.
 
const occ::handle< Graphic3d_Camera > & Camera () const
 Return the camera definition.
 
const NCollection_Mat4< double > & ProjectionMatrix () const
 Returns current projection matrix.
 
const NCollection_Mat4< double > & WorldViewMatrix () const
 Returns current world view transformation matrix.
 
int ViewportWidth () const
 
int ViewportHeight () const
 
const Graphic3d_WorldViewProjStateWorldViewProjState () const
 Returns state of current world view projection transformation matrices.
 
const NCollection_Vec3< double > & CameraEye () const
 Returns camera eye position.
 
const NCollection_Vec3< double > & CameraDirection () const
 Returns camera direction.
 
double SignedPlanePointDistance (const NCollection_Vec4< double > &theNormal, const NCollection_Vec4< double > &thePnt)
 Calculates signed distance from plane to point.
 
bool IsOutFrustum (const NCollection_Vec3< double > &theMinPnt, const NCollection_Vec3< double > &theMaxPnt, bool *theIsInside=nullptr) const
 Detects if AABB overlaps view volume using separating axis theorem (SAT).
 
bool IsTooDistant (const CullingContext &theCtx, const NCollection_Vec3< double > &theMinPnt, const NCollection_Vec3< double > &theMaxPnt, bool *theIsInside=nullptr) const
 Returns TRUE if given AABB should be discarded by distance culling criterion.
 
bool IsTooSmall (const CullingContext &theCtx, const NCollection_Vec3< double > &theMinPnt, const NCollection_Vec3< double > &theMaxPnt) const
 Returns TRUE if given AABB should be discarded by size culling criterion.
 

Protected Types

enum  {
  Plane_Left , Plane_Right , Plane_Bottom , Plane_Top ,
  Plane_Near , Plane_Far , PlanesNB
}
 Enumerates planes of view volume. More...
 

Protected Attributes

Plane myClipPlanes [PlanesNB]
 Planes.
 
NCollection_Array1< NCollection_Vec3< double > > myClipVerts
 Vertices.
 
occ::handle< Graphic3d_CameramyCamera
 camera definition
 
double myMaxClipProjectionPts [PlanesNB]
 Max view volume's vertices projections onto its normals.
 
double myMinClipProjectionPts [PlanesNB]
 Min view volume's vertices projections onto its normals.
 
double myMaxOrthoProjectionPts [3]
 Max view volume's vertices projections onto normalized dimensions of AABB.
 
double myMinOrthoProjectionPts [3]
 Min view volume's vertices projections onto normalized dimensions of AABB.
 
bool myIsProjectionParallel
 
NCollection_Mat4< doublemyProjectionMat
 
NCollection_Mat4< doublemyWorldViewMat
 
int myViewportWidth
 
int myViewportHeight
 
Graphic3d_WorldViewProjState myWorldViewProjState
 State of world view projection matrices.
 
NCollection_Vec3< doublemyCamEye
 camera eye position for distance culling
 
NCollection_Vec3< doublemyCamDir
 camera direction for size culling
 
double myCamScale
 camera scale for size culling
 
double myPixelSize
 pixel size for size culling
 

Detailed Description

Graphic3d_CullingTool 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_Left 
Plane_Right 
Plane_Bottom 
Plane_Top 
Plane_Near 
Plane_Far 
PlanesNB 

Constructor & Destructor Documentation

◆ Graphic3d_CullingTool()

Graphic3d_CullingTool::Graphic3d_CullingTool ( )

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

Member Function Documentation

◆ CacheClipPtsProjections()

void Graphic3d_CullingTool::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 occ::handle< Graphic3d_Camera > & Graphic3d_CullingTool::Camera ( ) const
inline

Return the camera definition.

◆ CameraDirection()

const NCollection_Vec3< double > & Graphic3d_CullingTool::CameraDirection ( ) const
inline

Returns camera direction.

◆ CameraEye()

const NCollection_Vec3< double > & Graphic3d_CullingTool::CameraEye ( ) const
inline

Returns camera eye position.

◆ IsCulled()

bool Graphic3d_CullingTool::IsCulled ( const CullingContext & theCtx,
const NCollection_Vec3< double > & theMinPnt,
const NCollection_Vec3< double > & theMaxPnt,
bool * theIsInside = nullptr ) const
inline

Checks whether given AABB should be entirely culled or not.

Parameters
[in]theCtxculling properties
[in]theMinPntmaximum point of AABB
[in]theMaxPntminimum point of AABB
[out]theIsInsideflag indicating if AABB is fully inside; initial value should be set to TRUE
Returns
TRUE if AABB is completely outside of view frustum or culled by size/distance; FALSE in case of partial or complete overlap (use theIsInside to distinguish)

◆ IsOutFrustum()

bool Graphic3d_CullingTool::IsOutFrustum ( const NCollection_Vec3< double > & theMinPnt,
const NCollection_Vec3< double > & theMaxPnt,
bool * theIsInside = nullptr ) const
inline

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

Parameters
[in]theMinPntmaximum point of AABB
[in]theMaxPntminimum point of AABB
[out]theIsInsideflag indicating if AABB is fully inside; initial value should be set to TRUE
Returns
TRUE if AABB is completely outside of view frustum; FALSE in case of partial or complete overlap (use theIsInside to distinguish)
See also
SelectMgr_Frustum::hasOverlap()

◆ IsTooDistant()

bool Graphic3d_CullingTool::IsTooDistant ( const CullingContext & theCtx,
const NCollection_Vec3< double > & theMinPnt,
const NCollection_Vec3< double > & theMaxPnt,
bool * theIsInside = nullptr ) const
inline

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

Parameters
[in]theMinPntmaximum point of AABB
[in]theMaxPntminimum point of AABB
[out]theIsInsideflag indicating if AABB is fully inside; initial value should be set to TRUE
Returns
TRUE if AABB is completely behind culling distance; FALSE in case of partial or complete overlap (use theIsInside to distinguish)

◆ IsTooSmall()

bool Graphic3d_CullingTool::IsTooSmall ( const CullingContext & theCtx,
const NCollection_Vec3< double > & theMinPnt,
const NCollection_Vec3< double > & theMaxPnt ) const
inline

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

◆ ProjectionMatrix()

const NCollection_Mat4< double > & Graphic3d_CullingTool::ProjectionMatrix ( ) const
inline

Returns current projection matrix.

◆ SetCullingDistance()

void Graphic3d_CullingTool::SetCullingDistance ( CullingContext & theCtx,
double theDistance ) const

Setup distance culling.

◆ SetCullingSize()

void Graphic3d_CullingTool::SetCullingSize ( CullingContext & theCtx,
double theSize ) const

Setup size culling.

◆ SetViewportSize()

void Graphic3d_CullingTool::SetViewportSize ( int theViewportWidth,
int theViewportHeight,
double theResolutionRatio )

◆ SetViewVolume()

void Graphic3d_CullingTool::SetViewVolume ( const occ::handle< Graphic3d_Camera > & theCamera,
const NCollection_Mat4< double > & theModelWorld = NCollection_Mat4double >() )

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

Parameters
[in]theCameracamera definition
[in]theModelWorldoptional object transformation for computing frustum in object local coordinate system

◆ SignedPlanePointDistance()

double Graphic3d_CullingTool::SignedPlanePointDistance ( const NCollection_Vec4< double > & theNormal,
const NCollection_Vec4< double > & thePnt )

Calculates signed distance from plane to point.

Parameters
[in]theNormalthe plane's normal.
[in]thePnt

◆ ViewportHeight()

int Graphic3d_CullingTool::ViewportHeight ( ) const
inline

◆ ViewportWidth()

int Graphic3d_CullingTool::ViewportWidth ( ) const
inline

◆ WorldViewMatrix()

const NCollection_Mat4< double > & Graphic3d_CullingTool::WorldViewMatrix ( ) const
inline

Returns current world view transformation matrix.

◆ WorldViewProjState()

const Graphic3d_WorldViewProjState & Graphic3d_CullingTool::WorldViewProjState ( ) const
inline

Returns state of current world view projection transformation matrices.

Field Documentation

◆ myCamDir

NCollection_Vec3<double> Graphic3d_CullingTool::myCamDir
protected

camera direction for size culling

◆ myCamera

occ::handle<Graphic3d_Camera> Graphic3d_CullingTool::myCamera
protected

camera definition

◆ myCamEye

NCollection_Vec3<double> Graphic3d_CullingTool::myCamEye
protected

camera eye position for distance culling

◆ myCamScale

double Graphic3d_CullingTool::myCamScale
protected

camera scale for size culling

◆ myClipPlanes

Plane Graphic3d_CullingTool::myClipPlanes[PlanesNB]
protected

Planes.

◆ myClipVerts

NCollection_Array1<NCollection_Vec3<double> > Graphic3d_CullingTool::myClipVerts
protected

Vertices.

◆ myIsProjectionParallel

bool Graphic3d_CullingTool::myIsProjectionParallel
protected

◆ myMaxClipProjectionPts

double Graphic3d_CullingTool::myMaxClipProjectionPts[PlanesNB]
protected

Max view volume's vertices projections onto its normals.

◆ myMaxOrthoProjectionPts

double Graphic3d_CullingTool::myMaxOrthoProjectionPts[3]
protected

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

◆ myMinClipProjectionPts

double Graphic3d_CullingTool::myMinClipProjectionPts[PlanesNB]
protected

Min view volume's vertices projections onto its normals.

◆ myMinOrthoProjectionPts

double Graphic3d_CullingTool::myMinOrthoProjectionPts[3]
protected

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

◆ myPixelSize

double Graphic3d_CullingTool::myPixelSize
protected

pixel size for size culling

◆ myProjectionMat

NCollection_Mat4<double> Graphic3d_CullingTool::myProjectionMat
protected

◆ myViewportHeight

int Graphic3d_CullingTool::myViewportHeight
protected

◆ myViewportWidth

int Graphic3d_CullingTool::myViewportWidth
protected

◆ myWorldViewMat

NCollection_Mat4<double> Graphic3d_CullingTool::myWorldViewMat
protected

◆ myWorldViewProjState

Graphic3d_WorldViewProjState Graphic3d_CullingTool::myWorldViewProjState
protected

State of world view projection matrices.


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