Skip to content

Commit

Permalink
Fix bug in ortho()
Browse files Browse the repository at this point in the history
  • Loading branch information
romainguy committed Nov 24, 2022
1 parent 4e0b19a commit 536faaf
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ repositories {
}
dependencies {
implementation 'dev.romainguy:kotlin-math:1.5.2'
implementation 'dev.romainguy:kotlin-math:1.5.3'
}
```

Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -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

Expand Down
14 changes: 9 additions & 5 deletions src/commonMain/kotlin/dev/romainguy/kotlin/math/Matrix.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
)

0 comments on commit 536faaf

Please sign in to comment.