Now About Social Code
summaryrefslogtreecommitdiff
path: root/scripts/marching_cubes.gd
diff options
context:
space:
mode:
authorLucas Fryzek <lucas.fryzek@fryzekconcepts.com>2023-09-17 22:00:55 -0400
committerLucas Fryzek <lucas.fryzek@fryzekconcepts.com>2023-09-17 22:00:55 -0400
commit7bfa7fcf02124a4508dffa9d78e8ef921b86a315 (patch)
treeed800e13df324341d8d1e5cead44f95e69718869 /scripts/marching_cubes.gd
parentf2b1bba5a9fe2b0bede6792a34965987902c41aa (diff)
Setup basic player controller
Diffstat (limited to 'scripts/marching_cubes.gd')
-rw-r--r--scripts/marching_cubes.gd14
1 files changed, 4 insertions, 10 deletions
diff --git a/scripts/marching_cubes.gd b/scripts/marching_cubes.gd
index 6c5296c..cbf278b 100644
--- a/scripts/marching_cubes.gd
+++ b/scripts/marching_cubes.gd
@@ -12,14 +12,12 @@ class Cell:
position.resize(8)
value.resize(8)
-func march_cube(cell: Cell, triangles: PackedInt32Array, verticies: PackedVector3Array):
+func march_cube(cell: Cell, verticies: PackedVector3Array):
var cube_index : int = 0
var vertex_list: Array[Vector3] = []
vertex_list.resize(12)
- var starting_vertex_count = verticies.size()
-
for i in 8:
if cell.value[i] < 0: cube_index |= (1 << i)
@@ -66,16 +64,12 @@ func march_cube(cell: Cell, triangles: PackedInt32Array, verticies: PackedVector
local_remap[mc._tri_table[cube_index][tri_index]] = new_vertex_count
new_vertex_count += 1
tri_index += 1
-
- for i in new_vertex_count:
- var vert = new_vertex_list[i]
- verticies.push_back(vert)
tri_index = 0
while mc._tri_table[cube_index][tri_index] != -1:
- triangles.push_back(local_remap[mc._tri_table[cube_index][tri_index + 0]] + starting_vertex_count)
- triangles.push_back(local_remap[mc._tri_table[cube_index][tri_index + 1]] + starting_vertex_count)
- triangles.push_back(local_remap[mc._tri_table[cube_index][tri_index + 2]] + starting_vertex_count)
+ verticies.push_back(new_vertex_list[local_remap[mc._tri_table[cube_index][tri_index + 0]]])
+ verticies.push_back(new_vertex_list[local_remap[mc._tri_table[cube_index][tri_index + 1]]])
+ verticies.push_back(new_vertex_list[local_remap[mc._tri_table[cube_index][tri_index + 2]]])
tri_index += 3