From 605db8cd3778bd2f58a956a0776c1001d7286def Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sun, 21 Feb 2021 16:43:56 +0000 Subject: Named model parts, fix bogie spelling, new brush47 model --- gfx/models/obj.h | 9 +++++---- gfx/models/obj.impl.cpp | 14 +++++++------- 2 files changed, 12 insertions(+), 11 deletions(-) (limited to 'gfx') diff --git a/gfx/models/obj.h b/gfx/models/obj.h index 71733fe..a2d874f 100644 --- a/gfx/models/obj.h +++ b/gfx/models/obj.h @@ -8,6 +8,7 @@ #include #include #include +#include #include #include @@ -39,10 +40,10 @@ public: std::vector objects; glm::length_t axis {0}; - using NamedMeshData = std::pair, std::vector>>; - [[nodiscard]] std::vector createMeshData() const; - using NamedMesh = std::pair>; - [[nodiscard]] std::vector createMeshes() const; + using NamedMeshesData = std::map, std::vector>>; + [[nodiscard]] NamedMeshesData createMeshData() const; + using NamedMeshes = std::map>; + [[nodiscard]] NamedMeshes createMeshes() const; }; #endif diff --git a/gfx/models/obj.impl.cpp b/gfx/models/obj.impl.cpp index 5ac15ac..330e851 100644 --- a/gfx/models/obj.impl.cpp +++ b/gfx/models/obj.impl.cpp @@ -4,27 +4,27 @@ #include #include #include +#include #include #include #include -std::vector +ObjParser::NamedMeshes ObjParser::createMeshes() const { - std::vector out; + NamedMeshes out; const auto data {createMeshData()}; - std::transform(data.begin(), data.end(), std::back_inserter(out), [](auto && obj) { + std::transform(data.begin(), data.end(), std::inserter(out, out.end()), [](auto && obj) { return std::make_pair(obj.first, std::make_shared(obj.second.first, obj.second.second)); }); return out; } -std::vector +ObjParser::NamedMeshesData ObjParser::createMeshData() const { - std::vector out; - out.reserve(objects.size()); - std::transform(objects.begin(), objects.end(), std::back_inserter(out), [this](auto && obj) { + NamedMeshesData out; + std::transform(objects.begin(), objects.end(), std::inserter(out, out.end()), [this](auto && obj) { std::vector overtices; std::vector vertexOrder; std::vector indices; -- cgit v1.2.3