Skip to content

Commit

Permalink
Decode matrices in column-major order.
Browse files Browse the repository at this point in the history
  • Loading branch information
mrehayden1 committed Mar 21, 2024
1 parent cb22717 commit 1abce92
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions src/Text/GLTF/Loader/Internal/Decoders.hs
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,17 @@ getMat3 getter =
-- | 4x4 Matrix binary decoder
getMat4 :: Get a -> Get (Vector (M44 a))
getMat4 getter =
getVector
$ V4
<$> (V4 <$> getter <*> getter <*> getter <*> getter)
<*> (V4 <$> getter <*> getter <*> getter <*> getter)
<*> (V4 <$> getter <*> getter <*> getter <*> getter)
<*> (V4 <$> getter <*> getter <*> getter <*> getter)
getVector $ do {
m11 <- getter; m12 <- getter; m13 <- getter; m14 <- getter;
m21 <- getter; m22 <- getter; m23 <- getter; m24 <- getter;
m31 <- getter; m32 <- getter; m33 <- getter; m34 <- getter;
m41 <- getter; m42 <- getter; m43 <- getter; m44 <- getter;
return $ V4
(V4 m11 m21 m31 m41)
(V4 m12 m22 m32 m42)
(V4 m13 m23 m33 m43)
(V4 m14 m24 m34 m44)
}

-- | Byte binary decoder
getByte :: Get Int8
Expand Down

0 comments on commit 1abce92

Please sign in to comment.