27#ifndef EASY3D_RENDERER_FRUSTUM_H
28#define EASY3D_RENDERER_FRUSTUM_H
33#include <easy3d/core/types.h>
45 enum ProjectionType { PERSPECTIVE, ORTHO };
48 explicit Frustum(ProjectionType type);
53 void orient(
const vec3 &pos,
const vec3& at,
const vec3& up);
56 void set_perspective(
float fovy,
float aspect,
float znear,
float zfar);
57 void set_frustum(
float frustum_width,
float frustum_height,
float znear,
float zfar);
59 void set_ortho(
float xmin,
float xmax,
float ymin,
float ymax,
float znear,
float zfar);
61 mat4 view_matrix()
const;
62 mat4 projection_matrix()
const;
65 vec3 near_center()
const;
66 vec3 far_center()
const;
68 float near_width()
const;
69 float near_height()
const;
71 float far_width()
const;
72 float far_height()
const;
75 const vec3& position()
const {
return pos_; }
77 vec3 up_vector()
const;
78 vec3 right_vector()
const;
80 float near_distance()
const {
return near_; }
81 float far_distance()
const {
return far_; }
84 std::vector<vec3> vertices()
const;
94 float xmin_, xmax_, ymin_, ymax_;
A Frustum description for perspective projection.
Definition: frustum.h:43
Definition: collider.cpp:182