aboutsummaryrefslogtreecommitdiff
path: root/redist/linmath.c
diff options
context:
space:
mode:
authorcnlohr <lohr85@gmail.com>2018-03-10 23:57:58 -0500
committercnlohr <lohr85@gmail.com>2018-03-10 23:57:58 -0500
commita2ba45f43ae02b1e39b1816fe9c1c70c54a7f046 (patch)
treeb0a916dad0fb979e997d069a0f6c3184279e479a /redist/linmath.c
parent5ae3acb6d63301ac14beaebe692f5af680e65c26 (diff)
downloadlibsurvive-a2ba45f43ae02b1e39b1816fe9c1c70c54a7f046.tar.gz
libsurvive-a2ba45f43ae02b1e39b1816fe9c1c70c54a7f046.tar.bz2
Switch from pos,quat to pose. Also change initialization order.
Diffstat (limited to 'redist/linmath.c')
-rw-r--r--redist/linmath.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/redist/linmath.c b/redist/linmath.c
index 1d70ee1..4240ed6 100644
--- a/redist/linmath.c
+++ b/redist/linmath.c
@@ -490,6 +490,8 @@ void quatrotatevector( FLT * vec3out, const FLT * quat, const FLT * vec3in )
vquat[2] = vec3in[1];
vquat[3] = vec3in[2];
+ //XXX WARNING: This code is probably SLOW. See this: https://github.com/axlecrusher/hgengine3/blob/master/Mercury3/basic_light1_v.glsl
+
quatrotateabout( tquat, quat, vquat );
quatgetconjugate( qrecp, quat );
quatrotateabout( vquat, tquat, qrecp );
@@ -637,3 +639,11 @@ void matrix44transpose(FLT * mout, const FLT * minm )
}
+void ApplyPoseToPoint( FLT * pout, const FLT * pin, const FLT * pose )
+{
+ FLT v3o[3];
+ quatrotatevector( v3o, &pose[3], pin );
+ for(int i = 0; i < 3; i++)
+ pout[i] = pose[i] + v3o[i];
+}
+