summaryrefslogtreecommitdiffstats
path: root/world/chunk/Chunk.gd
diff options
context:
space:
mode:
authordusoleil <howcansocksbereal@gmail.com>2022-09-19 10:32:24 -0400
committerdusoleil <howcansocksbereal@gmail.com>2022-09-19 10:32:24 -0400
commit51a0664a1c2265adddbf4c42d4eda747c8ea8aaf (patch)
tree1bcdb3bcee5a0c1e303d55a001158ec906810329 /world/chunk/Chunk.gd
parent9bc2a0767e15d4dde7fd6231b07882d6456af71e (diff)
downloadgodot_wildjam_49-51a0664a1c2265adddbf4c42d4eda747c8ea8aaf.tar.gz
godot_wildjam_49-51a0664a1c2265adddbf4c42d4eda747c8ea8aaf.zip
Add Levels of Detail per Chunk
Diffstat (limited to '')
-rw-r--r--world/chunk/Chunk.gd37
1 files changed, 26 insertions, 11 deletions
diff --git a/world/chunk/Chunk.gd b/world/chunk/Chunk.gd
index 1860c84..4356caf 100644
--- a/world/chunk/Chunk.gd
+++ b/world/chunk/Chunk.gd
@@ -3,15 +3,30 @@ extends Area
enum LOD {DISTANCE,MID,CLOSE}
var lod = -1
+onready var lod_distance = $"gen_tree/lod_distance"
+onready var lod_mid = $"gen_tree/lod_mid"
+onready var lod_close = $"gen_tree/lod_close"
+
+onready var _collision_enabled = lod_close.collision_layer
+
+func _ready():
+ lod_update()
+
func lod_update():
- return
- for obj in $"gen_tree".get_children():
- match lod:
- LOD.CLOSE:
- obj.lod_close()
- LOD.MID:
- obj.lod_mid()
- LOD.DISTANCE:
- obj.lod_distance()
- _:
- obj.lod_distance()
+ match lod:
+ LOD.CLOSE:
+ lod_distance.visible = false
+ lod_mid.visible = true
+ lod_close.collision_layer = _collision_enabled
+ LOD.MID:
+ lod_distance.visible = false
+ lod_mid.visible = true
+ lod_close.collision_layer = 0
+ LOD.DISTANCE:
+ lod_distance.visible = true
+ lod_mid.visible = false
+ lod_close.collision_layer = 0
+ _:
+ lod_distance.visible = true
+ lod_mid.visible = false
+ lod_close.collision_layer = 0