27#ifndef EASY3D_RENDERER_FRUSTUM_H
28#define EASY3D_RENDERER_FRUSTUM_H
33#include <easy3d/core/types.h>
75 void set_perspective(
float fovy,
float aspect,
float znear,
float zfar);
83 void set_frustum(
float frustum_width,
float frustum_height,
float znear,
float zfar);
93 void set_ortho(
float xmin,
float xmax,
float ymin,
float ymax,
float znear,
float zfar);
180 float xmin_, xmax_, ymin_, ymax_;
void set_frustum(float frustum_width, float frustum_height, float znear, float zfar)
Sets the frustum parameters.
Definition frustum.cpp:80
Frustum(ProjectionType type)
Constructor with projection type.
Definition frustum.cpp:33
void set_perspective(float fovy, float aspect, float znear, float zfar)
Sets the perspective projection parameters.
Definition frustum.cpp:63
vec3 up_vector() const
Returns the up vector of the frustum in world space.
Definition frustum.cpp:130
vec3 near_center() const
Returns the center point of the near plane in world space.
Definition frustum.cpp:113
mat4 view_matrix() const
Returns the view matrix.
Definition frustum.cpp:94
float near_distance() const
Returns the distance to the near clipping plane.
Definition frustum.h:159
float near_height() const
Returns the height of the frustum at the near plane.
Definition frustum.cpp:154
const vec3 & position() const
Returns the position of the frustum in world space.
Definition frustum.h:143
void set_ortho(float xmin, float xmax, float ymin, float ymax, float znear, float zfar)
Sets the orthographic projection parameters.
Definition frustum.cpp:52
mat4 projection_matrix() const
Returns the projection matrix.
Definition frustum.cpp:100
float far_height() const
Returns the height of the frustum at the far plane.
Definition frustum.cpp:172
void orient(const vec3 &pos, const vec3 &at, const vec3 &up)
Sets the orientation of the frustum.
Definition frustum.cpp:44
vec3 far_center() const
Returns the center point of the far plane in world space.
Definition frustum.cpp:121
float near_width() const
Returns the width of the frustum at the near plane.
Definition frustum.cpp:145
vec3 right_vector() const
Returns the right vector of the frustum in world space.
Definition frustum.cpp:137
float far_distance() const
Returns the distance to the far clipping plane.
Definition frustum.h:164
ProjectionType
Types of projection.
Definition frustum.h:48
@ ORTHO
orthographic projection
Definition frustum.h:50
@ PERSPECTIVE
perspective projection
Definition frustum.h:49
std::vector< vec3 > vertices() const
Computes the 8 corner points of the frustum in world space.
Definition frustum.cpp:181
float far_width() const
Returns the width of the frustum at the far plane.
Definition frustum.cpp:163
Definition collider.cpp:182
Vec< 3, float > vec3
A 3D point/vector of float type.
Definition types.h:44
Mat4< float > mat4
A 4 by 4 matrix of float type.
Definition types.h:67