AI_SDB_VisibilityVisitor Class Reference
#include <AI_SDB_VisitorBase.h>
Detailed Description
Base class for visitors that collect all elements in a given region and visible from a given viewpoint.Various subclasses of this abstract class are used for specific types of visibility culling. To add a new type of visibility visitor:
1. Subclass this class. Add in stacks for any data that depends on the coordinate system.
2. Override Visit() to process elements. This will typically add the element to a list of visible objects, draw the visible element, or something similar.
3. To make hierarchy objects work, override the VisibilityTest(...) methods to perform a proper test for the given element.
4. To handle sectors with different coordinate systems, override the Enter/LeaveLocalSpace methods, such that you transform into the new sector space and push the new state onto your stacks.
Public Types | |
typedef AI_Array < AI_SDB_SpatialElement * > | VisibleElements |
Public Member Functions | |
AI_SDB_VisibilityVisitor (const AI_Vector3 &viewpoint) | |
virtual | ~AI_SDB_VisibilityVisitor () |
virtual void | Reset () |
virtual void | Reset (const AI_Vector3 &newviewpoint) |
virtual void | Visit (AI_SDB_SpatialElement *visitee)=0 |
Test and possibly process an element. | |
virtual AI_SDB_VisitorFlags | VisibilityTest (const AI_BBox &testbox, AI_SDB_VisitorFlags flags)=0 |
virtual AI_SDB_VisitorFlags | VisibilityTest (const AI_Sphere &testsphere, AI_SDB_VisitorFlags flags)=0 |
AI_Vector3 & | GetViewPoint () const |
get the current viewpoint in local sector space Mainly used by hierarchy elements; needed for occlusion or LOD testing | |
float | GetMinimumDetailRatio () const |
Get the detail ratio of invisible Details. For a given object of size S and distance D from the viewpoint, if (S/D) is less than the DetailRatio the object or detail is effectively invisible. This will typically correspond to a few on-screen pixels. Use this value to throw away small objects, or to determine what LOD level to use. The detail ratio lets you ignore sub-pixel or small details that don't show up during rendering. It can also be used to represent a creature with bad visionif it is especially large. | |
virtual void | EnterLocalSpace (AI_Matrix44 &warp) |
virtual void | LeaveLocalSpace () |
leave a local space | |
Protected Attributes | |
AI_Array< AI_Vector3 > | m_viewpointstack |
we have a stack of viewpoints to handle sector-local coordinate systems | |
AI_Array< float > | m_minimumdetailratiostack |
gee,I guess we need a stack of minimal detail values as well. |
Member Typedef Documentation
Constructor & Destructor Documentation
AI_SDB_VisibilityVisitor::AI_SDB_VisibilityVisitor | ( | const AI_Vector3 & | viewpoint | ) |
AI_SDB_VisibilityVisitor::~AI_SDB_VisibilityVisitor | ( | ) | [virtual] |
Member Function Documentation
void AI_SDB_VisibilityVisitor::Reset | ( | ) | [virtual] |
Reset any state use during a visibility sweep. If you use a visitor multiple times, reset it between each visibility collection
Reimplemented in AI_SDB_VisibleFrustumGenArray, AI_SDB_OccludedFrustumGenArray, AI_SDB_VisibleSphereGenArray, AI_SDB_GeometryOcclusionVisitor, AI_SDB_OccludedFrustumVisitor, AI_SDB_VisibleFrustumVisitor, and AI_SDB_VisibleSphereVisitor.
void AI_SDB_VisibilityVisitor::Reset | ( | const AI_Vector3 & | newviewpoint | ) | [virtual] |
Reimplemented in AI_SDB_GeometryOcclusionVisitor.
virtual void AI_SDB_VisibilityVisitor::Visit | ( | AI_SDB_SpatialElement * | visitee | ) | [pure virtual] |
Test and possibly process an element.
Implemented in AI_NavigationMesh::PointVisitor, AI_SDB_VisibleFrustumGenArray, AI_SDB_OccludedFrustumGenArray, AI_SDB_VisibleSphereGenArray, AI_SDB_GeometryOcclusionVisitor, AI_SDB_VisibleFrustumVisitor, and AI_SDB_VisibleSphereVisitor.
virtual AI_SDB_VisitorFlags AI_SDB_VisibilityVisitor::VisibilityTest | ( | const AI_BBox & | testbox, | |
AI_SDB_VisitorFlags | flags | |||
) | [pure virtual] |
Check if an element should be culled. If the returned AI_SDB_VisitorFlags produces a TestResult() of true, the element is visible. The returned AI_SDB_VisitorFlags can be used for more efficient visibility tests of primitives enclosed in this bounding box
Implemented in AI_NavigationMesh::PointVisitor, AI_SDB_GeometryOcclusionVisitor, AI_SDB_OccludedFrustumVisitor, AI_SDB_VisibleFrustumVisitor, AI_SDB_VisibleSphereVisitor, and AI_SDB_OcclusionVisitor.
virtual AI_SDB_VisitorFlags AI_SDB_VisibilityVisitor::VisibilityTest | ( | const AI_Sphere & | testsphere, | |
AI_SDB_VisitorFlags | flags | |||
) | [pure virtual] |
AI_Vector3 & AI_SDB_VisibilityVisitor::GetViewPoint | ( | ) | const |
get the current viewpoint in local sector space Mainly used by hierarchy elements; needed for occlusion or LOD testing
float AI_SDB_VisibilityVisitor::GetMinimumDetailRatio | ( | ) | const |
Get the detail ratio of invisible Details. For a given object of size S and distance D from the viewpoint, if (S/D) is less than the DetailRatio the object or detail is effectively invisible. This will typically correspond to a few on-screen pixels. Use this value to throw away small objects, or to determine what LOD level to use. The detail ratio lets you ignore sub-pixel or small details that don't show up during rendering. It can also be used to represent a creature with bad visionif it is especially large.
The returned detail ratio can be 0 if there is no minimal detail level.
void AI_SDB_VisibilityVisitor::EnterLocalSpace | ( | AI_Matrix44 & | warp | ) | [virtual] |
entering a new local space; the matrix given will transform from the current local system into the new space local coordinate system. This is used to possibly update a transform matrix or to transform the spatial region to a new coordinate system.
Reimplemented in AI_SDB_GeometryOcclusionVisitor, AI_SDB_OccludedFrustumVisitor, AI_SDB_VisibleFrustumVisitor, and AI_SDB_VisibleSphereVisitor.
void AI_SDB_VisibilityVisitor::LeaveLocalSpace | ( | ) | [virtual] |
leave a local space
Reimplemented in AI_SDB_GeometryOcclusionVisitor, AI_SDB_OccludedFrustumVisitor, AI_SDB_VisibleFrustumVisitor, and AI_SDB_VisibleSphereVisitor.
Member Data Documentation
AI_Array<AI_Vector3> AI_SDB_VisibilityVisitor::m_viewpointstack [protected] |
we have a stack of viewpoints to handle sector-local coordinate systems
AI_Array<float> AI_SDB_VisibilityVisitor::m_minimumdetailratiostack [protected] |
gee,I guess we need a stack of minimal detail values as well.
The documentation for this class was generated from the following files: