GL Studio C++ Runtime API
Culler Class Reference

#include <cull.h>

Public Types

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


The object was entirely outside of the viewing 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

enabledWhether or not to actually to the culling test

Member Function Documentation

bool Enabled ( void  ) const

Accessor method to get whether or not culling is enabled

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

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
A reference to the desired clipping plane for this view frustum
CullResultEnum SphereInFrustum ( const Vector v,
const float  radius 
) const
Whether the sphere is inside, outside or intersects the view frustum.
bool SphereOutsideFrustum ( const Vector center,
const float  radius 
) const

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

true if outside or intersecting, false if inside

Member Data Documentation

PlaneClass _planes[6]

Whether or not culling is enabled

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