From 3ac2fb62b67b6446ab31b2455a4cb74069f1c54f Mon Sep 17 00:00:00 2001 From: dusoleil Date: Sun, 18 Sep 2022 07:45:13 -0400 Subject: Add ChunkLoader to World Generation Break up world gen into chunk and offload generating them to a Chunk Loader. The World figures out which chunks should be loaded and gives this to the Chunk Loader. The Chunk Loader frees any chunks out of render distance. It also picks an unloaded chunk and gives it to a worker thread to generate it. --- Chunk.tscn | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'Chunk.tscn') diff --git a/Chunk.tscn b/Chunk.tscn index 0d0771e..0437a7e 100644 --- a/Chunk.tscn +++ b/Chunk.tscn @@ -1,33 +1,34 @@ -[gd_scene load_steps=6 format=2] +[gd_scene load_steps=7 format=2] -[ext_resource path="res://Chunk.gd" type="Script" id=1] +[ext_resource path="res://ChunkedCSGMesh.gd" type="Script" id=3] [sub_resource type="SphereShape" id=1] radius = 50.0 -[sub_resource type="PlaneMesh" id=2] -size = Vector2( 100, 100 ) - [sub_resource type="SpatialMaterial" id=3] flags_unshaded = true params_cull_mode = 2 albedo_color = Color( 0.937255, 0, 1, 1 ) +[sub_resource type="PlaneMesh" id=2] +size = Vector2( 100, 100 ) + [sub_resource type="PlaneMesh" id=4] size = Vector2( 98, 98 ) [node name="Chunk" type="Area"] collision_layer = 32 collision_mask = 0 -script = ExtResource( 1 ) [node name="Size" type="CollisionShape" parent="."] shape = SubResource( 1 ) [node name="Border" type="CSGMesh" parent="."] -mesh = SubResource( 2 ) -material = SubResource( 3 ) +material_override = SubResource( 3 ) +script = ExtResource( 3 ) +_mesh = SubResource( 2 ) [node name="CSGMesh" type="CSGMesh" parent="Border"] operation = 2 -mesh = SubResource( 4 ) +script = ExtResource( 3 ) +_mesh = SubResource( 4 ) -- cgit v1.2.3