@threenative/core 0.3.13 → 0.3.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/capabilities.json +299 -10
- package/dist/{chunk-4SRAQFTU.js → chunk-2GPHICV6.js} +1 -1
- package/dist/{chunk-DIPIJICH.js → chunk-GEMQJBY4.js} +70 -18
- package/dist/{chunk-EFWZWLPY.js → chunk-QAMSM3Z5.js} +354 -12
- package/dist/{chunk-SV4QVUTQ.js → chunk-QAQHYOWY.js} +1 -1
- package/dist/{chunk-EEABDLUC.js → chunk-VBBYWGAT.js} +2 -2
- package/dist/{chunk-GYUZJQ7U.js → chunk-VQRPEOKY.js} +4 -1
- package/dist/index.d.ts +605 -7
- package/dist/index.js +1973 -609
- package/dist/playtest.js +3 -3
- package/dist/{quality-BYqKGAwo.d.ts → quality-BADStsTn.d.ts} +2 -2
- package/dist/render-environment.d.ts +1 -1
- package/dist/ui-layer.js +2 -2
- package/dist/worker.js +2 -2
- package/dist/world.d.ts +13 -3
- package/dist/world.js +179 -36
- package/mcp/animation-server.mjs +1 -1
- package/mcp/engine-server.mjs +32 -6
- package/mcp/servers.mjs +3 -3
- package/package.json +5 -5
- package/scripts/ensure-mcp.mjs +6 -1
- package/src/clustered-batch.ts +146 -3
- package/src/clustered-mesh.ts +548 -20
- package/src/debug.ts +16 -0
- package/src/displaced-surface.ts +428 -0
- package/src/frame-budget.ts +16 -0
- package/src/generated/console-markers.ts +1 -0
- package/src/grass-field.ts +628 -0
- package/src/index.ts +112 -0
- package/src/render/material-key.ts +21 -1
- package/src/render/screen-probe-gather.ts +303 -0
- package/src/render/short-range-ao.ts +274 -0
- package/src/render/world-impostor-surface.ts +98 -3
- package/src/render-camera-cull.ts +9 -3
- package/src/renderer.ts +26 -4
- package/src/scatter-field.ts +496 -0
- package/src/startup-offscreen-bytes.ts +11 -5
- package/src/state.ts +16 -3
- package/src/static-transform.ts +75 -6
- package/src/tile-ring.ts +294 -0
- package/src/version.ts +1 -1
- package/src/warmup.ts +15 -2
- package/src/world-cell-batches.ts +4 -0
- package/src/world-cell-data.ts +7 -0
- package/src/world-cell-models.ts +36 -8
- package/src/world-cell-render-gpu-dress.ts +4 -2
- package/src/world-cell-render-util.ts +2 -2
- package/src/world-cells.ts +1 -1
- package/src/world-river-ribbon.ts +13 -22
- package/src/world-water-bodies.ts +113 -3
package/capabilities.json
CHANGED
|
@@ -1486,6 +1486,26 @@
|
|
|
1486
1486
|
"supersedes": [],
|
|
1487
1487
|
"symbol": "debugFlag"
|
|
1488
1488
|
},
|
|
1489
|
+
{
|
|
1490
|
+
"aliases": [],
|
|
1491
|
+
"constraints": [
|
|
1492
|
+
"the same name rule as `debugFlag`: `?quality=` on the web, `TN_DEBUG_QUALITY` on a native launch",
|
|
1493
|
+
"a name in camelCase becomes UPPER_SNAKE: `debugValue(\"quality\")` reads `?quality=` or `TN_DEBUG_QUALITY`"
|
|
1494
|
+
],
|
|
1495
|
+
"example": "import { debugValue } from \"@threenative/core\";\nconst tier = debugValue(\"quality\");",
|
|
1496
|
+
"importPath": "@threenative/core",
|
|
1497
|
+
"kind": "function",
|
|
1498
|
+
"overrides": [],
|
|
1499
|
+
"package": "@threenative/core",
|
|
1500
|
+
"signature": "export function debugValue(name: string): string | undefined { … }",
|
|
1501
|
+
"situations": [
|
|
1502
|
+
"read a debug override whose value is not a boolean",
|
|
1503
|
+
"override a quality tier or a mode for one run without changing the code"
|
|
1504
|
+
],
|
|
1505
|
+
"summary": "Read the text a debug switch was given by the launch, on the same rule as `debugFlag`.",
|
|
1506
|
+
"supersedes": [],
|
|
1507
|
+
"symbol": "debugValue"
|
|
1508
|
+
},
|
|
1489
1509
|
{
|
|
1490
1510
|
"aliases": [
|
|
1491
1511
|
"nearest target crosshair spawns",
|
|
@@ -2153,6 +2173,37 @@
|
|
|
2153
2173
|
"supersedes": [],
|
|
2154
2174
|
"symbol": "GPUSceneBVH"
|
|
2155
2175
|
},
|
|
2176
|
+
{
|
|
2177
|
+
"aliases": [],
|
|
2178
|
+
"constraints": [
|
|
2179
|
+
"call `update(camera)` once per rendered frame from `ctx.beforeRender`; chunks build nearest first inside `buildBudgetMs`",
|
|
2180
|
+
"the material reads `GRASS_FIELD_ATTRIBUTES` and the field's `nodes` uniforms, so its thinning matches the CPU trim",
|
|
2181
|
+
"a chunk is built inside 1.3 × the draw distance and discarded past 1.4 ×, so a camera on the edge rebuilds nothing",
|
|
2182
|
+
"Call `update(camera)` once per rendered frame, from `ctx.beforeRender`.",
|
|
2183
|
+
"Rotating or scaling the field is not supported; translating it is."
|
|
2184
|
+
],
|
|
2185
|
+
"example": "// the look lives in the kit's src/render/grass.ts\nconst grass = new GrassField3D({ blade: grassBlade(), material: grassMaterial, getHeight: height });\nctx.add(grass);\nctx.beforeRender(() => { grass.pushers[0]?.set(hero.x, hero.y, hero.z, 1.2); grass.update(ctx.camera); });",
|
|
2186
|
+
"importPath": "@threenative/core",
|
|
2187
|
+
"kind": "class",
|
|
2188
|
+
"overrides": [
|
|
2189
|
+
"densityScale and cullDistanceScale scale every density and distance at once; prewarm() builds all in range on the next update"
|
|
2190
|
+
],
|
|
2191
|
+
"package": "@threenative/core",
|
|
2192
|
+
"signature": "export class GrassField3D extends Group { … }",
|
|
2193
|
+
"situations": [
|
|
2194
|
+
"grass that sways and parts around the player",
|
|
2195
|
+
"a meadow, lawn or grassy field over terrain that streams around the camera",
|
|
2196
|
+
"ground cover grass blades with distance thinning and LOD that does not pop",
|
|
2197
|
+
"grass flattened or pushed aside where the player, a creature or a vehicle walks",
|
|
2198
|
+
"grow grass on a terrain biome's grass rows with grassFieldFromBiome",
|
|
2199
|
+
"Grass that sways and parts around the player across a large terrain.",
|
|
2200
|
+
"Stream instanced ground cover in chunks around the camera under a frame budget.",
|
|
2201
|
+
"Meadow, lawn or field grass with distance thinning and LOD that does not pop."
|
|
2202
|
+
],
|
|
2203
|
+
"summary": "Stream instanced grass in chunks around the camera; the game owns the blade and its TSL material.",
|
|
2204
|
+
"supersedes": [],
|
|
2205
|
+
"symbol": "GrassField3D"
|
|
2206
|
+
},
|
|
2156
2207
|
{
|
|
2157
2208
|
"aliases": [],
|
|
2158
2209
|
"constraints": [
|
|
@@ -3360,6 +3411,31 @@
|
|
|
3360
3411
|
"supersedes": [],
|
|
3361
3412
|
"symbol": "RippleField"
|
|
3362
3413
|
},
|
|
3414
|
+
{
|
|
3415
|
+
"aliases": [],
|
|
3416
|
+
"constraints": [
|
|
3417
|
+
"call `update(follow)` once per rendered frame",
|
|
3418
|
+
"`place` runs once per candidate per tile build: return false for paths and clearings",
|
|
3419
|
+
"rotating or scaling the field is not supported; translating it is"
|
|
3420
|
+
],
|
|
3421
|
+
"example": "const floor = new ScatterField3D({ parts: [{ lods, material }], getHeight, density: 0.05, place });\nctx.add(floor);\nctx.beforeRender(() => floor.update(hero.position));",
|
|
3422
|
+
"importPath": "@threenative/core",
|
|
3423
|
+
"kind": "class",
|
|
3424
|
+
"overrides": [],
|
|
3425
|
+
"package": "@threenative/core",
|
|
3426
|
+
"requires": [
|
|
3427
|
+
"npm i -D @threenative/procedural-vegetation for the bake these instances come from"
|
|
3428
|
+
],
|
|
3429
|
+
"signature": "export class ScatterField3D extends Group { … }",
|
|
3430
|
+
"situations": [
|
|
3431
|
+
"scatter fallen logs, twigs, leaf litter, stones and ferns over a forest floor",
|
|
3432
|
+
"stream instanced props of any baked mesh round the player without one draw per prop",
|
|
3433
|
+
"place rocks, debris or plants on a heightfield with distance thinning and level of detail"
|
|
3434
|
+
],
|
|
3435
|
+
"summary": "Stream instanced copies of any baked mesh around a follow point, with distance thinning and levels of detail, from the game's own placement rule.",
|
|
3436
|
+
"supersedes": [],
|
|
3437
|
+
"symbol": "ScatterField3D"
|
|
3438
|
+
},
|
|
3363
3439
|
{
|
|
3364
3440
|
"aliases": [],
|
|
3365
3441
|
"constraints": ["scene code must stay portable across web and native"],
|
|
@@ -3438,6 +3514,34 @@
|
|
|
3438
3514
|
"supersedes": [],
|
|
3439
3515
|
"symbol": "Scheduler"
|
|
3440
3516
|
},
|
|
3517
|
+
{
|
|
3518
|
+
"aliases": [],
|
|
3519
|
+
"constraints": [
|
|
3520
|
+
"the owned engine only: on engine: \"threejs\" the upstream node takes the camera as its fourth argument and has no probes, and gather() refuses",
|
|
3521
|
+
"the gather is a delta in E / pi: multiply it by the receiver's diffuse colour (mrt({ diffuseColor })) and add it after the scene pass, and give the scene pass no other indirect diffuse or the light is counted twice",
|
|
3522
|
+
"a viewport resize needs a new gather: the probe grid is fixed when it is built",
|
|
3523
|
+
"the grid is the cost: downsampleFactor 16 and an 8 x 8 octahedron are Unreal's Epic, 32 and 8 its High",
|
|
3524
|
+
"radiance answers in the frame's units (the cache read times the frame's gain), and a trace reads it only where the screen has nothing"
|
|
3525
|
+
],
|
|
3526
|
+
"example": "const gather = new ScreenProbeGather({ camera, viewport, radiance, trace });\nconst gi = gather.gather(convertToTexture(input), depth(), normalView());\nconst bounce = gather.getGINode().rgb.mul(diffuseColor.rgb);",
|
|
3527
|
+
"importPath": "@threenative/core",
|
|
3528
|
+
"kind": "class",
|
|
3529
|
+
"overrides": [
|
|
3530
|
+
"downsampleFactor, tracingOctahedronResolution, cacheCellSize, timedPass and the strength of the composite are game-owned choices"
|
|
3531
|
+
],
|
|
3532
|
+
"package": "@threenative/core",
|
|
3533
|
+
"signature": "export class ScreenProbeGather { … }",
|
|
3534
|
+
"situations": [
|
|
3535
|
+
"bounce light that reads the room off screen instead of a flat ambient term",
|
|
3536
|
+
"global illumination that costs a fraction of one ray per pixel",
|
|
3537
|
+
"the light a corner sees from around the wall, which a per-pixel screen trace loses",
|
|
3538
|
+
"lumen screen probe gather",
|
|
3539
|
+
"lumen final gather"
|
|
3540
|
+
],
|
|
3541
|
+
"summary": "Lumen's Screen Probe Gather: one probe per 16 x 16 pixels traces an 8 x 8 octahedron of rays, the probes are filtered into an irradiance octahedron each, and a pixel blends the four nearest probes it can see, instead of every pixel tracing its own rays. A ray that hits on screen returns the lit frame minus the cache along it; a ray that leaves the screen continues through the packed scene up to the radiance cache's cell and reads the cache where it ended, so the light that arrives from off screen is that direction's and not the pixel's mean.",
|
|
3542
|
+
"supersedes": [],
|
|
3543
|
+
"symbol": "ScreenProbeGather"
|
|
3544
|
+
},
|
|
3441
3545
|
{
|
|
3442
3546
|
"aliases": [],
|
|
3443
3547
|
"constraints": [
|
|
@@ -3505,6 +3609,31 @@
|
|
|
3505
3609
|
"supersedes": [],
|
|
3506
3610
|
"symbol": "ShadowFilterBudget"
|
|
3507
3611
|
},
|
|
3612
|
+
{
|
|
3613
|
+
"aliases": [],
|
|
3614
|
+
"constraints": [
|
|
3615
|
+
"it replaces GTAO when dynamic GI runs; a tier without GI keeps ambientOcclusion",
|
|
3616
|
+
"the occlusion multiplies indirect light only: direct light and emission keep their own occlusion",
|
|
3617
|
+
"multi-bounce and its albedo cap belong to the game's composite; Unreal caps the albedo at 0.5",
|
|
3618
|
+
"an authored stage that carries its name must anchor itself (`before: \"ssgi\"`), because the chain's built-in order names no shortRangeAO"
|
|
3619
|
+
],
|
|
3620
|
+
"example": "const shortRange = new ShortRangeAO({ camera, viewport: renderer.drawingBufferSize });\nconst contact = shortRange.occlusion(depth(), normalView());\nconst indirect = input.rgb.mul(contact.a);",
|
|
3621
|
+
"importPath": "@threenative/core",
|
|
3622
|
+
"kind": "class",
|
|
3623
|
+
"overrides": [
|
|
3624
|
+
"horizonSearchSliceCount, horizonSearchStepCount, reachPx, bentNormal and intensity are game-owned choices"
|
|
3625
|
+
],
|
|
3626
|
+
"package": "@threenative/core",
|
|
3627
|
+
"signature": "export class ShortRangeAO { … }",
|
|
3628
|
+
"situations": [
|
|
3629
|
+
"contact shadow at the foot of an object while dynamic GI runs",
|
|
3630
|
+
"dark line where a wall meets the floor, without a second wide AO over the gathered light",
|
|
3631
|
+
"lumen short range ao"
|
|
3632
|
+
],
|
|
3633
|
+
"summary": "Unreal's Short Range AO: a horizon search of 2 sweeps around the view normal, 3 samples each at the squared fraction of a 32 px screen reach, at full resolution, with a bent normal at Epic. It is the occlusion that runs *with* dynamic global illumination — the contact detail Lumen keeps after the screen probe gather has already answered the wide occlusion — so a gathered frame is not darkened twice by two wide treatments. The result is one texture: `rgb` the bent normal in view space, `a` the share of the hemisphere left open, which multiplies indirect light only.",
|
|
3634
|
+
"supersedes": [],
|
|
3635
|
+
"symbol": "ShortRangeAO"
|
|
3636
|
+
},
|
|
3508
3637
|
{
|
|
3509
3638
|
"aliases": [],
|
|
3510
3639
|
"constraints": [
|
|
@@ -5417,9 +5546,10 @@
|
|
|
5417
5546
|
"signature": "export function lakeSurfaceGeometry( lake: IWaterLake, field: Heightfield, options: ILakeSurfaceOptions = { … }",
|
|
5418
5547
|
"situations": [
|
|
5419
5548
|
"draw a lake's water surface from the baked level and seed",
|
|
5420
|
-
"a lake's drawn water and the swimmer's water disagree"
|
|
5549
|
+
"a lake's drawn water and the swimmer's water disagree",
|
|
5550
|
+
"lake water ends in a straight edge over a valley past the basin's rim"
|
|
5421
5551
|
],
|
|
5422
|
-
"summary": "A lake's water surface: a level disc out to `lakeReach`, the footprint `WaterBodies` floods, with a `metres` attribute (water depth over the ground). Only cells with
|
|
5552
|
+
"summary": "A lake's water surface: a level disc out to `lakeReach`, the footprint `WaterBodies` floods, with a `metres` attribute (water depth over the ground). Only cells with a corner the seed's water reaches get triangles, so the surface does not hover over dry hillside, a hollow past the basin's rim (a river valley beyond the dam) stays dry instead of standing under a sheet that stops where the reach does, and the shore follows the ground's contour. The rings pack towards the middle, so an irregular basin costs vertices where the camera sees them. Returns `undefined` when the basin holds no water at its level.",
|
|
5423
5553
|
"supersedes": [],
|
|
5424
5554
|
"symbol": "lakeSurfaceGeometry"
|
|
5425
5555
|
},
|
|
@@ -5793,7 +5923,7 @@
|
|
|
5793
5923
|
"importPath": "@threenative/core/world",
|
|
5794
5924
|
"kind": "class",
|
|
5795
5925
|
"overrides": [
|
|
5796
|
-
"`hlod: false` keeps source rendering; ring, budgets, terrain tile size/resolution, terrain stream and collider radius, `transparentScatter`, `clusterSize` and `shadows.invalidate`, load `concurrency`, `rebuildsPerUpdate`, `admissionBudgetMs` and the package's per-asset maxDistance; `impostorFar: \"always\"` keeps the far aggregate the near ring's guaranteed radius made unnecessary"
|
|
5926
|
+
"`hlod: false` keeps source rendering; `partMaterial` gives a part the game's own surface (a swaying tree); ring, budgets, terrain tile size/resolution, terrain stream and collider radius, `transparentScatter`, `clusterSize` and `shadows.invalidate`, load `concurrency`, `rebuildsPerUpdate`, `admissionBudgetMs` and the package's per-asset maxDistance; `impostorFar: \"always\"` keeps the far aggregate the near ring's guaranteed radius made unnecessary"
|
|
5797
5927
|
],
|
|
5798
5928
|
"package": "@threenative/core",
|
|
5799
5929
|
"signature": "export class WorldCells extends Group implements IComputeDriven { … }",
|
|
@@ -8290,6 +8420,54 @@
|
|
|
8290
8420
|
"supersedes": [],
|
|
8291
8421
|
"symbol": "bakeWolfToFile"
|
|
8292
8422
|
},
|
|
8423
|
+
{
|
|
8424
|
+
"aliases": [],
|
|
8425
|
+
"constraints": [
|
|
8426
|
+
"fails closed: an unknown preset throws naming the nearest ids, the seed must be an integer and each lod 0 to 2",
|
|
8427
|
+
"the same preset, seed and lods write identical bytes; files are written atomically (temporary file, then rename)",
|
|
8428
|
+
"bake-time only, so keep it a dev dependency; the game owns the look and the sway (a TSL render/wind.ts reading _WIND), because Arbor.three is not shipped",
|
|
8429
|
+
"_WIND is vec4 (trunk sway, branch sway, flutter, phase): forest-kit sway is flutter in z, and debris writes all four zero",
|
|
8430
|
+
"form and leafImage patch an Arbor preset only; a forest-kit debris or cover preset throws when given either"
|
|
8431
|
+
],
|
|
8432
|
+
"example": "await bakeVegetation({ preset: \"oak\", seed: 7, lods: [0, 1], out: \"assets/trees\" });\nawait bakeVegetation({ preset: \"log\", seed: 3, out: \"assets/debris\" });",
|
|
8433
|
+
"importPath": "@threenative/procedural-vegetation",
|
|
8434
|
+
"kind": "function",
|
|
8435
|
+
"overrides": [],
|
|
8436
|
+
"package": "@threenative/procedural-vegetation",
|
|
8437
|
+
"requires": ["npm i -D @threenative/procedural-vegetation"],
|
|
8438
|
+
"signature": "export async function bakeVegetation(options: IBakeVegetationOptions): Promise<IVegetationBake[]> { … }",
|
|
8439
|
+
"situations": [
|
|
8440
|
+
"generate a procedural tree, an oak, pine, spruce, palm or any forest species as a GLB",
|
|
8441
|
+
"procedural oak tree GLB with level of detail for a game forest",
|
|
8442
|
+
"tree GLB for Unity, Unreal or Godot, with wind weights in a _WIND attribute",
|
|
8443
|
+
"a fallen mossy log and leaf litter on the forest floor, with a stump, twigs and boulders",
|
|
8444
|
+
"reeds and cattails at a pond edge, or sedge tussocks, clover and seeding grass as cover"
|
|
8445
|
+
],
|
|
8446
|
+
"summary": "Bake a procedural tree (Arbor) to GLBs, one per level of detail, ready for ctx.assets.model. Each GLB carries the _WIND vertex attribute, COLOR_0 and TEXCOORD_0; the Arbor presets also embed their bark and leaf textures with alpha-masked leaves, while forest-kit debris and cover shade from COLOR_0 alone.",
|
|
8447
|
+
"supersedes": [],
|
|
8448
|
+
"symbol": "bakeVegetation"
|
|
8449
|
+
},
|
|
8450
|
+
{
|
|
8451
|
+
"aliases": [],
|
|
8452
|
+
"constraints": [
|
|
8453
|
+
"ids come from the vendored Arbor and forest-kit presets; trees are kind \"tree\", grass, ferns and flowers are kind \"cover\", deadwood, litter and stone are kind \"debris\""
|
|
8454
|
+
],
|
|
8455
|
+
"example": "vegetationPresets().filter((p) => p.kind === \"debris\").map((p) => p.id);",
|
|
8456
|
+
"importPath": "@threenative/procedural-vegetation",
|
|
8457
|
+
"kind": "function",
|
|
8458
|
+
"overrides": [],
|
|
8459
|
+
"package": "@threenative/procedural-vegetation",
|
|
8460
|
+
"requires": ["npm i -D @threenative/procedural-vegetation"],
|
|
8461
|
+
"signature": "export function vegetationPresets(): IVegetationPreset[] { … }",
|
|
8462
|
+
"situations": [
|
|
8463
|
+
"list the oak, pine, spruce, palm and other tree species a bake can grow",
|
|
8464
|
+
"choose a tree species id for bakeVegetation or a terrain arbor: species",
|
|
8465
|
+
"what deadwood, leaf litter, boulders, reeds and tussocks can I bake for a forest floor"
|
|
8466
|
+
],
|
|
8467
|
+
"summary": "List every preset a bake can grow: id, name, latin name and kind. Trees and cover come from Arbor; the `debris` rows (log, stump, twig, branch, leaflitter, rock) and the extra cover rows (reeds, tussock, seedgrass, clover, dock, plume) come from forest-kit.",
|
|
8468
|
+
"supersedes": [],
|
|
8469
|
+
"symbol": "vegetationPresets"
|
|
8470
|
+
},
|
|
8293
8471
|
{
|
|
8294
8472
|
"aliases": [],
|
|
8295
8473
|
"constraints": [
|
|
@@ -9068,6 +9246,27 @@
|
|
|
9068
9246
|
"supersedes": [],
|
|
9069
9247
|
"symbol": "gradientAt"
|
|
9070
9248
|
},
|
|
9249
|
+
{
|
|
9250
|
+
"aliases": [],
|
|
9251
|
+
"constraints": [
|
|
9252
|
+
"the look stays the game's: pass the result with the kit's `render/grass.ts` blade and material"
|
|
9253
|
+
],
|
|
9254
|
+
"example": "const placement = grassFieldFromBiome(biome, { heightAt: (x, z) => field.heightAt(x, z), waterLevel: 0 });\nif (placement) ctx.add(new GrassField3D({ ...placement, blade: grassBlade(), material: grassMaterial }));",
|
|
9255
|
+
"importPath": "@threenative/terrain",
|
|
9256
|
+
"kind": "function",
|
|
9257
|
+
"overrides": [],
|
|
9258
|
+
"package": "@threenative/terrain",
|
|
9259
|
+
"requires": ["npm i -D @threenative/terrain"],
|
|
9260
|
+
"signature": "export function grassFieldFromBiome( biome: Pick<IBiomeSpec, \"grass\" | \"seed\">, ground: IGrassGround, ): IGrassFieldPlacement | null { … }",
|
|
9261
|
+
"situations": [
|
|
9262
|
+
"grow streamed grass on a terrain world's biome grass rows",
|
|
9263
|
+
"a Strata or terrain_generate world with a meadow that sways round the player",
|
|
9264
|
+
"feed a cooked biome to GrassField3D"
|
|
9265
|
+
],
|
|
9266
|
+
"summary": "Turns a terrain biome's grass rows and its ground into `GrassField3D` placement options, so a generated or cooked world grows streamed grass with one call. Returns null when the biome has no grass rows: the game draws no field. Each row covers its own slope band (full to `slope[1]`, gone `slopeFalloff` degrees past it), its own height band above `ground.floor` (fading over `heightFalloff` below the ceiling) and stays `waterMargin` above `ground.waterLevel`; the field takes the strongest row at each spot.",
|
|
9267
|
+
"supersedes": [],
|
|
9268
|
+
"symbol": "grassFieldFromBiome"
|
|
9269
|
+
},
|
|
9071
9270
|
{
|
|
9072
9271
|
"aliases": [],
|
|
9073
9272
|
"constraints": [
|
|
@@ -10332,6 +10531,31 @@
|
|
|
10332
10531
|
"supersedes": [],
|
|
10333
10532
|
"symbol": "useUiStateDuringStartup"
|
|
10334
10533
|
},
|
|
10534
|
+
{
|
|
10535
|
+
"symbol": "ctx.assets.memo",
|
|
10536
|
+
"package": "@threenative/core",
|
|
10537
|
+
"importPath": "src/assets.ts",
|
|
10538
|
+
"kind": "function",
|
|
10539
|
+
"signature": "ctx.assets.memo<T>(key: string, build: () => T | Promise<T>): Promise<T>",
|
|
10540
|
+
"summary": "Returns what `build` returned the last time this build of the game ran, read back from disk, and calls `build` only when nothing is stored. Use it for seeded work that is the same every run: placement lists, painted sky pixels, terrain heights, a generated stage.",
|
|
10541
|
+
"situations": [
|
|
10542
|
+
"cache generated geometry between page loads",
|
|
10543
|
+
"stop rebuilding the same generated stage on every page load",
|
|
10544
|
+
"cache painted sky pixels or baked terrain heights between runs",
|
|
10545
|
+
"keep seeded placement work the same every run without recomputing it",
|
|
10546
|
+
"make a slow boot fast without shipping a baked asset"
|
|
10547
|
+
],
|
|
10548
|
+
"aliases": [],
|
|
10549
|
+
"example": "const { pixels } = await ctx.assets.memo(\"sky\", () => ({ pixels: paintSky() }));",
|
|
10550
|
+
"constraints": [
|
|
10551
|
+
"The value is named typed arrays; a map of names to typed arrays is what is stored.",
|
|
10552
|
+
"On the dev server and on a native host `build` runs every time, and `TN_ASSET_MEMO` reports why: the cache is a build artifact, not a substitute for authoring.",
|
|
10553
|
+
"A new build of the game regenerates: the key alone does not pin a value across a rebuild.",
|
|
10554
|
+
"A game that drives a loader outside `defineGame` may call it whenever it likes; the reveal is not waited on."
|
|
10555
|
+
],
|
|
10556
|
+
"overrides": ["TN_ASSET_MEMO reports why a run rebuilt instead of reading the store"],
|
|
10557
|
+
"supersedes": []
|
|
10558
|
+
},
|
|
10335
10559
|
{
|
|
10336
10560
|
"symbol": "createStormAudio",
|
|
10337
10561
|
"package": "template:rain",
|
|
@@ -10557,6 +10781,76 @@
|
|
|
10557
10781
|
"supersedes": [],
|
|
10558
10782
|
"aliases": []
|
|
10559
10783
|
},
|
|
10784
|
+
{
|
|
10785
|
+
"symbol": "ctx.after",
|
|
10786
|
+
"package": "@threenative/core",
|
|
10787
|
+
"importPath": "src/scene.ts",
|
|
10788
|
+
"kind": "function",
|
|
10789
|
+
"signature": "ctx.after(delay: number, callback: () => void): ScheduleHandle",
|
|
10790
|
+
"summary": "Runs `callback` once, `delay` seconds of game time later, and returns a handle that cancels it. Game time stops while the game is paused, so a delayed beat does not fire behind a paused frame.",
|
|
10791
|
+
"situations": [
|
|
10792
|
+
"run a callback after a delay",
|
|
10793
|
+
"schedule a one-shot timer that pauses with the game",
|
|
10794
|
+
"do something a moment later without setTimeout",
|
|
10795
|
+
"cancel a pending delayed action when a scene exits"
|
|
10796
|
+
],
|
|
10797
|
+
"aliases": [],
|
|
10798
|
+
"example": "const spawn = ctx.after(0.4, () => ctx.add(makeWave()));\nspawn(); // cancels",
|
|
10799
|
+
"constraints": [
|
|
10800
|
+
"The delay is game seconds: a paused game does not age it, and a slow frame does not skip it.",
|
|
10801
|
+
"`setTimeout` keeps running while the game is paused and after the scene is gone; this does not.",
|
|
10802
|
+
"Call the returned handle to cancel: a pending callback holds its scene's closure alive."
|
|
10803
|
+
],
|
|
10804
|
+
"overrides": [],
|
|
10805
|
+
"supersedes": []
|
|
10806
|
+
},
|
|
10807
|
+
{
|
|
10808
|
+
"symbol": "ctx.beforeRender",
|
|
10809
|
+
"package": "@threenative/core",
|
|
10810
|
+
"importPath": "src/scene.ts",
|
|
10811
|
+
"kind": "function",
|
|
10812
|
+
"signature": "ctx.beforeRender(callback: () => void): () => void",
|
|
10813
|
+
"summary": "Registers work that runs once per actual world render, after the frame's last fixed update and before the projection reconciles and the renderer draws. The last place to change a transform, a uniform or a camera before the frame is presented.",
|
|
10814
|
+
"situations": [
|
|
10815
|
+
"run a callback just before the frame renders",
|
|
10816
|
+
"update a camera or a uniform after physics and before the draw",
|
|
10817
|
+
"change a transform in the same frame it is seen",
|
|
10818
|
+
"run per-render work that must not run on a loader-only frame"
|
|
10819
|
+
],
|
|
10820
|
+
"aliases": [],
|
|
10821
|
+
"example": "const stop = ctx.beforeRender(() => (material.uniforms.time.value = clock.elapsed));\n// later: stop();",
|
|
10822
|
+
"constraints": [
|
|
10823
|
+
"A held, loader-only frame has no world draw and dispatches nothing.",
|
|
10824
|
+
"Runs after every fixed update in the frame, so a value it writes is the one drawn.",
|
|
10825
|
+
"Returns an unregister function; call it when the object that needed it is gone."
|
|
10826
|
+
],
|
|
10827
|
+
"overrides": [],
|
|
10828
|
+
"supersedes": []
|
|
10829
|
+
},
|
|
10830
|
+
{
|
|
10831
|
+
"symbol": "ctx.startup.progress",
|
|
10832
|
+
"package": "@threenative/core",
|
|
10833
|
+
"importPath": "src/scene.ts",
|
|
10834
|
+
"kind": "function",
|
|
10835
|
+
"signature": "ctx.startup.progress: number",
|
|
10836
|
+
"summary": "How much of the start scene has loaded and presented, 0 to 1, for a loading cover's bar. It never falls: a loader whose pending work grows keeps the number it reached rather than jumping backwards.",
|
|
10837
|
+
"situations": [
|
|
10838
|
+
"boot progress bar",
|
|
10839
|
+
"show how much of the start scene has loaded",
|
|
10840
|
+
"loading screen percentage",
|
|
10841
|
+
"a progress bar that never goes backwards",
|
|
10842
|
+
"report startup progress while assets stream in"
|
|
10843
|
+
],
|
|
10844
|
+
"aliases": [],
|
|
10845
|
+
"example": "const width = `${Math.round(ctx.startup.progress * 100)}%`; // a cover the game draws on ctx.canvasLayer",
|
|
10846
|
+
"constraints": [
|
|
10847
|
+
"Never decreases, even when the loader is asked for more work mid-boot.",
|
|
10848
|
+
"Reaches 1 only after the first world render has been presented, not when the last byte arrived.",
|
|
10849
|
+
"A loading view the engine drew for you already reads it; this is for a cover the game draws itself."
|
|
10850
|
+
],
|
|
10851
|
+
"overrides": [],
|
|
10852
|
+
"supersedes": []
|
|
10853
|
+
},
|
|
10560
10854
|
{
|
|
10561
10855
|
"symbol": "bloom",
|
|
10562
10856
|
"package": "three",
|
|
@@ -10869,14 +11163,9 @@
|
|
|
10869
11163
|
"situations": ["authoritative replication", "client prediction"]
|
|
10870
11164
|
},
|
|
10871
11165
|
{
|
|
10872
|
-
"guidance": "The framework owns no vegetation system
|
|
11166
|
+
"guidance": "The framework owns no vegetation render system: wind and materials are your look, in your project's src/render/. Trees come from the optional bake package: npm i -D @threenative/procedural-vegetation, then await bakeVegetation({ preset: \"oak\", seed: 7, lods: [0, 1], out: \"assets/trees\" }) writes one GLB per LOD (vegetationPresets() lists the 28 species). Each GLB carries COLOR_0, TEXCOORD_0, embedded bark and leaf textures, alpha-masked leaves and a per-vertex _WIND vec4 (x trunk sway m, y branch sway m, z leaf flutter m, w phase). Cook them with assets.models.passes.prune: false (prune strips the uv and _WIND your materials read), load with ctx.assets.model and re-material by glTF material name (bark, foliage). Write the sway as TSL in render/wind.ts: attribute(\"_wind\", \"vec4\") scaled by a time uniform and a world wind direction, pushed through modelWorldMatrixInverse so it stays in world metres. A terrain world takes the same trees through the species prefix arbor:<preset>[@seed].",
|
|
10873
11167
|
"id": "procedural-vegetation",
|
|
10874
|
-
"situations": [
|
|
10875
|
-
"procedural trees",
|
|
10876
|
-
"swaying trees",
|
|
10877
|
-
"tree foliage wind sway",
|
|
10878
|
-
"grow procedural tree meshes"
|
|
10879
|
-
]
|
|
11168
|
+
"situations": ["swaying trees", "tree foliage wind sway"]
|
|
10880
11169
|
},
|
|
10881
11170
|
{
|
|
10882
11171
|
"guidance": "The framework owns no IK system. Copy the MIT source in examples/integrations/ik/src/ (https://github.com/ThreeNativeHQ/threenative/tree/develop/examples/integrations/ik) into your src/ and follow its README: it needs the closed-chain-ik/core dependency its own package.json pins, three keeps the only rendered pose, and new ConstrainedIK({root, joints: [{bone, axes, min, max}], effectors: [{bone, orientation?}], iterations, positionTolerance, rotationTolerance}) admits direct Bone hierarchies under rigid or positive-uniform-scale parents (shear, reflection, non-uniform or singular scale throws before the pose is touched). Call ik.update(targets) once per frame after AnimationPlayer/mixer and before render, with one world-space metre position per effector in order plus an optional quaternion only where the effector declared orientation: true; it never starts a loop, never moves the root and installs no bone translation or root-motion controller. Joint limits are X/Y/Z offsets relative to the animation pose supplied that call, so reapply the animation pose before solving to avoid accumulation, and the solver only rotates: bone lengths hold to under 1e-15 m. Iterations are 1-128; an unreachable goal returns converged false with finite residuals and never throws, a solver failure restores the original pose, and dispose() at scene teardown. Worked demo: the rifle grip game in examples/constrained-ik/, which plays on web, desktop native and Android.",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { debugRequested, countDebug, measureDebug } from './chunk-
|
|
1
|
+
import { debugRequested, countDebug, measureDebug } from './chunk-VQRPEOKY.js';
|
|
2
2
|
import { UI_STARTUP_MESSAGE, GAME_STATE_MESSAGE, UI_INTENT_MESSAGE, postUiState, serializeUiState } from './chunk-CFGTPFUH.js';
|
|
3
3
|
|
|
4
4
|
// src/ui-state.ts
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { isEngineRenderHook, markStreamedGeometry, upgradeStreamedGeometry, GEOMETRY_ASSET_KEY, TN_VIRTUAL_GEOMETRY, VirtualGeometryPlugin, TN_DISCRETE_LOD, DiscreteLodPlugin, isStreamedGeometry, DISCRETE_LOD_DEFAULT_HYSTERESIS, lodChainOf, registerModelLodController, selectLodFor, biasedLodDistance, selectLodLevel } from './chunk-
|
|
2
|
-
import { debugRequested, countDebug, readLaunchFlag, measureDebug } from './chunk-
|
|
1
|
+
import { isEngineRenderHook, markStreamedGeometry, upgradeStreamedGeometry, GEOMETRY_ASSET_KEY, TN_VIRTUAL_GEOMETRY, VirtualGeometryPlugin, TN_DISCRETE_LOD, DiscreteLodPlugin, isStreamedGeometry, DISCRETE_LOD_DEFAULT_HYSTERESIS, lodChainOf, registerModelLodController, selectLodFor, biasedLodDistance, selectLodLevel } from './chunk-QAMSM3Z5.js';
|
|
2
|
+
import { debugRequested, countDebug, readLaunchFlag, measureDebug } from './chunk-VQRPEOKY.js';
|
|
3
3
|
import { isNative } from './chunk-XDTZ4QMO.js';
|
|
4
4
|
import { AnimationAction, AnimationMixer, Matrix4, NumberKeyframeTrack, Skeleton, Vector3, BufferGeometry, Color, BufferAttribute, Matrix3, Mesh, InstancedBufferGeometry, Object3D, Texture, InstancedMesh, Quaternion, NoColorSpace, SRGBColorSpace, Sphere, RGBA_ASTC_4x4_Format, Frustum, Box3, InstancedBufferAttribute } from 'three';
|
|
5
5
|
import { mergeGeometries } from 'three/addons/utils/BufferGeometryUtils.js';
|
|
@@ -857,7 +857,7 @@ function measureStartupOffscreenBytes(resolved, root, camera) {
|
|
|
857
857
|
}
|
|
858
858
|
var ASSET_UNUSED_MARKER = "TN_ASSET_UNUSED";
|
|
859
859
|
var ASSET_UNUSED_AFTER_MS = 6e4;
|
|
860
|
-
var ASSET_UNUSED_FIX = "Nothing in the scene came from these models, which the reveal waited for. If nothing ever builds one, delete its load; if the game builds it later, ctx.assets.prefetch it after the reveal and load it then.";
|
|
860
|
+
var ASSET_UNUSED_FIX = "Nothing in the scene came from these models, which the reveal waited for. If nothing ever builds one, delete its load; if the game builds it later, ctx.assets.prefetch it after the reveal and load it then. A listed file may also be geometry the game merged into a new buffer, which drops its provenance: check that before deleting it.";
|
|
861
861
|
function measureUnusedModels(resolved, root, sinceRevealMs) {
|
|
862
862
|
const present = unbilled(() => {
|
|
863
863
|
const paths = /* @__PURE__ */ new Set();
|
|
@@ -868,13 +868,14 @@ function measureUnusedModels(resolved, root, sinceRevealMs) {
|
|
|
868
868
|
});
|
|
869
869
|
return paths;
|
|
870
870
|
});
|
|
871
|
-
const files = [...resolved].filter(([path, asset]) => asset.kind === "model" && !present.has(path)).map(([path, asset]) =>
|
|
871
|
+
const files = [...resolved].filter(([path, asset]) => asset.kind === "model" && !present.has(path)).map(([path, asset]) => asset.bytes === void 0 ? { path } : { bytes: asset.bytes, path }).sort((a, b) => (b.bytes ?? -1) - (a.bytes ?? -1));
|
|
872
872
|
if (files.length === 0) return void 0;
|
|
873
873
|
return {
|
|
874
|
-
bytes: files.reduce((sum, file) => sum + file.bytes, 0),
|
|
874
|
+
bytes: files.reduce((sum, file) => sum + (file.bytes ?? 0), 0),
|
|
875
875
|
files,
|
|
876
876
|
fix: ASSET_UNUSED_FIX,
|
|
877
|
-
sinceRevealMs
|
|
877
|
+
sinceRevealMs,
|
|
878
|
+
unsizedFiles: files.filter((file) => file.bytes === void 0).length
|
|
878
879
|
};
|
|
879
880
|
}
|
|
880
881
|
function reportUnusedModelsLater(awaited, root, gone) {
|
|
@@ -3906,10 +3907,10 @@ function hierarchyRevision(object2) {
|
|
|
3906
3907
|
const revision = object2.__hierarchyRevision;
|
|
3907
3908
|
return typeof revision === "number" ? revision : void 0;
|
|
3908
3909
|
}
|
|
3909
|
-
function countEngineCost2(name) {
|
|
3910
|
+
function countEngineCost2(name, count = 1) {
|
|
3910
3911
|
const host = globalThis;
|
|
3911
3912
|
host.__tnEngineCost ??= {};
|
|
3912
|
-
host.__tnEngineCost[name] = (host.__tnEngineCost[name] ?? 0) +
|
|
3913
|
+
host.__tnEngineCost[name] = (host.__tnEngineCost[name] ?? 0) + count;
|
|
3913
3914
|
}
|
|
3914
3915
|
function engineBandRoot(root) {
|
|
3915
3916
|
const candidate = root;
|
|
@@ -4067,7 +4068,11 @@ var RenderCameraCull = class {
|
|
|
4067
4068
|
this.#animationFrame += 1;
|
|
4068
4069
|
this.#animationPrepared = true;
|
|
4069
4070
|
this.#prepareCamera(camera, viewportHeight);
|
|
4070
|
-
if (this.#bandOnEngine(root, camera)
|
|
4071
|
+
if (this.#bandOnEngine(root, camera)) {
|
|
4072
|
+
countEngineCost2("cullRigRebuilds", 0);
|
|
4073
|
+
return;
|
|
4074
|
+
}
|
|
4075
|
+
if (!this.#prepareAnimated()) return;
|
|
4071
4076
|
const rootShown = this.#isVisibleInWorld(root);
|
|
4072
4077
|
const holds = rootShown && !this.#nestedRigs && animationRateCarriers.size === 0 && animationRateRoots.size >= RATE_HOLD_RIGS;
|
|
4073
4078
|
let turn = this.#animationFrame;
|
|
@@ -6812,7 +6817,7 @@ function writeSnapshot(root, into) {
|
|
|
6812
6817
|
const position = root.position;
|
|
6813
6818
|
const quaternion = root.quaternion;
|
|
6814
6819
|
const scale = root.scale;
|
|
6815
|
-
const matrix2 = root.matrix;
|
|
6820
|
+
const matrix2 = root.matrix.elements;
|
|
6816
6821
|
into[0] = position.x;
|
|
6817
6822
|
into[1] = position.y;
|
|
6818
6823
|
into[2] = position.z;
|
|
@@ -6823,8 +6828,7 @@ function writeSnapshot(root, into) {
|
|
|
6823
6828
|
into[7] = scale.x;
|
|
6824
6829
|
into[8] = scale.y;
|
|
6825
6830
|
into[9] = scale.z;
|
|
6826
|
-
for (let element = 0; element < 16; element += 1)
|
|
6827
|
-
into[10 + element] = matrix2.elements[element] ?? 0;
|
|
6831
|
+
for (let element = 0; element < 16; element += 1) into[10 + element] = matrix2[element] ?? 0;
|
|
6828
6832
|
const parent = root.parent?.matrixWorld.elements ?? IDENTITY;
|
|
6829
6833
|
for (let element = 0; element < 16; element += 1) into[26 + element] = parent[element] ?? 0;
|
|
6830
6834
|
}
|
|
@@ -6869,13 +6873,22 @@ function freeze(root) {
|
|
|
6869
6873
|
return objects;
|
|
6870
6874
|
}
|
|
6871
6875
|
function markStatic(root) {
|
|
6876
|
+
return freezeRoot(root, false);
|
|
6877
|
+
}
|
|
6878
|
+
function markEngineStatic(root) {
|
|
6879
|
+
return freezeRoot(root, true);
|
|
6880
|
+
}
|
|
6881
|
+
function freezeRoot(root, engine) {
|
|
6872
6882
|
const existing = frozen.get(root);
|
|
6873
6883
|
if (existing !== void 0) thaw(root);
|
|
6874
6884
|
const objects = freeze(root);
|
|
6875
6885
|
const snapshot = existing?.snapshot ?? new Float64Array(SNAPSHOT_LENGTH2);
|
|
6876
6886
|
writeSnapshot(root, snapshot);
|
|
6877
6887
|
const version = (existing?.version ?? 0) + 1;
|
|
6878
|
-
frozen.set(
|
|
6888
|
+
frozen.set(
|
|
6889
|
+
root,
|
|
6890
|
+
engine ? { objects, root, snapshot, version, parent: root.parent, fresh: true } : { objects, root, snapshot, version }
|
|
6891
|
+
);
|
|
6879
6892
|
return version;
|
|
6880
6893
|
}
|
|
6881
6894
|
function unmarkStatic(root) {
|
|
@@ -6904,12 +6917,44 @@ function staticRoots() {
|
|
|
6904
6917
|
var rearmedSinceCensus = 0;
|
|
6905
6918
|
function refreshStaticTransforms() {
|
|
6906
6919
|
if (frozen.size === 0) return;
|
|
6920
|
+
parentMovedThisFrame.clear();
|
|
6907
6921
|
for (const entry of frozen.values()) {
|
|
6908
|
-
|
|
6909
|
-
|
|
6922
|
+
const engine = entry.parent !== void 0;
|
|
6923
|
+
if (engine) {
|
|
6924
|
+
const parent = entry.root.parent;
|
|
6925
|
+
const moved = parentMoved(parent);
|
|
6926
|
+
if (parent === entry.parent && entry.fresh !== true && !moved) continue;
|
|
6927
|
+
entry.fresh = false;
|
|
6928
|
+
if (snapshotMatches(entry.root, entry.snapshot, scratch2)) {
|
|
6929
|
+
entry.parent = parent;
|
|
6930
|
+
continue;
|
|
6931
|
+
}
|
|
6932
|
+
} else if (snapshotMatches(entry.root, entry.snapshot, scratch2)) continue;
|
|
6933
|
+
freezeRoot(entry.root, engine);
|
|
6910
6934
|
rearmedSinceCensus += 1;
|
|
6911
6935
|
}
|
|
6912
6936
|
}
|
|
6937
|
+
var parentSeen = /* @__PURE__ */ new WeakMap();
|
|
6938
|
+
var parentMovedThisFrame = /* @__PURE__ */ new Map();
|
|
6939
|
+
function parentMoved(parent) {
|
|
6940
|
+
if (parent === null) return false;
|
|
6941
|
+
const answered = parentMovedThisFrame.get(parent);
|
|
6942
|
+
if (answered !== void 0) return answered;
|
|
6943
|
+
const elements = parent.matrixWorld.elements;
|
|
6944
|
+
let seen = parentSeen.get(parent);
|
|
6945
|
+
let moved = seen === void 0;
|
|
6946
|
+
if (seen === void 0) {
|
|
6947
|
+
seen = new Float64Array(16);
|
|
6948
|
+
parentSeen.set(parent, seen);
|
|
6949
|
+
}
|
|
6950
|
+
for (let element = 0; element < 16; element += 1) {
|
|
6951
|
+
const value = elements[element] ?? 0;
|
|
6952
|
+
if (seen[element] !== value) moved = true;
|
|
6953
|
+
seen[element] = value;
|
|
6954
|
+
}
|
|
6955
|
+
parentMovedThisFrame.set(parent, moved);
|
|
6956
|
+
return moved;
|
|
6957
|
+
}
|
|
6913
6958
|
function staticTransformCensus() {
|
|
6914
6959
|
let objects = 0;
|
|
6915
6960
|
for (const entry of frozen.values()) objects += entry.objects;
|
|
@@ -6923,6 +6968,7 @@ function staticTransformCensus() {
|
|
|
6923
6968
|
}
|
|
6924
6969
|
function resetStaticTransforms() {
|
|
6925
6970
|
frozen.clear();
|
|
6971
|
+
parentMovedThisFrame.clear();
|
|
6926
6972
|
rearmedSinceCensus = 0;
|
|
6927
6973
|
}
|
|
6928
6974
|
|
|
@@ -7361,6 +7407,9 @@ async function warmUpSceneWithCompletion(renderer, scene, camera, options = {})
|
|
|
7361
7407
|
const report2 = await warmUpScene(renderer, scene, camera, options);
|
|
7362
7408
|
return { report: report2, completion: warmUpCompletions.get(report2) ?? Promise.resolve() };
|
|
7363
7409
|
}
|
|
7410
|
+
function isFrameGateTimeout(error) {
|
|
7411
|
+
return error instanceof Error && error.message.startsWith("TN_WARMUP_FRAME_GATE");
|
|
7412
|
+
}
|
|
7364
7413
|
function nativeEnvironmentPreparer(raw) {
|
|
7365
7414
|
return typeof raw?.prepareEnvironmentAsync === "function" ? raw : void 0;
|
|
7366
7415
|
}
|
|
@@ -7925,11 +7974,13 @@ async function warmUpScene(renderer, scene, camera, options = {}) {
|
|
|
7925
7974
|
const pass = await renderWarmPassesOnce();
|
|
7926
7975
|
if (pass === void 0) {
|
|
7927
7976
|
if (passError === void 0 && now3() >= startedAt + budgetMs) return;
|
|
7977
|
+
if (isFrameGateTimeout(passError)) return;
|
|
7928
7978
|
throw passError ?? new Error("covered world warm render did not settle");
|
|
7929
7979
|
}
|
|
7930
7980
|
});
|
|
7931
7981
|
};
|
|
7932
7982
|
let gpuDrainSettled = true;
|
|
7983
|
+
let compileOutran = false;
|
|
7933
7984
|
const compileWithinDeadline = async (deadline2, work, yieldFrame2, now4) => {
|
|
7934
7985
|
let settled = false;
|
|
7935
7986
|
const track = () => {
|
|
@@ -7937,7 +7988,8 @@ async function warmUpScene(renderer, scene, camera, options = {}) {
|
|
|
7937
7988
|
};
|
|
7938
7989
|
void work.then(track, track);
|
|
7939
7990
|
const finished = await withinDeadline(deadline2, work, yieldFrame2, now4);
|
|
7940
|
-
|
|
7991
|
+
compileOutran = !finished && !settled;
|
|
7992
|
+
if (compileOutran) pendingCompiles.push(work);
|
|
7941
7993
|
return finished;
|
|
7942
7994
|
};
|
|
7943
7995
|
const finish = (report3) => {
|
|
@@ -8018,7 +8070,7 @@ async function warmUpScene(renderer, scene, camera, options = {}) {
|
|
|
8018
8070
|
elapsedMs: now3() - startedAt,
|
|
8019
8071
|
unsupported: false,
|
|
8020
8072
|
abandoned: finished2 ? 0 : 1,
|
|
8021
|
-
timedOut: !finished2 && (passError === void 0 || now3() >= deadline2)
|
|
8073
|
+
timedOut: !finished2 && (passError === void 0 || compileOutran || now3() >= deadline2)
|
|
8022
8074
|
})
|
|
8023
8075
|
);
|
|
8024
8076
|
}
|
|
@@ -8913,4 +8965,4 @@ var STORAGE_PLAIN = {
|
|
|
8913
8965
|
};
|
|
8914
8966
|
var SOURCE_FLOOR = 16;
|
|
8915
8967
|
|
|
8916
|
-
export { ASSET_LATE_MARKER, AutoBatch, DEFAULT_CLIP_EXTENTS, DEFAULT_MAX_LEVEL_RATIO, DEFAULT_TARGET_FPS, DRAW_ARGS_BYTES, DRAW_ARGS_WORDS, INSTANCED_LOD_MAX_PIXEL_ERROR, InstancedBatch, LOCAL_WORDS, MAX_TARGET_FPS, MIN_BATCH_MEMBERS, NO_LOCAL, PLACEMENT_ROWS, PLACEMENT_WORDS, RenderCameraCull, SLOT_NONE, SOURCE_FLOOR, SPANS, SPANS_FLAG, SPANS_MARKER, SPAN_COUNT, SPAN_NAMES, STARTUP_COMPILE_BUDGET_MS, STARTUP_OFFSCREEN_BYTES_MARKER, STARTUP_STABLE_WINDOW_MS, STARTUP_STALL_MS, STATIC_TRANSFORM_MARKER, STORAGE_PLAIN, SkinnedBatch, SpanRecorder, StartupReadiness, TALLY_EVERY, VALIDATE_EVERY, VEC4_WORDS, VIRTUAL_SHADOW_CASTER_LAYER, VIRTUAL_SHADOW_KEY_LAYER, VIRTUAL_SHADOW_MOVER_LAYER, VIRTUAL_SHADOW_SMALL_CASTER_LAYER, VIRTUAL_SHADOW_WIDE_CASTER_LAYER, addInSlices, addRange, addSpan, alwaysRender, animationPacketField, animationPacketMethodsPristine, animationPacketReaders, animationPacketTime, animationPacketTimeReaders, argsWords, autoBatchOf, baseColorOf, batchRecords, beginSpan, clipLadder, composeSilencedByFreeze, createAssetLoader, createProjectionScanWorkspace, displacesVertices, drainMeshPool, drawWorld, dropPooledFor, endSliceFrames, endSpan, fetchAsset, formatSpansWindow, frustumPlanes, geometryVersionSum, growBuffer, hasMorphAttributes, hasRenderHook, invalidateStatic, isAutoBatchMerged, isLight, isRenderable, isSimilarityTransform, isStatic, loadAll, markStatic, measureStartupOffscreenBytes, mergeByMaterial, mergeParts, nodes, noteSliceFrame, observeAnimationRates, parkMesh, placedBox, pooledCapacity, pooledMesh, prepareSceneEnvironment, reconcileMirroredClips, refreshStaticTransforms, releaseProjectionScanWorkspace, rendererFacts, reportUnusedModelsLater, resetStaticTransforms, resolveTargetFps, scanProjection, sceneNeedsEnvironmentPreparation, setSpanRecorder, snapRefreshRate, spanNow, spanRecorder, spansRequested, staticRoots, staticTransformCensus, storageAttribute, trackAnimationRate, uniformUnchanged, unmarkStatic, untrackAnimationRate, warmUpComputeNodes, warmUpScene, warmUpSceneWithCompletion, worldSilencedByFreeze, yieldToHost };
|
|
8968
|
+
export { ASSET_LATE_MARKER, AutoBatch, DEFAULT_CLIP_EXTENTS, DEFAULT_MAX_LEVEL_RATIO, DEFAULT_TARGET_FPS, DRAW_ARGS_BYTES, DRAW_ARGS_WORDS, INSTANCED_LOD_MAX_PIXEL_ERROR, InstancedBatch, LOCAL_WORDS, MAX_TARGET_FPS, MIN_BATCH_MEMBERS, NO_LOCAL, PLACEMENT_ROWS, PLACEMENT_WORDS, RenderCameraCull, SLOT_NONE, SOURCE_FLOOR, SPANS, SPANS_FLAG, SPANS_MARKER, SPAN_COUNT, SPAN_NAMES, STARTUP_COMPILE_BUDGET_MS, STARTUP_OFFSCREEN_BYTES_MARKER, STARTUP_STABLE_WINDOW_MS, STARTUP_STALL_MS, STATIC_TRANSFORM_MARKER, STORAGE_PLAIN, SkinnedBatch, SpanRecorder, StartupReadiness, TALLY_EVERY, VALIDATE_EVERY, VEC4_WORDS, VIRTUAL_SHADOW_CASTER_LAYER, VIRTUAL_SHADOW_KEY_LAYER, VIRTUAL_SHADOW_MOVER_LAYER, VIRTUAL_SHADOW_SMALL_CASTER_LAYER, VIRTUAL_SHADOW_WIDE_CASTER_LAYER, addInSlices, addRange, addSpan, alwaysRender, animationPacketField, animationPacketMethodsPristine, animationPacketReaders, animationPacketTime, animationPacketTimeReaders, argsWords, autoBatchOf, baseColorOf, batchRecords, beginSpan, clipLadder, composeSilencedByFreeze, createAssetLoader, createProjectionScanWorkspace, displacesVertices, drainMeshPool, drawWorld, dropPooledFor, endSliceFrames, endSpan, fetchAsset, formatSpansWindow, frustumPlanes, geometryVersionSum, growBuffer, hasMorphAttributes, hasRenderHook, invalidateStatic, isAutoBatchMerged, isLight, isRenderable, isSimilarityTransform, isStatic, loadAll, markEngineStatic, markStatic, measureStartupOffscreenBytes, mergeByMaterial, mergeParts, nodes, noteSliceFrame, observeAnimationRates, parkMesh, placedBox, pooledCapacity, pooledMesh, prepareSceneEnvironment, reconcileMirroredClips, refreshStaticTransforms, releaseProjectionScanWorkspace, rendererFacts, reportUnusedModelsLater, resetStaticTransforms, resolveTargetFps, scanProjection, sceneNeedsEnvironmentPreparation, setSpanRecorder, snapRefreshRate, spanNow, spanRecorder, spansRequested, staticRoots, staticTransformCensus, storageAttribute, trackAnimationRate, uniformUnchanged, unmarkStatic, untrackAnimationRate, warmUpComputeNodes, warmUpScene, warmUpSceneWithCompletion, worldSilencedByFreeze, yieldToHost };
|