Commented out the terrarin mesh build phase for now, the c++ version is ok if I'm not experimenting.

This commit is contained in:
Relintai 2020-02-26 01:14:42 +01:00
parent a4aecfb9cd
commit 3e68b820b5

View File

@ -207,45 +207,45 @@ func _build_phase(phase):
bake_lights() bake_lights()
set_physics_process_internal(true) set_physics_process_internal(true)
return false return false
elif phase == VoxelChunk.BUILD_PHASE_TERRARIN_MESH: # elif phase == VoxelChunk.BUILD_PHASE_TERRARIN_MESH:
for i in range(get_mesher_count()): # for i in range(get_mesher_count()):
var mesher : VoxelMesher = get_mesher(i) # var mesher : VoxelMesher = get_mesher(i)
mesher.bake_colors(self) # mesher.bake_colors(self)
#
for i in range(get_mesher_count()): # for i in range(get_mesher_count()):
var mesher : VoxelMesher = get_mesher(i) # var mesher : VoxelMesher = get_mesher(i)
mesher.set_library(library) # mesher.set_library(library)
#
if get_mesh_rid() == RID(): # if get_mesh_rid() == RID():
allocate_main_mesh() # allocate_main_mesh()
#
var mesher : VoxelMesher = null # var mesher : VoxelMesher = null
for i in range(get_mesher_count()): # for i in range(get_mesher_count()):
var m : VoxelMesher = get_mesher(i) # var m : VoxelMesher = get_mesher(i)
#
if mesher == null: # if mesher == null:
mesher = m # mesher = m
continue # continue
#
mesher.set_material(library.material) # mesher.set_material(library.material)
mesher.add_mesher(m) # mesher.add_mesher(m)
#
VisualServer.mesh_clear(get_mesh_rid()) # VisualServer.mesh_clear(get_mesh_rid())
#
if mesher.get_vertex_count() == 0: # if mesher.get_vertex_count() == 0:
next_phase() # next_phase()
return true # return true
#
var arr : Array = mesher.build_mesh() # var arr : Array = mesher.build_mesh()
#
VisualServer.mesh_add_surface_from_arrays(get_mesh_rid(), VisualServer.PRIMITIVE_TRIANGLES, arr) # VisualServer.mesh_add_surface_from_arrays(get_mesh_rid(), VisualServer.PRIMITIVE_TRIANGLES, arr)
#
if library.material != null: # if library.material != null:
VisualServer.mesh_surface_set_material(get_mesh_rid(), 0, library.material.get_rid()) # VisualServer.mesh_surface_set_material(get_mesh_rid(), 0, library.material.get_rid())
#
next_phase(); # next_phase();
#
return true; # return true;
elif phase == VoxelChunk.BUILD_PHASE_PROP_MESH: elif phase == VoxelChunk.BUILD_PHASE_PROP_MESH:
set_physics_process_internal(true) set_physics_process_internal(true)
return false return false