Skip to content

Commit

Permalink
Allow iterateSceneNodes to take AssetType as const ref (#68)
Browse files Browse the repository at this point in the history
  • Loading branch information
n0F4x authored Aug 16, 2024
1 parent d433b90 commit bb52c0f
Showing 1 changed file with 4 additions and 3 deletions.
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

0 comments on commit bb52c0f

Please sign in to comment.