extends Node3D

@onready var world_environment: WorldEnvironment = $Environment/WorldEnvironment


func _ready() -> void:
	GameState.game_map = self
	call_deferred("_init_noise")


func _init_noise() -> void:
	var noise: FastNoiseLite = FastNoiseLite.new()
	noise.noise_type = FastNoiseLite.TYPE_SIMPLEX_SMOOTH
	noise.seed = 2
	noise.frequency = 0.1278
	noise.fractal_type = FastNoiseLite.FRACTAL_PING_PONG
	var tex: NoiseTexture3D = NoiseTexture3D.new()
	tex.width = 32
	tex.height = 32
	tex.depth = 128
	tex.noise = noise
	await tex.changed

	var sky_shader: ShaderMaterial = world_environment.environment.sky.sky_material
	sky_shader.set_shader_parameter("base_noise", tex)
