Easy3D 2.6.1
Loading...
Searching...
No Matches
Frustum Class Reference

A Frustum description for perspective projection. More...

#include <easy3d/renderer/frustum.h>

Public Types

enum  ProjectionType { PERSPECTIVE , ORTHO }
 Types of projection. More...
 

Public Member Functions

 Frustum (ProjectionType type)
 Constructor with projection type.
 
void orient (const vec3 &pos, const vec3 &at, const vec3 &up)
 Sets the orientation of the frustum.
 
void set_perspective (float fovy, float aspect, float znear, float zfar)
 Sets the perspective projection parameters.
 
void set_frustum (float frustum_width, float frustum_height, float znear, float zfar)
 Sets the frustum parameters.
 
void set_ortho (float xmin, float xmax, float ymin, float ymax, float znear, float zfar)
 Sets the orthographic projection parameters.
 
mat4 view_matrix () const
 Returns the view matrix.
 
mat4 projection_matrix () const
 Returns the projection matrix.
 
vec3 near_center () const
 Returns the center point of the near plane in world space.
 
vec3 far_center () const
 Returns the center point of the far plane in world space.
 
float near_width () const
 Returns the width of the frustum at the near plane.
 
float near_height () const
 Returns the height of the frustum at the near plane.
 
float far_width () const
 Returns the width of the frustum at the far plane.
 
float far_height () const
 Returns the height of the frustum at the far plane.
 
const vec3position () const
 Returns the position of the frustum in world space.
 
vec3 up_vector () const
 Returns the up vector of the frustum in world space.
 
vec3 right_vector () const
 Returns the right vector of the frustum in world space.
 
float near_distance () const
 Returns the distance to the near clipping plane.
 
float far_distance () const
 Returns the distance to the far clipping plane.
 
std::vector< vec3vertices () const
 Computes the 8 corner points of the frustum in world space.
 

Detailed Description

A Frustum description for perspective projection.

Member Enumeration Documentation

◆ ProjectionType

Types of projection.

Enumerator
PERSPECTIVE 

perspective projection

ORTHO 

orthographic projection

Constructor & Destructor Documentation

◆ Frustum()

Frustum ( ProjectionType type)
explicit

Constructor with projection type.

Parameters
typeThe type of projection.

Member Function Documentation

◆ far_center()

vec3 far_center ( ) const

Returns the center point of the far plane in world space.

Returns
The center point of the far plane.

◆ far_distance()

float far_distance ( ) const
inline

Returns the distance to the far clipping plane.

Returns
The far clipping plane distance.

◆ far_height()

float far_height ( ) const

Returns the height of the frustum at the far plane.

Returns
The height of the far plane.

◆ far_width()

float far_width ( ) const

Returns the width of the frustum at the far plane.

Returns
The width of the far plane.

◆ near_center()

vec3 near_center ( ) const

Returns the center point of the near plane in world space.

Returns
The center point of the near plane.

◆ near_distance()

float near_distance ( ) const
inline

Returns the distance to the near clipping plane.

Returns
The near clipping plane distance.

◆ near_height()

float near_height ( ) const

Returns the height of the frustum at the near plane.

Returns
The height of the near plane.

◆ near_width()

float near_width ( ) const

Returns the width of the frustum at the near plane.

Returns
The width of the near plane.

◆ orient()

void orient ( const vec3 & pos,
const vec3 & at,
const vec3 & up )

Sets the orientation of the frustum.

Parameters
posThe position of the frustum.
atThe point the frustum is looking at.
upThe up direction of the frustum.

◆ position()

const vec3 & position ( ) const
inline

Returns the position of the frustum in world space.

Returns
The position of the frustum.

◆ projection_matrix()

mat4 projection_matrix ( ) const

Returns the projection matrix.

Returns
The projection matrix.

◆ right_vector()

vec3 right_vector ( ) const

Returns the right vector of the frustum in world space.

Returns
The right vector.

◆ set_frustum()

void set_frustum ( float frustum_width,
float frustum_height,
float znear,
float zfar )

Sets the frustum parameters.

Parameters
frustum_widthThe width of the frustum.
frustum_heightThe height of the frustum.
znearThe near clipping plane.
zfarThe far clipping plane.

◆ set_ortho()

void set_ortho ( float xmin,
float xmax,
float ymin,
float ymax,
float znear,
float zfar )

Sets the orthographic projection parameters.

Parameters
xminThe minimum x value.
xmaxThe maximum x value.
yminThe minimum y value.
ymaxThe maximum y value.
znearThe near clipping plane.
zfarThe far clipping plane.

◆ set_perspective()

void set_perspective ( float fovy,
float aspect,
float znear,
float zfar )

Sets the perspective projection parameters.

Parameters
fovyThe field of view in the y direction, in radians.
aspectThe aspect ratio of the frustum.
znearThe near clipping plane.
zfarThe far clipping plane.

◆ up_vector()

vec3 up_vector ( ) const

Returns the up vector of the frustum in world space.

Returns
The up vector.

◆ vertices()

std::vector< vec3 > vertices ( ) const

Computes the 8 corner points of the frustum in world space.

Returns
A vector containing the 8 corner points.

◆ view_matrix()

mat4 view_matrix ( ) const

Returns the view matrix.

Returns
The view matrix.

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