Skip to content

Commit 536faaf

Browse files
committed
Fix bug in ortho()
1 parent 4e0b19a commit 536faaf

File tree

3 files changed

+11
-7
lines changed

3 files changed

+11
-7
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ repositories {
2626
}
2727
2828
dependencies {
29-
implementation 'dev.romainguy:kotlin-math:1.5.2'
29+
implementation 'dev.romainguy:kotlin-math:1.5.3'
3030
}
3131
```
3232

gradle.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
GROUP=dev.romainguy
2-
VERSION_NAME=1.5.2
2+
VERSION_NAME=1.5.3
33

44
POM_DESCRIPTION=Graphics oriented math library for Kotlin
55

src/commonMain/kotlin/dev/romainguy/kotlin/math/Matrix.kt

+9-5
Original file line numberDiff line numberDiff line change
@@ -775,9 +775,13 @@ fun perspective(fov: Float, ratio: Float, near: Float, far: Float): Mat4 {
775775
}
776776

777777
fun ortho(l: Float, r: Float, b: Float, t: Float, n: Float, f: Float) = Mat4(
778-
Float4(x = 2.0f / (r - 1.0f)),
779-
Float4(y = 2.0f / (t - b)),
780-
Float4(z = -2.0f / (f - n)),
781-
Float4(-(r + l) / (r - l), -(t + b) / (t - b), -(f + n) / (f - n), 1.0f)
778+
Float4(x = 2.0f / (r - l)),
779+
Float4(y = 2.0f / (t - b)),
780+
Float4(z = -2.0f / (f - n)),
781+
Float4(
782+
-(r + l) / (r - l),
783+
-(t + b) / (t - b),
784+
-(f + n) / (f - n),
785+
1.0f
786+
)
782787
)
783-

0 commit comments

Comments
 (0)