Repository navigation
Description
Status: approved
Part of epic #3782 (parts 1 and 2). The epic holds the facts, the measurements and the full design.
TL;DR
Goal: TrailView fetches every fixed-shape instance model (trees, plants, rocks, animals, small objects of the kinds) as a file that the web build makes; the device builds no model, and no pixel changes.
Decision: a Vite plugin runs today's generators and mesh code in Node and emits packed model files (16-byte vertices, meshopt coded) with a manifest module; the engine fetches them per region and keeps them in the device cache entry models (8 MiB). specs/trailview-models.md holds the file format and the model budget.
Systems: trailview, web-planner
Contracts: new specs/trailview-models.md
Size: M (2 systems, a new contract, more than 500 changed lines)
Plan
models/pack.ts: the file codec;quantizeand the derived values (largest, radius, spread, proxy, outlines, sinks) move here frominstances/instances.ts. Trees and plants are packed from float32, the others from float64, as today.models/bake.tsandvite/model-files.ts: build the files and the manifestvirtual:models(file URLs, model ids,keepsHeading, phase colour matrices and own-crown flags, plant ground rules andsized, breed heights and coats, objects inPOINT_MODELSorder after the rocks). The dev server rebuilds on a change of any module in the entry's module graph. The build fails on a model over the budget of the spec.instances/instances.ts: take packed meshes with their derived values.vegetation/tree-models.ts,plants.ts,forest.ts,rows.ts,dressing/dressing.ts,structures/kind-points.ts: fetch the files in today's order; a 404 is not asked again in the session and warns once.- Delete
model-worker.ts,model-entry.ts,plant-worker.ts, thetreeentry ofvite/bundle-version.ts,virtual:tree-version;terrain/device-cache.ts:models(8 MiB) replacestrees. specs/trailview-models.md: the format and the budget table of the epic's part 2.docs/design/trailview.md: ownvite/model-files.ts.
The epic's ## Files lists every file.
Done when
models/pack.test.ts: each file decodes to a fresh pack of the generator output, bit for bit.- In the pull request, once: the pools' bytes and model records of develop and the branch are equal for every model, phase, season and seed; a pixel diff of three still views (forest summer, forest winter, pasture with herds) shows 0 changed pixels.
- Cold first open of the Alps, develop against the branch, alternated, 3 runs each, on the M1 Pro and once on the iPhone 13 (app host of prototype #3765: TrailView in the iOS app's web view on the iPhone 13 #3768): the time to the near trees and to the first complete view are not longer on the branch.
- An open with no network after a first open draws trees, plants and herds from the device cache.
- The web suites that
obc test affected --base origin/developselects pass, andnpm run checkpasses inbuilder/web.
The phone plan #3656 lists the model workers in its budget table; whichever lands second adapts those rows.
Activity