From 0d7bcc90bbdba7c8f6f938131b87c929c8808d83 Mon Sep 17 00:00:00 2001 From: JosiahWI Date: Wed, 17 May 2023 13:07:39 -0500 Subject: [PATCH] Add r-value reference constructor to ModelParser --- source/Irrlicht/CGLTFMeshFileLoader.cpp | 9 ++++++++- source/Irrlicht/CGLTFMeshFileLoader.h | 2 ++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/source/Irrlicht/CGLTFMeshFileLoader.cpp b/source/Irrlicht/CGLTFMeshFileLoader.cpp index a3da812ad..5964d6851 100644 --- a/source/Irrlicht/CGLTFMeshFileLoader.cpp +++ b/source/Irrlicht/CGLTFMeshFileLoader.cpp @@ -19,6 +19,7 @@ #include #include #include +#include #include // A helper function to disable tinygltf embedded image loading @@ -106,7 +107,7 @@ IAnimatedMesh* CGLTFMeshFileLoader::createMesh(io::IReadFile* file) std::vector indicesBuffer(model.accessors[ indicesAccessorId].count); - ModelParser parser(model); + ModelParser parser(std::move(model)); parser.getIndices(indicesAccessorId, indicesBuffer); parser.getVertices(positionAccessorId, @@ -141,6 +142,12 @@ CGLTFMeshFileLoader::ModelParser::ModelParser( { } +CGLTFMeshFileLoader::ModelParser::ModelParser( + const tinygltf::Model&& model) + : m_model(model) +{ +} + void CGLTFMeshFileLoader::ModelParser::getIndices( const std::size_t accessorId, std::vector& outIndices) const diff --git a/source/Irrlicht/CGLTFMeshFileLoader.h b/source/Irrlicht/CGLTFMeshFileLoader.h index dd56416cd..968a76030 100644 --- a/source/Irrlicht/CGLTFMeshFileLoader.h +++ b/source/Irrlicht/CGLTFMeshFileLoader.h @@ -58,6 +58,8 @@ private: public: ModelParser(const tinygltf::Model& model); + ModelParser(const tinygltf::Model&& model); + void getIndices(const std::size_t accessorId, std::vector& outIndices) const;