docs/STYLE.md sets Tidewall's look: a drowned coast printed by hand. It has the palette, shape language, character proportions, shading, UI motifs, audio palette and a do-not-do list. - Palette (src/client/style/palette.gd) is the one table of client colours. Every colour that was scattered over the views now names its entry, with values unchanged. test_palette fails on a colour literal anywhere else in src/client or src/app, and on a palette colour the guide doesn't list. - Look sets up the sky, the salt-faded grading (saturation 0.86, contrast 1.05), the sun and the print pass, for the match view and the capture scenes. - folk_print.gdshader is one full-screen quad multiplied over the frame. It draws ink lines at depth jumps and creases (fading with distance, scaled with screen height), diagonal hatching cut into real shadow, and faint paper grain. Ground under the sea gets none. - make style-captures renders a hamlet and a dock with and without the pass. Closes #41 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
121 lines
5.0 KiB
GDScript
121 lines
5.0 KiB
GDScript
## Capture scenario for the streamed island terrain. The camera stands `lift` metres above
|
|
## the ground at `eye` (x, z) and looks at `target`. With `crack_check` the sky is a flat
|
|
## magenta that appears nowhere in the terrain, so any crack between chunks shows up as
|
|
## magenta pixels for tools/crack_check.gd to count.
|
|
extends Node3D
|
|
|
|
const CRACK_COLOUR: Color = Color(1.0, 0.0, 1.0)
|
|
|
|
@export var island_seed: int = 2
|
|
@export var eye: Vector2 = Vector2(700.0, 760.0)
|
|
@export var lift: float = 12.0
|
|
@export var target: Vector3 = Vector3(520.0, 35.0, 470.0)
|
|
@export var show_lod: bool = false
|
|
@export var crack_check: bool = false
|
|
@export var fov: float = 70.0
|
|
## Off only in terrain_cracks_control, which must show cracks.
|
|
@export var skirts: bool = true
|
|
## When set, draw the island's points of interest and frame the first one of this kind:
|
|
## the camera stands `poi_view` (x right, y up, z out of the front) from its origin.
|
|
@export var poi_kind: String = ""
|
|
@export var poi_view: Vector3 = Vector3(6.0, 7.0, 22.0)
|
|
## Draw the sea at `sea_level`. Never in crack checks, where it would hide seams.
|
|
@export var show_water: bool = true
|
|
@export var sea_level: float = Tuning.SEA_LEVEL_START
|
|
## Draw the island's props too.
|
|
@export var show_props: bool = false
|
|
## When set, frame the first prop of this kind whose surroundings hold at least
|
|
## `prop_crowd` others within 25 m: the camera stands `prop_view` from it (x east, y up,
|
|
## z south) and looks at it.
|
|
@export var prop_kind: String = ""
|
|
@export var prop_crowd: int = 0
|
|
@export var prop_view: Vector3 = Vector3(10.0, 4.0, 14.0)
|
|
## Destroy every `knock_out`th prop near the framed one, to show felled props vanish.
|
|
@export var knock_out: int = 0
|
|
## Draw with the woodcut print pass and graded colour (docs/STYLE.md). Off shows the
|
|
## plain render, for before-and-after captures.
|
|
@export var print_pass: bool = true
|
|
|
|
|
|
func _ready() -> void:
|
|
var island: Island = Island.generate(island_seed)
|
|
var environment: Environment = Environment.new()
|
|
if crack_check:
|
|
environment.background_mode = Environment.BG_COLOR
|
|
environment.background_color = CRACK_COLOUR
|
|
environment.ambient_light_source = Environment.AMBIENT_SOURCE_COLOR
|
|
environment.ambient_light_color = Color(0.5, 0.5, 0.5)
|
|
environment.tonemap_mode = Environment.TONE_MAPPER_LINEAR
|
|
else:
|
|
environment = Look.environment(print_pass)
|
|
var world: WorldEnvironment = WorldEnvironment.new()
|
|
world.environment = environment
|
|
add_child(world)
|
|
|
|
var sun: DirectionalLight3D = Look.sun(600.0)
|
|
sun.shadow_enabled = not crack_check
|
|
add_child(sun)
|
|
|
|
var camera: Camera3D = Camera3D.new()
|
|
camera.fov = fov
|
|
camera.far = 2000.0
|
|
camera.position = Vector3(eye.x, island.ground.terrain_height(eye.x, eye.y) + lift, eye.y)
|
|
var look_at_point: Vector3 = target
|
|
if not poi_kind.is_empty():
|
|
var placed: PoiSet = PoiSet.generate(island)
|
|
var view: PoiView = PoiView.new()
|
|
view.setup(placed)
|
|
add_child(view)
|
|
for poi: Poi in placed.pois:
|
|
if poi.kind == poi_kind:
|
|
camera.position = poi.to_world(poi_view)
|
|
camera.position.y = maxf(camera.position.y, island.ground.terrain_height(camera.position.x, camera.position.z) + 2.0)
|
|
look_at_point = poi.origin + Vector3.UP * 2.5
|
|
break
|
|
if show_props or not prop_kind.is_empty():
|
|
var sim_props: PropSet = PropSet.generate(island, PoiSet.generate(island))
|
|
var prop_view_node: PropView = PropView.new()
|
|
prop_view_node.setup(sim_props)
|
|
add_child(prop_view_node)
|
|
if not prop_kind.is_empty():
|
|
for prop: int in sim_props.count():
|
|
if sim_props.kind_name(prop) != prop_kind:
|
|
continue
|
|
var at: Vector3 = sim_props.boxes[prop].get_center()
|
|
var crowd: PackedInt32Array = sim_props.near(at, 25.0)
|
|
if crowd.size() <= prop_crowd:
|
|
continue
|
|
var base: Vector3 = Vector3(at.x, island.ground.terrain_height(at.x, at.z), at.z)
|
|
# Back away along the view offset until no canopy is in the camera's face.
|
|
var offset: Vector3 = prop_view
|
|
for _try: int in 12:
|
|
camera.position = base + offset
|
|
camera.position.y = maxf(camera.position.y, island.ground.terrain_height(camera.position.x, camera.position.z) + 1.6)
|
|
if sim_props.near(Vector3(camera.position.x, island.ground.terrain_height(camera.position.x, camera.position.z), camera.position.z), 6.0).is_empty():
|
|
break
|
|
offset *= 1.15
|
|
look_at_point = base + Vector3.UP * minf(sim_props.boxes[prop].size.y * 0.5, 3.0)
|
|
if knock_out > 0:
|
|
for index: int in crowd.size():
|
|
if index % knock_out == 1:
|
|
sim_props.damage(crowd[index], 100000)
|
|
prop_view_node.sync()
|
|
break
|
|
if show_water and not crack_check:
|
|
var water: WaterView = WaterView.new()
|
|
water.set_level(sea_level)
|
|
add_child(water)
|
|
add_child(camera)
|
|
camera.look_at(look_at_point)
|
|
camera.make_current()
|
|
if print_pass and not crack_check:
|
|
Look.set_sea_level(Look.add_print_pass(camera), sea_level if show_water else -1000.0)
|
|
|
|
var terrain: TerrainView = TerrainView.new()
|
|
terrain.setup(island)
|
|
terrain.focus = camera.position
|
|
terrain.show_lod = show_lod
|
|
terrain.skirts = skirts
|
|
add_child(terrain)
|
|
terrain.build_all_now()
|