From 714850c4f97b60033d19236a32858901d02514af Mon Sep 17 00:00:00 2001 From: Marc Garcia Puig Date: Thu, 26 Mar 2020 21:02:31 +0100 Subject: [PATCH] Fixed the mesh addition --- LibCarla/source/carla/geom/Mesh.cpp | 9 +++++++-- LibCarla/source/carla/geom/Mesh.h | 2 ++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/LibCarla/source/carla/geom/Mesh.cpp b/LibCarla/source/carla/geom/Mesh.cpp index c9dccf9ac..3e681a839 100644 --- a/LibCarla/source/carla/geom/Mesh.cpp +++ b/LibCarla/source/carla/geom/Mesh.cpp @@ -257,6 +257,10 @@ namespace geom { return _indexes; } + size_t Mesh::GetIndexesNum() const { + return _indexes.size(); + } + const std::vector &Mesh::GetUVs() const { return _uvs; } @@ -271,6 +275,7 @@ namespace geom { Mesh &Mesh::operator+=(const Mesh &rhs) { const size_t v_num = GetVerticesNum(); + const size_t i_num = GetIndexesNum(); _vertices.insert( _vertices.end(), @@ -298,8 +303,8 @@ namespace geom { rhs.GetMaterials().end(), std::back_inserter(_materials), [=](MeshMaterial mat) { - mat.index_start += v_num; - mat.index_end += v_num; + mat.index_start += i_num; + mat.index_end += i_num; return mat; }); diff --git a/LibCarla/source/carla/geom/Mesh.h b/LibCarla/source/carla/geom/Mesh.h index 24b69a963..c2ea29a1a 100644 --- a/LibCarla/source/carla/geom/Mesh.h +++ b/LibCarla/source/carla/geom/Mesh.h @@ -125,6 +125,8 @@ namespace geom { const std::vector &GetIndexes() const; + size_t GetIndexesNum() const; + const std::vector &GetUVs() const; const std::vector &GetMaterials() const;