diff --git a/Client/origin-client/autoloads/ContentCache.gd b/Client/origin-client/autoloads/ContentCache.gd index 2036462..4893b8d 100644 --- a/Client/origin-client/autoloads/ContentCache.gd +++ b/Client/origin-client/autoloads/ContentCache.gd @@ -203,6 +203,7 @@ func load_texture_async(url: String, callback: Callable) -> void: ## Hides the first direct-child ColorRect of `parent` and injects a full-rect ## TextureRect (from a random active skybox) as the new first child. +## The texture slowly scrolls horizontally to match the 3D sky rotation feel. ## Call from _ready() in any 2D scene that has a solid-color background. func apply_scene_background(parent: Control) -> void: var skybox := get_random_skybox() @@ -224,6 +225,12 @@ func apply_scene_background(parent: Control) -> void: tr.stretch_mode = TextureRect.STRETCH_KEEP_ASPECT_COVERED tr.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT) tr.mouse_filter = Control.MOUSE_FILTER_IGNORE + # Slowly scroll UV horizontally — same ~4-min revolution as the 3D sky rotation. + var shader := Shader.new() + shader.code = "shader_type canvas_item;\nvoid fragment() {\n\tvec2 uv = UV;\n\tuv.x = fract(uv.x + TIME * 0.004);\n\tCOLOR = texture(TEXTURE, uv);\n}\n" + var mat := ShaderMaterial.new() + mat.shader = shader + tr.material = mat parent.add_child(tr) parent.move_child(tr, 0)) diff --git a/Client/origin-client/scenes/game/game_screen.gd b/Client/origin-client/scenes/game/game_screen.gd index 583382a..bc02e4f 100644 --- a/Client/origin-client/scenes/game/game_screen.gd +++ b/Client/origin-client/scenes/game/game_screen.gd @@ -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()