diff options
author | Julian T <julian@jtle.dk> | 2021-02-03 14:23:14 +0100 |
---|---|---|
committer | Julian T <julian@jtle.dk> | 2021-02-03 14:23:14 +0100 |
commit | f02aabd4db7232f927622b87ea885491e6651b44 (patch) | |
tree | 0a219e2f5b65edd7cead6ff751058a2ec7431ab1 /src/core/transform.rs | |
parent | 2b4adacea3c76b8b33dc5f50d296dd4a61107c16 (diff) |
Work on camera implementation using Transformationscamera-using-transform
Not sure if this is really neccesary, will take that later, now it is
saved on this commit.
The reason it ditched it is that it requires the ability to inverse
matrixes, which is really complicated
Diffstat (limited to 'src/core/transform.rs')
-rw-r--r-- | src/core/transform.rs | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/core/transform.rs b/src/core/transform.rs index f64710c..337d9b1 100644 --- a/src/core/transform.rs +++ b/src/core/transform.rs @@ -17,6 +17,7 @@ use super::matrix4x4::Matrix4x4f; use crate::Float; use crate::core::Vector3f; +use std::ops; pub struct Transform { m: Matrix4x4f, @@ -56,6 +57,22 @@ impl Transform { Vector3f::new_xyz(x, y, z) } + + pub fn inverse(&self) -> Self { + Transform { + m: self.m.inverse(), + } + } +} + +impl ops::Mul for Transform { + type Output = Transform; + + fn mul(self, op: Self) -> Self::Output { + Transform { + m: &self.m * &op.m + } + } } // Creation of different transformations |