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

Allow resetting model matrix when tiles have regions #12409

Merged
merged 2 commits into from
Jan 3, 2025

Conversation

javagl
Copy link
Contributor

@javagl javagl commented Jan 3, 2025

Description

When loading a tileset where the tiles contained bounding regions, changing the modelMatrix of the tileset, and then setting the modelMatrix back to its initial value, the update caused a

TypeError: result.computeBoundingVolumes is not a function

A detailed description of what went wrong is in #12002 (comment)

While creating a (pretty strict, dedicated) spec, I noticed that the suggested fix does not fully cover it. There are basically four cases to consider:

  • When the transform did change (compared to the initial one)
    • When the result is a TileOrientedBoundingBox, then reuse it
    • When the result is not a TileOrientedBoundingBox, then create a new one
  • When the transform did not change (compared to the initial one)
    • When the result is a TileBoundingRegion, then reuse it
    • When the result is not a TileBoundingRegion, then create a new one

(It's hard to be 100% sure that all cases can happen in practice, but easy to handle them generically)

Issue number and link

Fixes #12002
Fixes #12403

Testing plan

The issue descriptions contain examples that caused the crash (basically the same example, though).

Also, I added a dedicated spec for this.

NOTE: The whole spec is currently wrapped into a expect ... not.toThrow. This is the actual change that is done here. One could consider this as the "baseline", though, and remove this check, and only use the expect's for the respective bounding volume types.

Author checklist

  • I have submitted a Contributor License Agreement
  • I have added my name to CONTRIBUTORS.md
  • I have updated CHANGES.md with a short summary of my change
  • I have added or updated unit tests to ensure consistent code coverage
  • I have updated the inline documentation, and included code examples where relevant
  • I have performed a self-review of my code

Copy link

github-actions bot commented Jan 3, 2025

Thank you for the pull request, @javagl!

✅ We can confirm we have a CLA on file for you.

@jjhembd
Copy link
Contributor

jjhembd commented Jan 3, 2025

@javagl thanks for the fix! The code change makes sense, and the Sandcastle now works for me. I am still trying to run the specs--need to fix a configuration somewhere on my new laptop.

Can you add a note to CHANGES.md?

Copy link
Contributor

@jjhembd jjhembd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I fixed my configuration and the tests ran through successfully.

Thanks again @javagl!

@jjhembd jjhembd added this pull request to the merge queue Jan 3, 2025
Merged via the queue into main with commit b44fddb Jan 3, 2025
9 checks passed
@jjhembd jjhembd deleted the fix-model-matrix-update-error branch January 3, 2025 20:05
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.

Error updating 3DTiles transformation matrix. Cesium3DTileset modelMatrix reset error
2 participants