feat: the village draws with Three.js: land, forest and buildings in one mesh in the painter's order, people, animals, smoke and crows posed every frame from the same timing, depth steps so they sort in among the buildings; a thin SVG on top keeps click targets, focus, tags and countdowns

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Fabian @ Blax Software 2026-10-30 11:52:55 +01:00
parent 0a0012e22b
commit 488a5f2832
8 changed files with 893 additions and 132 deletions

File diff suppressed because one or more lines are too long

View File

@ -1,8 +1,6 @@
<script setup lang="ts">
import type { BuildingType, Resources, VillageState } from '~/types/game'
import { drillThrust, workInPlace } from '~/diorama/life'
import { buildScene, type SceneBuilding, type SceneInset, type ScenePlot } from '~/diorama/scene'
import { SHIRTS, SMOKE, UNIFORM } from '~/diorama/models'
import type { BuildingTag } from '~/utils/buildingTags'
const props = defineProps<{
@ -67,6 +65,19 @@ const controlsAt = computed(() => ({ right: `${(props.inset?.right ?? 0) + 8}px`
const motion = ref(false)
onMounted(() => (motion.value = !window.matchMedia('(prefers-reduced-motion: reduce)').matches))
// The picture is WebGL (useDioramaGl); the SVG over it only takes clicks and focus and
// carries the tags. The ground rings under the open building and the one keyboard focus
// is on are drawn in the picture, under the buildings.
const canvas = ref<HTMLCanvasElement | null>(null)
const focused = ref<{ id: number; dashed: boolean } | null>(null)
const onFocus = (id: number, e: FocusEvent) => (focused.value = { id, dashed: (e.target as Element).matches(':focus-visible') })
const marks = computed(() => [
...(selected.value !== null ? [{ id: selected.value, dashed: false }] : []),
...(focused.value?.dashed ? [focused.value] : []),
])
useDioramaGl({ canvas, scene: () => scene.value, view: () => view.value, size: () => size.value, motion: () => motion.value, marks: () => marks.value, background: '#6a7049' })
const targets = computed(() => scene.value.objects.flatMap((o) => (o.building ? [{ key: o.key, b: o.building }] : [])))
const name = (b: SceneBuilding) => t(`buildings.${b.type}`)
const label = (b: SceneBuilding) => t('village.diorama.label', { name: name(b), level: b.level })
const plotLabel = (p: ScenePlot) => t(p.another ? 'village.diorama.plot_another' : 'village.diorama.plot', { name: t(`buildings.${p.type}`) })
@ -164,40 +175,16 @@ const timers = computed(() => {
<template>
<div ref="scroller" class="relative h-full w-full overflow-y-hidden bg-[#6a7049]" :class="fill ? 'overflow-x-hidden' : 'overflow-x-auto'">
<div ref="stage" class="h-full" :class="[fill ? (still ? '' : 'pan touch-none') : 'min-w-[640px]', { panning }]">
<div ref="stage" class="relative h-full" :class="[fill ? (still ? '' : 'pan touch-none') : 'min-w-[640px]', { panning }]">
<canvas ref="canvas" class="absolute inset-0 block h-full w-full" aria-hidden="true" />
<svg
class="block h-full w-full select-none"
class="absolute inset-0 block h-full w-full select-none"
:viewBox="viewBox"
preserveAspectRatio="xMidYMid slice"
role="group"
:aria-label="$t('village.diorama.title')"
@click="clear"
>
<g stroke-width="0.6" stroke-linejoin="round">
<polygon v-for="(p, i) in scene.terrain" :key="`t${i}`" :points="p.points" :fill="p.fill" :stroke="p.stroke" />
<polygon v-for="(p, i) in scene.decals" :key="`d${i}`" :points="p.points" :fill="p.fill" :stroke="p.stroke" />
</g>
<!-- Villagers going out to work and bringing the load home, under the buildings they
walk into; sheep and chickens wandering. -->
<g v-if="motion" class="pointer-events-none">
<template v-for="(w, i) in scene.walks" :key="`walk-${i}-${w.d.length}`">
<VillageWorker
v-for="n in w.count"
:key="n"
:d="w.d"
:walk="w.walk"
:work="w.work"
:tool="w.tool"
:carry="w.carry"
:shirt="SHIRTS[(i * 3 + n) % SHIRTS.length]!"
:size="1.6"
:begin="-((n - 1) * (w.walk * 2 + w.work)) / w.count - i * 3"
/>
</template>
<VillageAnimal v-for="(a, i) in scene.herds" :key="`herd-${i}`" :kind="a.kind" :d="a.d" :dur="a.dur" :begin="a.begin" :size="a.kind === 'sheep' ? 1.7 : 1.4" />
</g>
<!-- Empty plots: nothing to see, but each opens its building type's build card. -->
<ellipse
v-for="p in scene.plots"
@ -226,86 +213,24 @@ const timers = computed(() => {
@click.stop="press(scene.wallBand.id)"
/>
<template v-for="obj in scene.objects" :key="obj.key">
<g
v-if="obj.building"
v-memo="[obj, selected === obj.building.id]"
class="bld"
:class="{ 'is-selected': selected === obj.building.id }"
:role="obj.building.focusable ? 'button' : undefined"
:tabindex="obj.building.focusable ? 0 : -1"
:aria-hidden="obj.building.focusable ? undefined : 'true'"
:aria-label="obj.building.focusable ? label(obj.building) : undefined"
:aria-pressed="obj.building.focusable ? selected === obj.building.id : undefined"
stroke-width="0.6"
stroke-linejoin="round"
@click.stop="press(obj.building.id)"
@keydown.enter.prevent="toggle(obj.building.id)"
@keydown.space.prevent="toggle(obj.building.id)"
>
<polygon v-if="obj.building.hit" class="hit" :points="obj.building.hit" />
<ellipse v-if="obj.building.ring.rx" class="ring" v-bind="obj.building.ring" />
<polygon v-for="(p, i) in obj.polys" :key="i" :points="p.points" :fill="p.fill" :stroke="p.stroke" />
<title>{{ label(obj.building) }}</title>
</g>
<!-- Villagers who stay put: talking, hammering at a building in the works, drilling;
soldiers standing guard at the doors. -->
<g v-else-if="obj.life" class="pointer-events-none" :transform="`translate(${obj.life.at[0]} ${obj.life.at[1]})`">
<g v-if="obj.life.guard" transform="scale(1.6)">
<VillageWalker :shirt="UNIFORM" :facing="obj.life.facing" tool="spear" soldier />
</g>
<g v-else transform="scale(1.6)">
<animateTransform
v-if="motion && !obj.life.tool"
attributeName="transform"
type="translate"
values="0 0;0 -0.5;0 0;0 0"
keyTimes="0;0.15;0.3;1"
:dur="`${2.2 + (obj.life.shirt % 3) * 0.4}s`"
additive="sum"
repeatCount="indefinite"
/>
<VillageWalker
:shirt="SHIRTS[obj.life.shirt % SHIRTS.length]!"
:facing="obj.life.facing"
:tool="obj.life.tool"
:swing="motion && obj.life.tool ? (obj.life.drill ? drillThrust() : workInPlace()) : null"
/>
</g>
</g>
<!-- Villagers coming out of a door and going back in, porters bringing materials. -->
<g v-else-if="obj.walker" class="pointer-events-none">
<VillageWorker
v-if="motion"
:d="obj.walker.d"
:walk="obj.walker.walk"
:work="obj.walker.work"
:rest="obj.walker.rest"
:indoors="obj.walker.indoors"
:tool="obj.walker.tool"
:carry="obj.walker.carry"
:soldier="obj.walker.soldier"
:shirt="obj.walker.soldier ? UNIFORM : SHIRTS[obj.walker.shirt % SHIRTS.length]!"
:size="1.6"
:begin="obj.walker.begin"
/>
</g>
<g v-else v-memo="[obj]" stroke-width="0.6" stroke-linejoin="round">
<polygon v-for="(p, i) in obj.polys" :key="i" :points="p.points" :fill="p.fill" :stroke="p.stroke" />
<title v-if="obj.planned">{{ $t('village.diorama.planned') }}</title>
</g>
</template>
<!-- Smoke from chimneys, forges and kilns: flat puffs that rise, drift and shrink away. -->
<g v-if="motion" class="pointer-events-none" :fill="SMOKE.fill" :stroke="SMOKE.edge" stroke-width="0.5">
<g v-for="(p, i) in scene.smoke" :key="`smoke-${i}`" :transform="`translate(${p[0]} ${p[1]})`">
<circle v-for="n in 3" :key="n" class="puff" r="5.5" :style="{ animationDelay: `${-(n * 1.3 + i * 0.9)}s` }" />
</g>
</g>
<!-- Birds crossing now and then. -->
<g v-if="motion" class="pointer-events-none">
<VillageBird v-for="(b, i) in scene.birds" :key="`bird-${i}`" :d="b.d" :dur="b.dur" :begin="b.begin" :size="1.6" />
<!-- Each building's outline, back to front, so the one in front takes the click. -->
<g
v-for="{ key, b } in targets"
:key="key"
class="bld"
:role="b.focusable ? 'button' : undefined"
:tabindex="b.focusable ? 0 : -1"
:aria-hidden="b.focusable ? undefined : 'true'"
:aria-label="b.focusable ? label(b) : undefined"
:aria-pressed="b.focusable ? selected === b.id : undefined"
@click.stop="press(b.id)"
@keydown.enter.prevent="toggle(b.id)"
@keydown.space.prevent="toggle(b.id)"
@focus="onFocus(b.id, $event)"
@blur="focused = null"
>
<polygon v-if="b.hit" class="hit" :points="b.hit" />
<title>{{ label(b) }}</title>
</g>
<!-- Building tags (level and what it does now) and countdowns. Flat colours only. -->
@ -396,13 +321,12 @@ const timers = computed(() => {
}
/* Buildings are massive and stay put: no lift, no glow, nothing on hover. Only a click
(or keyboard focus) outlines the ground they stand on. */
(or keyboard focus) outlines the ground they stand on, drawn in the picture. */
.bld,
.plot {
cursor: pointer;
outline: none;
}
.ring,
.plot,
.hit {
fill: transparent;
@ -414,33 +338,13 @@ const timers = computed(() => {
pointer-events: stroke;
cursor: pointer;
}
.bld.is-selected .ring,
.plot.is-selected {
stroke: #7b1e16;
stroke-width: 2;
}
.bld:focus-visible .ring,
.plot:focus-visible {
stroke: #7b1e16;
stroke-width: 2;
stroke-dasharray: 4 3;
}
/* A puff starts small at the chimney, grows as it rises and drifts, then shrinks to nothing. */
.puff {
transform-box: fill-box;
transform-origin: center;
animation: puff 3.9s linear infinite;
}
@keyframes puff {
0% {
transform: translate(0, 0) scale(0.25);
}
55% {
transform: translate(-6px, -15px) scale(1);
}
100% {
transform: translate(-13px, -27px) scale(0);
}
}
</style>

View File

@ -0,0 +1,143 @@
import { BufferAttribute, BufferGeometry, Color, DoubleSide, LinearSRGBColorSpace, Mesh, MeshBasicMaterial, OrthographicCamera, Scene as GlRoot, WebGLRenderer } from 'three'
import { Batch, RING_CORNERS, rgbOf, ring } from '~/diorama/figures'
import { buildGl, type GlScene } from '~/diorama/gl'
import type { Scene, View } from '~/diorama/scene'
/**
* Draws a village scene with WebGL into `canvas`: everything that stands still in one mesh
* built when the scene changes, people, animals, smoke and crows in a second mesh written
* every frame, and an orthographic camera on `view` (cut to the canvas like SVG's
* xMidYMid slice), so panning and zooming only move the camera.
*/
export function useDioramaGl(opts: {
canvas: Ref<HTMLCanvasElement | null>
scene: () => Scene
view: () => View
size: () => { w: number; h: number }
/** Animate; without it, people who stay put stand still and the rest is not drawn. */
motion: () => boolean
/** Buildings whose ground ring shows: the open one solid, the keyboard's focus dashed. */
marks: () => { id: number; dashed: boolean }[]
background: string
}) {
let renderer: WebGLRenderer | null = null
const root = new GlRoot()
const camera = new OrthographicCamera()
const material = new MeshBasicMaterial({ vertexColors: true, side: DoubleSide })
let still: Mesh | null = null
let moving: Mesh | null = null
let batch: Batch | null = null
let gl: GlScene | null = null
let frame = 0
let dirty = true
function build() {
gl = buildGl(opts.scene())
if (still) {
root.remove(still)
still.geometry.dispose()
}
const geometry = new BufferGeometry()
geometry.setAttribute('position', new BufferAttribute(gl.positions, 3))
geometry.setAttribute('color', new BufferAttribute(gl.colors, 3, true))
geometry.setIndex(new BufferAttribute(gl.indices, 1))
still = new Mesh(geometry, material)
still.frustumCulled = false
still.renderOrder = 0
root.add(still)
const capacity = gl.actors.reduce((n, a) => n + a.actor.corners, 0) + RING_CORNERS * 2
if (!batch || batch.capacity < capacity) {
batch = new Batch(capacity)
if (moving) {
root.remove(moving)
moving.geometry.dispose()
}
const g = new BufferGeometry()
g.setAttribute('position', new BufferAttribute(batch.positions, 3))
g.setAttribute('color', new BufferAttribute(batch.colors, 3))
moving = new Mesh(g, material)
moving.frustumCulled = false
moving.renderOrder = 1
root.add(moving)
}
// Look down at the nearest step from just above it.
camera.position.z = gl.top + 1
camera.near = 0.5
camera.far = gl.top + 2
aim()
}
function aim() {
const { w, h } = opts.size()
const v = opts.view()
const k = Math.max(w / v.w, h / v.h)
const fw = w / k
const fh = h / k
const left = v.x + (v.w - fw) / 2
const top = v.y + (v.h - fh) / 2
camera.left = left
camera.right = left + fw
camera.top = -top
camera.bottom = -(top + fh)
camera.updateProjectionMatrix()
dirty = true
}
function draw(now: number) {
if (!renderer || !gl || !batch || !moving) return
const motion = opts.motion()
batch.count = 0
const t = now / 1000
for (const mark of opts.marks()) {
const at = gl.rings.get(mark.id)
if (at) ring(batch, at.ring, mark.dashed, at.z)
}
for (const { actor, z } of gl.actors) if (motion || !actor.moving) actor.draw(batch, t, motion, z)
const g = moving.geometry
;(g.attributes.position as BufferAttribute).needsUpdate = true
;(g.attributes.color as BufferAttribute).needsUpdate = true
g.setDrawRange(0, batch.count)
renderer.render(root, camera)
dirty = false
}
function loop(now: number) {
frame = requestAnimationFrame(loop)
if (opts.motion() || dirty) draw(now)
}
function resize() {
const { w, h } = opts.size()
renderer?.setSize(w, h, false)
aim()
}
onMounted(() => {
const canvas = opts.canvas.value
if (!canvas) return
renderer = new WebGLRenderer({ canvas, antialias: true })
// Colours go out exactly as the palette writes them, like the SVG did.
renderer.outputColorSpace = LinearSRGBColorSpace
const [r, g, b] = rgbOf(opts.background)
renderer.setClearColor(new Color().setRGB(r, g, b, LinearSRGBColorSpace), 1)
renderer.setPixelRatio(Math.min(2, window.devicePixelRatio || 1))
resize()
build()
frame = requestAnimationFrame(loop)
})
onBeforeUnmount(() => {
cancelAnimationFrame(frame)
still?.geometry.dispose()
moving?.geometry.dispose()
material.dispose()
renderer?.dispose()
renderer?.forceContextLoss()
renderer = null
})
watch(() => opts.scene(), () => renderer && build())
watch(() => opts.size(), () => renderer && resize())
watch(() => opts.view(), () => aim())
watch(() => [JSON.stringify(opts.marks()), opts.motion()], () => (dirty = true))
}

382
app/diorama/figures.ts Normal file
View File

@ -0,0 +1,382 @@
// The village's people, animals, crows and smoke for the WebGL diorama: the same flat
// panels as VillageWalker, VillageAnimal and VillageBird, triangulated once, and posed every
// frame from the same timing (app/diorama/life.ts) the SVG animations ran on.
import earcut from 'earcut'
import { scale } from './iso'
import { type Cycle, drillThrust, type Tool, workCycle, workInPlace } from './life'
import { polylines, Track } from './svgpath'
export type RGB = [number, number, number]
const colors = new Map<string, RGB>()
export function rgbOf(hex: string): RGB {
let c = colors.get(hex)
if (!c) {
const n = Number.parseInt(hex.slice(1), 16)
c = [((n >> 16) & 255) / 255, ((n >> 8) & 255) / 255, (n & 255) / 255]
colors.set(hex, c)
}
return c
}
/** Triangles of filled outlines, as x,y pairs per corner. */
export function triangles(...rings: [number, number][][]): Float32Array {
const out: number[] = []
for (const ring of rings) {
const flat = ring.flat()
for (const i of earcut(flat)) out.push(flat[i * 2]!, flat[i * 2 + 1]!)
}
return new Float32Array(out)
}
const path = (d: string) => triangles(...polylines(d))
const rect = (x: number, y: number, w: number, h: number) => triangles([[x, y], [x + w, y], [x + w, y + h], [x, y + h]])
const circle = (cx: number, cy: number, r: number, n = 12) =>
triangles(Array.from({ length: n }, (_, i): [number, number] => [cx + r * Math.cos((i / n) * Math.PI * 2), cy + r * Math.sin((i / n) * Math.PI * 2)]))
// Affine maps as SVG writes them: (x, y) -> (a x + c y + e, b x + d y + f).
export type M = [number, number, number, number, number, number]
export const IDENTITY: M = [1, 0, 0, 1, 0, 0]
export function mul(p: M, q: M): M {
return [p[0] * q[0] + p[2] * q[1], p[1] * q[0] + p[3] * q[1], p[0] * q[2] + p[2] * q[3], p[1] * q[2] + p[3] * q[3], p[0] * q[4] + p[2] * q[5] + p[4], p[1] * q[4] + p[3] * q[5] + p[5]]
}
export const move = (x: number, y: number): M => [1, 0, 0, 1, x, y]
export const stretch = (x: number, y = x): M => [x, 0, 0, y, 0, 0]
/** SVG's rotate(deg cx cy): clockwise on screen. */
export function turn(deg: number, cx: number, cy: number): M {
const a = (deg * Math.PI) / 180
const c = Math.cos(a)
const s = Math.sin(a)
return [c, s, -s, c, cx - c * cx + s * cy, cy - s * cx - c * cy]
}
/** Corners written per frame: positions (x, -y, z) and colours, for one dynamic mesh. */
export class Batch {
readonly positions: Float32Array
readonly colors: Float32Array
count = 0
constructor(readonly capacity: number) {
this.positions = new Float32Array(capacity * 3)
this.colors = new Float32Array(capacity * 3)
}
put(tris: Float32Array, color: RGB, m: M, z: number) {
const n = Math.min(tris.length / 2, this.capacity - this.count)
for (let i = 0; i < n; i++) {
const x = tris[i * 2]!
const y = tris[i * 2 + 1]!
const k = (this.count + i) * 3
this.positions[k] = m[0] * x + m[2] * y + m[4]
this.positions[k + 1] = -(m[1] * x + m[3] * y + m[5])
this.positions[k + 2] = z
this.colors[k] = color[0]
this.colors[k + 1] = color[1]
this.colors[k + 2] = color[2]
}
this.count += n
}
}
/** Something that moves: draws itself into the batch at time `t` (seconds). */
export interface Actor {
/** Corners it writes at most. */
readonly corners: number
/** Only seen while things move (not under reduced motion). */
readonly moving: boolean
draw(b: Batch, t: number, motion: boolean, z: number): void
}
// SMIL value lists, sampled like the browser does.
interface Keys {
values: number[][]
times: number[]
}
function keys(values: string, keyTimes: string): Keys {
return {
values: values.split(';').map((v) => (v === 'visible' ? [1] : v === 'hidden' ? [0] : v.trim().split(/[\s,]+/).map(Number))),
times: keyTimes.split(';').map(Number),
}
}
function linear(k: Keys, f: number): number[] {
const { values, times } = k
if (f <= times[0]!) return values[0]!
for (let i = 1; i < times.length; i++) {
if (f <= times[i]!) {
const span = times[i]! - times[i - 1]!
const t = span > 0 ? (f - times[i - 1]!) / span : 1
return values[i - 1]!.map((v, j) => v + (values[i]![j]! - v) * t)
}
}
return values[values.length - 1]!
}
function discrete(k: Keys, f: number): number[] {
let i = 0
while (i + 1 < k.times.length && f >= k.times[i + 1]!) i++
return k.values[i]!
}
/** Where in its cycle a clock that began at `begin` is, 0..1. */
const phase = (t: number, begin: number, dur: number) => ((((t - begin) % dur) + dur) % dur) / dur
// People.
const METAL = rgbOf('#868b8e')
const HANDLE = rgbOf('#5f4c3a')
const HEADS: Record<Tool, string> = {
axe: 'M3.3 -11.4L5.5 -10.5L5 -9.3L3.6 -10.1z',
pick: 'M2.1 -11.7L5.7 -10.1L5.4 -9.7L3.8 -10.5L2.3 -11.1z',
shovel: 'M3.3 -10.5L4.8 -12L5.7 -11.1L4.2 -9.7z',
sickle: 'M3.6 -10.9Q6.6 -12.3 5.7 -9.1Q5.3 -10.8 3.9 -10.4z',
hammer: 'M2.9 -11.2L4.6 -10.3L4.1 -9.3L2.4 -10.1z',
spear: 'M1.2 -15.6L1.8 -13.6L0.6 -13.6z',
}
let person: ReturnType<typeof personShapes> | null = null
function personShapes() {
return {
legA: rect(-1.5, -2.4, 1.2, 2.4),
legB: rect(0.3, -2.4, 1.2, 2.4),
shirtA: path('M-1.9 -6.9L0 -7.3V-2.2H-1.7z'),
shirtB: path('M0 -7.3L1.9 -6.9L1.7 -2.2H0z'),
head: circle(0, -8.9, 1.65),
helmet: path('M-1.85 -9Q-1.8 -11.2 0 -11.3Q1.8 -11.2 1.85 -9z'),
helmetShade: path('M0 -11.3Q1.8 -11.2 1.85 -9H0z'),
strap: path('M0.75 -9H1.15V-7.9H0.75z'),
hair: path('M-1.7 -9.1Q0 -11.5 1.7 -9.1Q0 -9.9 -1.7 -9.1z'),
shaft: path('M0.95 -0.6H1.45V-13.8H0.95z'),
handle: path('M0.85 -6.6L1.35 -6.2L4.15 -10.7L3.65 -11.1z'),
heads: Object.fromEntries(Object.entries(HEADS).map(([tool, d]) => [tool, path(d)])) as Record<Tool, Float32Array>,
shield: path('M-0.1 -6.9H2.5V-4.7Q2.5 -3.1 1.2 -2.1Q-0.1 -3.1 -0.1 -4.7z'),
shieldShade: path('M1.2 -6.9H2.5V-4.7Q2.5 -3.1 1.2 -2.1z'),
boss: path('M1 -6.9H1.4V-2.3L1.2 -2.1L1 -2.3z'),
loadTop: path('M-0.6 -9.3L2.2 -9.8L3.8 -9L1 -8.5z'),
loadA: path('M-0.6 -9.3L1 -8.5V-6.9L-0.6 -7.7z'),
loadB: path('M1 -8.5L3.8 -9V-7.4L1 -6.9z'),
}
}
const PERSON_CORNERS = 400
interface Look {
shirt: string
carry?: string | null
tool?: Tool | null
soldier?: boolean
}
interface Pose {
/** 1 facing right, -1 left. */
fx: number
legA: number
legB: number
/** Tool angle about the shoulder, degrees. */
swing: number
load: boolean
}
/** One villager as VillageWalker draws it: legs, shirt, head, tool, shield, load. */
function drawPerson(b: Batch, look: Look, pose: Pose, base: M, z: number) {
const s = (person ??= personShapes())
const shirt = rgbOf(look.shirt)
const m = mul(base, stretch(pose.fx, 1))
b.put(s.legA, rgbOf('#3a322a'), mul(m, move(pose.legA, 0)), z)
b.put(s.legB, rgbOf('#2f2822'), mul(m, move(pose.legB, 0)), z)
b.put(s.shirtA, shirt, m, z)
b.put(s.shirtB, rgbOf(scale(look.shirt, 0.72)), m, z)
b.put(s.head, rgbOf('#be9d82'), m, z)
if (look.soldier) {
b.put(s.helmet, METAL, m, z)
b.put(s.helmetShade, rgbOf('#62676a'), m, z)
b.put(s.strap, rgbOf('#62676a'), m, z)
} else {
b.put(s.hair, rgbOf('#3a2e24'), m, z)
}
if (look.tool) {
const t = pose.swing ? mul(m, turn(pose.swing, 1.1, -6.4)) : m
b.put(look.tool === 'spear' ? s.shaft : s.handle, HANDLE, t, z)
b.put(s.heads[look.tool], METAL, t, z)
}
if (look.soldier) {
b.put(s.shield, rgbOf('#6e1d16'), m, z)
b.put(s.shieldShade, rgbOf('#4f140f'), m, z)
b.put(s.boss, rgbOf('#9a8f78'), m, z)
}
if (look.carry && pose.load) {
b.put(s.loadTop, rgbOf(scale(look.carry, 1.15)), m, z)
b.put(s.loadA, rgbOf(look.carry), m, z)
b.put(s.loadB, rgbOf(scale(look.carry, 0.7)), m, z)
}
}
/** A villager going out along `d` to work and bringing the load home, as VillageWorker. */
export function worker(o: Look & { d: string; walk: number; work: number; rest?: number; indoors?: boolean; size: number; begin: number }): Actor {
const track = new Track(o.d)
const [from, to] = track.ends
const cycle: Cycle = workCycle(o.walk, o.work, o.rest ?? 1.2, to[0] < from[0] ? -1 : 1, o.indoors)
const k = {
motion: keys(cycle.motion.keyPoints, cycle.motion.keyTimes),
step: keys(cycle.step.values, cycle.step.keyTimes),
mirrored: keys(cycle.step.mirrored, cycle.step.keyTimes),
swing: keys(cycle.swing.values, cycle.swing.keyTimes),
load: keys(cycle.load.values, cycle.load.keyTimes),
face: keys(cycle.face.values, cycle.face.keyTimes),
presence: cycle.presence ? keys(cycle.presence.values, cycle.presence.keyTimes) : null,
}
// A spear rides on the shoulder while walking; other tools swing at work.
const swings = !!o.tool && o.tool !== 'spear'
return {
corners: PERSON_CORNERS,
moving: true,
draw(b, t, motion, z) {
if (!motion) return
const f = phase(t, o.begin, cycle.dur)
if (k.presence && !discrete(k.presence, f)[0]) return
const [x, y] = track.point(linear(k.motion, f)[0]!)
const pose: Pose = {
fx: discrete(k.face, f)[0]!,
legA: linear(k.step, f)[0]!,
legB: linear(k.mirrored, f)[0]!,
swing: swings ? linear(k.swing, f)[0]! : 0,
load: !!discrete(k.load, f)[0],
}
drawPerson(b, o, pose, mul(move(x, y), stretch(o.size)), z)
},
}
}
const BOB = keys('0 0;0 -0.5;0 0;0 0', '0;0.15;0.3;1')
/** A villager who stays put: talking (bobbing a little), hammering, drilling, or on guard. */
export function standing(o: { at: [number, number]; facing: 1 | -1; tool: Tool | null; shirt: string; drill?: boolean; guard?: boolean; bob: number }): Actor {
const spec = o.guard || !o.tool ? null : o.drill ? drillThrust() : workInPlace()
const swing = spec ? keys(spec.values, spec.keyTimes) : null
const look: Look = o.guard ? { shirt: o.shirt, tool: 'spear', soldier: true } : { shirt: o.shirt, tool: o.tool }
return {
corners: PERSON_CORNERS,
moving: false,
draw(b, t, motion, z) {
const lift = motion && !o.tool && !o.guard ? linear(BOB, phase(t, 0, o.bob))[1]! : 0
const angle = motion && swing && spec ? linear(swing, phase(t, 0, spec.dur))[0]! : 0
drawPerson(b, look, { fx: o.facing, legA: 0, legB: 0, swing: angle, load: true }, mul(move(o.at[0], o.at[1]), mul(stretch(1.6), move(0, lift))), z)
},
}
}
// Animals and crows.
let animals: ReturnType<typeof animalShapes> | null = null
function animalShapes() {
return {
sheep: {
body: [
{ tris: path('M-1 -0.9h0.6V0h-0.6zM1.2 -0.9h0.6V0h-0.6z'), color: rgbOf('#2e2722') },
{ tris: path('M-2.2 -3.4Q-2.4 -1 -0.6 -0.7H2Q3 -1.6 2.4 -3.4Q0.2 -4.6 -2.2 -3.4z'), color: rgbOf('#b5ae9c') },
{ tris: path('M0.2 -0.7H2Q3 -1.6 2.4 -3.4Q1.4 -3.9 0.2 -3.9z'), color: rgbOf('#968f80') },
],
head: [{ tris: path('M2.1 -3.3L3.7 -3.1L3.6 -1.9L2.3 -2.1z'), color: rgbOf('#2e2722') }],
pivot: [2.2, -2.6] as [number, number],
peck: { k: keys('0;28;28;0;0', '0;0.15;0.6;0.75;1'), dur: 2.2 },
},
chicken: {
body: [
{ tris: path('M-0.3 -0.8h0.3V0h-0.3zM0.4 -0.8h0.3V0h-0.3z'), color: rgbOf('#a07e3a') },
{ tris: path('M-1.4 -2.6Q-1.2 -0.7 0.4 -0.8Q1.4 -1.2 1.2 -2.2Q0 -3.2 -1.4 -2.6z'), color: rgbOf('#86663f') },
],
head: [
{ tris: path('M0.8 -3.4L1.7 -3.2L1.6 -2.2L0.9 -2.3z'), color: rgbOf('#86663f') },
{ tris: path('M1.7 -3L2.3 -2.7L1.7 -2.5z'), color: rgbOf('#a07e3a') },
{ tris: path('M0.9 -3.6L1.4 -3.9L1.4 -3.3z'), color: rgbOf('#7e2218') },
],
pivot: [1, -2.2] as [number, number],
peck: { k: keys('0;40;0;0', '0;0.2;0.4;1'), dur: 0.7 },
},
crow: path('M0 0L-3.8 -1.6L-1.6 0.3zM0 0L3.8 -1.6L1.6 0.3zM-0.5 -0.3H0.5V0.6H-0.5z'),
}
}
// Four stretches of the loop, each followed by a stop to graze or peck.
const WANDER = keys('0;0.25;0.25;0.5;0.5;0.75;0.75;1;1', '0;0.12;0.3;0.42;0.55;0.67;0.8;0.92;1')
/** A sheep or a chicken wandering its loop, head going down now and then, as VillageAnimal. */
export function animal(o: { kind: 'sheep' | 'chicken'; d: string; dur: number; begin: number; size: number }): Actor {
const track = new Track(o.d)
return {
corners: 120,
moving: true,
draw(b, t, motion, z) {
if (!motion) return
const a = (animals ??= animalShapes())[o.kind]
const [x, y] = track.point(linear(WANDER, phase(t, o.begin, o.dur))[0]!)
const m = mul(move(x, y), stretch(o.size))
for (const p of a.body) b.put(p.tris, p.color, m, z)
const head = mul(m, turn(linear(a.peck.k, phase(t, o.begin, a.peck.dur))[0]!, a.pivot[0], a.pivot[1]))
for (const p of a.head) b.put(p.tris, p.color, head, z)
},
}
}
const FLAP = keys('1 1;1 -0.6;1 1', '0;0.5;1')
const BLACK = rgbOf('#121212')
/** A crow crossing or circling at an even speed, wings beating, as VillageBird. */
export function crow(o: { d: string; dur: number; begin: number; size: number }): Actor {
const track = new Track(o.d)
return {
corners: 30,
moving: true,
draw(b, t, motion, z) {
if (!motion) return
const [x, y] = track.point(phase(t, o.begin, o.dur))
const flap = linear(FLAP, phase(t, o.begin, 0.45))[1]!
b.put((animals ??= animalShapes()).crow, BLACK, mul(move(x, y), mul(stretch(o.size), stretch(1, flap))), z)
},
}
}
// Smoke: three flat puffs per chimney that rise, drift and shrink away (3.9 s each).
const PUFF = { dur: 3.9, r: 5.5, edge: 0.25, k: keys('0 0 0.25;-6 -15 1;-13 -27 0', '0;0.55;1') }
let puffShapes: { edge: Float32Array; fill: Float32Array } | null = null
export function smoke(o: { at: [number, number]; index: number; fill: string; edge: string }): Actor {
const fill = rgbOf(o.fill)
const edge = rgbOf(o.edge)
return {
corners: 3 * 2 * 14 * 3,
moving: true,
draw(b, t, motion, z) {
if (!motion) return
puffShapes ??= { edge: circle(0, 0, PUFF.r + PUFF.edge, 14), fill: circle(0, 0, PUFF.r - PUFF.edge, 14) }
for (let n = 1; n <= 3; n++) {
const [dx, dy, s] = linear(PUFF.k, phase(t, -(n * 1.3 + o.index * 0.9), PUFF.dur))
if (!s) continue
const m = mul(move(o.at[0] + dx!, o.at[1] + dy!), stretch(s!))
b.put(puffShapes.edge, edge, m, z)
b.put(puffShapes.fill, fill, m, z)
}
},
}
}
// The ground ring under a picked building: solid when clicked, dashed under keyboard focus.
const RING = rgbOf('#7b1e16')
export function ring(b: Batch, e: { cx: number; cy: number; rx: number; ry: number }, dashed: boolean, z: number) {
const n = 96
const at = (i: number, grow: number): [number, number] => {
const a = (i / n) * Math.PI * 2
return [e.cx + (e.rx + grow) * Math.cos(a), e.cy + (e.ry + grow) * Math.sin(a)]
}
let walked = 0
for (let i = 0; i < n; i++) {
const [ax, ay] = at(i, 0)
const [bx, by] = at(i + 1, 0)
const piece = Math.hypot(bx - ax, by - ay)
// Dashes of 4 with gaps of 3, like the SVG's stroke-dasharray.
const show = !dashed || (walked + piece / 2) % 7 < 4
walked += piece
if (!show) continue
const [ix, iy] = at(i, -1)
const [ox, oy] = at(i, 1)
const [jx, jy] = at(i + 1, -1)
const [px, py] = at(i + 1, 1)
b.put(new Float32Array([ix, iy, ox, oy, px, py, ix, iy, px, py, jx, jy]), RING, IDENTITY, z)
}
}
export const RING_CORNERS = 96 * 6

102
app/diorama/gl.ts Normal file
View File

@ -0,0 +1,102 @@
// A village scene in buffers for WebGL. The SVG drew everything back to front; here all
// that stands still goes into one mesh in that same order, and every place where something
// moves (people, animals, smoke, crows) or a ground ring may show gets a depth step of its
// own. The figures are drawn afterwards at their step, so the depth test puts them behind
// what was drawn after them and in front of what came before: the painter's order, kept.
import earcut from 'earcut'
import type { Poly } from './iso'
import { type Actor, animal, crow, rgbOf, smoke, standing, worker } from './figures'
import { SHIRTS, SMOKE, UNIFORM } from './models'
import type { Scene } from './scene'
export interface GlScene {
/** Corners (x, -y, z) and colours (0..255) of everything that stands still, with triangle indices. */
positions: Float32Array
colors: Uint8Array
indices: Uint32Array
/** What moves, each with its depth step, back to front. */
actors: { actor: Actor; z: number }[]
/** Where each building's ground ring goes, and its depth step: just under the building. */
rings: Map<number, { z: number; ring: { cx: number; cy: number; rx: number; ry: number } }>
/** The nearest depth step in use. */
top: number
}
export function buildGl(scene: Scene): GlScene {
const positions: number[] = []
const colors: number[] = []
const indices: number[] = []
const flat: number[] = []
function add(polys: Poly[], z: number) {
for (const p of polys) {
flat.length = 0
for (const pair of p.points.split(' ')) {
const comma = pair.indexOf(',')
flat.push(Number(pair.slice(0, comma)), Number(pair.slice(comma + 1)))
}
const tris = earcut(flat)
if (!tris.length) continue
const first = positions.length / 3
const [r, g, b] = rgbOf(p.fill)
for (let i = 0; i < flat.length; i += 2) {
positions.push(flat[i]!, -flat[i + 1]!, z)
colors.push(r * 255, g * 255, b * 255)
}
for (const i of tris) indices.push(first + i)
}
}
const actors: GlScene['actors'] = []
const rings: GlScene['rings'] = new Map()
let z = 0
add(scene.terrain, z)
add(scene.decals, z)
// Villagers on their way to work and animals walk under every building.
z++
scene.walks.forEach((w, i) => {
for (let n = 1; n <= w.count; n++) {
const shirt = SHIRTS[(i * 3 + n) % SHIRTS.length]!
const begin = -((n - 1) * (w.walk * 2 + w.work)) / w.count - i * 3
actors.push({ z, actor: worker({ d: w.d, walk: w.walk, work: w.work, tool: w.tool, carry: w.carry, shirt, size: 1.6, begin }) })
}
})
for (const a of scene.herds) actors.push({ z, actor: animal({ ...a, size: a.kind === 'sheep' ? 1.7 : 1.4 }) })
z++
for (const o of scene.objects) {
if (o.building) {
if (o.building.ring.rx) rings.set(o.building.id, { z: ++z, ring: o.building.ring })
add(o.polys, ++z)
} else if (o.life) {
const l = o.life
const shirt = l.guard ? UNIFORM : SHIRTS[l.shirt % SHIRTS.length]!
actors.push({ z: ++z, actor: standing({ at: l.at, facing: l.facing, tool: l.tool, shirt, drill: l.drill, guard: l.guard, bob: 2.2 + (l.shirt % 3) * 0.4 }) })
z++
} else if (o.walker) {
const w = o.walker
const shirt = w.soldier ? UNIFORM : SHIRTS[w.shirt % SHIRTS.length]!
actors.push({ z: ++z, actor: worker({ ...w, shirt, size: 1.6 }) })
z++
} else {
add(o.polys, z)
}
}
// Smoke over the roofs, crows over everything.
z++
scene.smoke.forEach((at, index) => actors.push({ z, actor: smoke({ at, index, fill: SMOKE.fill, edge: SMOKE.edge }) }))
z++
for (const b of scene.birds) actors.push({ z, actor: crow({ ...b, size: 1.6 }) })
return {
positions: new Float32Array(positions),
colors: new Uint8Array(colors),
indices: new Uint32Array(indices),
actors,
rings,
top: z,
}
}

166
app/diorama/svgpath.ts Normal file
View File

@ -0,0 +1,166 @@
// SVG path data as plain points, for drawing the figures with WebGL and moving them along
// the same paths the scene hands out as strings. Covers what the dioramas write: M L H V Q
// A Z, absolute and relative; curves and arcs are cut into short straight pieces.
import type { V2 } from './iso'
const TOKEN = /[MmLlHhVvQqAaZz]|[-+]?(?:\d+\.?\d*|\.\d+)(?:[eE][-+]?\d+)?/g
/** Each subpath of `d` as a polyline; a closed subpath does not repeat its first point. */
export function polylines(d: string, pieces = 6): V2[][] {
const tokens = d.match(TOKEN) ?? []
const out: V2[][] = []
let line: V2[] = []
let x = 0
let y = 0
let i = 0
let command = 'M'
const num = () => Number(tokens[i++])
const end = () => {
if (line.length > 1) out.push(line)
line = []
}
while (i < tokens.length) {
if (/[a-zA-Z]/.test(tokens[i]!)) command = tokens[i++]!
const rel = command === command.toLowerCase()
const ox = rel ? x : 0
const oy = rel ? y : 0
switch (command.toUpperCase()) {
case 'M':
end()
x = ox + num()
y = oy + num()
line.push([x, y])
// Further pairs after a moveto are linetos.
command = rel ? 'l' : 'L'
break
case 'L':
x = ox + num()
y = oy + num()
line.push([x, y])
break
case 'H':
x = ox + num()
line.push([x, y])
break
case 'V':
y = oy + num()
line.push([x, y])
break
case 'Q': {
const cx = ox + num()
const cy = oy + num()
const ex = ox + num()
const ey = oy + num()
for (let k = 1; k <= pieces; k++) {
const t = k / pieces
const u = 1 - t
line.push([u * u * x + 2 * u * t * cx + t * t * ex, u * u * y + 2 * u * t * cy + t * t * ey])
}
x = ex
y = ey
break
}
case 'A': {
const rx = num()
const ry = num()
const rotation = num()
const large = num()
const sweep = num()
const ex = ox + num()
const ey = oy + num()
arc(line, x, y, rx, ry, (rotation * Math.PI) / 180, large !== 0, sweep !== 0, ex, ey, pieces * 3)
x = ex
y = ey
break
}
case 'Z': {
const first = line[0]
end()
if (first) [x, y] = first
break
}
default:
i++
}
}
end()
return out
}
/** An elliptical arc from (x1, y1) to (x2, y2), endpoint form as in SVG, as points after the start. */
function arc(out: V2[], x1: number, y1: number, rx: number, ry: number, phi: number, large: boolean, sweep: boolean, x2: number, y2: number, pieces: number) {
rx = Math.abs(rx)
ry = Math.abs(ry)
if (!rx || !ry) {
out.push([x2, y2])
return
}
const cos = Math.cos(phi)
const sin = Math.sin(phi)
const dx = (x1 - x2) / 2
const dy = (y1 - y2) / 2
const px = cos * dx + sin * dy
const py = -sin * dx + cos * dy
const grow = (px * px) / (rx * rx) + (py * py) / (ry * ry)
if (grow > 1) {
rx *= Math.sqrt(grow)
ry *= Math.sqrt(grow)
}
const num = rx * rx * ry * ry - rx * rx * py * py - ry * ry * px * px
const den = rx * rx * py * py + ry * ry * px * px
const k = (large === sweep ? -1 : 1) * Math.sqrt(Math.max(0, num / den))
const cpx = (k * rx * py) / ry
const cpy = (-k * ry * px) / rx
const cx = cos * cpx - sin * cpy + (x1 + x2) / 2
const cy = sin * cpx + cos * cpy + (y1 + y2) / 2
const angle = (ux: number, uy: number, vx: number, vy: number) => Math.atan2(ux * vy - uy * vx, ux * vx + uy * vy)
const t1 = angle(1, 0, (px - cpx) / rx, (py - cpy) / ry)
let dt = angle((px - cpx) / rx, (py - cpy) / ry, (-px - cpx) / rx, (-py - cpy) / ry)
if (!sweep && dt > 0) dt -= Math.PI * 2
if (sweep && dt < 0) dt += Math.PI * 2
for (let n = 1; n <= pieces; n++) {
const t = t1 + (dt * n) / pieces
out.push([cx + rx * Math.cos(t) * cos - ry * Math.sin(t) * sin, cy + rx * Math.cos(t) * sin + ry * Math.sin(t) * cos])
}
}
/** A path to move along: the point at a fraction of its length, like SVG's animateMotion. */
export class Track {
private readonly pts: V2[]
private readonly at: number[]
readonly length: number
constructor(d: string) {
this.pts = polylines(d, 8).flat()
if (!this.pts.length) this.pts = [[0, 0]]
this.at = [0]
for (let i = 1; i < this.pts.length; i++) {
const [ax, ay] = this.pts[i - 1]!
const [bx, by] = this.pts[i]!
this.at.push(this.at[i - 1]! + Math.hypot(bx - ax, by - ay))
}
this.length = this.at[this.at.length - 1]!
}
point(fraction: number): V2 {
const target = Math.min(1, Math.max(0, fraction)) * this.length
let lo = 0
let hi = this.at.length - 1
while (hi - lo > 1) {
const mid = (lo + hi) >> 1
if (this.at[mid]! <= target) lo = mid
else hi = mid
}
const span = this.at[hi]! - this.at[lo]!
const t = span > 0 ? (target - this.at[lo]!) / span : 0
const [ax, ay] = this.pts[lo]!
const [bx, by] = this.pts[hi]!
return [ax + (bx - ax) * t, ay + (by - ay) * t]
}
/** Where it starts and where it ends, for which way a walker faces. */
get ends(): [V2, V2] {
return [this.pts[0]!, this.pts[this.pts.length - 1]!]
}
}

View File

@ -16,12 +16,15 @@
"@blax-software/i18n": "^0.2.0",
"@blax-software/networking": "^0.4.0",
"@nuxtjs/i18n": "^10.6.0",
"earcut": "^3.2.4",
"nuxt": "^4.6.3",
"three": "^0.186.1",
"vue": "^3.5.44",
"vue-router": "^5.4.0"
},
"devDependencies": {
"@tailwindcss/vite": "^4.3.3",
"@types/three": "^0.186.0",
"tailwindcss": "^4.3.3",
"typescript": "^5.9.3",
"vue-tsc": "^3.3.13"

View File

@ -175,9 +175,15 @@ importers:
'@nuxtjs/i18n':
specifier: ^10.6.0
version: 10.6.0(@nuxt/schema@4.6.3)(db0@0.3.4)(dotenv@17.4.2)(esbuild@0.28.2)(giget@3.3.1)(ioredis@5.11.1(supports-color@10.2.2))(jiti@2.7.0)(rolldown@1.2.15)(rollup@4.65.1)(supports-color@10.2.2)(typescript@5.9.3)(vite@8.3.5(esbuild@0.28.2)(jiti@2.7.0)(terser@5.51.2)(yaml@2.9.1))(vue@3.5.44(typescript@5.9.3))
earcut:
specifier: ^3.2.4
version: 3.2.4
nuxt:
specifier: ^4.6.3
version: 4.6.3(@babel/plugin-syntax-jsx@7.29.7(@babel/core@7.29.7(supports-color@10.2.2)))(@babel/plugin-syntax-typescript@7.29.7(@babel/core@7.29.7(supports-color@10.2.2)))(@oxc-project/types@0.155.0)(@vue/compiler-sfc@3.5.44)(acorn@8.19.0)(confbox@0.2.4)(db0@0.3.4)(dotenv@17.4.2)(esbuild@0.28.2)(giget@3.3.1)(ioredis@5.11.1(supports-color@10.2.2))(lightningcss@1.33.0)(mlly@1.8.2)(oxc-parser@0.141.0)(rolldown@1.2.15)(rollup-plugin-visualizer@7.1.1(rolldown@1.2.15)(rollup@4.65.1))(rollup@4.65.1)(srvx@1.0.8)(supports-color@10.2.2)(terser@5.51.2)(typescript@5.9.3)(vite@8.3.5(esbuild@0.28.2)(jiti@2.7.0)(terser@5.51.2)(yaml@2.9.1))(vue-tsc@3.3.13(typescript@5.9.3))(yaml@2.9.1)
three:
specifier: ^0.186.1
version: 0.186.1
vue:
specifier: ^3.5.44
version: 3.5.44(typescript@5.9.3)
@ -188,6 +194,9 @@ importers:
'@tailwindcss/vite':
specifier: ^4.3.3
version: 4.3.3(vite@8.3.5(esbuild@0.28.2)(jiti@2.7.0)(terser@5.51.2)(yaml@2.9.1))
'@types/three':
specifier: ^0.186.0
version: 0.186.0
tailwindcss:
specifier: ^4.3.3
version: 4.3.3
@ -369,6 +378,9 @@ packages:
resolution: {integrity: sha512-OoKoR0f76dCY666JlcbhmVTs2drYj1GUXZTYTcbUgJjh9Nv41aFfZ21bPQTERm5+L5cBDo466NltB2lplS5GBw==}
engines: {node: '>=20.19.0'}
'@dimforge/rapier3d-compat@0.12.0':
resolution: {integrity: sha512-uekIGetywIgopfD97oDL5PfeezkFpNhwlzlaEYNOA0N6ghdsOvh/HYjSMek5Q2O1PYvRSDFcqFVJl4r4ZBwOow==}
'@dxup/nuxt@0.5.10':
resolution: {integrity: sha512-54Vehb7LmR7qYpC6KFwjDTSm6CB1CayBu+JXdHrPLrIjjr5xAgb43jvgOU+mnB+tsRh414fSsEy0QjBMKILQ8g==}
@ -1836,6 +1848,9 @@ packages:
peerDependencies:
vite: ^5.2.0 || ^6 || ^7 || ^8
'@tweenjs/tween.js@23.1.3':
resolution: {integrity: sha512-vJmvvwFxYuGnF2axRtPYocag6Clbb5YS7kLL+SO/TeVFzHqDIWrNKYtcsPMibjDx9O+bu+psAy9NKfWklassUA==}
'@tybys/wasm-util@0.10.4':
resolution: {integrity: sha512-W3c4gRigFS0T/Ma4qIYF3GDAc5AQdHb1yL5znJT1Zv1YaD9Kitx656wBjvr19qbiosmZT8lWDM5BEMynUqX65A==}
@ -1845,6 +1860,15 @@ packages:
'@types/resolve@1.20.2':
resolution: {integrity: sha512-60BCwRFOZCQhDncwQdxxeOEEkbc5dIMccYLwbxsS4TUNeVECQ/pBJ0j09mrHOl/JJvpRPGwO9SvE4nR2Nb/a4Q==}
'@types/stats.js@0.17.4':
resolution: {integrity: sha512-jIBvWWShCvlBqBNIZt0KAshWpvSjhkwkEu4ZUcASoAvhmrgAUI2t1dXrjSL4xXVLB4FznPrIsX3nKXFl/Dt4vA==}
'@types/three@0.186.0':
resolution: {integrity: sha512-mxYSBpDC+D0pLfSP6sW4WZTcT+nrtmZcimMqnVmy36Hte3XpeYSrvgg4TRdaM1GemGog1AWzI5qL2VoIfMXbJQ==}
'@types/webxr@0.5.24':
resolution: {integrity: sha512-h8fgEd/DpoS9CBrjEQXR+dIDraopAEfu4wYVNY2tEPwk60stPWhvZMf4Foo5FakuQ7HFZoa8WceaWFervK2Ovg==}
'@typescript-eslint/project-service@8.72.1':
resolution: {integrity: sha512-fAuVMkwdO/huI8nyo/WKnNKf6Gag93S56Rh3Ts5mGcavwSdaN8tRg1gCeIGX8PF+nzp1BjGfO4gHhGzW1J6jTg==}
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
@ -2431,6 +2455,9 @@ packages:
duplexer@0.1.2:
resolution: {integrity: sha512-jtD6YG370ZCIi/9GTaJKQxWTZD045+4R4hTk/x1UyoqadyJ9x9CgSi1RlVDQF8U2sxLLSnFkCaMihqljHIWgMg==}
earcut@3.2.4:
resolution: {integrity: sha512-FHc6yNpnTORB0tM5kmZ03iD2mDuNakDE2lvf4Hw1XkfxtEHIGVi01B/GqUSwx+NcC1WGjidAfpTXzeALtPtfpg==}
eastasianwidth@0.2.0:
resolution: {integrity: sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==}
@ -2581,6 +2608,9 @@ packages:
fetchdts@0.2.0:
resolution: {integrity: sha512-PJb4ZTGT2/wK78RmVrxZITStWabhZlKBsL52VOgq+c7clEkdHdEB+0rtzrXCbZJqeYJj+IwNWYqB5/G6vouA6A==}
fflate@0.8.3:
resolution: {integrity: sha512-tbZNuJrLwGUp3zshBtdy4W+ORxZuIh8a5ilyIEQDC5rY1f3U20JMry0Ll3WBzU58EZKsEuJFXhb5gwv8CsPvgA==}
file-uri-to-path@1.0.0:
resolution: {integrity: sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==}
@ -3053,6 +3083,9 @@ packages:
resolution: {integrity: sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==}
engines: {node: '>= 8'}
meshoptimizer@1.1.1:
resolution: {integrity: sha512-oRFNWJRDA/WTrVj7NWvqa5HqE1t9MYDj2VaWirQCzCCrAd2GHrqR/sQezCxiWATPNlKTcRaPRHPJwIRoPBAp5g==}
microdiff@1.6.0:
resolution: {integrity: sha512-w7JWt8Bno6I8h0rEqlxr4lNG4UbT1FVtWo42wWosIiaJ+rP3pXh7shCYDnyqBrYx36LJ1CZ64p8A62aVp0sJpQ==}
@ -3644,6 +3677,9 @@ packages:
text-decoder@1.2.7:
resolution: {integrity: sha512-vlLytXkeP4xvEq2otHeJfSQIRyWxo/oZGEbXrtEEF9Hnmrdly59sUbzZ/QgyWuLYHctCHxFF4tRQZNQ9k60ExQ==}
three@0.186.1:
resolution: {integrity: sha512-blFeqb49wRCSGUGj7gtpfnSGHy2lwDk94RhUmS1c/hTby70kvChbWpkJ4Pm1390LqzzvTmzgXKHPEafJwCb8jA==}
tiny-invariant@1.3.3:
resolution: {integrity: sha512-+FbBPE1o9QAYvviau/qC5SE3caw21q3xkvWKBtja5vgqOWIHHJ3ioaq1VPfn/Szqctz2bU/oYeKd9/z5BL+PVg==}
@ -4373,6 +4409,8 @@ snapshots:
'@csstools/css-tokenizer@4.0.2': {}
'@dimforge/rapier3d-compat@0.12.0': {}
'@dxup/nuxt@0.5.10(@nuxt/schema@4.6.3)(confbox@0.2.4)(dotenv@17.4.2)(esbuild@0.28.2)(giget@3.3.1)(jiti@2.7.0)(mlly@1.8.2)(oxc-parser@0.141.0)(rolldown@1.2.15)(rollup@4.65.1)(vite@8.3.5(esbuild@0.28.2)(jiti@2.7.0)(terser@5.51.2)(yaml@2.9.1))':
dependencies:
'@dxup/unimport': 0.1.2
@ -5713,6 +5751,8 @@ snapshots:
tailwindcss: 4.3.3
vite: 8.3.5(esbuild@0.28.2)(jiti@2.7.0)(terser@5.51.2)(yaml@2.9.1)
'@tweenjs/tween.js@23.1.3': {}
'@tybys/wasm-util@0.10.4':
dependencies:
tslib: 2.8.1
@ -5722,6 +5762,19 @@ snapshots:
'@types/resolve@1.20.2': {}
'@types/stats.js@0.17.4': {}
'@types/three@0.186.0':
dependencies:
'@dimforge/rapier3d-compat': 0.12.0
'@tweenjs/tween.js': 23.1.3
'@types/stats.js': 0.17.4
'@types/webxr': 0.5.24
fflate: 0.8.3
meshoptimizer: 1.1.1
'@types/webxr@0.5.24': {}
'@typescript-eslint/project-service@8.72.1(supports-color@10.2.2)(typescript@5.9.3)':
dependencies:
'@typescript-eslint/tsconfig-utils': 8.72.1(typescript@5.9.3)
@ -6320,6 +6373,8 @@ snapshots:
duplexer@0.1.2: {}
earcut@3.2.4: {}
eastasianwidth@0.2.0: {}
ee-first@1.1.1: {}
@ -6522,6 +6577,8 @@ snapshots:
fetchdts@0.2.0: {}
fflate@0.8.3: {}
file-uri-to-path@1.0.0: {}
fill-range@7.1.1:
@ -6951,6 +7008,8 @@ snapshots:
merge2@1.4.1: {}
meshoptimizer@1.1.1: {}
microdiff@1.6.0: {}
micromatch@4.0.8:
@ -7807,6 +7866,8 @@ snapshots:
transitivePeerDependencies:
- react-native-b4a
three@0.186.1: {}
tiny-invariant@1.3.3: {}
tinyclip@0.1.15: {}