Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement some missing functionalities that would be useful in WebRender. #170

Merged
merged 4 commits into from Dec 9, 2016
Merged
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

Next

Implement to_untyped and from_untyped for Matrix4D.

  • Loading branch information
nical committed Dec 9, 2016
commit eb73801c49098a816d640d0adf692ff86aad87ce
@@ -196,6 +196,28 @@ where T: Copy + Clone +
)
}

/// Drop the units, preserving only the numeric value.
#[inline]
pub fn to_untyped(&self) -> Matrix4D<T> {
Matrix4D::row_major(
self.m11, self.m12, self.m13, self.m14,
self.m21, self.m22, self.m23, self.m24,
self.m31, self.m32, self.m33, self.m34,
self.m41, self.m42, self.m43, self.m44,
)
}

/// Tag a unitless value with units.
#[inline]
pub fn from_untyped(m: &Matrix4D<T>) -> Self {
TypedMatrix4D::row_major(
m.m11, m.m12, m.m13, m.m14,
m.m21, m.m22, m.m23, m.m24,
m.m31, m.m32, m.m33, m.m34,
m.m41, m.m42, m.m43, m.m44,
)
}

/// Returns the multiplication of the two matrices such that mat's transformation
/// applies after self's transformation.
pub fn post_mul<NewDst>(&self, mat: &TypedMatrix4D<T, Dst, NewDst>) -> TypedMatrix4D<T, Src, NewDst> {
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.