From d0a0d6ec3937596ccf459624f9dd7ed038115a58 Mon Sep 17 00:00:00 2001 From: Relintai Date: Fri, 14 Feb 2020 03:25:41 +0100 Subject: [PATCH] Update HEADS to get the indexing/Cubic Mesher improvements from Voxelman. Updated most of the level generation logic. (A few errors still get printed to the console though.) Right now (temporarily) only the Cubic Mesher's mesh is visible. --- HEADS | 2 +- game/scenes/Menu.tscn | 3 ++- game/scenes/World.tscn | 3 +++ game/scripts/biomes/simple_biome.gd | 13 +++++-------- game/voxelman/world/TVVoxelChunk.gd | 5 ++--- game/voxelman/world/TestVoxelMesher.gd | 2 +- 6 files changed, 14 insertions(+), 14 deletions(-) diff --git a/HEADS b/HEADS index 8214cffb..a091401d 100644 --- a/HEADS +++ b/HEADS @@ -1 +1 @@ -{"engine": {"3.2": "8a0f94a688f18a9565a21657bf44791550aec96a", "master": "8c73e813134001e575b6f59e3b0100471c007410"}, "world_generator": {"master": "09372b146936fda509f5c23a522e998d12f38e13"}, "entity_spell_system": {"master": "0bdf71c431b62b24d56c1fc178dbcb792e5dca3d"}, "ui_extensions": {"master": "38acc650db260a831dc26ca96fe9d9a087230bdc"}, "voxelman": {"master": "8b08a9b14ff98f54a3658a9b79f247bafd723d44"}, "texture_packer": {"master": "b17c174906f84de93d84aa60d010ffe603efaa28"}, "fastnoise": {"master": "41b7ea05a1f7aa2b8ecddaa1fd739e64d6970f7e"}, "mesh_data_resource": {"master": "4bda19b12be2c2a79a6121de6d22e48f3934e726"}, "procedural_animations": {"master": "00f6c128bd0e9799b7f7f86e118ed68277fbe27d"}, "fast_quadratic_mesh_simplifier": {"master": "d3f3a829eff40a93464f6b321c13ce26d44e11e3"}, "ess_data": {"master": "3bd637fdd3304b64a18287a49a6b7387acf2f5de"}, "prop_tool": {"master": "df438053ebc900966f8f842fc65f0264f1271d49"}} \ No newline at end of file +{"engine": {"3.2": "8a0f94a688f18a9565a21657bf44791550aec96a", "master": "8c73e813134001e575b6f59e3b0100471c007410"}, "world_generator": {"master": "09372b146936fda509f5c23a522e998d12f38e13"}, "entity_spell_system": {"master": "0bdf71c431b62b24d56c1fc178dbcb792e5dca3d"}, "ui_extensions": {"master": "38acc650db260a831dc26ca96fe9d9a087230bdc"}, "voxelman": {"master": "a457ed400c3980b40fe800ea43fdb7a0870079a2"}, "texture_packer": {"master": "b17c174906f84de93d84aa60d010ffe603efaa28"}, "fastnoise": {"master": "41b7ea05a1f7aa2b8ecddaa1fd739e64d6970f7e"}, "mesh_data_resource": {"master": "4bda19b12be2c2a79a6121de6d22e48f3934e726"}, "procedural_animations": {"master": "00f6c128bd0e9799b7f7f86e118ed68277fbe27d"}, "fast_quadratic_mesh_simplifier": {"master": "655be02357fb4fd9d8d1b537758c1599fb37bb15"}, "ess_data": {"master": "3bd637fdd3304b64a18287a49a6b7387acf2f5de"}, "prop_tool": {"master": "df438053ebc900966f8f842fc65f0264f1271d49"}} \ No newline at end of file diff --git a/game/scenes/Menu.tscn b/game/scenes/Menu.tscn index fa456255..269fee7d 100644 --- a/game/scenes/Menu.tscn +++ b/game/scenes/Menu.tscn @@ -20,7 +20,6 @@ [ext_resource path="res://scripts/world_generators/MainPlanetGenerator.gd" type="Script" id=18] [ext_resource path="res://scripts/settings/DirectionalLightSettings.gd" type="Script" id=19] - [sub_resource type="VoxelmanLevelGenerator" id=1] script = ExtResource( 18 ) _force_planet = -1 @@ -563,6 +562,8 @@ current = true [node name="World" type="VoxelWorld" parent="." groups=[ "save", ]] +data_margin_start = 1 +data_margin_end = 2 use_threads = false max_concurrent_generations = 1 library = ExtResource( 17 ) diff --git a/game/scenes/World.tscn b/game/scenes/World.tscn index 54315c7a..bd238380 100644 --- a/game/scenes/World.tscn +++ b/game/scenes/World.tscn @@ -56,10 +56,13 @@ adjustment_enabled = true [node name="World" type="VoxelWorld" groups=[ "save", ]] +data_margin_start = 1 +data_margin_end = 2 use_threads = false max_concurrent_generations = 1 library = ExtResource( 2 ) level_generator = SubResource( 1 ) +voxel_scale = 1.3 chunk_spawn_range = 3 script = ExtResource( 8 ) diff --git a/game/scripts/biomes/simple_biome.gd b/game/scripts/biomes/simple_biome.gd index 296500f8..224b3241 100644 --- a/game/scripts/biomes/simple_biome.gd +++ b/game/scripts/biomes/simple_biome.gd @@ -26,9 +26,6 @@ func _generate_chunk(chunk: VoxelChunk, spawn_mobs: bool) -> void: generate_terrarin(chunk, spawn_mobs) func generate_terrarin(chunk : VoxelChunk, spawn_mobs: bool) -> void: -# chunk.create(int(chunk.size_x) + 1, int(chunk.size_y) + 1, int(chunk.size_z) + 1) - chunk.set_size(int(chunk.size_x), int(chunk.size_y), int(chunk.size_z), 0, 1) - var noise : OpenSimplexNoise = OpenSimplexNoise.new() noise.seed = 10 * current_seed noise.octaves = 4 @@ -47,8 +44,8 @@ func generate_terrarin(chunk : VoxelChunk, spawn_mobs: bool) -> void: det_noise.period = 80.0 det_noise.persistence = 0.3 - for x in range(0, chunk.size_x + 1): - for z in range(0, chunk.size_z + 1): + for x in range(-chunk.get_margin_start(), chunk.size_x + chunk.get_margin_end()): + for z in range(-chunk.get_margin_start(), chunk.size_z + chunk.get_margin_end()): var val : float = noise.get_noise_2d(x + (chunk.position_x * chunk.size_x), z + (chunk.position_z * chunk.size_z)) val *= val val *= 200 @@ -66,10 +63,10 @@ func generate_terrarin(chunk : VoxelChunk, spawn_mobs: bool) -> void: v -= chunk.position_y * (chunk.size_y) - if v > chunk.size_y + 1: - v = chunk.size_y + 1 + if v > chunk.size_y + chunk.get_margin_end(): + v = chunk.size_y + chunk.get_margin_end() - for y in range(0, v): + for y in range(-chunk.get_margin_start(), v): seed(x + (chunk.position_x * chunk.size_x) + z + (chunk.position_z * chunk.size_z) + y + (chunk.position_y * chunk.size_y)) diff --git a/game/voxelman/world/TVVoxelChunk.gd b/game/voxelman/world/TVVoxelChunk.gd index a7918280..5f426f7a 100644 --- a/game/voxelman/world/TVVoxelChunk.gd +++ b/game/voxelman/world/TVVoxelChunk.gd @@ -47,12 +47,11 @@ func _create_meshers(): var mesher : TVVoxelMesher = TVVoxelMesher.new() mesher.base_light_value = 0.45 mesher.ao_strength = 0.2 -# var m : float = 1.0 / 16.0 - mesher.uv_margin = Rect2(0.017, 0.017, 1 - 0.034, 1 - 0.034) - add_mesher(mesher) + add_mesher(VoxelMesherCubic.new()) + _prop_texture_packer = TexturePacker.new() _prop_texture_packer.max_atlas_size = 1024 _prop_texture_packer.margin = 1 diff --git a/game/voxelman/world/TestVoxelMesher.gd b/game/voxelman/world/TestVoxelMesher.gd index 0d67d72e..ca929a6b 100644 --- a/game/voxelman/world/TestVoxelMesher.gd +++ b/game/voxelman/world/TestVoxelMesher.gd @@ -373,7 +373,7 @@ func get_case_code(buffer : VoxelChunk, x : int, y : int, z : int, size : int = return case_code -func _add_chunk(buffer : VoxelChunk) -> void: +func _add_chunk(buffer : Node) -> void: var x_size : int = buffer.get_size_x() - 1 var y_size : int = buffer.get_size_y() - 1 var z_size : int = buffer.get_size_z() - 1