Skip to content

Commit

Permalink
Fixed orthographic matrices
Browse files Browse the repository at this point in the history
  • Loading branch information
Rob2309 committed Jan 6, 2022
1 parent 393bdb3 commit da73386
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "gfx-maths"
version = "0.2.4"
version = "0.2.5"
authors = [ "Robin Quint" ]
edition = "2018"
description = "Implementations for the most essential Graphics Math operations"
Expand Down
10 changes: 5 additions & 5 deletions src/mat4.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,9 @@ impl Mat4 {
pub fn orthographic_vulkan(left: f32, right: f32, bottom: f32, top: f32, near: f32, far: f32) -> Self {
let mut res = Self::identity();

let a = 2.0 * (right - left);
let a = 2.0 / (right - left);
let b = (-left - right) / (right - left);
let c = 2.0 * (top - bottom);
let c = 2.0 / (top - bottom);
let d = (-bottom - top) / (top - bottom);
let e = 1.0 / (far - near);
let f = -near / (far - near);
Expand All @@ -136,11 +136,11 @@ impl Mat4 {
pub fn orthographic_opengl(left: f32, right: f32, bottom: f32, top: f32, near: f32, far: f32) -> Self {
let mut res = Self::identity();

let a = 2.0 * (right - left);
let a = 2.0 / (right - left);
let b = (-left - right) / (right - left);
let c = 2.0 * (top - bottom);
let c = 2.0 / (top - bottom);
let d = (-bottom - top) / (top - bottom);
let e = 2.0 * (far - near);
let e = 2.0 / (far - near);
let f = (-near - far) / (far - near);

res.values[cr(0, 0)] = a;
Expand Down

0 comments on commit da73386

Please sign in to comment.