Nebula
Loading...
Searching...
No Matches
Math::frustum Class Reference

#include <frustum.h>

Detailed Description

Defines a clipping frustum made of 6 planes.

(C) 2010 Radon Labs GmbH (C) 2013-2020 Individual contributors, see AUTHORS file

Public Types

enum  PlaneIndex {
  Near = 0 , Far , Left , Right ,
  Top , Bottom , NumPlanes
}
 plane indices More...
 

Public Member Functions

 frustum ()
 default constructor
 
 frustum (const mat4 &invViewProj)
 construct from view and projection matrix
 
void set (const mat4 &invViewProj)
 setup from view and proj matrix
 
void set (const bbox &box, const mat4 &boxTransform)
 setup from transformed bounding box
 
bool inside (const point &p) const
 test if point is inside frustum
 
uint clipmask (const point &p) const
 get clip bitmask of point (0 if inside, (1<<PlaneIndex) if outside)
 
ClipStatus::Type clip (const line &l, line &clippedLine) const
 clip line against view frustum
 
ClipStatus::Type clipstatus (const bbox &box) const
 get clip status of a local bounding box
 
ClipStatus::Type clipstatus (const bbox &box, const mat4 &boxTransform) const
 get clip status of a transformed bounding box
 
template<typename T >
as () const
 convert to any type
 

Public Attributes

plane planes [NumPlanes]
 

Static Public Attributes

static const int TopLeftFar = 0
 
static const int TopRightFar = 1
 
static const int BottomLeftFar = 2
 
static const int BottomRightFar = 3
 
static const int TopLeftNear = 4
 
static const int TopRightNear = 5
 
static const int BottomLeftNear = 6
 
static const int BottomRightNear = 7
 

Member Enumeration Documentation

◆ PlaneIndex

plane indices

Enumerator
Near 
Far 
Left 
Right 
Top 
Bottom 
NumPlanes 

Constructor & Destructor Documentation

◆ frustum() [1/2]

Math::frustum::frustum ( )
inline

default constructor

◆ frustum() [2/2]

Math::frustum::frustum ( const mat4 & invViewProj)
inline

construct from view and projection matrix

Member Function Documentation

◆ as()

template<typename T >
T Math::frustum::as ( ) const

convert to any type

◆ clip()

ClipStatus::Type Math::frustum::clip ( const line & l,
line & clippedLine ) const
inline

clip line against view frustum

◆ clipmask()

uint Math::frustum::clipmask ( const point & p) const
inline

get clip bitmask of point (0 if inside, (1<<PlaneIndex) if outside)

Get clipmask of point.

◆ clipstatus() [1/2]

ClipStatus::Type Math::frustum::clipstatus ( const bbox & box) const
inline

get clip status of a local bounding box

◆ clipstatus() [2/2]

ClipStatus::Type Math::frustum::clipstatus ( const bbox & box,
const mat4 & boxTransform ) const
inline

get clip status of a transformed bounding box

Returns the clip status of a transformed bounding box.

◆ inside()

bool Math::frustum::inside ( const point & p) const
inline

test if point is inside frustum

Test if point is inside frustum.

◆ set() [1/2]

void Math::frustum::set ( const bbox & box,
const mat4 & boxTransform )
inline

setup from transformed bounding box

Setup from a transformed bounding box.

◆ set() [2/2]

void Math::frustum::set ( const mat4 & invViewProj)
inline

setup from view and proj matrix

Setup frustum from invViewProj matrix (transform from projection space into world space).

Member Data Documentation

◆ BottomLeftFar

const int Math::frustum::BottomLeftFar = 2
static

◆ BottomLeftNear

const int Math::frustum::BottomLeftNear = 6
static

◆ BottomRightFar

const int Math::frustum::BottomRightFar = 3
static

◆ BottomRightNear

const int Math::frustum::BottomRightNear = 7
static

◆ planes

plane Math::frustum::planes[NumPlanes]

◆ TopLeftFar

const int Math::frustum::TopLeftFar = 0
static

◆ TopLeftNear

const int Math::frustum::TopLeftNear = 4
static

◆ TopRightFar

const int Math::frustum::TopRightFar = 1
static

◆ TopRightNear

const int Math::frustum::TopRightNear = 5
static

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