Add slow skybox rotation to 3D scene and 2D scene backgrounds

3D (game_screen): _process increments env.sky_rotation.y at 0.026 rad/s
(~4 min per full revolution) — works for all sky types (panoramic,
animated panoramic, cubemap shader) via Godot's built-in EYEDIR transform.

2D (ContentCache): apply_scene_background attaches a canvas_item ShaderMaterial
to the background TextureRect that horizontally scrolls UV.x using the built-in
TIME uniform at 0.004 UV/s (matching the ~4 min cycle) — no GDScript tick needed.

Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
This commit is contained in:
dingo
2026-03-25 20:31:27 -04:00
co-authored by Claude Happy
parent 70f0089b2f
commit ff973ce9c3
2 changed files with 14 additions and 0 deletions
@@ -158,6 +158,7 @@ var _anim_players : Dictionary = {} # instanceId → AnimationPlayer (null if
var _unit_def_ids : Dictionary = {} # instanceId → card definition ID string
# ── Skybox state ───────────────────────────────────────────────────────────────
const SKY_ROTATION_SPEED := 0.026 # rad/sec — ~4 min per full revolution
var _skybox_sky : Sky = null # the Sky object created in _setup_environment
var _skybox_frames : Array = [] # Array[ImageTexture] for animated skybox frames
var _skybox_frame_idx : int = 0
@@ -262,6 +263,12 @@ func _ready() -> void:
Game.send_ready()
func _process(delta: float) -> void:
var env := $WorldEnvironment.environment
if env != null:
env.sky_rotation.y += delta * SKY_ROTATION_SPEED
func _exit_tree() -> void:
if _is_spectating:
Game.stop_spectating()