@es3d/es3d 1.1.2 → 1.2.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/README.md +24 -0
- package/browser/es3d-stage.min.js +243 -10232
- package/browser/es3d.min.js +534 -0
- package/docs/STAGE.md +95 -0
- package/package.json +6 -3
- package/src/browser.js +16 -0
- package/src/cache/geometry-store.js +56 -18
- package/src/geometry/geometry-cache.js +93 -8
- package/src/io/compression.js +4 -1
- package/src/io/convert.js +14 -1
- package/src/pipeline.js +2 -1
- package/src/render/compile-worker.js +143 -0
- package/src/render/frame-builder.js +114 -77
- package/src/render/renderer.js +28 -2
- package/src/render/stage.js +305 -50
- package/src/render/worker-boot.js +14 -0
- package/src/scene/fragments.js +527 -0
- package/src/scene/picking.js +31 -2
- package/src/scene/prepared.js +398 -0
- package/src/scene/scene-graph.js +1 -1
- package/src/scene/scene-set.js +251 -0
package/README.md
CHANGED
|
@@ -67,6 +67,21 @@ stage.show(source);
|
|
|
67
67
|
|
|
68
68
|
`background: true` runs the clock and leaves the camera still. `stage.setTransform(id, matrix)` replaces the local matrix of an element that is placed once (column-major, the same layout as `matrix()`). `stage.setTransforms([[id, matrix], ...])` stores every matrix, walks each affected part of the scene once, and returns a boolean for each entry. A shared definition or a `<repeat>` / `<scatter>` copy is left unchanged and that entry is false. `stage.reducedMotion` follows the visitor's reduced-motion preference, and the clock stays still while it matches. `clock: 'always'` runs the clock when the document has no `<animate>`. `mulberry32`, `es3dSin` and `es3dCos` are the reader's placement functions. The format stays version 1.
|
|
69
69
|
|
|
70
|
+
### Fragments
|
|
71
|
+
|
|
72
|
+
A page that streams content (map tiles, rooms, a route) adds whole documents to the one on screen. Only that document is compiled:
|
|
73
|
+
|
|
74
|
+
```js
|
|
75
|
+
const tile = stage.add(await stage.prepare(tileSource), { id: 'tile-1' }); // compiled in a worker
|
|
76
|
+
await tile.ready;
|
|
77
|
+
tile.visible = false;
|
|
78
|
+
tile.replace(newSource);
|
|
79
|
+
tile.remove();
|
|
80
|
+
await stage.drawn(); // the next frame that shows every change
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
Every option and call is in [docs/STAGE.md](https://github.com/bitilia/es3d/blob/HEAD/docs/STAGE.md) and on [es3d.org/stage](https://es3d.org/stage/).
|
|
84
|
+
|
|
70
85
|
## Compile, check and convert
|
|
71
86
|
|
|
72
87
|
```js
|
|
@@ -79,6 +94,15 @@ const { text } = await importFiles([{ name: 'logo.svg', bytes }]); // SVG, OBJ,
|
|
|
79
94
|
const { files } = exportFormat(text, 'glb'); // ES3D → glTF, OBJ, STL, STEP, X3D, USDA, OpenSCAD, three.js
|
|
80
95
|
```
|
|
81
96
|
|
|
97
|
+
In a web page, `@es3d/es3d/browser` is all of that in one file, and `importFiles` takes the visitor's files as they come from an `<input type="file">`. Nothing is uploaded:
|
|
98
|
+
|
|
99
|
+
```js
|
|
100
|
+
import { importFiles, exportFormat } from '@es3d/es3d/browser';
|
|
101
|
+
|
|
102
|
+
const { text } = await importFiles(input.files);
|
|
103
|
+
const { files } = exportFormat(text, 'stl');
|
|
104
|
+
```
|
|
105
|
+
|
|
82
106
|
Every error has a line, a column, a code and, where it can, a "did you mean" suggestion. Repeated warnings that share a code, an element name and a message are printed once, with a count. `validate --json` still lists every warning.
|
|
83
107
|
|
|
84
108
|
## The command
|