Update to latest Magnum with complete MeshData Python bindings #1999
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.