diff options
author | PouleyKetchoupp <pouleyketchoup@gmail.com> | 2021-09-14 17:14:06 -0700 |
---|---|---|
committer | PouleyKetchoupp <pouleyketchoup@gmail.com> | 2021-09-14 17:14:06 -0700 |
commit | 2ca94e51e4d4477709b83b487a4f5b938f24f56b (patch) | |
tree | e9acd648a7ca4911bc131a9dae7a55590dafae55 /core/math/triangle_mesh.h | |
parent | cd5a8f8dd4a86b06f6aa898db03a18d5dbd0f94c (diff) |
Clean convex hull decomposition code
Remove unnecessary conversion between triangle data and vertex data
whenever possible.
Diffstat (limited to 'core/math/triangle_mesh.h')
-rw-r--r-- | core/math/triangle_mesh.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/core/math/triangle_mesh.h b/core/math/triangle_mesh.h index 463b0dd5c8..2d3b4db4bb 100644 --- a/core/math/triangle_mesh.h +++ b/core/math/triangle_mesh.h @@ -37,11 +37,13 @@ class TriangleMesh : public RefCounted { GDCLASS(TriangleMesh, RefCounted); +public: struct Triangle { Vector3 normal; int indices[3]; }; +private: Vector<Triangle> triangles; Vector<Vector3> vertices; @@ -86,8 +88,8 @@ public: Vector3 get_area_normal(const AABB &p_aabb) const; Vector<Face3> get_faces() const; - Vector<Triangle> get_triangles() const { return triangles; } - Vector<Vector3> get_vertices() const { return vertices; } + const Vector<Triangle> &get_triangles() const { return triangles; } + const Vector<Vector3> &get_vertices() const { return vertices; } void get_indices(Vector<int> *r_triangles_indices) const; void create(const Vector<Vector3> &p_faces); |