From a2ba45f43ae02b1e39b1816fe9c1c70c54a7f046 Mon Sep 17 00:00:00 2001 From: cnlohr Date: Sat, 10 Mar 2018 23:57:58 -0500 Subject: Switch from pos,quat to pose. Also change initialization order. --- redist/linmath.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'redist/linmath.c') 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]; +} + -- cgit v1.2.3