[qfcc] Put problematic printf into ptrstructinit

It turns out the bug I was chasing in set_poses was not the data getting
lost or incorrect data being read, but the arguments to printf being set
from the parent pose `p` before `p` had actually been set.
This commit is contained in:
Bill Currie 2024-02-19 23:10:55 +09:00
parent 00781160e2
commit 07ef862c52

View file

@ -129,6 +129,9 @@ set_poses (armature_t *arm, iqmjoint_t *joints, int num_joints)
for (int i = 0; i < num_joints; i++) {
if (joints[i].parent >= 0) {
auto p = arm.pose[joints[i].parent];
// printf IS the bug: its parameters get set before p is loaded,
// otherwise this code compiles correctly
printf ("%q %q %q\n", p.translate, p.rotate, p.scale);
arm.pose[i] = {
.translate = p.translate + [(quaternion)p.rotate * joints[i].translate, 0],
.rotate = (quaternion)p.rotate * joints[i].rotate,