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
+19 -64
View File
@@ -6,8 +6,8 @@
## simulation replicates about them, with shots, swings and building played from FX
## records through hear(). Held and lying items are the models of A4 (ItemModels): a
## held one sits with its grip in the figure's right hand and points where its player
## looks. The barge and chests are still stand-in shapes. Nothing here is ever used
## for collision.
## looks. The barge and the sea chests are VesselModels, generated in code. Nothing
## here is ever used for collision.
class_name EntityView
extends Node3D
@@ -17,12 +17,10 @@ const OILSKINS: Array[Color] = [
Palette.OILSKIN_SLATE, Palette.OILSKIN_NAVY, Palette.TANNED_SAIL,
]
const SKIN: Color = Palette.SKIN
const CANVAS: Color = Palette.CANVAS
const TAR: Color = Palette.TAR
const PLANK: Color = Palette.PLANK
const CHEST_SHUT: Color = Palette.SEA_PAINT
const CHEST_OPEN: Color = Palette.HOLD_SHADOW
const ITEM: Color = Palette.GILT
## Chest instance colours, multiplied into the chest model's own: an opened chest
## shows darker, its paint dulled.
const CHEST_SHUT: Color = Color.WHITE
const CHEST_OPEN: Color = Palette.OPENED_DULL
## How far apart passengers stand on the barge's deck, in metres. The simulation
## carries them all at one point; this only spreads them out to be seen.
const DECK_SPACING: float = 1.3
@@ -56,7 +54,7 @@ func setup(sim: Simulation) -> void:
_pickups = Node3D.new()
_pickups.name = "Pickups"
add_child(_pickups)
_chests = _box_field("Chests", Vector3(0.9, 0.55, 0.6), false)
_chests = _chest_field()
add_child(_chests)
sync()
@@ -145,7 +143,7 @@ func sync() -> void:
var chests: MultiMesh = _chests.multimesh
chests.instance_count = _sim.loot.chest_positions.size()
for index: int in _sim.loot.chest_positions.size():
chests.set_instance_transform(index, Transform3D(Basis.IDENTITY, _sim.loot.chest_positions[index] + Vector3(0.0, 0.28, 0.0)))
chests.set_instance_transform(index, Transform3D(Basis.IDENTITY, _sim.loot.chest_positions[index]))
chests.set_instance_color(index, CHEST_OPEN if _sim.loot.chest_opened[index] != 0 else CHEST_SHUT)
@@ -231,11 +229,10 @@ func _item_field(key: String) -> MultiMeshInstance3D:
multimesh.transform_format = MultiMesh.TRANSFORM_3D
var mesh: ArrayMesh = ItemModels.model(key.get_slice("@", 0), key.get_slice("@", 1).to_int())
if mesh == null:
var stand_in: BoxMesh = BoxMesh.new()
stand_in.size = Vector3(0.25, 0.25, 0.25)
multimesh.mesh = stand_in
else:
multimesh.mesh = mesh
# Every catalogue item has a model (test_item_models); this is a bug.
push_error("EntityView: no model for item %s" % key)
mesh = ArrayMesh.new()
multimesh.mesh = mesh
var field: MultiMeshInstance3D = MultiMeshInstance3D.new()
field.name = key.replace("@", "_")
field.multimesh = multimesh
@@ -250,64 +247,22 @@ func _build_figure(entity_id: int) -> FigureRig:
return figure
## A flat-bottomed hull hung under a canvas envelope. Its deck is at the origin, where
## the simulation carries the passengers.
## The barge (VesselModels): a hull hung under a canvas envelope. Its deck is at the
## origin, where the simulation carries the passengers.
func _build_barge() -> Node3D:
var barge: Node3D = Node3D.new()
var barge: MeshInstance3D = MeshInstance3D.new()
barge.name = "Barge"
var deck: BoxMesh = BoxMesh.new()
deck.size = Vector3(7.5, 0.3, 11.0)
barge.add_child(_part(deck, PLANK, Vector3(0.0, -0.15, 0.0)))
var hull: BoxMesh = BoxMesh.new()
hull.size = Vector3(6.4, 1.3, 9.6)
barge.add_child(_part(hull, TAR, Vector3(0.0, -0.95, 0.0)))
for side: float in [-1.0, 1.0]:
var rail: BoxMesh = BoxMesh.new()
rail.size = Vector3(0.15, 0.7, 11.0)
barge.add_child(_part(rail, TAR, Vector3(side * 3.68, 0.35, 0.0)))
for end: float in [-1.0, 1.0]:
var rope: CylinderMesh = CylinderMesh.new()
rope.top_radius = 0.05
rope.bottom_radius = 0.05
rope.height = 7.0
barge.add_child(_part(rope, PLANK.darkened(0.3), Vector3(side * 3.4, 3.5, end * 4.6)))
var envelope: SphereMesh = SphereMesh.new()
envelope.radius = 1.0
envelope.height = 2.0
var bag: MeshInstance3D = _part(envelope, CANVAS, Vector3(0.0, 10.5, 0.0))
bag.scale = Vector3(5.2, 3.8, 9.0)
barge.add_child(bag)
barge.mesh = VesselModels.barge()
return barge
func _part(mesh: PrimitiveMesh, colour: Color, at: Vector3) -> MeshInstance3D:
var material: StandardMaterial3D = StandardMaterial3D.new()
material.albedo_color = colour
material.roughness = 0.85
mesh.material = material
var instance: MeshInstance3D = MeshInstance3D.new()
instance.mesh = mesh
instance.position = at
return instance
func _box_field(node_name: String, size: Vector3, glow: bool) -> MultiMeshInstance3D:
var material: StandardMaterial3D = StandardMaterial3D.new()
material.vertex_color_use_as_albedo = true
material.roughness = 0.7
if glow:
material.emission_enabled = true
material.emission = ITEM
material.emission_energy_multiplier = 0.5
var mesh: BoxMesh = BoxMesh.new()
mesh.size = size
mesh.material = material
func _chest_field() -> MultiMeshInstance3D:
var multimesh: MultiMesh = MultiMesh.new()
multimesh.transform_format = MultiMesh.TRANSFORM_3D
multimesh.use_colors = true
multimesh.mesh = mesh
multimesh.mesh = VesselModels.chest()
var instance: MultiMeshInstance3D = MultiMeshInstance3D.new()
instance.name = node_name
instance.name = "Chests"
instance.multimesh = multimesh
instance.cast_shadow = GeometryInstance3D.SHADOW_CASTING_SETTING_OFF
return instance