| GL Studio C++ Runtime API

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

`#include <cull.h>`

## Public Types
enum | CullResultEnum { OUTSIDE_FRUSTUM , INTERSECTS_FRUSTUM , INSIDE_FRUSTUM }
enum | ClippingPlanesEnum { RIGHT_PLANE , LEFT_PLANE , BOTTOM_PLANE , TOP_PLANE , FAR_PLANE , NEAR_PLANE }

## 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 () const
void | Enabled (bool newVal)
const PlaneClass & | Plane (const ClippingPlanesEnum &whichPlane) const

## Protected Attributes
bool | _enabled
| Whether or not culling is enabled.
PlaneClass | _planes [6]
| Array of six clipping planes to define the frustum.

## Detailed Description

The Culler class. Implements view frustum culling.

## Member Enumeration Documentation

## ◆ ClippingPlanesEnum

enum ClippingPlanesEnum

Definitions for the six frustum clipping planes

## ◆ CullResultEnum

enum CullResultEnum

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()

Culler | ( | bool | enabled = `true` | ) |

Culler constructor

Parameters

  enabled | Whether or not to actually to the culling test

## Member Function Documentation

## ◆ Enabled() [1/2]

bool Enabled | ( |  | ) | const
| inline

Accessor method to get whether or not culling is enabled

Returns
  Whether or not culling is enabled

## ◆ Enabled() [2/2]

void Enabled | ( | bool | newVal | ) |
| inline

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

Parameters

  newVal | The enabled value to set.

## ◆ ExtractFrustum()

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.

Parameters

  matrices | A return reference for the frustum.

## ◆ Plane()

const PlaneClass & Plane | ( | const ClippingPlanesEnum & | whichPlane | ) | const

Returns the clip plane values for the desired plane index.

Parameters

  whichPlane | The index for the clipping plane to return.

Returns
  A reference to the desired clipping plane for this view frustum.

## ◆ SphereInFrustum()

CullResultEnum SphereInFrustum | ( | const Vector & | v,
|  | const float | radius
| ) |  | const

Parameters

  v | The center of the sphere.
  radius | The radius of the sphere.

Returns
  Whether the sphere is inside, outside or intersects the view frustum.

## ◆ SphereOutsideFrustum()

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.

Parameters

  center | The center of the sphere.
  radius | The radius of the sphere.

Returns
  True if outside or intersecting, false if inside.

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

- cull.h