Cutting Holes Into Mesh

We be cutting holes :)
This commit is contained in:
2025-11-09 16:17:04 -05:00
parent 2d0408c09e
commit c6e4d4f725
12 changed files with 176 additions and 73 deletions

View File

@@ -14,8 +14,8 @@ var _v_points = []
var edges = {}
func _init(vector_indexes: PackedInt32Array, vector_points: PackedVector2Array, depth: float = -2.0):
assert(len(vector_indexes) % 3 == 0, "Number of vertex points is not divisible by 3, invalid triangle verticies")
func _init(vector_indexes: PackedInt32Array, vector_points: PackedVector2Array, depth: float = -0.1):
assert(len(vector_indexes) % 3 == 0 && len(vector_indexes) != 0, "Number of vertex points is not divisible by 3, invalid triangle verticies")
surface_array.resize(Mesh.ARRAY_MAX)
self._v_indexes = vector_indexes
@@ -39,7 +39,6 @@ func calculate_area(mesh_vertices: PackedVector2Array) -> float:
return result * 0.5
# edges are any verticies that share only on triangle
func _pre_process_edges():
var faces = UTIL.chunk_array(self._v_indexes, 3)
@@ -144,9 +143,6 @@ func _draw_sides(depth: float):
var v3 = self._v_points[outline_edges_ordered[outline_vector_ind + 1]]+ Vector3(0, 0, depth)
var n1 = self._calc_triangle_normal(v2, v1, v0)
#
#print(v0, ", ", v1, ", ", v2, ", ", v3)
#print(n1)
self.verts.append_array([v0, v1, v2, v1, v3, v2])
self.normals.append_array([n1, n1, n1, n1, n1, n1])