Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistent type assumption for scratch variable #11685

Closed
javagl opened this issue Dec 11, 2023 · 1 comment · Fixed by #11700
Closed

Inconsistent type assumption for scratch variable #11685

javagl opened this issue Dec 11, 2023 · 1 comment · Fixed by #11700
Labels

Comments

@javagl
Copy link
Contributor

javagl commented Dec 11, 2023

(I originally mentioned this in #11665, but should probably be an own issue)

The scratchVariable in ModelAnimationChannel is initialized depending on the "path" of the channel: For "translation" animations, it is a Cartesian3, and for "rotation" animations, it is a Quaternion. But ... it is a global variable 😬 When initializing multiple channels, then there are cases where this should be a Quaternion, but it actually is a Cartesian3, meaning that some of the functions are just shoving some .w property into that poor Cartesian3. It happens to work (hooray to untyped languages), but ... feels wrong.

Would the preferred way of fixing this be to convert that scratchVariable an instance variable in the ModelAnimationChannel?

@ggetz
Copy link
Contributor

ggetz commented Dec 12, 2023

I think the preferred solution would be to have two scratch variables, one for each type.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2 participants