Fixed the mesh addition

This commit is contained in:
Marc Garcia Puig 2020-03-26 21:02:31 +01:00 committed by bernat
parent b0038182e6
commit 714850c4f9
2 changed files with 9 additions and 2 deletions

View File

@ -257,6 +257,10 @@ namespace geom {
return _indexes;
}
size_t Mesh::GetIndexesNum() const {
return _indexes.size();
}
const std::vector<Mesh::uv_type> &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;
});

View File

@ -125,6 +125,8 @@ namespace geom {
const std::vector<index_type> &GetIndexes() const;
size_t GetIndexesNum() const;
const std::vector<uv_type> &GetUVs() const;
const std::vector<material_type> &GetMaterials() const;