diff options
Diffstat (limited to 'World.gd')
-rw-r--r-- | World.gd | 29 |
1 files changed, 28 insertions, 1 deletions
@@ -4,7 +4,11 @@ export(NodePath) var traveler = null onready var _traveler = get_node(traveler) export var acceleration = 10.0 -onready var chunk_render_distance = $"ChunkRenderDistance/Radius".shape.radius +onready var lod_distance = $"ChunkRenderDistance" +onready var lod_mid = $"ChunkRenderMid" +onready var lod_close = $"ChunkRenderClose" + +onready var chunk_render_distance = lod_distance.get_node("Radius").shape.radius onready var chunk_half_size = $"Chunks/Chunk/Size".shape.radius onready var chunk_size = chunk_half_size * 2.0 @@ -13,9 +17,32 @@ func _ready(): ChunkLoader.world = self ChunkGen.chunk_half_size = self.chunk_half_size +func _on_ChunkRenderDistance_area_entered(area:Area): + if area.lod < area.LOD.DISTANCE: + area.lod = area.LOD.DISTANCE + area.lod_update() + +func _on_ChunkRenderMid_area_entered(area:Area): + if area.lod < area.LOD.MID: + area.lod = area.LOD.MID + area.lod_update() + +func _on_ChunkRenderClose_area_entered(area:Area): + if area.lod < area.LOD.CLOSE: + area.lod = area.LOD.CLOSE + area.lod_update() + func _on_ChunkRenderDistance_area_exited(area:Area): area.queue_free() +func _on_ChunkRenderMid_area_exited(area:Area): + area.lod = area.LOD.DISTANCE + area.lod_update() + +func _on_ChunkRenderClose_area_exited(area:Area): + area.lod = area.LOD.MID + area.lod_update() + func travel(direction:Vector3): var heading = _traveler.global_transform.basis heading = Basis(Vector3.UP*heading.get_euler().y) |