54 lines
2.0 KiB
GDScript
54 lines
2.0 KiB
GDScript
extends SceneTree
|
|
|
|
func _initialize() -> void:
|
|
call_deferred("run")
|
|
|
|
func run() -> void:
|
|
root.size = Vector2i(1200, 800)
|
|
var world := Node3D.new()
|
|
root.add_child(world)
|
|
var environment := WorldEnvironment.new()
|
|
environment.environment = Environment.new()
|
|
environment.environment.background_mode = Environment.BG_COLOR
|
|
environment.environment.background_color = Color("303a46")
|
|
environment.environment.ambient_light_source = Environment.AMBIENT_SOURCE_COLOR
|
|
environment.environment.ambient_light_color = Color("c2d1e2")
|
|
environment.environment.ambient_light_energy = 0.65
|
|
world.add_child(environment)
|
|
var light := DirectionalLight3D.new()
|
|
light.rotation_degrees = Vector3(-40, -35, 0)
|
|
light.light_energy = 1.8
|
|
light.shadow_enabled = true
|
|
world.add_child(light)
|
|
var ground := MeshInstance3D.new()
|
|
ground.mesh = PlaneMesh.new()
|
|
ground.scale = Vector3(5, 1, 5)
|
|
var floor_material := StandardMaterial3D.new()
|
|
floor_material.albedo_color = Color("454e58")
|
|
ground.material_override = floor_material
|
|
world.add_child(ground)
|
|
var camera := Camera3D.new()
|
|
world.add_child(camera)
|
|
camera.position = Vector3(2.9, 2.1, -5.3)
|
|
camera.look_at(Vector3(0, 0.9, 0))
|
|
camera.projection = Camera3D.PROJECTION_ORTHOGONAL
|
|
camera.size = 3.8
|
|
camera.make_current()
|
|
var models: Array[ImportedOperator] = []
|
|
for variant: String in ["steve", "gas_mask"]:
|
|
var model := ImportedOperator.new()
|
|
world.add_child(model)
|
|
model.setup(variant)
|
|
model.position.x = -0.72 if models.is_empty() else 0.72
|
|
model.weapon_mount.add_child(WeaponModels.build(0))
|
|
models.append(model)
|
|
for clip: String in ["idle_aiming", "walk_crouching_forward", "reload", "death_from_the_front", "slide"]:
|
|
var key := "slide__running_slide" if clip == "slide" else "pro_rifle__" + clip
|
|
for model in models:
|
|
model.preview(key, model.pose.clip(key).length * 0.5)
|
|
for frame in 4: await process_frame
|
|
await RenderingServer.frame_post_draw
|
|
root.get_texture().get_image().save_png("res://logs/operator-" + clip + ".png")
|
|
print("RENDER ", clip)
|
|
quit()
|