stick-the-quick/test/SkyTestEnvironment.gd

58 lines
1.5 KiB
GDScript3
Raw Normal View History

@tool class_name SkyTestEnvironment extends WorldEnvironment
const REAL_ENVIRONMENT := preload("res://vfx/Environment.tres") as Environment
var _night: float = 0.0
var _overcast: float = 0.25
var _windy: float = 0.25
var _bright: float = 0.25
var _twist: float = 0.0
var _psychedelic: float = 0.0
@export_range(0.0, 1.0) var night: float:
get: return _night
set(value):
_night = value
_rebuild_environment()
@export_range(0.0, 1.0) var overcast: float:
get: return _overcast
set(value):
_overcast = value
_rebuild_environment()
@export_range(0.0, 1.0) var windy: float:
get: return _windy
set(value):
_windy = value
_rebuild_environment()
@export_range(0.0, 1.0) var bright: float:
get: return _bright
set(value):
_bright = value
_rebuild_environment()
@export_range(0.0, 1.0) var twist: float:
get: return _twist
set(value):
_twist = value
_rebuild_environment()
@export_range(0.0, 1.0) var psychedelic: float:
get: return _psychedelic
set(value):
_psychedelic = value
_rebuild_environment()
func _rebuild_environment() -> void:
environment = REAL_ENVIRONMENT.duplicate(true)
var mat := environment.sky.sky_material as ShaderMaterial
mat.shader = REAL_ENVIRONMENT.sky.sky_material.shader
mat.set_shader_parameter(&'night', _night)
mat.set_shader_parameter(&'overcast', _overcast)
mat.set_shader_parameter(&'windy', _windy)
mat.set_shader_parameter(&'bright', _bright)
mat.set_shader_parameter(&'twist', _twist)
mat.set_shader_parameter(&'psychedelic', _psychedelic)