fix chunk boundaries

This commit is contained in:
Guillaume Vern 2026-02-13 21:34:53 +01:00
parent ee5c2662e3
commit bc58e13a61
2 changed files with 4 additions and 1 deletions

View File

@ -36,7 +36,8 @@ func create_device(world_size: int):
pipeline2 = rd.compute_pipeline_create(shader_pass2)
# 3. Pre-allocate Buffers (assuming world_size is constant)
var total = world_size ** 3
# add 1 to look at adjacent voxels for chunk boundaries
var total = (world_size + 2) ** 3
# We create them once with empty/zero data of the correct size
buffer = rd.storage_buffer_create(total * 4)
@ -49,6 +50,7 @@ func create_device(world_size: int):
params_buffer = rd.uniform_buffer_create(16) # world_size, threshold, time, etc
func compute_mesh(world_size: int, threshold: float, chunk_pos: Vector3) -> ArrayMesh:
world_size += 2
# 1. Update existing buffers with NEW data for THIS chunk
var chunk_pos_data = PackedFloat32Array([chunk_pos.x, chunk_pos.y, chunk_pos.z, 0.0]).to_byte_array()

View File

@ -4,6 +4,7 @@
constant = Color(0.30202293, 0.6060653, 0.9109474, 1)
[resource]
modes/cull = 2
nodes/vertex/0/position = Vector2(360, 220)
nodes/fragment/0/position = Vector2(660, 140)
nodes/fragment/2/node = SubResource("VisualShaderNodeColorConstant_sxi40")