three-vat 4.0.0 → 4.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/dist/index.d.ts CHANGED
@@ -1,6 +1,8 @@
1
- import { AnimationClip, AnimationAction, Object3D, DataTexture, FloatType, HalfFloatType } from 'three';
2
- import { D as DeltaVAT, R as RigVAT, V as VAT } from './carrier-D4pkftSk.js';
3
- export { E as EndMode, I as INFINITE_REPETITIONS, L as LoopMode, a as VATBase, b as VATCarrier, c as VATClip, d as VATClipDefaults, e as VATClock, f as VATCrowd, g as VATFrame, h as VATInstance, i as VATOutgoingFrame, j as VATPlaybackState, k as VATPlaybackTexture, l as VATPlaybackTextureOptions, m as createVATPlaybackTexture, n as endsAt, r as resolveVATFrame, s as setVATInstance } from './carrier-D4pkftSk.js';
1
+ import { AnimationClip, AnimationAction, Object3D, Material, DataTexture, FloatType, HalfFloatType } from 'three';
2
+ import { D as DeltaVAT, R as RigVAT, b as VAT } from './types-CDPXKe0_.js';
3
+ export { E as EndMode, I as INFINITE_REPETITIONS, L as LoopMode, e as VATBase, f as VATClip, g as VATClipDefaults, V as VATClock, d as VATCrowd, h as VATFrame, c as VATInstance, i as VATOutgoingFrame, j as VATPlaybackState, a as VATPlaybackTexture, k as VATPlaybackTextureOptions, l as createVATPlaybackTexture, m as endsAt, r as resolveVATFrame, s as setVATInstance, t as turnVATInstance } from './types-CDPXKe0_.js';
4
+ import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader.js';
5
+ export { V as VATCarrier } from './carrier-DmKhB4QL.js';
4
6
 
5
7
  /**
6
8
  * What {@link bakeVAT} takes for each animation: the clip itself, or an
@@ -15,10 +17,14 @@ interface BakeOptions {
15
17
  /** Sample rate in frames per second. Default `30`. */
16
18
  fps?: number;
17
19
  /**
18
- * Largest texture dimension the target GPU accepts. Both VAT axes are checked
19
- * against it: `vertexCount` (width) and `totalFrames` (height). Defaults to
20
+ * Largest texture dimension the target GPU accepts. Under the rig encoding
21
+ * both axes are checked against it: the rig's width and `totalFrames`. Under
22
+ * the vertex encoding a frame whose vertices outnumber it spans several rows
23
+ * instead of refusing (ADR-0030), so the height alone is checked: `totalFrames
24
+ * × rowsPerFrame`. Defaults to
20
25
  * {@link MAX_TEXTURE_SIZE}; pass the renderer's real limit to avoid baking a
21
- * VAT that allocates on your desktop and fails on a phone.
26
+ * VAT that allocates on your desktop and fails on a phone, and so that a
27
+ * frame spans rows only where this GPU needs it to.
22
28
  */
23
29
  maxTextureSize?: number;
24
30
  /**
@@ -103,7 +109,8 @@ interface BakeOptions {
103
109
  * a plain clip carries no configuration, so the simple case still needs no
104
110
  * mixer at all and takes the library defaults ({@link VATClipDefaults}).
105
111
  *
106
- * `loop`, `repetitions` and `timeScale` are read. **`clampWhenFinished` is
112
+ * `loop`, `repetitions` and `timeScale` are read, a negative `timeScale` as a
113
+ * clip that plays backwards by default (ADR-0033). **`clampWhenFinished` is
107
114
  * not**: it is `false` on every untouched action, so a crowd reads it as the
108
115
  * silence it usually is and clamps either way — an instance names
109
116
  * `endMode: EndMode.Rewind` to get three's behaviour back.
@@ -150,6 +157,35 @@ declare function bakeVAT(root: Object3D, animations: BakeInput[], options: BakeO
150
157
  }): RigVAT;
151
158
  declare function bakeVAT(root: Object3D, animations: BakeInput[], options?: BakeOptions): VAT;
152
159
 
160
+ interface LoadVATOptions {
161
+ /**
162
+ * The loader to read the file with: yours, configured as your page already
163
+ * configures it. A plain `GLTFLoader` when none is passed. The plugin that
164
+ * reads the baked file is registered on it once, and leaves every other
165
+ * file it loads alone.
166
+ */
167
+ loader?: GLTFLoader;
168
+ /**
169
+ * Your own materials, to use in place of the file's: one for each
170
+ * `materialIndex`, in that order, as `vat.materials` holds them. Replaces
171
+ * them wholesale, so a crowd is restyled without a re-bake. An array of
172
+ * another length is refused.
173
+ */
174
+ materials?: Material[];
175
+ }
176
+ /**
177
+ * Load a baked file, written by `npx three-vat bake <input> --out <file>`, as
178
+ * the VAT `bakeVAT` returned when the command baked it: every texel, the clip
179
+ * table with its defaults, the bounds and `fallback`. Hand it to
180
+ * `createVATMesh` exactly as a fresh one.
181
+ *
182
+ * Refuses, by name, a file of another format version, which is to be baked
183
+ * again, and a file whose geometry no longer matches the one its texels are
184
+ * addressed by, which an optimizer that reorders, welds or simplifies vertices
185
+ * is the likely cause of.
186
+ */
187
+ declare function loadVAT(url: string, { loader, materials }?: LoadVATOptions): Promise<VAT>;
188
+
153
189
  /**
154
190
  * The WebGL2 *spec floor for high-end desktop*, which two things lean on.
155
191
  *
@@ -220,7 +256,8 @@ interface Vec3Out {
220
256
  }
221
257
  /**
222
258
  * Write a normal into two bytes of a VAT normal texture's buffer, at `offset`
223
- * and `offset + 1` — `(row * vertexCount + vertex) * 2` for the texel of one
259
+ * and `offset + 1` — `(row * vertexCount + vertex) * 2` in a one-row bake,
260
+ * `deltaTexel` in `src/test-utils.ts` in any, for the texel of one
224
261
  * vertex at one frame.
225
262
  *
226
263
  * Takes a direction, not a unit vector: the first step is a division by the L1
@@ -313,4 +350,4 @@ declare function bakeVATInWorker(worker: VATBakeWorker, root: Object3D, animatio
313
350
  */
314
351
  declare function serveVATBakes(scope?: VATBakeScope): () => void;
315
352
 
316
- export { type BakeInput, type BakeOptions, DeltaVAT, MAX_TEXTURE_SIZE, RigVAT, VAT, type VATBakeScope, type VATBakeWorker, type Vec3Out, bakeVAT, bakeVATInWorker, decodeOctahedral, encodeOctahedral, makeVATNormalTexture, makeVATTexture, serveVATBakes };
353
+ export { type BakeInput, type BakeOptions, DeltaVAT, type LoadVATOptions, MAX_TEXTURE_SIZE, RigVAT, VAT, type VATBakeScope, type VATBakeWorker, type Vec3Out, bakeVAT, bakeVATInWorker, decodeOctahedral, encodeOctahedral, loadVAT, makeVATNormalTexture, makeVATTexture, serveVATBakes };