diff options
author | Campbell Barton <ideasman42@gmail.com> | 2020-02-04 13:55:57 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2020-02-04 14:19:28 +0300 |
commit | 62dba60e49e79e77ecb11027e723823767c13854 (patch) | |
tree | a4e73ad651d3bec8da62bb75d8646760fe268dbe /source/blender/gpu/intern/gpu_matrix.c | |
parent | e3f8c887fb528fb495e12d4da5ded6be1ecc6154 (diff) |
GPU: add projection matrix function to set only near/far clipping
Useful when UI code needs to extend the clipping range.
Diffstat (limited to 'source/blender/gpu/intern/gpu_matrix.c')
-rw-r--r-- | source/blender/gpu/intern/gpu_matrix.c | 8 |
1 files changed, 8 insertions, 0 deletions
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; |