1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-04 12:00:25 +00:00

Clean convex hull decomposition code

Remove unnecessary conversion between triangle data and vertex data
whenever possible.
This commit is contained in:
PouleyKetchoupp
2021-09-14 17:14:06 -07:00
parent cd5a8f8dd4
commit 2ca94e51e4
5 changed files with 84 additions and 127 deletions

View File

@@ -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);