66 lines
2.0 KiB
GDScript
66 lines
2.0 KiB
GDScript
extends SceneTree
|
|
|
|
## Close-up visual regression capture for Akiba's repaired assets.
|
|
## godot --path . --windowed --resolution 1280x720 \
|
|
## -s res://debug/akiba_detail_capture.gd -- <out_dir>
|
|
|
|
var _frames := 0
|
|
var _out_dir := "."
|
|
var _camera: Camera3D
|
|
|
|
|
|
func _initialize() -> void:
|
|
var args := OS.get_cmdline_user_args()
|
|
if not args.is_empty():
|
|
_out_dir = args[0]
|
|
change_scene_to_file("res://scenes/maps/neon_alley/neon_alley.tscn")
|
|
|
|
|
|
func _process(_delta: float) -> bool:
|
|
_frames += 1
|
|
if _frames == 60:
|
|
_camera = Camera3D.new()
|
|
_camera.far = 1200.0
|
|
current_scene.add_child(_camera)
|
|
_camera.current = true
|
|
var poles := root.find_children(
|
|
"UtilityPole_*", "StaticBody3D", true, false)
|
|
if not poles.is_empty():
|
|
var pole := poles[0] as StaticBody3D
|
|
_camera.look_at_from_position(
|
|
pole.global_position + Vector3(-8.0, 3.2, -9.0),
|
|
pole.global_position + Vector3(0.6, 5.8, 0), Vector3.UP)
|
|
elif _frames == 90:
|
|
_snap("powerlines")
|
|
var cars := root.find_children("Car_*", "StaticBody3D", true, false)
|
|
if not cars.is_empty():
|
|
var car := cars[0] as StaticBody3D
|
|
_camera.look_at_from_position(
|
|
car.global_position + Vector3(6.5, 3.1, 7.5),
|
|
car.global_position + Vector3(0, 1.0, 0), Vector3.UP)
|
|
elif _frames == 120:
|
|
_snap("parked_car")
|
|
var landings := root.find_children(
|
|
"EscLanding_*", "StaticBody3D", true, false)
|
|
if not landings.is_empty():
|
|
var landing := landings[0] as StaticBody3D
|
|
_camera.look_at_from_position(
|
|
landing.global_position + Vector3(0, 3.2, -10.0),
|
|
landing.global_position + Vector3(0, 2.0, 0), Vector3.UP)
|
|
elif _frames == 150:
|
|
_snap("supported_escape")
|
|
unload_current_scene()
|
|
elif _frames >= 240:
|
|
return true
|
|
return false
|
|
|
|
|
|
func _snap(tag: String) -> void:
|
|
var image := root.get_viewport().get_texture().get_image()
|
|
var path := _out_dir.path_join("akiba_%s.png" % tag)
|
|
var error := image.save_png(path)
|
|
if error == OK:
|
|
print("akiba_detail_capture: saved ", path)
|
|
else:
|
|
printerr("akiba_detail_capture: save failed ", error)
|