From 536faaf2a18187c2a6aac646cacec36525754dca Mon Sep 17 00:00:00 2001 From: Romain Guy Date: Wed, 23 Nov 2022 18:45:15 -0800 Subject: [PATCH] Fix bug in ortho() --- README.md | 2 +- gradle.properties | 2 +- .../kotlin/dev/romainguy/kotlin/math/Matrix.kt | 14 +++++++++----- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 72ddc28..3ff884e 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ repositories { } dependencies { - implementation 'dev.romainguy:kotlin-math:1.5.2' + implementation 'dev.romainguy:kotlin-math:1.5.3' } ``` diff --git a/gradle.properties b/gradle.properties index d8de165..f3bfe50 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,5 +1,5 @@ GROUP=dev.romainguy -VERSION_NAME=1.5.2 +VERSION_NAME=1.5.3 POM_DESCRIPTION=Graphics oriented math library for Kotlin diff --git a/src/commonMain/kotlin/dev/romainguy/kotlin/math/Matrix.kt b/src/commonMain/kotlin/dev/romainguy/kotlin/math/Matrix.kt index 4a0646b..53ada9d 100644 --- a/src/commonMain/kotlin/dev/romainguy/kotlin/math/Matrix.kt +++ b/src/commonMain/kotlin/dev/romainguy/kotlin/math/Matrix.kt @@ -775,9 +775,13 @@ fun perspective(fov: Float, ratio: Float, near: Float, far: Float): Mat4 { } fun ortho(l: Float, r: Float, b: Float, t: Float, n: Float, f: Float) = Mat4( - Float4(x = 2.0f / (r - 1.0f)), - Float4(y = 2.0f / (t - b)), - Float4(z = -2.0f / (f - n)), - Float4(-(r + l) / (r - l), -(t + b) / (t - b), -(f + n) / (f - n), 1.0f) + Float4(x = 2.0f / (r - l)), + Float4(y = 2.0f / (t - b)), + Float4(z = -2.0f / (f - n)), + Float4( + -(r + l) / (r - l), + -(t + b) / (t - b), + -(f + n) / (f - n), + 1.0f + ) ) -