mirror of
https://github.com/Relintai/broken_seals.git
synced 2024-12-25 01:17:10 +01:00
Update to the latest Voxelman, to get the VoxelChunk->VoxelChunk,VoxelChunkDefault refactor.
This commit is contained in:
parent
ae0d64a069
commit
16d4c9ae2e
2
HEADS
2
HEADS
@ -1 +1 @@
|
|||||||
{"engine": {"3.2": "34dc32aeb8b06947897f75399c15f3eb9c211d7b", "master": "8c73e813134001e575b6f59e3b0100471c007410"}, "world_generator": {"master": "a08917370cdef0884042bdb49fb80ece0b2e76ec"}, "entity_spell_system": {"master": "bff7b220c40216f625a028af144b174620106c59"}, "ui_extensions": {"master": "38acc650db260a831dc26ca96fe9d9a087230bdc"}, "voxelman": {"master": "91540092500d8b8bd0c12322e46f4e10a00c66ae"}, "texture_packer": {"master": "b17c174906f84de93d84aa60d010ffe603efaa28"}, "fastnoise": {"master": "41b7ea05a1f7aa2b8ecddaa1fd739e64d6970f7e"}, "mesh_data_resource": {"master": "4bda19b12be2c2a79a6121de6d22e48f3934e726"}, "procedural_animations": {"master": "9b1868668de4242ccc0565cf3c6b5e1c375f1576"}, "ess_data": {"master": "3bd637fdd3304b64a18287a49a6b7387acf2f5de"}, "fast_quadratic_mesh_simplifier": {"master": "0007d4793ef76b1998586018b66382b0fc8a9c99"}}
|
{"engine": {"3.2": "34dc32aeb8b06947897f75399c15f3eb9c211d7b", "master": "8c73e813134001e575b6f59e3b0100471c007410"}, "world_generator": {"master": "a08917370cdef0884042bdb49fb80ece0b2e76ec"}, "entity_spell_system": {"master": "bff7b220c40216f625a028af144b174620106c59"}, "ui_extensions": {"master": "38acc650db260a831dc26ca96fe9d9a087230bdc"}, "voxelman": {"master": "080e8f2437f8cdfdd49ca9dacb705de2b4bbe538"}, "texture_packer": {"master": "b17c174906f84de93d84aa60d010ffe603efaa28"}, "fastnoise": {"master": "41b7ea05a1f7aa2b8ecddaa1fd739e64d6970f7e"}, "mesh_data_resource": {"master": "4bda19b12be2c2a79a6121de6d22e48f3934e726"}, "procedural_animations": {"master": "9b1868668de4242ccc0565cf3c6b5e1c375f1576"}, "ess_data": {"master": "3bd637fdd3304b64a18287a49a6b7387acf2f5de"}, "fast_quadratic_mesh_simplifier": {"master": "0007d4793ef76b1998586018b66382b0fc8a9c99"}}
|
@ -244,7 +244,7 @@ _global_script_classes=[ {
|
|||||||
"language": "GDScript",
|
"language": "GDScript",
|
||||||
"path": "res://scripts/spells/gd_spell_script.gd"
|
"path": "res://scripts/spells/gd_spell_script.gd"
|
||||||
}, {
|
}, {
|
||||||
"base": "VoxelChunk",
|
"base": "VoxelChunkDefault",
|
||||||
"class": "TVVoxelChunk",
|
"class": "TVVoxelChunk",
|
||||||
"language": "GDScript",
|
"language": "GDScript",
|
||||||
"path": "res://voxelman/world/TVVoxelChunk.gd"
|
"path": "res://voxelman/world/TVVoxelChunk.gd"
|
||||||
|
@ -58,9 +58,8 @@ adjustment_enabled = true
|
|||||||
]]
|
]]
|
||||||
data_margin_start = 1
|
data_margin_start = 1
|
||||||
data_margin_end = 2
|
data_margin_end = 2
|
||||||
use_threads = false
|
|
||||||
max_concurrent_generations = 4
|
max_concurrent_generations = 4
|
||||||
max_frame_chunk_build_steps = 1
|
max_frame_chunk_build_steps = 4
|
||||||
library = ExtResource( 2 )
|
library = ExtResource( 2 )
|
||||||
level_generator = SubResource( 1 )
|
level_generator = SubResource( 1 )
|
||||||
voxel_scale = 1.6
|
voxel_scale = 1.6
|
||||||
|
@ -71,11 +71,11 @@ func generate_terrarin(chunk : VoxelChunk, spawn_mobs: bool) -> void:
|
|||||||
|
|
||||||
|
|
||||||
if v < 2:
|
if v < 2:
|
||||||
chunk.set_voxel(1, x, y, z, VoxelChunk.DEFAULT_CHANNEL_TYPE)
|
chunk.set_voxel(1, x, y, z, VoxelChunkDefault.DEFAULT_CHANNEL_TYPE)
|
||||||
elif v == 2:
|
elif v == 2:
|
||||||
chunk.set_voxel(3, x, y, z, VoxelChunk.DEFAULT_CHANNEL_TYPE)
|
chunk.set_voxel(3, x, y, z, VoxelChunkDefault.DEFAULT_CHANNEL_TYPE)
|
||||||
else:
|
else:
|
||||||
chunk.set_voxel(2, x, y, z, VoxelChunk.DEFAULT_CHANNEL_TYPE)
|
chunk.set_voxel(2, x, y, z, VoxelChunkDefault.DEFAULT_CHANNEL_TYPE)
|
||||||
|
|
||||||
# if y == v - 1:
|
# if y == v - 1:
|
||||||
# chunk.set_voxel(int(255.0 * (val - int(val))), x, y, z, VoxelChunk.DEFAULT_CHANNEL_ISOLEVEL)
|
# chunk.set_voxel(int(255.0 * (val - int(val))), x, y, z, VoxelChunk.DEFAULT_CHANNEL_ISOLEVEL)
|
||||||
@ -87,7 +87,7 @@ func generate_terrarin(chunk : VoxelChunk, spawn_mobs: bool) -> void:
|
|||||||
val2 = int(val2)
|
val2 = int(val2)
|
||||||
val2 /= 4.0
|
val2 /= 4.0
|
||||||
|
|
||||||
chunk.set_voxel(int(255.0 * val2), x, y, z, VoxelChunk.DEFAULT_CHANNEL_ISOLEVEL)
|
chunk.set_voxel(int(255.0 * val2), x, y, z, VoxelChunkDefault.DEFAULT_CHANNEL_ISOLEVEL)
|
||||||
# chunk.set_voxel(int(255.0 * (val - int(val)) / 180.0) * 180, x, y, z, VoxelChunk.DEFAULT_CHANNEL_ISOLEVEL)
|
# chunk.set_voxel(int(255.0 * (val - int(val)) / 180.0) * 180, x, y, z, VoxelChunk.DEFAULT_CHANNEL_ISOLEVEL)
|
||||||
# chunk.set_voxel(int(255.0 * (val - int(val))), x, y, z, VoxelChunk.DEFAULT_CHANNEL_ISOLEVEL)
|
# chunk.set_voxel(int(255.0 * (val - int(val))), x, y, z, VoxelChunk.DEFAULT_CHANNEL_ISOLEVEL)
|
||||||
|
|
||||||
|
@ -36,23 +36,23 @@ func _generate_chunk(chunk : VoxelChunk, spawn_mobs: bool) -> void:
|
|||||||
for y in range(0, 4):
|
for y in range(0, 4):
|
||||||
for x in range(-4, 5):
|
for x in range(-4, 5):
|
||||||
for z in range(-4, 5):
|
for z in range(-4, 5):
|
||||||
if chunk.get_voxel(hs + x, y, hs + z, VoxelChunk.DEFAULT_CHANNEL_TYPE) != 0:
|
if chunk.get_voxel(hs + x, y, hs + z, VoxelChunkDefault.DEFAULT_CHANNEL_TYPE) != 0:
|
||||||
chunk.set_voxel(4, hs + x, y, hs + z, VoxelChunk.DEFAULT_CHANNEL_TYPE)
|
chunk.set_voxel(4, hs + x, y, hs + z, VoxelChunkDefault.DEFAULT_CHANNEL_TYPE)
|
||||||
|
|
||||||
|
|
||||||
for x in range(-5, 5):
|
for x in range(-5, 5):
|
||||||
for z in [-5, 4]:
|
for z in [-5, 4]:
|
||||||
for y in range(0, randi() % 5):
|
for y in range(0, randi() % 5):
|
||||||
if chunk.get_voxel(hs + x, y, hs + z, VoxelChunk.DEFAULT_CHANNEL_TYPE) == 0:
|
if chunk.get_voxel(hs + x, y, hs + z, VoxelChunkDefault.DEFAULT_CHANNEL_TYPE) == 0:
|
||||||
chunk.set_voxel(4, hs + x, y, hs + z, VoxelChunk.DEFAULT_CHANNEL_TYPE)
|
chunk.set_voxel(4, hs + x, y, hs + z, VoxelChunkDefault.DEFAULT_CHANNEL_TYPE)
|
||||||
chunk.set_voxel(10, hs + x, y, hs + z, VoxelChunk.DEFAULT_CHANNEL_ISOLEVEL)
|
chunk.set_voxel(10, hs + x, y, hs + z, VoxelChunkDefault.DEFAULT_CHANNEL_ISOLEVEL)
|
||||||
|
|
||||||
for x in [-5, 5]:
|
for x in [-5, 5]:
|
||||||
for z in range(-5, 4):
|
for z in range(-5, 4):
|
||||||
for y in range(0, randi() % 5):
|
for y in range(0, randi() % 5):
|
||||||
if chunk.get_voxel(hs + x, y, hs + z, VoxelChunk.DEFAULT_CHANNEL_TYPE) == 0:
|
if chunk.get_voxel(hs + x, y, hs + z, VoxelChunkDefault.DEFAULT_CHANNEL_TYPE) == 0:
|
||||||
chunk.set_voxel(4, hs + x, y, hs + z, VoxelChunk.DEFAULT_CHANNEL_TYPE)
|
chunk.set_voxel(4, hs + x, y, hs + z, VoxelChunkDefault.DEFAULT_CHANNEL_TYPE)
|
||||||
chunk.set_voxel(10, hs + x, y, hs + z, VoxelChunk.DEFAULT_CHANNEL_ISOLEVEL)
|
chunk.set_voxel(10, hs + x, y, hs + z, VoxelChunkDefault.DEFAULT_CHANNEL_ISOLEVEL)
|
||||||
|
|
||||||
# var num : int = randi() % 10 + 7
|
# var num : int = randi() % 10 + 7
|
||||||
# for i in range(num):
|
# for i in range(num):
|
||||||
@ -60,41 +60,41 @@ func _generate_chunk(chunk : VoxelChunk, spawn_mobs: bool) -> void:
|
|||||||
# var z : int = randi() % 12 - 6
|
# var z : int = randi() % 12 - 6
|
||||||
#
|
#
|
||||||
# for y in range(4, 1, -1):
|
# for y in range(4, 1, -1):
|
||||||
# if chunk.get_voxel(hs + x, y, hs + z, VoxelChunk.DEFAULT_CHANNEL_TYPE) != 0:
|
# if chunk.get_voxel(hs + x, y, hs + z, VoxelChunkDefault.DEFAULT_CHANNEL_TYPE) != 0:
|
||||||
# chunk.set_voxel(1, hs + x, y + 1, hs + z, VoxelChunk.DEFAULT_CHANNEL_TYPE)
|
# chunk.set_voxel(1, hs + x, y + 1, hs + z, VoxelChunkDefault.DEFAULT_CHANNEL_TYPE)
|
||||||
# chunk.set_voxel(100, hs + x, y + 1, hs + z, VoxelChunk.DEFAULT_CHANNEL_ISOLEVEL)
|
# chunk.set_voxel(100, hs + x, y + 1, hs + z, VoxelChunkDefault.DEFAULT_CHANNEL_ISOLEVEL)
|
||||||
# break
|
# break
|
||||||
|
|
||||||
for y in range(-chunk.get_margin_start(), chunk.size_y + chunk.get_margin_end()):
|
for y in range(-chunk.get_margin_start(), chunk.size_y + chunk.get_margin_end()):
|
||||||
for x in range(0, 2):
|
for x in range(0, 2):
|
||||||
for z in range(0, 2):
|
for z in range(0, 2):
|
||||||
chunk.set_voxel(0, hs + x, y, hs + z, VoxelChunk.DEFAULT_CHANNEL_TYPE)
|
chunk.set_voxel(0, hs + x, y, hs + z, VoxelChunkDefault.DEFAULT_CHANNEL_TYPE)
|
||||||
|
|
||||||
for y in range(3, chunk.get_size_y() / 2):
|
for y in range(3, chunk.get_size_y() / 2):
|
||||||
chunk.set_voxel(4, hs, y, hs, VoxelChunk.DEFAULT_CHANNEL_TYPE)
|
chunk.set_voxel(4, hs, y, hs, VoxelChunkDefault.DEFAULT_CHANNEL_TYPE)
|
||||||
chunk.set_voxel((16 - y) * 8, hs, y, hs, VoxelChunk.DEFAULT_CHANNEL_ISOLEVEL)
|
chunk.set_voxel((16 - y) * 8, hs, y, hs, VoxelChunkDefault.DEFAULT_CHANNEL_ISOLEVEL)
|
||||||
|
|
||||||
if chunk.position_y == -1:
|
if chunk.position_y == -1:
|
||||||
for y in range(chunk.get_size_y() - sizey - 1, chunk.get_size_y()):
|
for y in range(chunk.get_size_y() - sizey - 1, chunk.get_size_y()):
|
||||||
for x in range(hs - 1, hs + sizex + 1):
|
for x in range(hs - 1, hs + sizex + 1):
|
||||||
for z in range(hs - 1, hs + sizez + 1):
|
for z in range(hs - 1, hs + sizez + 1):
|
||||||
chunk.set_voxel(4, x, y, z, VoxelChunk.DEFAULT_CHANNEL_TYPE)
|
chunk.set_voxel(4, x, y, z, VoxelChunkDefault.DEFAULT_CHANNEL_TYPE)
|
||||||
chunk.set_voxel(255, x, y, z, VoxelChunk.DEFAULT_CHANNEL_ISOLEVEL)
|
chunk.set_voxel(255, x, y, z, VoxelChunkDefault.DEFAULT_CHANNEL_ISOLEVEL)
|
||||||
|
|
||||||
for y in range(chunk.get_size_y() - sizey + 1, chunk.size_y + chunk.get_margin_end()):
|
for y in range(chunk.get_size_y() - sizey + 1, chunk.size_y + chunk.get_margin_end()):
|
||||||
for x in range(0, 2):
|
for x in range(0, 2):
|
||||||
for z in range(0, 2):
|
for z in range(0, 2):
|
||||||
chunk.set_voxel(0, hs + x, y, hs + z, VoxelChunk.DEFAULT_CHANNEL_TYPE)
|
chunk.set_voxel(0, hs + x, y, hs + z, VoxelChunkDefault.DEFAULT_CHANNEL_TYPE)
|
||||||
|
|
||||||
|
|
||||||
for y in range(chunk.get_size_y() - sizey, chunk.get_size_y() - 1):
|
for y in range(chunk.get_size_y() - sizey, chunk.get_size_y() - 1):
|
||||||
for x in range(hs, hs + sizex):
|
for x in range(hs, hs + sizex):
|
||||||
for z in range(hs, hs + sizez):
|
for z in range(hs, hs + sizez):
|
||||||
chunk.set_voxel(0, x, y, z, VoxelChunk.DEFAULT_CHANNEL_TYPE)
|
chunk.set_voxel(0, x, y, z, VoxelChunkDefault.DEFAULT_CHANNEL_TYPE)
|
||||||
|
|
||||||
for x in range(0, 2):
|
for x in range(0, 2):
|
||||||
for z in range(0, 2):
|
for z in range(0, 2):
|
||||||
chunk.set_voxel(3, hs + x, chunk.get_size_y() - sizey, hs + z, VoxelChunk.DEFAULT_CHANNEL_TYPE)
|
chunk.set_voxel(3, hs + x, chunk.get_size_y() - sizey, hs + z, VoxelChunkDefault.DEFAULT_CHANNEL_TYPE)
|
||||||
chunk.set_voxel(30, x, chunk.get_size_y() - sizey, z, VoxelChunk.DEFAULT_CHANNEL_ISOLEVEL)
|
chunk.set_voxel(30, x, chunk.get_size_y() - sizey, z, VoxelChunkDefault.DEFAULT_CHANNEL_ISOLEVEL)
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
tool
|
tool
|
||||||
extends VoxelChunk
|
extends VoxelChunkDefault
|
||||||
class_name TVVoxelChunk
|
class_name TVVoxelChunk
|
||||||
|
|
||||||
# Copyright Péter Magyar relintai@gmail.com
|
# Copyright Péter Magyar relintai@gmail.com
|
||||||
@ -54,6 +54,8 @@ func _create_meshers():
|
|||||||
mesher.base_light_value = 0.45
|
mesher.base_light_value = 0.45
|
||||||
mesher.ao_strength = 0.2
|
mesher.ao_strength = 0.2
|
||||||
mesher.uv_margin = Rect2(0.017, 0.017, 1 - 0.034, 1 - 0.034)
|
mesher.uv_margin = Rect2(0.017, 0.017, 1 - 0.034, 1 - 0.034)
|
||||||
|
mesher.lod_size = lod_size
|
||||||
|
mesher.voxel_scale = voxel_scale
|
||||||
add_mesher(mesher)
|
add_mesher(mesher)
|
||||||
|
|
||||||
#add_mesher(VoxelMesherCubic.new())
|
#add_mesher(VoxelMesherCubic.new())
|
||||||
@ -209,14 +211,14 @@ func get_prop_mesh_transform(base_transform : Transform, snap_to_mesh: bool, sna
|
|||||||
func _build_phase(phase):
|
func _build_phase(phase):
|
||||||
|
|
||||||
# print(name + " " + str(phase))
|
# print(name + " " + str(phase))
|
||||||
if phase == VoxelChunk.BUILD_PHASE_LIGHTS:
|
if phase == VoxelChunkDefault.BUILD_PHASE_LIGHTS:
|
||||||
clear_baked_lights()
|
clear_baked_lights()
|
||||||
generate_random_ao()
|
generate_random_ao()
|
||||||
bake_lights()
|
bake_lights()
|
||||||
#set_physics_process_internal(true)
|
#set_physics_process_internal(true)
|
||||||
active_build_phase_type = VoxelChunk.BUILD_PHASE_TYPE_PHYSICS_PROCESS
|
active_build_phase_type = VoxelChunkDefault.BUILD_PHASE_TYPE_PHYSICS_PROCESS
|
||||||
return
|
return
|
||||||
# elif phase == VoxelChunk.BUILD_PHASE_TERRARIN_MESH:
|
# elif phase == VoxelChunkDefault.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)
|
||||||
@ -279,11 +281,11 @@ func _build_phase(phase):
|
|||||||
# next_phase();
|
# next_phase();
|
||||||
#
|
#
|
||||||
# return
|
# return
|
||||||
elif phase == VoxelChunk.BUILD_PHASE_PROP_MESH:
|
elif phase == VoxelChunkDefault.BUILD_PHASE_PROP_MESH:
|
||||||
# set_physics_process_internal(true)
|
# set_physics_process_internal(true)
|
||||||
active_build_phase_type = VoxelChunk.BUILD_PHASE_TYPE_PHYSICS_PROCESS
|
active_build_phase_type = VoxelChunkDefault.BUILD_PHASE_TYPE_PHYSICS_PROCESS
|
||||||
return
|
return
|
||||||
elif phase == VoxelChunk.BUILD_PHASE_FINALIZE:
|
elif phase == VoxelChunkDefault.BUILD_PHASE_FINALIZE:
|
||||||
_notification(NOTIFICATION_TRANSFORM_CHANGED)
|
_notification(NOTIFICATION_TRANSFORM_CHANGED)
|
||||||
|
|
||||||
._build_phase(phase)
|
._build_phase(phase)
|
||||||
@ -313,19 +315,19 @@ func generate_random_ao() -> void:
|
|||||||
if val < 0:
|
if val < 0:
|
||||||
val = -val
|
val = -val
|
||||||
|
|
||||||
set_voxel(int(val * 255.0), x, y, z, VoxelChunk.DEFAULT_CHANNEL_RANDOM_AO)
|
set_voxel(int(val * 255.0), x, y, z, VoxelChunkDefault.DEFAULT_CHANNEL_RANDOM_AO)
|
||||||
|
|
||||||
func _build_phase_physics_process(phase):
|
func _build_phase_physics_process(phase):
|
||||||
if current_build_phase == VoxelChunk.BUILD_PHASE_LIGHTS:
|
if current_build_phase == VoxelChunkDefault.BUILD_PHASE_LIGHTS:
|
||||||
build_phase_lights()
|
build_phase_lights()
|
||||||
# set_physics_process_internal(false)
|
# set_physics_process_internal(false)
|
||||||
active_build_phase_type = VoxelChunk.BUILD_PHASE_TYPE_NORMAL
|
active_build_phase_type = VoxelChunkDefault.BUILD_PHASE_TYPE_NORMAL
|
||||||
next_phase()
|
next_phase()
|
||||||
|
|
||||||
elif current_build_phase == VoxelChunk.BUILD_PHASE_PROP_MESH:
|
elif current_build_phase == VoxelChunkDefault.BUILD_PHASE_PROP_MESH:
|
||||||
build_phase_prop_mesh()
|
build_phase_prop_mesh()
|
||||||
# set_physics_process_internal(false)
|
# set_physics_process_internal(false)
|
||||||
active_build_phase_type = VoxelChunk.BUILD_PHASE_TYPE_NORMAL
|
active_build_phase_type = VoxelChunkDefault.BUILD_PHASE_TYPE_NORMAL
|
||||||
next_phase()
|
next_phase()
|
||||||
else:
|
else:
|
||||||
._build_phase_physics_process(phase)
|
._build_phase_physics_process(phase)
|
||||||
|
Loading…
Reference in New Issue
Block a user