summaryrefslogtreecommitdiff
path: root/core/math
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2019-09-06 22:51:27 -0300
committerJuan Linietsky <reduzio@gmail.com>2020-02-11 12:01:18 +0100
commit920db604d26e2e82b6289807ad8a0607b310eef6 (patch)
treeeedd704c8df67b4f7931bd2f955a8ce6834ac3dd /core/math
parent1d871f6226c2a82415291d58f7e91be60e94f203 (diff)
Rewrote large part of rendering, omni and spot shadows now work.
Diffstat (limited to 'core/math')
-rw-r--r--core/math/camera_matrix.cpp22
-rw-r--r--core/math/camera_matrix.h1
2 files changed, 23 insertions, 0 deletions
diff --git a/core/math/camera_matrix.cpp b/core/math/camera_matrix.cpp
index 9018a78c57..070616f061 100644
--- a/core/math/camera_matrix.cpp
+++ b/core/math/camera_matrix.cpp
@@ -512,6 +512,28 @@ CameraMatrix CameraMatrix::operator*(const CameraMatrix &p_matrix) const {
return new_matrix;
}
+void CameraMatrix::set_depth_correction() {
+
+ real_t *m = &matrix[0][0];
+
+ m[0] = 1;
+ m[1] = 0.0;
+ m[2] = 0.0;
+ m[3] = 0.0;
+ m[4] = 0.0;
+ m[5] = -1;
+ m[6] = 0.0;
+ m[7] = 0.0;
+ m[8] = 0.0;
+ m[9] = 0.0;
+ m[10] = 0.5;
+ m[11] = 0.0;
+ m[12] = 0.0;
+ m[13] = 0.0;
+ m[14] = 0.5;
+ m[15] = 1.0;
+}
+
void CameraMatrix::set_light_bias() {
real_t *m = &matrix[0][0];
diff --git a/core/math/camera_matrix.h b/core/math/camera_matrix.h
index a7a85fee8d..2a25109367 100644
--- a/core/math/camera_matrix.h
+++ b/core/math/camera_matrix.h
@@ -50,6 +50,7 @@ struct CameraMatrix {
void set_identity();
void set_zero();
void set_light_bias();
+ void set_depth_correction();
void set_light_atlas_rect(const Rect2 &p_rect);
void set_perspective(real_t p_fovy_degrees, real_t p_aspect, real_t p_z_near, real_t p_z_far, bool p_flip_fov = false);
void set_perspective(real_t p_fovy_degrees, real_t p_aspect, real_t p_z_near, real_t p_z_far, bool p_flip_fov, int p_eye, real_t p_intraocular_dist, real_t p_convergence_dist);