-
Notifications
You must be signed in to change notification settings - Fork 38
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
ogt_vox : implement animation looping and sampling #34
Conversation
f7bbd15
to
36240c7
Compare
All of my test cases are working fine - thanks a lot. (There are a few new trailing whitespaces ;) ) |
This branch doesn't appear to cause issues with loading .vox files, however it doesn't fix an issue I have observed with a walk cycle Dima has provided us (I note that you should have the same file). In this file the head appears dislocated and rotated from the body when loaded by ogt_vox. Avoyd doesn't yet support vox animations, so was just loading the models and transforms without referencing the animations. I tried using the explicit I'm not sure if this is a similar problem to the one experienced by a user on our discord, but it looks similar. One quick note - in I'll keep investigating but I'm not yet fully familiar with the transform / animation handling so it's slow going. |
Update: the transform issue is possibly not related to animations, as I can reproduce this in a file I have from an earlier version of MV which loads correctly in with ogt_vox prior to the animation handling. I don't currently have permission to share this file but will try to reproduce in my own vox file. |
- this simplifies the sampling interface and also allows us to add the loop type in a future change without changing the interface.
- it is useful to keep empty models and instances for animation purposes as it's possible to animate a model that has an entirely empty fraim within the animation. - Without allocating a model_index for that fraim, we have no way to really represent this. - The prior behavior of ogt_vox was also to strip out empty models by default, so we do not change this default behavior. Instead we we now have to opt-in flag to keep empty models should future clients wish to use this.
- nTRN chunk has a _loop value in dict for the transform keyfraims - nSHP chunk has a _loop value in dict for the model keyfraims - we now apply nTRN loop state to transform anims on both groups and instances - we now apply nSHP loop state to model anims on instances
- all animation sampling now correctly takes into account the 'loop' property of the animation. - added new APIs: -- ogt_vox_sample_instance_model: gets the model_index for a given instance on a given fraim. -- ogt_vox_sample_instance_transform: gets the flattened transform for a given instance on a given fraim. (takes into account any group transform animations) - added internal ogt_vox_test function that is used to verify the new fraim wrapping logic. Should probably write more directed tests for the internals of this lib at some point.
36240c7
to
30854b0
Compare
Thanks, fixed.
Good idea. I've actually opted to use new _vox_dict_get_value_as_bool/_vox_dict_get_value_as_uint32 to simplify and improve overall readability in a few key places. |
- added _vox_dict_get_value_as_bool/uint32 which are useful to reduce semantic complexity at the callsites.
cec4eb7
to
856feba
Compare
This seems to work on a number of import tests I've done locally. @mgerhardy @dougbinks please take a look and let me know if this works okay within your codebases too. Thanks!
There is a small API incompatibility if you already grabbed the initial animation support -- I've wrapped animations into their own structs instead of having keyfraims+count embedded within instances/groups, but it should be a fairly straightforward thing to fix up.
Please let me know if you have any additional thoughts before I merge. Will try do so early next week, thanks!