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 iterateSceneNodes to take Asset as const ref #68

Merged
merged 1 commit into from
Aug 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions include/fastgltf/tools.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -898,11 +898,12 @@ FASTGLTF_EXPORT inline auto getTransformMatrix(const Node& node, const math::fma
* Iterates over every node within a scene recursively, computing the world space transform of each node,
* and calling the callback function with that node and the transform.
*/
FASTGLTF_EXPORT template <typename Callback>
FASTGLTF_EXPORT template <typename AssetType, typename Callback>
#if FASTGLTF_HAS_CONCEPTS
requires std::is_invocable_v<Callback, fastgltf::Node&, const fastgltf::math::fmat4x4&>
requires std::same_as<std::remove_cvref_t<AssetType>, Asset>
&& std::is_invocable_v<Callback, fastgltf::Node&, const fastgltf::math::fmat4x4&>
#endif
void iterateSceneNodes(fastgltf::Asset& asset, std::size_t sceneIndex, math::fmat4x4 initial, Callback callback) {
void iterateSceneNodes(AssetType&& asset, std::size_t sceneIndex, math::fmat4x4 initial, Callback callback) {
auto& scene = asset.scenes[sceneIndex];

auto function = [&](std::size_t nodeIndex, math::fmat4x4 nodeMatrix, auto& self) -> void {
Expand Down
Loading