feat: Kufenspur mit Richtungsfarbe in der 3D-Vorschau

- zwei verblassende Ribbons an den Kufen (tuerkis vorwaerts,
  orange rueckwaerts)
- Alterung ueber Playback-Zeit, Reset bei Spruengen/Scrubbing
- 3/4-Folgekamera macht die Spur sichtbar
- Legende im 3D-Bild
- 52 Praesentations-Assertions (1181 gesamt)
- Doku, Architektur (D16) und Roadmap aktualisiert
This commit is contained in:
torsten 2026-10-31 14:20:53 +01:00
parent 7f35162966
commit 1530914814
13 changed files with 478 additions and 15 deletions

View file

@ -60,11 +60,30 @@ func _capture() -> void:
controller.get_presentation_3d().set_camera_mode(
Presentation3D.CameraMode.OVERVIEW
)
controller.seek_playback(seek_time)
await process_frame
controller.seek_playback(maxf(seek_time - 1.2, 0.0))
controller.play()
for _frame: int in range(90):
await process_frame
controller.pause()
await process_frame
await process_frame
var presentation := controller.get_presentation_3d()
print(
"PLAYBACK ",
controller.get_playback_time(),
" ",
controller.get_playback_position(),
" ",
controller.get_playback_segment_id()
)
print(
"TRAIL ",
presentation.trail.get_sample_count(),
" ",
presentation.trail.get_last_color()
)
var image := root.get_texture().get_image()
image.save_png(output)
print("SAVED ", output)

View file

@ -112,6 +112,67 @@ func _test_presentation() -> void:
"clear pose resets the skater position"
)
var forward_segment := PathSegment.new()
forward_segment.direction = PathSegment.Direction.FORWARD
var backward_segment := PathSegment.new()
backward_segment.direction = PathSegment.Direction.BACKWARD
presentation.update_pose(
Vector2(0.0, 0.0),
Vector2.RIGHT,
forward_segment
)
presentation.update_pose(
Vector2(1.0, 0.0),
Vector2.RIGHT,
forward_segment
)
_check(
presentation.trail.get_sample_count() >= 1,
"forward movement leaves a trail"
)
var blades := presentation.skater.get_blade_positions()
_check(
blades.size() == 2 and blades[0].distance_to(blades[1]) > 0.1,
"the trail uses two separate blades"
)
_check(
_color_matches(
presentation.trail.get_last_color(),
Presentation3D.FORWARD_TRAIL_COLOR
),
"forward trail is cyan"
)
presentation.update_pose(
Vector2(2.0, 0.0),
Vector2.RIGHT,
backward_segment
)
_check(
_color_matches(
presentation.trail.get_last_color(),
Presentation3D.BACKWARD_TRAIL_COLOR
),
"backward trail is orange"
)
presentation.update_pose(
Vector2(20.0, 0.0),
Vector2.RIGHT,
backward_segment
)
_check(
presentation.trail.get_sample_count() == 0,
"a large jump clears the trail"
)
presentation.clear_pose()
_check(
presentation.trail.get_sample_count() == 0,
"clear pose clears the trail"
)
presentation.set_active(false)
_check(not presentation.visible, "inactive presentation is hidden")
_check(not presentation.camera.current, "inactive presentation releases the camera")
@ -146,6 +207,7 @@ func _test_controller() -> void:
_check(controller.is_3d_view_active(), "3D view opens")
_check(controller.view_3d_button.text == "2D", "toolbar offers the way back")
_check(controller.camera_mode_button.visible, "camera button is visible in 3D")
_check(controller.trail_legend.visible, "trail legend is visible in 3D")
_check(not controller.rink_canvas.visible, "2D canvas is hidden in 3D")
_check(not controller.sections_panel.visible, "section panel is hidden in 3D")
_check(not controller.timing_bar.visible, "timing bar is hidden in 3D")
@ -185,6 +247,7 @@ func _test_controller() -> void:
_check(controller.sections_panel.visible, "section panel is restored")
_check(controller.timing_bar.visible, "timing bar is restored")
_check(not controller.camera_mode_button.visible, "camera button is hidden in 2D")
_check(not controller.trail_legend.visible, "trail legend is hidden in 2D")
_check(not presentation.is_active(), "presentation is inactive after closing")
controller.open_3d_view()
@ -209,6 +272,14 @@ func _check_approx(
_check(absf(actual - expected) <= tolerance, message)
func _color_matches(actual: Color, expected: Color) -> bool:
return (
absf(actual.r - expected.r) <= 0.001
and absf(actual.g - expected.g) <= 0.001
and absf(actual.b - expected.b) <= 0.001
)
func _check(condition: bool, message: String) -> void:
_assertions += 1
if not condition: