Updated voxelman to the latest. Mesher/job creation now have to be handled by the world's _create_chunk.

This commit is contained in:
Relintai 2020-10-06 20:10:30 +02:00
parent e9ade41995
commit bfd41efd2e
3 changed files with 56 additions and 6 deletions

2
HEADS
View File

@ -1 +1 @@
{"engine": {"3.2": "4162df439727fad01b0d1240df69f59ba97ed422", "master": "8c73e813134001e575b6f59e3b0100471c007410"}, "world_generator": {"master": "c7a98e704dd62782b9f8b4a22b74787278574657"}, "entity_spell_system": {"master": "cdc8b7830daf3341871be1c9b38eceeed947f4a1"}, "ui_extensions": {"master": "ca7df8435154d1146be36c4fc97e6cc7092d3eb9"}, "voxelman": {"master": "3add3daef4c4f90a435ffff68a5714c3921634f5"}, "texture_packer": {"master": "f98b7410cd3f2a743cb57456910ad9f93ef89937"}, "fastnoise": {"master": "d0e3f1c759332cf0d9a5d7e0e71d0b0278310651"}, "mesh_data_resource": {"master": "6c99ddcaa6203e77163b4770e7af95bc2a181e3d"}, "procedural_animations": {"master": "ec465a7a683a047cd373959bb022bde1321fb72d"}, "ess_data": {"master": "3bd637fdd3304b64a18287a49a6b7387acf2f5de"}, "props": {"master": "bfb60df21570415b1860c25c2dae7722cf158ed9"}, "mesh_utils": {"master": "3365df3faf89a4c29c3b4664b53e9007e4e6267b"}, "broken_seals_module": {"master": "9f89e2a4e7b59351ac4cb4c4dc5f88e5b60a2f15"}, "thread_pool": {"master": "b1030eaf92ba595c56ae8caac90b58081303d16f"}} {"engine": {"3.2": "4162df439727fad01b0d1240df69f59ba97ed422", "master": "8c73e813134001e575b6f59e3b0100471c007410"}, "world_generator": {"master": "c7a98e704dd62782b9f8b4a22b74787278574657"}, "entity_spell_system": {"master": "cdc8b7830daf3341871be1c9b38eceeed947f4a1"}, "ui_extensions": {"master": "ca7df8435154d1146be36c4fc97e6cc7092d3eb9"}, "voxelman": {"master": "90fe105b54c85b80735df4544e980fcc5e5fe32b"}, "texture_packer": {"master": "f98b7410cd3f2a743cb57456910ad9f93ef89937"}, "fastnoise": {"master": "d0e3f1c759332cf0d9a5d7e0e71d0b0278310651"}, "mesh_data_resource": {"master": "6c99ddcaa6203e77163b4770e7af95bc2a181e3d"}, "procedural_animations": {"master": "ec465a7a683a047cd373959bb022bde1321fb72d"}, "ess_data": {"master": "3bd637fdd3304b64a18287a49a6b7387acf2f5de"}, "props": {"master": "bfb60df21570415b1860c25c2dae7722cf158ed9"}, "mesh_utils": {"master": "3365df3faf89a4c29c3b4664b53e9007e4e6267b"}, "broken_seals_module": {"master": "9f89e2a4e7b59351ac4cb4c4dc5f88e5b60a2f15"}, "thread_pool": {"master": "b1030eaf92ba595c56ae8caac90b58081303d16f"}}

View File

@ -37,6 +37,13 @@ var _prop_mesh_rid : RID
# add_mesh_data_resource(get_transform().scaled(Vector3(10, 10, 10)), ResourceLoader.load("res://modules/species/Human/Female/character_models/huf_calf_left.gltf")) # add_mesh_data_resource(get_transform().scaled(Vector3(10, 10, 10)), ResourceLoader.load("res://modules/species/Human/Female/character_models/huf_calf_left.gltf"))
# add_mesh_data_resource(get_transform().translated(Vector3(0, 4, 0)), ResourceLoader.load("res://modules/species/Human/Female/character_models/huf_calf_left.gltf")) # add_mesh_data_resource(get_transform().translated(Vector3(0, 4, 0)), ResourceLoader.load("res://modules/species/Human/Female/character_models/huf_calf_left.gltf"))
#func _init():
# _prop_texture_packer = TexturePacker.new()
# _prop_texture_packer.max_atlas_size = 1024
# _prop_texture_packer.margin = 1
# _prop_texture_packer.background_color = Color(0, 0, 0, 1)
# _prop_texture_packer.texture_flags = Texture.FLAG_MIPMAPS
func _create_meshers(): func _create_meshers():
var tj : VoxelTerrarinJob = VoxelTerrarinJob.new() var tj : VoxelTerrarinJob = VoxelTerrarinJob.new()
@ -64,7 +71,6 @@ func _create_meshers():
mesher.channel_index_isolevel = VoxelChunkDefault.DEFAULT_CHANNEL_ISOLEVEL mesher.channel_index_isolevel = VoxelChunkDefault.DEFAULT_CHANNEL_ISOLEVEL
tj.add_mesher(mesher) tj.add_mesher(mesher)
var cmesher : VoxelMesherBlocky = VoxelMesherBlocky.new() var cmesher : VoxelMesherBlocky = VoxelMesherBlocky.new()
cmesher.texture_scale = 3 cmesher.texture_scale = 3
cmesher.base_light_value = 0.45 cmesher.base_light_value = 0.45

View File

@ -202,12 +202,56 @@ func get_chunk_lod_level(x : int, y : int, z : int, default : int) -> int:
return ch.lod_size return ch.lod_size
func _create_chunk(x : int, y : int, z : int, pchunk : VoxelChunk) -> VoxelChunk: func _create_chunk(x : int, y : int, z : int, pchunk : VoxelChunk) -> VoxelChunk:
var chunk : VoxelChunk = TVVoxelChunk.new() if !pchunk:
pchunk = TVVoxelChunk.new()
#chunk.meshing_create_collider = false var tj : VoxelTerrarinJob = VoxelTerrarinJob.new()
var lj : VoxelLightJob = VoxelLightJob.new()
var pj : VoxelPropJob = VoxelPropJob.new()
var prop_mesher = TVVoxelMesher.new()
prop_mesher.base_light_value = 0.45
prop_mesher.ao_strength = 0.2
prop_mesher.uv_margin = Rect2(0.017, 0.017, 1 - 0.034, 1 - 0.034)
prop_mesher.voxel_scale = voxel_scale
prop_mesher.build_flags = build_flags
prop_mesher.texture_scale = 3
pj.set_prop_mesher(prop_mesher);
# print("added " + str(Vector3(x, y, z))) var mesher : TVVoxelMesher = TVVoxelMesher.new()
return ._create_chunk(x, y, z, chunk) mesher.base_light_value = 0.45
mesher.ao_strength = 0.2
mesher.uv_margin = Rect2(0.017, 0.017, 1 - 0.034, 1 - 0.034)
mesher.voxel_scale = voxel_scale
mesher.build_flags = build_flags
mesher.texture_scale = 3
mesher.channel_index_type = VoxelChunkDefault.DEFAULT_CHANNEL_TYPE
mesher.channel_index_isolevel = VoxelChunkDefault.DEFAULT_CHANNEL_ISOLEVEL
tj.add_mesher(mesher)
var cmesher : VoxelMesherBlocky = VoxelMesherBlocky.new()
cmesher.texture_scale = 3
cmesher.base_light_value = 0.45
cmesher.ao_strength = 0.2
cmesher.voxel_scale = voxel_scale
cmesher.build_flags = build_flags
if cmesher.build_flags & VoxelChunkDefault.BUILD_FLAG_USE_LIGHTING != 0:
cmesher.build_flags = cmesher.build_flags ^ VoxelChunkDefault.BUILD_FLAG_USE_LIGHTING
cmesher.always_add_colors = true
# cmesher.channel_index_type = VoxelChunkDefault.DEFAULT_CHANNEL_TYPE
cmesher.channel_index_type = VoxelChunkDefault.DEFAULT_CHANNEL_ALT_TYPE
tj.add_mesher(cmesher)
pchunk.add_job(lj)
pchunk.add_job(tj)
pchunk.add_job(pj)
return ._create_chunk(x, y, z, pchunk)
func spawn(start_x : int, start_y : int, start_z : int) -> void: func spawn(start_x : int, start_y : int, start_z : int) -> void:
if not Engine.editor_hint: if not Engine.editor_hint: