Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2020-02-04 14:20:58 +0300
committerCampbell Barton <ideasman42@gmail.com>2020-02-04 14:20:58 +0300
commit5c8f8a74030c96e07a0ce719f37ed7958b6c3fb8 (patch)
tree6ef48627addb8acf00f2cff7cde50592dd730d98 /source/blender/gpu
parent04ec64b251f155581b6bd2a6bc0d55c4381ba12d (diff)
parent3dde6360ff6ae002002472f7b5a155e3d119230f (diff)
Merge branch 'blender-v2.82-release'
Diffstat (limited to 'source/blender/gpu')
-rw-r--r--source/blender/gpu/GPU_matrix.h7
-rw-r--r--source/blender/gpu/intern/gpu_matrix.c8
2 files changed, 15 insertions, 0 deletions
diff --git a/source/blender/gpu/GPU_matrix.h b/source/blender/gpu/GPU_matrix.h
index a424f3180de..2899fba46e4 100644
--- a/source/blender/gpu/GPU_matrix.h
+++ b/source/blender/gpu/GPU_matrix.h
@@ -90,6 +90,8 @@ void GPU_matrix_identity_projection_set(void);
void GPU_matrix_projection_set(const float m[4][4]);
void GPU_matrix_ortho_set(float left, float right, float bottom, float top, float near, float far);
+void GPU_matrix_ortho_set_z(float near, float far);
+
void GPU_matrix_frustum_set(
float left, float right, float bottom, float top, float near, float far);
void GPU_matrix_perspective_set(float fovy, float aspect, float near, float far);
@@ -222,4 +224,9 @@ int GPU_matrix_stack_level_get_projection(void);
# define GPU_matrix_normal_inverse_get(x) GPU_matrix_normal_inverse_get(_GPU_MAT3_CAST(x))
#endif /* SUPPRESS_GENERIC_MATRIX_API */
+/* Not part of the GPU_matrix API,
+ * however we need to check these limits in code that calls into these API's. */
+#define GPU_MATRIX_ORTHO_CLIP_NEAR_DEFAULT (-100)
+#define GPU_MATRIX_ORTHO_CLIP_FAR_DEFAULT (100)
+
#endif /* __GPU_MATRIX_H__ */
diff --git a/source/blender/gpu/intern/gpu_matrix.c b/source/blender/gpu/intern/gpu_matrix.c
index 5e44a950ba7..8260e1496ff 100644
--- a/source/blender/gpu/intern/gpu_matrix.c
+++ b/source/blender/gpu/intern/gpu_matrix.c
@@ -421,6 +421,14 @@ void GPU_matrix_ortho_set(float left, float right, float bottom, float top, floa
gpu_matrix_state_active_set_dirty(true);
}
+void GPU_matrix_ortho_set_z(float near, float far)
+{
+ CHECKMAT(Projection);
+ Projection[2][2] = -2.0f / (far - near);
+ Projection[3][2] = -(far + near) / (far - near);
+ gpu_matrix_state_active_set_dirty(true);
+}
+
void GPU_matrix_ortho_2d_set(float left, float right, float bottom, float top)
{
Mat4 m;