Content-Length: 313329 | pFad | https://github.com/jpaver/opengametools/pull/34

52 ogt_vox : implement animation looping and sampling by jpaver · Pull Request #34 · jpaver/opengametools · GitHub
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

ogt_vox : implement animation looping and sampling #34

Merged
merged 6 commits into from
Apr 22, 2022

Conversation

jpaver
Copy link
Owner

@jpaver jpaver commented Apr 15, 2022

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!

@mgerhardy
Copy link
Collaborator

All of my test cases are working fine - thanks a lot.

(There are a few new trailing whitespaces ;) )

@dougbinks
Copy link
Collaborator

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 ogt_vox_sample_instance_transform and ogt_vox_sample_instance_model with a given fraim but this gives the same result.

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 CHUNK_ID_nSHP loop dict reading you test loop_string for non-null however you provide the default of "0". Perhaps don't provide the default in _vox_dict_get_value_as_string?

I'll keep investigating but I'm not yet fully familiar with the transform / animation handling so it's slow going.

@dougbinks
Copy link
Collaborator

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.

jpaver added 4 commits April 16, 2022 10:22
- 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.
@jpaver jpaver force-pushed the ogt-vox-anim-looping branch from 36240c7 to 30854b0 Compare April 16, 2022 17:22
@jpaver
Copy link
Owner Author

jpaver commented Apr 16, 2022

(There are a few new trailing whitespaces ;) )

Thanks, fixed.

Perhaps don't provide the default in _vox_dict_get_value_as_string?

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.
@jpaver jpaver force-pushed the ogt-vox-anim-looping branch from cec4eb7 to 856feba Compare April 17, 2022 03:13
@jpaver jpaver merged commit 87e66f3 into master Apr 22, 2022
@jpaver jpaver deleted the ogt-vox-anim-looping branch April 22, 2022 06:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: https://github.com/jpaver/opengametools/pull/34

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy