1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-10 13:00:37 +00:00

Add FRUSTUM camera mode, allowing tilted frustums

This new camera mode makes it easy to create tilted frustums for mirror
or portal effects.

This work was kindly sponsored by IMVU.
This commit is contained in:
JFonS
2019-02-19 17:17:02 +01:00
parent c7ba1e210e
commit 54b95b6c5a
11 changed files with 133 additions and 27 deletions

View File

@@ -210,6 +210,14 @@ void CameraMatrix::set_frustum(real_t p_left, real_t p_right, real_t p_bottom, r
te[15] = 0;
}
void CameraMatrix::set_frustum(real_t p_size, real_t p_aspect, Vector2 p_offset, real_t p_near, real_t p_far, bool p_flip_fov) {
if (!p_flip_fov) {
p_size *= p_aspect;
}
set_frustum(-p_size / 2 + p_offset.x, +p_size / 2 + p_offset.x, -p_size / p_aspect / 2 + p_offset.y, +p_size / p_aspect / 2 + p_offset.y, p_near, p_far);
}
real_t CameraMatrix::get_z_far() const {
const real_t *matrix = (const real_t *)this->matrix;