GL Studio API
Public Types | Public Member Functions | Protected Attributes | List of all members
Culler Class Reference

#include <cull.h>

Public Types

enum  CullResultEnum { , INTERSECTS_FRUSTUM, INSIDE_FRUSTUM }
 
enum  ClippingPlanesEnum
 

Public Member Functions

 Culler (bool enabled=true)
 
void ExtractFrustum (OpenGLMatrices &matrices)
 
CullResultEnum SphereInFrustum (const Vector &v, const float radius) const
 
bool SphereOutsideFrustum (const Vector &center, const float radius) const
 
bool Enabled (void) const
 
void Enabled (bool newVal)
 
const PlaneClassPlane (const ClippingPlanesEnum &whichPlane) const
 

Protected Attributes

PlaneClass _planes [6]
 

Detailed Description

The Culler class. Implements view frustum culling.

Member Enumeration Documentation

Definitions for the six frustum clipping planes

Return type for culling function

Enumerator
INTERSECTS_FRUSTUM 

The object was entirely outside of the viewing frustum

INSIDE_FRUSTUM 

The object intersects the viewing frustum The object was entirely inside the viewing frustum

Constructor & Destructor Documentation

Culler ( bool  enabled = true)

Array of six clipping planes to define the frustum Culler constructor

Parameters
enabledWhether or not to actually to the culling test

Member Function Documentation

bool Enabled ( void  ) const
inline

Accessor method to get whether or not culling is enabled

Returns
Whether or not culling is enabled
void Enabled ( bool  newVal)
inline

Accessor method to set whether or not culling is enabled Be carefull with this, because the Culler is usually passed by reference.

void ExtractFrustum ( OpenGLMatrices matrices)

Reads the current OpenGL projection matrices and determines the six frustum planes Note: This assumes a perspective projection, but it will work with orthographic, though it could be optimized better if it was known that Ortho is being used.

const PlaneClass& Plane ( const ClippingPlanesEnum whichPlane) const
Returns
A reference to the desired clipping plane for this view frustum
CullResultEnum SphereInFrustum ( const Vector v,
const float  radius 
) const
Returns
Whether the sphere is inside, outside or intersects the view frustum.
bool SphereOutsideFrustum ( const Vector center,
const float  radius 
) const
inline

Slightly faster sphere culling because it doesn't test seperately for intersection and it ignores the Enabled() state.

Returns
true if outside or intersecting, false if inside

Member Data Documentation

PlaneClass _planes[6]
protected

Whether or not culling is enabled


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