Work on orienting and drawing attachments

This commit is contained in:
2024-09-30 23:02:22 +01:00
parent 48b8cfe7ef
commit 752b568a86
13 changed files with 340 additions and 229 deletions
+14 -4
View File
@@ -8,9 +8,19 @@ import qualified Linear.Quaternion as Q
orientChild :: Item -> (Point3, Q.Quaternion Float)
orientChild itm = case _itType itm of
HELD {} -> (0,0)
_ -> (0,0)
HELD {} -> (0,Q.axisAngle (V3 1 0 0) 0)
_ -> (0,Q.axisAngle (V3 1 0 0) 0)
orientByLink :: Item -> ComposeLinkType -> (Point3, Q.Quaternion Float)
orientByLink itm _ = case _itType itm of
_ -> (0,0)
orientByLink itm lt = case (_itType itm,lt) of
--(HELD FLAMETHROWER, AmmoInLink{}) -> undefined --(V3 4 (-6) 0,0)
(HELD FLAMETHROWER, AmmoInLink{}) -> (V3 4 (-6) 0, Q.axisAngle (V3 1 0 0) 0)
(HELD _,AmmoInLink{}) -> (V3 7 (-2) 0, Q.axisAngle (V3 1 0 0) 0)
_ -> (0,Q.axisAngle (V3 1 0 0) 0)
orientAttachment :: Item -> ComposeLinkType -> Item -> Maybe (Point3, Q.Quaternion Float)
orientAttachment par lnk ch = Just (t1 + (Q.rotate q1 t2), q1 * q2)
--orientAttachment par lnk ch = Just (t1 , q1 )
where
(t1,q1) = orientByLink par lnk
(t2,q2) = orientChild ch