-
Notifications
You must be signed in to change notification settings - Fork 426
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
Update to latest Magnum with complete MeshData Python bindings #1999
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. All the changes are in submodules of course though. :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
#2000 should fix the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for implementing these additional features so quickly.
For others' context, we're starting to want asset loading in Habitat-lab python and we don't want a ton of new dependencies, so it is ideal to use Magnum for this.
Planning to integrate these changes with habitat-lab1108 for receptacle PLY mesh import.
* Update Magnum submodules. * Bundle shaders as null-terminated strings to avoid needless copies. * tests: size_type is some internal Bullet typedef, don't use it. --------- Co-authored-by: aclegg3 <alexanderwclegg@gmail.com>
Motivation and Context
This brings another ~2 months of Magnum-side updates. A good part of the following list is a side-product of working on Habitat-unrelated things recently, nevertheless I feel it's good to mention everything for exposure:
ArrayView
,StridedArrayView
etc.) now have debug assertions checking out-of-bounds conditions. This should lead to much safer behavior in debug builds without explicitly having to wrap access in range-checking helpers, and since the asserts are compiled out in release builds, no perf degradation in deployed binaries. If some Habitat code starts asserting in debug builds after this upgrade, it means it had accidental OOB access before, not that a regression was introduced by this PR.BitArray
andBitArrayView
APIs and a new StridedBitArrayView container for multi-dimensional ranges of bits. Meant to be used for representing boolean fields in SceneData as well as various algorithms in the batch renderer and ECS-like data processing.Utility::copy()
being called too much during load will get fixed properly in the next round of batch renderer updates.std::pair
from the APIs, leading to more efficient data copies as Containers::Pair is properly trivially copyable.std::string
before. As a related change, I updated the compiled-in Habitat shader sources to be null-terminated strings for zero-copy compilation.--phong-to-pbr
option. This is however already available in the prebuilt binaries I'm providing.But maybe the fanciest new thing is typed mesh attribute and index data access in Python, requested by @aclegg3. It's just a quick half-a-day feature, which among other things means you can now do this with a trade.MeshData:
The
indices
andattribute()
APIs return acontainers.StridedArrayView1D
with a dynamic type, which implements a buffer protocol and thus provides an efficient zero-copy access to the underlying data, compatible with numpy arrays. It works for "usual" attribute types as well as various packed types like 16-bit texture coordinates or 8-bit vertex colors, with Python nicely abstracting over the differences to access everything through a single API. There's alsomutable_indices
andmutable_attribute()
for those who need full power, and of course all otherMeshData
properties are exposed as well. Except for helpers likepositionsAsArray()
, which we don't need there, because Python is amazing and can do that all in a single API.The same will be eventually exposed for
trade.SceneData
, allowing you to inspect actual scene hierarchies, node mesh/material assignments etc.I also have more changes pending for
SceneData
, expanding glTF import/export capabilities, newMaterialTools
utilities, as well as GL API additions for #1997. Those will be in the next batch.How Has This Been Tested
🟢 on my side, not sure what's up with the Python
and JSfailures here.