@driftengine/core 4.10.0 → 4.11.0
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/CHANGELOG.json +71 -0
- package/README.md +1 -1
- package/dist/index.d.ts +4 -3
- package/dist/index.js +1 -1
- package/dist/render/backend/webgl2/renderer.d.ts +99 -2
- package/dist/render/backend/webgl2/renderer.js +361 -42
- package/dist/render/backend/webgpu/buffers.d.ts +5 -0
- package/dist/render/backend/webgpu/buffers.js +98 -48
- package/dist/render/backend/webgpu/clothKernels.d.ts +8 -0
- package/dist/render/backend/webgpu/clothKernels.js +76 -0
- package/dist/render/backend/webgpu/clothOps.d.ts +39 -0
- package/dist/render/backend/webgpu/clothOps.js +78 -0
- package/dist/render/backend/webgpu/clothSetLayout.d.ts +25 -0
- package/dist/render/backend/webgpu/clothSetLayout.js +84 -0
- package/dist/render/backend/webgpu/clothSetPack.d.ts +33 -0
- package/dist/render/backend/webgpu/clothSetPack.js +144 -0
- package/dist/render/backend/webgpu/drawCommand.d.ts +2 -0
- package/dist/render/backend/webgpu/drawCommand.js +1 -0
- package/dist/render/backend/webgpu/flatPass.d.ts +1 -1
- package/dist/render/backend/webgpu/flatPass.js +2 -1
- package/dist/render/backend/webgpu/gpuClothSet.d.ts +80 -0
- package/dist/render/backend/webgpu/gpuClothSet.js +462 -0
- package/dist/render/backend/webgpu/latePass.js +1 -0
- package/dist/render/backend/webgpu/motionPass.js +15 -6
- package/dist/render/backend/webgpu/pipelineCache.d.ts +22 -1
- package/dist/render/backend/webgpu/pipelineCache.js +39 -1
- package/dist/render/backend/webgpu/postPass.d.ts +1 -1
- package/dist/render/backend/webgpu/renderer.d.ts +48 -0
- package/dist/render/backend/webgpu/renderer.js +207 -27
- package/dist/render/backend/webgpu/shaders/clothSolve.wgsl.d.ts +9 -2
- package/dist/render/backend/webgpu/shaders/clothSolve.wgsl.js +121 -47
- package/dist/render/backend/webgpu/staticBundles.js +2 -1
- package/dist/render/backend/webgpu/vertexFormats.d.ts +22 -0
- package/dist/render/backend/webgpu/vertexFormats.js +97 -0
- package/dist/render/globalMediumPass.d.ts +2 -0
- package/dist/render/globalMediumPass.js +1 -0
- package/dist/render/indexWidth.d.ts +17 -0
- package/dist/render/indexWidth.js +23 -0
- package/dist/render/lightMatrix.d.ts +11 -0
- package/dist/render/lightMatrix.js +14 -0
- package/dist/render/mesh.d.ts +9 -0
- package/dist/render/mesh.js +38 -14
- package/dist/render/renderQuality.d.ts +30 -0
- package/dist/render/renderQuality.js +5 -0
- package/dist/render/rendererHarness.d.ts +7 -0
- package/dist/render/rendererHarness.js +12 -0
- package/dist/render/shader.d.ts +15 -0
- package/dist/render/shader.js +41 -0
- package/dist/render/shaders/flat/directionalShadow.js +84 -10
- package/dist/render/shaders/flat/glassTint.d.ts +1 -1
- package/dist/render/shaders/flat/glassTint.js +3 -0
- package/dist/render/shaders/flat/index.d.ts +15 -0
- package/dist/render/shaders/flat/index.js +15 -2
- package/dist/render/shaders/flat/layered.d.ts +19 -0
- package/dist/render/shaders/flat/layered.js +115 -0
- package/dist/render/shaders/flat/main.d.ts +1 -1
- package/dist/render/shaders/flat/main.js +43 -16
- package/dist/render/shaders/flat/mapReads.d.ts +10 -0
- package/dist/render/shaders/flat/mapReads.js +38 -0
- package/dist/render/shaders/flat/movingSun.d.ts +21 -0
- package/dist/render/shaders/flat/movingSun.js +46 -0
- package/dist/render/shaders/flat/normalMap.d.ts +6 -2
- package/dist/render/shaders/flat/normalMap.js +14 -3
- package/dist/render/shaders/flat/overlay.d.ts +3 -2
- package/dist/render/shaders/flat/overlay.js +41 -19
- package/dist/render/shaders/flat/preamble.js +23 -5
- package/dist/render/shaders/flat/worldUv.d.ts +22 -0
- package/dist/render/shaders/flat/worldUv.js +113 -0
- package/dist/render/shaders/generated/flat.wgsl.d.ts +768 -368
- package/dist/render/shaders/generated/flat.wgsl.js +791 -391
- package/dist/render/shaders/generated/globalMedium.wgsl.d.ts +8 -3
- package/dist/render/shaders/generated/globalMedium.wgsl.js +8 -3
- package/dist/render/shaders/generated/lightVolume.wgsl.d.ts +15 -10
- package/dist/render/shaders/generated/lightVolume.wgsl.js +16 -11
- package/dist/render/shaders/globalMedium.js +9 -1
- package/dist/render/shaders/lightVolume.js +9 -1
- package/dist/render/shaders/tangentFrame.d.ts +1 -1
- package/dist/render/shaders/tangentFrame.js +16 -3
- package/dist/render/skinnedClothRun.d.ts +28 -0
- package/dist/render/skinnedClothRun.js +103 -35
- package/dist/render/surfaceLayers.d.ts +39 -0
- package/dist/render/surfaceLayers.js +26 -0
- package/dist/render/surfaceOverlay.d.ts +16 -3
- package/dist/render/surfaceOverlay.js +11 -6
- package/dist/render/surfaceProjection.d.ts +34 -0
- package/dist/render/surfaceProjection.js +30 -0
- package/dist/render/surfaceTexture.d.ts +30 -0
- package/dist/render/vertexPacking.d.ts +48 -0
- package/dist/render/vertexPacking.js +68 -0
- package/package.json +6 -6
- package/src/index.ts +4 -2
- package/src/render/backend/webgl2/renderer.ts +408 -55
- package/src/render/backend/webgpu/buffers.ts +153 -54
- package/src/render/backend/webgpu/clothKernels.ts +86 -0
- package/src/render/backend/webgpu/clothOps.ts +86 -0
- package/src/render/backend/webgpu/clothSetLayout.ts +102 -0
- package/src/render/backend/webgpu/clothSetPack.ts +197 -0
- package/src/render/backend/webgpu/drawCommand.ts +3 -0
- package/src/render/backend/webgpu/flatPass.ts +26 -28
- package/src/render/backend/webgpu/gpuClothSet.ts +564 -0
- package/src/render/backend/webgpu/latePass.ts +1 -0
- package/src/render/backend/webgpu/motionPass.ts +18 -7
- package/src/render/backend/webgpu/pipelineCache.ts +46 -7
- package/src/render/backend/webgpu/renderer.ts +274 -48
- package/src/render/backend/webgpu/shaders/clothSolve.wgsl.ts +121 -47
- package/src/render/backend/webgpu/staticBundles.ts +2 -1
- package/src/render/backend/webgpu/vertexFormats.ts +113 -0
- package/src/render/globalMediumPass.ts +7 -0
- package/src/render/indexWidth.ts +27 -0
- package/src/render/lightMatrix.ts +15 -0
- package/src/render/mesh.ts +66 -14
- package/src/render/renderQuality.ts +38 -0
- package/src/render/rendererHarness.ts +15 -0
- package/src/render/shader.ts +59 -0
- package/src/render/shaders/flat/directionalShadow.ts +84 -10
- package/src/render/shaders/flat/glassTint.ts +7 -1
- package/src/render/shaders/flat/index.ts +30 -2
- package/src/render/shaders/flat/layered.ts +115 -0
- package/src/render/shaders/flat/main.ts +43 -16
- package/src/render/shaders/flat/mapReads.ts +38 -0
- package/src/render/shaders/flat/movingSun.ts +46 -0
- package/src/render/shaders/flat/normalMap.ts +14 -3
- package/src/render/shaders/flat/overlay.ts +41 -19
- package/src/render/shaders/flat/preamble.ts +23 -5
- package/src/render/shaders/flat/worldUv.ts +113 -0
- package/src/render/shaders/generated/flat.wgsl.ts +791 -391
- package/src/render/shaders/generated/globalMedium.wgsl.ts +8 -3
- package/src/render/shaders/generated/lightVolume.wgsl.ts +16 -11
- package/src/render/shaders/globalMedium.ts +9 -1
- package/src/render/shaders/lightVolume.ts +9 -1
- package/src/render/shaders/tangentFrame.ts +16 -3
- package/src/render/skinnedClothRun.ts +138 -38
- package/src/render/surfaceLayers.ts +57 -0
- package/src/render/surfaceOverlay.ts +24 -7
- package/src/render/surfaceProjection.ts +57 -0
- package/src/render/surfaceTexture.ts +30 -0
- package/src/render/vertexPacking.ts +109 -0
- package/dist/render/backend/webgpu/gpuSkinnedCloth.d.ts +0 -74
- package/dist/render/backend/webgpu/gpuSkinnedCloth.js +0 -452
- package/src/render/backend/webgpu/gpuSkinnedCloth.ts +0 -502
package/CHANGELOG.json
CHANGED
|
@@ -1,4 +1,75 @@
|
|
|
1
1
|
[
|
|
2
|
+
{
|
|
3
|
+
"version": "4.11.0",
|
|
4
|
+
"date": "2026-10-10",
|
|
5
|
+
"entries": [
|
|
6
|
+
{
|
|
7
|
+
"kind": "added",
|
|
8
|
+
"short": "`SurfaceRim.mode: 'blend'` pulls a surface's colour toward the rim colour at its edges before it is lit, where a rim used to add glow over it.",
|
|
9
|
+
"text": "A surface overlay's rim takes `mode: 'blend'`: the base colour is mixed toward the rim colour by the edge's weight, raised to its contrast and scaled by its alpha, before lighting, so the edge is lit, shadowed and fogged as the rest of the surface is rather than glowing over it, and a colour channel weighted above 1 is held at 1. `'add'`, the default, is the rim as it was. On `demo/dev/surfaceOverlay.html?rim=blend` an edge out of the light moved by −1.9 in luminance where adding moved it by +41, and the two backends draw the same picture."
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"kind": "added",
|
|
13
|
+
"short": "`setDitherOpacity(true)` spends each opaque draw's own opacity, an instance's alpha included, on a screen door, so an instance fades without blending or a pop.",
|
|
14
|
+
"text": "With `setDitherOpacity(true)` the draws that follow keep a pixel only where the opacity it carries (a mesh's own, or `MeshInstances.alphas` for an instance of a batch) lies above an 8x8 ordered threshold, the pattern `setDitherFade` uses, so an opaque instance fades in or out over a few frames instead of popping, still writes depth and needs no sorting; two instances crossfading cover each pixel once. On `demo/dev/hlodFade.html?opacity=` the share of pixels kept matches the opacity to 1/64 on both backends. What it gives up: a screen door shows as a pattern up close, which the temporal resolve smooths where it runs."
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"kind": "added",
|
|
18
|
+
"short": "`createSkinnedClothSet` solves every garment together, one dispatch per batch of constraints across all of them, and `maxSteps` caps the steps one frame runs.",
|
|
19
|
+
"text": "`createSkinnedClothSet(renderer, setups)` solves several garments together: on WebGPU one pass a step, each constraint batch of every garment merged by colour into one dispatch, where each garment had its own encoder, pass and submit. Garments are named by their index, in `setPose(g, …)`, `setWind(g, …)`, `reset(g)` and `particles[g]` for `setCloth`, and `step(dt)` runs them all; `createSkinnedCloth` is a set of one, and a backend without compute runs the set on the CPU. Garments in a set share `substeps`, `iterations` and `maxSteps`, and are refused by the first they disagree on. `SkinnedClothParameters.maxSteps` caps the whole steps one `advance` runs and drops the time past it, so a slow frame no longer hands the next one more steps; unset, it is unbounded as before. On `demo/dev/skinnedCloth.html?bench=1&garments=15`, fifteen garments step in 0.793 ms as one set against 8.903 ms as fifteen solvers, and a set agrees with separate solvers within the spread of a nudged control."
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"kind": "added",
|
|
23
|
+
"short": "`RenderQuality.pipelineCompile: 'skip'` leaves a draw out while its new pipeline compiles off the main thread, rather than holding the frame for the compile.",
|
|
24
|
+
"text": "A lit pipeline first needed inside a frame, for a material's surface model or a lit switch met mid-scene, was compiled where it was asked for, which holds the GPU process for the compile, reported at 130 to 400 ms on a phone. With `pipelineCompile: 'skip'` the compile starts off the main thread and the draw is left out until it lands; `'wait'`, the default, is as before. `ready()` waits for every compile started either way. On WebGL2 a model program compiles through `KHR_parallel_shader_compile` where the context offers it and waits where it does not. On `demo/dev/pipelineCompile.html`, eight new variants at once held a WebGPU frame 700 to 3,700 ms waiting and 17 ms skipping, the draws landing 21 to 26 frames later; through ANGLE on OpenGL the longest WebGL2 frame went from 820–1,120 ms to 630–700 ms, the driver finishing its own compile at the program's first draw. What it gives up is the draw, for the frames its compile takes."
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"kind": "added",
|
|
28
|
+
"short": "`SurfaceMaterial.projection` places a material's maps by the world, planar across the ground or triplanar on three planes, at so many repeats a metre.",
|
|
29
|
+
"text": "`projection: { kind: 'planar' | 'triplanar', scale, sharpness? }` reads a material's maps at a point's place in the world rather than at the mesh's texture coordinates: `'planar'` across the two horizontal axes, `'triplanar'` on three planes blended by how squarely the surface faces each, with the normal map turned into the world by the whiteout blend, so no tangent frame is needed. A lit switch, compiled in the first time a material asks. On `demo/dev/worldUv.html` a triplanar cube matches the same map read through each face's own coordinates and tangents, on both backends. What it gives up: a projection belongs to the world, so a mesh that moves slides under it; triplanar reads each map three times; a texture is mirrored on a plane's far side; and a cutout material's shadow is still cut by the mesh's coordinates."
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"kind": "added",
|
|
33
|
+
"short": "The sun's moving shadow layer is read through the matrix its own pass was drawn with, so what moves can have a tight, sharp square inside the static layer's wide one.",
|
|
34
|
+
"text": "A frame's `beginShadowPass(matrix, 'dynamic')` drawn with a matrix other than the environment's `lightViewProj` is now read through that matrix: the static layer keeps one square over the whole of what stands still, and the moving layer a tight one around what moves, at its own texel size, filter and depth span. The lit stage, the global medium and light volumes all read it, behind a lit switch that turns on the first frame a dynamic pass's matrix differs. On `demo/dev/sunLayers.html?moving=tight` a moving caster's shadow core went from 144 to 202 pixels and its penumbra from 886 to 739, and everything outside the tight square was unchanged to the pixel, on both backends. What it gives up: a receiver outside the static layer's square takes no sun shadow at all, so the tight square belongs inside the wide one."
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
"kind": "added",
|
|
38
|
+
"short": "`SurfaceMaterial.diffuseTransmission` lets light from behind a thin surface through, coloured by it: a banner, a leaf or a lampshade lit from behind.",
|
|
39
|
+
"text": "`diffuseTransmission`, 0 to 1, brings the light falling on a surface's far side (the sun, lamps, area lights and DriftLight) to the eye through it, coloured by the surface's own colour; a metal lets none through, and 0, the default, is every material as it was. A lamp's shadow is read from the side the lamp is on, so a thin surface does not stand in its own shadow. On `demo/dev/thinLight.html` a sheet lit only from behind went from 16 to 163 in luminance under the sun and to 104 under a lamp, with no light behind it unchanged, on both backends. What it gives up: a thin surface rather than a volume, so a thick one lets as much through as a sheet; the light behind is not blurred; and glass lets light through by its own rule."
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"kind": "added",
|
|
43
|
+
"short": "`SurfaceMaterial.layers` blends up to five layers by a mask, each at its own repeat, colour, normal and roughness alike, out of one texture array per map.",
|
|
44
|
+
"text": "`layers: { mask, repeats, emissiveLayer? }` lays up to four layers over a base by an RGBA mask read at the mesh's coordinates, red laying layer 1 through alpha laying layer 4, each over every one before it. Layer `i` is layer `i` of the material's albedo, normal and ORM arrays, read at the coordinates times its own repeat, and the tangent-space normals are blended before the frame turns them into the world; `emissiveLayer` makes the emissive map glow only where that layer shows. A lit switch, compiled in the first time a material asks, and the mask is read where `modelMap` goes, so it takes no texture binding of its own. On `demo/dev/layers.html` three layers at three repeats draw the same on both backends, and a material without layers draws as before. What it gives up: every layer is read at every pixel whatever its share; a material carries a mask or a surface model's map, not both."
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"kind": "changed",
|
|
48
|
+
"short": "A mesh's indices are sixteen bits where its vertices fit, and its normals, tangents, colours and weights sixteen-bit fixed point: 29% less mesh memory in the published scenes.",
|
|
49
|
+
"text": "Every attribute of a mesh travelled as 32-bit floats and every index as 32 bits. Indices are 16 bits now wherever a mesh has 65,536 vertices or fewer; normals and tangents travel as 16-bit signed fixed point, colours and skin weights inside [0, 1] as unsigned; and a colour or an emissive every vertex shares is a constant rather than a stream. Both backends decide it the same way, from the data, when a mesh is made, and positions and texture coordinates stay floats. Measured on WebGPU across the eight published scenes, mesh vertex and index buffers went from 210 to 150 MB: the voxel sandbox's vertices from 38.4 to 28.5 MB and its indices from 4.8 to 2.4, the showroom's from 113.8 to 78.2 and from 34.9 to 25.2. Eight of the nine scenes are the same to the pixel on WebGPU, and one moves 12 pixels by 2 of 255 on average, which is normals at 1/32767. What it gives up: texture coordinates stay floats because sixteen bits move a pixel on an atlas tile's edge onto the next tile, measured as 29 pixels in the voxel sandbox; a dynamic mesh's normals stay floats; and an attribute outside its range stays a float rather than being clamped."
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
"kind": "fixed",
|
|
53
|
+
"short": "A normal map on a mesh with no tangents and a mirrored mapping is no longer turned half a circle by the frame derived for it, which lit it from the far side.",
|
|
54
|
+
"text": "Where a mesh carries no tangents, the frame its normal map is read in is derived from screen-space derivatives, and its handedness was taken from the texture coordinates' determinant alone, which cannot see a mapping mirrored about the normal: such a surface had its bumps lit from the side opposite the light. The handedness is the surface's orientation on screen against its normal now, which is the determinant's sign wherever a mapping is not mirrored. On `demo/dev/worldUv.html` a mirrored ground read 74.8 derived against 110.8 through its tangents, and 110.8 both ways after; every published scene is unchanged to the pixel."
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
"kind": "fixed",
|
|
58
|
+
"short": "On WebGPU a lit surface reads the sun's static layer through the environment's light matrix, not through whichever matrix the last shadow pass used.",
|
|
59
|
+
"text": "The WebGPU lit vertex stage projected a receiver into the sun's map through the matrix of the frame's last shadow pass. Where every pass shared one matrix nothing showed; where a dynamic pass was drawn with a tighter one, the static layer was read through it and its shadows landed in the wrong place. It projects through `env.lightViewProj` now, as WebGL2 always did."
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
"kind": "fixed",
|
|
63
|
+
"short": "`ready()` no longer waits for ever on a pipeline whose compile off the main thread failed, and it waits for a lit switch's rebuild as well.",
|
|
64
|
+
"text": "A pipeline whose `createRenderPipelineAsync` rejected stayed among the compiles `ready()` waits on, so a boot awaiting it never resolved; it is taken out, and built where it is next asked for so the device says why. And `ready()` now waits for a lit switch's rebuild, so the first frame after it has every pipeline with the feature that turned the switch on, where a capture taken then photographed the frames before."
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
"kind": "fixed",
|
|
68
|
+
"short": "On WebGL2 a surface model's program first made in the middle of a mesh pass keeps the pass's dither fade, where its draws used to ignore it.",
|
|
69
|
+
"text": "A program for a surface model first made between `bindMeshPass` and the draws after it was handed the pass's state with the dither fade cleared, so the draws through it ignored `setDitherFade` until the next pass. WebGL2 only: WebGPU carries the fade in each draw's block."
|
|
70
|
+
}
|
|
71
|
+
]
|
|
72
|
+
},
|
|
2
73
|
{
|
|
3
74
|
"version": "4.10.0",
|
|
4
75
|
"date": "2026-10-07",
|
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@ WebGL2 everywhere else, behind one API, and carries the fixed-step loop, the ren
|
|
|
6
6
|
input, the scene graph, geometry, text and the whole of `@driftengine/physics`, which it re-exports.
|
|
7
7
|
Everything else is a separate package a game adds when it reaches for it.
|
|
8
8
|
|
|
9
|
-
**Cost:
|
|
9
|
+
**Cost: 898.2 KB gzipped, importing `createRenderer`.** Measured by `scripts/size-gate.test.mjs`,
|
|
10
10
|
which fails the build if the figure drifts by more than 3%.
|
|
11
11
|
|
|
12
12
|
The manual is at **[driftengine.dev/docs](https://driftengine.dev/docs)**, with an example running
|
package/dist/index.d.ts
CHANGED
|
@@ -164,8 +164,8 @@ export type { FrameReflections } from './render/frameReflections.ts';
|
|
|
164
164
|
export type { OverlayRegion, SurfaceDissolve, SurfaceOverlay, SurfaceRim, SurfaceWrinkle, } from './render/surfaceOverlay.ts';
|
|
165
165
|
export { WHOLE_PAGE } from './render/lightmap.ts';
|
|
166
166
|
export type { LightmapPage, LightmapRegion } from './render/lightmap.ts';
|
|
167
|
-
export { createSkinnedCloth } from './render/skinnedClothRun.ts';
|
|
168
|
-
export type { SkinnedClothSolver } from './render/skinnedClothRun.ts';
|
|
167
|
+
export { createSkinnedCloth, createSkinnedClothSet } from './render/skinnedClothRun.ts';
|
|
168
|
+
export type { SkinnedClothSet, SkinnedClothSolver } from './render/skinnedClothRun.ts';
|
|
169
169
|
/**
|
|
170
170
|
* What a frame asked of a backend, against the ceilings that backend imposes.
|
|
171
171
|
*
|
|
@@ -223,11 +223,12 @@ export type { PrefilterQuality } from './render/prefilterEnvMap.ts';
|
|
|
223
223
|
* `ProbeBakeOptions`, which is the whole of the reasoning.
|
|
224
224
|
*/
|
|
225
225
|
export type { ProbeBakeOptions } from './render/reflectionProbe.ts';
|
|
226
|
-
export type { DirectionalShadowDepthLayers, GlassShadows, OutputTransform, RenderQuality, RenderQualityOptions, ShadowFilterTaps, SkinScattering, WaterReflectionFilterTaps, } from './render/renderQuality.ts';
|
|
226
|
+
export type { DirectionalShadowDepthLayers, GlassShadows, OutputTransform, PipelineCompile, RenderQuality, RenderQualityOptions, ShadowFilterTaps, SkinScattering, WaterReflectionFilterTaps, } from './render/renderQuality.ts';
|
|
227
227
|
export { MAX_POINT_LIGHTS, SURFACE_TEXTURE_UNIT } from './render/lightBudget.ts';
|
|
228
228
|
export { MAX_CLUSTERED_LIGHTS } from './render/clusteredLights.ts';
|
|
229
229
|
export { SurfaceTexture } from './render/surfaceTexture.ts';
|
|
230
230
|
export type { SurfaceMaterial, SurfaceTextureOptions } from './render/surfaceTexture.ts';
|
|
231
|
+
export type { SurfaceProjection } from './render/surfaceProjection.ts';
|
|
231
232
|
export { compressedFormatName, isCompressedSource, levelBytes, uploadsCompressed, } from './render/compressedSource.ts';
|
|
232
233
|
export type { BlockFormat, CompressedTextureFormat, CompressedTextureSource, SurfaceSource, } from './render/compressedSource.ts';
|
|
233
234
|
export { DEFAULT_GOVERNOR_LIMITS, ResolutionGovernor } from './render/resolutionGovernor.ts';
|
package/dist/index.js
CHANGED
|
@@ -237,7 +237,7 @@ export { WHOLE_PAGE } from './render/lightmap.js';
|
|
|
237
237
|
* A skinned cloth solved where the renderer can: compute on WebGPU, the CPU under WebGL2. A function
|
|
238
238
|
* rather than a renderer method so only a game that imports it carries the solver.
|
|
239
239
|
*/
|
|
240
|
-
export { createSkinnedCloth } from './render/skinnedClothRun.js';
|
|
240
|
+
export { createSkinnedCloth, createSkinnedClothSet } from './render/skinnedClothRun.js';
|
|
241
241
|
/*
|
|
242
242
|
* Reading an image's texels back exactly, which no canvas and no `VideoFrame` will do.
|
|
243
243
|
*
|
|
@@ -931,6 +931,15 @@ export declare class WebGL2Renderer implements RendererApi {
|
|
|
931
931
|
* compiled the first time a draw asks for one. See `modelProgram`.
|
|
932
932
|
*/
|
|
933
933
|
private readonly modelFlat;
|
|
934
|
+
/**
|
|
935
|
+
* Model programs still compiling, where draws skip a compile (`pipelineCompile: 'skip'`) and the
|
|
936
|
+
* context offers `KHR_parallel_shader_compile`; `parallelCompile` is its completion query then,
|
|
937
|
+
* and null where draws wait for a program here instead. See `modelProgram`.
|
|
938
|
+
*/
|
|
939
|
+
private readonly modelPending;
|
|
940
|
+
/** What `drawVariantOf` answers, rewritten each draw rather than made. */
|
|
941
|
+
private readonly drawVariant;
|
|
942
|
+
private readonly parallelCompile;
|
|
934
943
|
/** The last palette chosen, which an eye's axis is turned by. See `setSkinPalette`. */
|
|
935
944
|
private paletteData;
|
|
936
945
|
private readonly emptyTexture2D;
|
|
@@ -993,7 +1002,7 @@ export declare class WebGL2Renderer implements RendererApi {
|
|
|
993
1002
|
private oitReplaying;
|
|
994
1003
|
/** `uSurfaceScene`, resolved once a pass. See `surfaceScene.ts`. */
|
|
995
1004
|
private readonly surfaceScene;
|
|
996
|
-
/** The
|
|
1005
|
+
/** The three lanes of `uWriteMode`, kept here because a `vec3` is written whole. */
|
|
997
1006
|
private oitWeight;
|
|
998
1007
|
/**
|
|
999
1008
|
* How the surfaces drawn next meet the medium: what `setSurfaceFog` set, and `FOG_RECEDE` from
|
|
@@ -1001,6 +1010,7 @@ export declare class WebGL2Renderer implements RendererApi {
|
|
|
1001
1010
|
*/
|
|
1002
1011
|
private surfaceFog;
|
|
1003
1012
|
private ditherFade;
|
|
1013
|
+
private ditherOpacity;
|
|
1004
1014
|
/** Said once, not per frame, where the context cannot give the float target the sum needs. */
|
|
1005
1015
|
private oitRefused;
|
|
1006
1016
|
/** Said once for the whole renderer. See `refuseOitMultisampled`. */
|
|
@@ -1257,6 +1267,28 @@ export declare class WebGL2Renderer implements RendererApi {
|
|
|
1257
1267
|
private overlayTexture;
|
|
1258
1268
|
/** Whether this device's lit stage has room for the overlay's vectors: asked once. */
|
|
1259
1269
|
private overlayRoom;
|
|
1270
|
+
/**
|
|
1271
|
+
* The matrix the sun's dynamic shadow pass was last drawn with, uncorrected, and whether one has
|
|
1272
|
+
* been: what the moving layer is read through. See `movingLightFor`.
|
|
1273
|
+
*/
|
|
1274
|
+
private readonly movingLightViewProj;
|
|
1275
|
+
private movingLightKnown;
|
|
1276
|
+
/** Whether the lit stage has room for the moving layer's matrix, and whether its refusal was said. */
|
|
1277
|
+
private movingRoom;
|
|
1278
|
+
private warnedMovingRoom;
|
|
1279
|
+
/** The same answer for a material's projection, and whether its refusal was said. */
|
|
1280
|
+
private projectionRoom;
|
|
1281
|
+
private warnedProjectionRoom;
|
|
1282
|
+
/** `uWorldUv`, the current material's projection packed. See `surfaceProjection.ts`. */
|
|
1283
|
+
private readonly projection;
|
|
1284
|
+
/** The current material's `diffuseTransmission`, `uGlassTint.w`, 0 to 1. */
|
|
1285
|
+
private diffuseTransmission;
|
|
1286
|
+
/** `uLayers`, the current material's layers packed. See `surfaceLayers.ts`. */
|
|
1287
|
+
private readonly layerFloats;
|
|
1288
|
+
/** Whether the lit stage has room for layers' two vectors, and which refusals were said. */
|
|
1289
|
+
private layersRoom;
|
|
1290
|
+
private warnedLayersRoom;
|
|
1291
|
+
private warnedLayersModelMap;
|
|
1260
1292
|
private warnedOverlayRoom;
|
|
1261
1293
|
private warnedOverlayBlocks;
|
|
1262
1294
|
/** Whether a probe is being baked, so the passes that would recurse into one can tell. */
|
|
@@ -1786,6 +1818,15 @@ export declare class WebGL2Renderer implements RendererApi {
|
|
|
1786
1818
|
* this before its first frame gets the right behaviour on both without asking which backend
|
|
1787
1819
|
* it has, which is the contract `RendererApi` exists to keep.
|
|
1788
1820
|
*/
|
|
1821
|
+
/**
|
|
1822
|
+
* Resolve once every program a draw has started compiling has finished, adopting each: what a
|
|
1823
|
+
* loading screen awaits after drawing what its scene will use, where draws skip a compile. See
|
|
1824
|
+
* `RenderQuality.pipelineCompile`; nothing is started anywhere else here, so otherwise it is now.
|
|
1825
|
+
*
|
|
1826
|
+
* **It waits without holding the thread**, as the other backend's does: it asks the driver
|
|
1827
|
+
* whether each is done, which does not wait, and yields between asks. A driver that never says
|
|
1828
|
+
* done is asked the way that waits after `READY_MAX_POLLS`, so this cannot hang a loading screen.
|
|
1829
|
+
*/
|
|
1789
1830
|
ready(): Promise<void>;
|
|
1790
1831
|
dispose(options?: {
|
|
1791
1832
|
releaseContext?: boolean;
|
|
@@ -1936,6 +1977,8 @@ export declare class WebGL2Renderer implements RendererApi {
|
|
|
1936
1977
|
* material at once, as `ensureClothPrograms` feeds its own.
|
|
1937
1978
|
*/
|
|
1938
1979
|
private modelProgram;
|
|
1980
|
+
/** A model program compiled: kept, written to by every material setter, and fed the pass. */
|
|
1981
|
+
private adoptModel;
|
|
1939
1982
|
/**
|
|
1940
1983
|
* An eye's axis in the world for this draw, into its program's `uModelParams`: the material's
|
|
1941
1984
|
* own numbers with the axis turned by the draw's model matrix and the eye's joint. See
|
|
@@ -2073,6 +2116,32 @@ export declare class WebGL2Renderer implements RendererApi {
|
|
|
2073
2116
|
private overlayRoomLeft;
|
|
2074
2117
|
/** Whether the lit shader with the overlay compiled in fits this GPU: counted once. */
|
|
2075
2118
|
private overlayFits;
|
|
2119
|
+
/**
|
|
2120
|
+
* Whether a material's projection can be drawn: none asked, or the lit stage has the room for its
|
|
2121
|
+
* one vector. **Refused, said once, where it has not**, as the overlay is, and the material's
|
|
2122
|
+
* maps are then laid by the mesh's coordinates, as they were before it existed.
|
|
2123
|
+
*/
|
|
2124
|
+
private projectionFits;
|
|
2125
|
+
/**
|
|
2126
|
+
* What the sun's moving layer is read through: the matrix its shadow pass was last drawn with,
|
|
2127
|
+
* where the lit stage carries one (`MOVING_SUN`); the environment's otherwise, which every caller
|
|
2128
|
+
* drawing both layers with one matrix hands it anyway.
|
|
2129
|
+
*/
|
|
2130
|
+
private movingLightFor;
|
|
2131
|
+
/**
|
|
2132
|
+
* Turn the moving layer's own matrix on the first time a frame draws that layer with one the
|
|
2133
|
+
* environment's does not share. **Refused, said once, where the lit stage has no room for its five
|
|
2134
|
+
* vectors**: the layer is then read through the environment's matrix, so its shadows land where
|
|
2135
|
+
* that matrix puts them, and a caller there draws both layers with one.
|
|
2136
|
+
*/
|
|
2137
|
+
private askMovingSun;
|
|
2138
|
+
/**
|
|
2139
|
+
* A material's layers where they can be drawn: none asked, a model's map in the mask's place, or
|
|
2140
|
+
* no room for their two vectors each leave one layer, the last two said once each.
|
|
2141
|
+
*/
|
|
2142
|
+
private layersOf;
|
|
2143
|
+
/** Whether the lit shader with `feature` compiled in fits this GPU's fragment uniform vectors. */
|
|
2144
|
+
private switchFits;
|
|
2076
2145
|
/**
|
|
2077
2146
|
* How bright the environment the surfaces drawn next reflect is. 1 is the default and identity.
|
|
2078
2147
|
*
|
|
@@ -2155,7 +2224,25 @@ export declare class WebGL2Renderer implements RendererApi {
|
|
|
2155
2224
|
* are a pass of their own, do not. See `uDither` in `flat/preamble.ts` for what it costs.
|
|
2156
2225
|
*/
|
|
2157
2226
|
setDitherFade(amount: number): void;
|
|
2158
|
-
/**
|
|
2227
|
+
/**
|
|
2228
|
+
* Whether the draws that follow spend their own opacity on a screen door rather than on blending:
|
|
2229
|
+
* an instance's `MeshInstances.alphas`, or a vertex's channel alpha, keeps that share of the
|
|
2230
|
+
* pixels `setDitherFade` would and draws the rest not at all. So an opaque or cut-out batch fades
|
|
2231
|
+
* one instance at a time, with no sorting and no blend, and an instance at 1 is drawn whole.
|
|
2232
|
+
*
|
|
2233
|
+
* Off is what `bindMeshPass` restores. It shares the fade's pattern, so a crossfade at `t` and
|
|
2234
|
+
* `-t` of an instance at opacity `a` covers that instance's share once, without holes. Material
|
|
2235
|
+
* state like `setDitherFade`; instanced draws read it, and shadow casters do not.
|
|
2236
|
+
*
|
|
2237
|
+
* What it gives up: a fade reads as grain while it lasts, which a temporal resolve smooths and a
|
|
2238
|
+
* plain frame does not; a blended draw that asks spends its opacity here and blends none of it;
|
|
2239
|
+
* and a lightmapped batch carries regions where the opacities would be, so it has none to fade.
|
|
2240
|
+
*/
|
|
2241
|
+
setDitherOpacity(on: boolean): void;
|
|
2242
|
+
/**
|
|
2243
|
+
* `uWriteMode`: the order-independent weight, the fade and whether the opacity is dithered, which
|
|
2244
|
+
* share one uniform row.
|
|
2245
|
+
*/
|
|
2159
2246
|
private writeMode;
|
|
2160
2247
|
/**
|
|
2161
2248
|
* How strong the microscopic relief on the surfaces drawn next is, and how coarse.
|
|
@@ -3709,6 +3796,16 @@ export declare class WebGL2Renderer implements RendererApi {
|
|
|
3709
3796
|
*/
|
|
3710
3797
|
private scatterSkin;
|
|
3711
3798
|
/** One draw of a mesh, as `drawMesh` describes, of the half of a skin `half` names. */
|
|
3799
|
+
/**
|
|
3800
|
+
* Whether every half a split skin draws has its program, starting any that has not: a skin drawn
|
|
3801
|
+
* without its kept halves would lose its diffuse light for the frames they take to compile.
|
|
3802
|
+
*/
|
|
3803
|
+
private skinHalvesReady;
|
|
3804
|
+
/**
|
|
3805
|
+
* The vertex variant a draw of `mesh` takes now, and its program and uniforms where it is not the
|
|
3806
|
+
* plain one: what a model's program is keyed by, and what `drawMeshHalf` draws with.
|
|
3807
|
+
*/
|
|
3808
|
+
private drawVariantOf;
|
|
3712
3809
|
private drawMeshHalf;
|
|
3713
3810
|
/**
|
|
3714
3811
|
* Draw a mesh you can see through, in the same material as everything else by default.
|