A5: World art for points of interest, build pieces, vessels and terrain

- PoiMesher dresses every point of interest from its parts: lapped tarred
  weatherboards, plank boards, stone in a running bond with lichen, tiled
  roofs with a ridge cap, salt-white trim on paint, crusted salt pans, and a
  tarred frame round the lighthouse's glowing glass. One mesh per POI.
- Huts get a shuttered window in each side wall (non-solid parts, no rng).
- Build pieces show their state: building in quarter steps, worn (a third of
  health gone) and battered (two thirds gone, strips knocked out).
  StructureView rebuilds a piece's mesh only when its state changes.
- VesselModels builds the barge (lofted hull, curved rails, mooring lines,
  gored envelope) and the sea chests in code; the primitive stand-ins are gone.
- Terrain: tussocks, wind-dried patches, shingle on sand, lichen on rock.
- test_world_art (9) fails on any primitive stand-in mesh or placeholder
  resource under src/ or assets/, and covers POI bounds and determinism,
  windows, the lamp surface, wear and build stages, view rebuilds and the
  vessel models.
- make poi-captures and make build-captures (state card, vessels).

Closes #45

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-13 20:39:24 -05:00
co-authored by Claude Opus 5.5
parent fdd4c992c3
commit 923876ed1f
22 changed files with 976 additions and 131 deletions
+51
View File
@@ -1,10 +1,14 @@
## Capture scenario for building (B2): a small fort of every piece kind in all three
## materials on real island terrain, with one valid and one invalid placement ghost.
## With `states`, instead a test card of walls (A5): a row per material (driftwood at
## the bottom, then stone, then iron) and a column per state: half built, intact, worn
## and battered, left to right, plus a battered driftwood ramp on the left.
extends Node3D
@export var island_seed: int = 2
## Camera offset from the fort's corner: x east, y up, z south.
@export var view: Vector3 = Vector3(-11.0, 8.5, -12.0)
@export var states: bool = false
func _ready() -> void:
@@ -24,6 +28,9 @@ func _ready() -> void:
feet.y = sim.ground.terrain_height(feet.x, feet.z)
var level: int = roundi(feet.y / Tuning.BUILD_LEVEL_METRES)
var up: int = roundi(g / Tuning.BUILD_LEVEL_METRES)
if states:
_state_card(sim, site, level, up)
return
var placed: Array[String] = []
# A two-cell room: floor, walls in three materials, a roof, a ramp up its side and a
# breakwater on the seaward... well, the near side.
@@ -47,6 +54,7 @@ func _ready() -> void:
var result: Building.Result = Building.place(sim, builder, at, entry[3])
placed.append("%s %s" % [StructureSet.KINDS[at.kind], Building.Result.keys()[result]])
print("build_scene: site %s level %d: %s" % [site, level, ", ".join(placed)])
_finish_building(sim)
_environment()
var structures: StructureView = StructureView.new()
@@ -92,6 +100,49 @@ func _ready() -> void:
add_child(water)
## Steps every piece's building to the end, so the captures show finished pieces.
func _finish_building(sim: Simulation) -> void:
# A copy: set_progress drops finished pieces from the live list.
for piece_id: int in sim.structures.building().duplicate():
var piece: StructureSet.Piece = sim.structures.find(piece_id)
sim.structures.set_progress(piece_id, piece.build_ticks, StructureSet.damage_taken(piece))
func _state_card(sim: Simulation, site: Vector2i, level: int, up: int) -> void:
var g: float = Tuning.GRID_CELL_METRES
# Fraction built and share of max health lost, per column.
var columns: Array = [[0.5, 0.0], [1.0, 0.0], [1.0, 0.45], [1.0, 0.8]]
var shown: Array[String] = []
for material: int in 3:
for column: int in columns.size():
# Seen from the north (the sunlit side), so the columns run towards -x.
var slot: Vector4i = Vector4i(site.x + 3 - column, level + up * material, site.y, StructureSet.SLOT_WALL_Z)
var piece: StructureSet.Piece = sim.structures.add(StructureSet.WALL, material, slot, 0, 0, 0, sim.ground)
var spec: Array = columns[column]
sim.structures.set_progress(piece.id, roundi(piece.build_ticks * float(spec[0])), roundi(piece.max_health * float(spec[1])))
shown.append(str(PieceMesher.state_of(piece)))
var ramp: StructureSet.Piece = sim.structures.add(StructureSet.RAMP, Materials.DRIFTWOOD, Vector4i(site.x + 5, level, site.y - 1, StructureSet.SLOT_VOLUME), 0, 0, 0, sim.ground)
sim.structures.set_progress(ramp.id, ramp.build_ticks, roundi(ramp.max_health * 0.8))
print("build_scene: state card at %s level %d: %s" % [site, level, ", ".join(shown)])
_environment()
var structures: StructureView = StructureView.new()
structures.setup(sim.structures)
add_child(structures)
var camera: Camera3D = Camera3D.new()
camera.fov = 62.0
camera.far = 1500.0
var centre: Vector3 = Vector3((site.x + 2.6) * g, level * Tuning.BUILD_LEVEL_METRES + 1.5 * g, site.y * g)
camera.position = centre + view
add_child(camera)
camera.look_at(centre)
camera.make_current()
var terrain: TerrainView = TerrainView.new()
terrain.setup(sim.island)
terrain.focus = camera.position
add_child(terrain)
terrain.build_all_now()
func _face(player: SimEntity, yaw_degrees: float, pitch_degrees: float) -> void:
var command: PlayerCommand = PlayerCommand.from_input(0, Vector2.ZERO, deg_to_rad(yaw_degrees), deg_to_rad(pitch_degrees))
player.yaw = command.yaw
+8
View File
@@ -0,0 +1,8 @@
[gd_scene load_steps=2 format=3]
[ext_resource type="Script" path="res://test/capture/build_scene.gd" id="1"]
[node name="CaptureBuild" type="Node3D"]
script = ExtResource("1")
view = Vector3(3, 1, -19)
states = true
+6
View File
@@ -0,0 +1,6 @@
[gd_scene load_steps=2 format=3]
[ext_resource type="Script" path="res://test/capture/vessels_scene.gd" id="1"]
[node name="CaptureVessels" type="Node3D"]
script = ExtResource("1")
+35
View File
@@ -0,0 +1,35 @@
## Capture scenario for the generated barge and sea chests (A5): the barge from outside,
## in the air above the sea, with a row of chests on a plank stand, shut and opened.
extends Node3D
func _ready() -> void:
var world: WorldEnvironment = WorldEnvironment.new()
world.environment = Look.environment()
add_child(world)
add_child(Look.sun(200.0))
var barge: MeshInstance3D = MeshInstance3D.new()
barge.mesh = VesselModels.barge()
barge.position = Vector3(0.0, 0.0, 0.0)
barge.rotation.y = 0.5
add_child(barge)
var multimesh: MultiMesh = MultiMesh.new()
multimesh.transform_format = MultiMesh.TRANSFORM_3D
multimesh.use_colors = true
multimesh.mesh = VesselModels.chest()
multimesh.instance_count = 3
for index: int in 3:
var at: Vector3 = Vector3(-1.4 + index * 1.4, 0.0, 0.0)
multimesh.set_instance_transform(index, Transform3D(Basis.IDENTITY, at))
multimesh.set_instance_color(index, EntityView.CHEST_OPEN if index == 2 else EntityView.CHEST_SHUT)
var chests: MultiMeshInstance3D = MultiMeshInstance3D.new()
chests.multimesh = multimesh
chests.position = Vector3(9.0, 0.0, 6.0)
add_child(chests)
var camera: Camera3D = Camera3D.new()
camera.fov = 60.0
camera.position = Vector3(16.0, 6.0, 20.0)
add_child(camera)
camera.look_at(Vector3(2.0, 5.0, 0.0))
camera.make_current()
Look.add_print_pass(camera)
+1
View File
@@ -0,0 +1 @@
uid://4sttk8o6hosl