diff options
Diffstat (limited to 'src/common')
| -rw-r--r-- | src/common/Collision/Models/WorldModel.cpp | 7 | ||||
| -rw-r--r-- | src/common/Collision/Models/WorldModel.h | 6 |
2 files changed, 7 insertions, 6 deletions
diff --git a/src/common/Collision/Models/WorldModel.cpp b/src/common/Collision/Models/WorldModel.cpp index 8917d459145..68e9128a6e9 100644 --- a/src/common/Collision/Models/WorldModel.cpp +++ b/src/common/Collision/Models/WorldModel.cpp @@ -20,6 +20,7 @@ #include "MapTree.h" #include "ModelIgnoreFlags.h" #include <array> +#include <cstring> using G3D::Vector3; @@ -294,10 +295,10 @@ namespace VMAP iLiquid = new WmoLiquid(*other.iLiquid); } - void GroupModel::setMeshData(std::vector<Vector3>& vert, std::vector<MeshTriangle>& tri) + void GroupModel::setMeshData(std::vector<Vector3>&& vert, std::vector<MeshTriangle>&& tri) { - vertices.swap(vert); - triangles.swap(tri); + vertices = std::move(vert); + triangles = std::move(tri); TriBoundFunc bFunc(vertices); meshTree.build(triangles, bFunc); } diff --git a/src/common/Collision/Models/WorldModel.h b/src/common/Collision/Models/WorldModel.h index 9d2ba99bb80..0958e9c308a 100644 --- a/src/common/Collision/Models/WorldModel.h +++ b/src/common/Collision/Models/WorldModel.h @@ -86,9 +86,9 @@ namespace VMAP iBound(bound), iMogpFlags(mogpFlags), iGroupWMOID(groupWMOID), iLiquid(nullptr) { } ~GroupModel() { delete iLiquid; } - //! pass mesh data to object and create BIH. Passed vectors get get swapped with old geometry! - void setMeshData(std::vector<G3D::Vector3> &vert, std::vector<MeshTriangle> &tri); - void setLiquidData(WmoLiquid*& liquid) { iLiquid = liquid; liquid = nullptr; } + //! pass mesh data to object and create BIH. + void setMeshData(std::vector<G3D::Vector3>&& vert, std::vector<MeshTriangle>&& tri); + void setLiquidData(WmoLiquid* liquid) { iLiquid = liquid; } bool IntersectRay(const G3D::Ray &ray, float &distance, bool stopAtFirstHit) const; enum InsideResult { INSIDE = 0, MAYBE_INSIDE = 1, ABOVE = 2, OUT_OF_BOUNDS = -1 }; InsideResult IsInsideObject(G3D::Ray const& ray, float& z_dist) const; |
