aboutsummaryrefslogtreecommitdiff
path: root/src/poser_charlesslow.c
diff options
context:
space:
mode:
authorJustin Berger <j.david.berger@gmail.com>2018-03-11 15:31:28 -0600
committerJustin Berger <j.david.berger@gmail.com>2018-03-12 09:52:50 -0600
commit95eab1b8938e0033a0aa0d10d6ec53d7d2782907 (patch)
treee92f9abf0287fea8c91abadf8a095318507a8885 /src/poser_charlesslow.c
parent7fadeeff29074520224be385ecd6c50271a07220 (diff)
downloadlibsurvive-95eab1b8938e0033a0aa0d10d6ec53d7d2782907.tar.gz
libsurvive-95eab1b8938e0033a0aa0d10d6ec53d7d2782907.tar.bz2
Added callback for lighthouse found; example in test.c
Diffstat (limited to 'src/poser_charlesslow.c')
-rw-r--r--src/poser_charlesslow.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/src/poser_charlesslow.c b/src/poser_charlesslow.c
index 96442b3..30fc677 100644
--- a/src/poser_charlesslow.c
+++ b/src/poser_charlesslow.c
@@ -165,9 +165,18 @@ int PoserCharlesSlow( SurviveObject * so, PoserData * pd )
RunOpti(so, fs, lh, 1, LighthousePos, LighthouseQuat);
- ctx->bsd[lh].PositionSet = 1;
- copy3d( ctx->bsd[lh].Pose.Pos, LighthousePos );
- quatcopy( ctx->bsd[lh].Pose.Rot, LighthouseQuat );
+ SurvivePose lighthousePose;
+ copy3d(lighthousePose.Pos, LighthousePos);
+ quatcopy(lighthousePose.Rot, LighthouseQuat);
+
+ const FLT rt[4] = {0, 0, 1, 0};
+ FLT tmp[4];
+ quatrotateabout(tmp, lighthousePose.Rot, rt);
+ memcpy(lighthousePose.Rot, tmp, sizeof(FLT) * 4);
+
+ if (ctx->lighthouseposeproc) {
+ ctx->lighthouseposeproc(ctx, lh, &lighthousePose);
+ }
#define ALT_COORDS
#ifdef ALT_COORDS
@@ -189,11 +198,6 @@ int PoserCharlesSlow( SurviveObject * so, PoserData * pd )
so->FromLHPose[lh].Rot[2] = LighthouseQuat[2];
so->FromLHPose[lh].Rot[3] = LighthouseQuat[3];
#endif
-
- const FLT rt[4] = {0, 0, 1, 0};
- FLT tmp[4];
- quatrotateabout(tmp, so->ctx->bsd[lh].Pose.Rot, rt);
- memcpy(so->ctx->bsd[lh].Pose.Rot, tmp, sizeof(FLT) * 4);
}
return 0;