@needle-tools/three-mesh-effects 0.2.1 → 0.2.2

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.
Files changed (3) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/SKILL.md +70 -0
  3. package/package.json +2 -2
package/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.2.2 - 2026-10-21
4
+
5
+ - Include a package-root `SKILL.md` with integration guidance for extension loading, compression decoders, runtime updates, and cleanup in Three.js and Needle Engine applications.
6
+
3
7
  ## 0.2.1 - 2026-10-21
4
8
 
5
9
  - Put installation and features before the Quick start, and clarify that consumers configure compression decoders themselves when needed.
package/SKILL.md ADDED
@@ -0,0 +1,70 @@
1
+ ---
2
+ name: three-mesh-effects
3
+ description: Integrate Mesh Baker glTF models into Three.js or Needle Engine applications, including extension loading, hull effects, deformation rigs, and pixel impostor displays.
4
+ ---
5
+
6
+ # Three Mesh Effects
7
+
8
+ Use the public runtime package to reproduce a Mesh Baker export in an existing
9
+ viewer. Read [README.md](README.md) for effect-specific examples and supported
10
+ Three.js versions. Read `package.json` for the installed version and exports.
11
+
12
+ ## Loader setup
13
+
14
+ Register `useLoader(loader, renderer)` from `@needle-tools/three-mesh-effects`
15
+ before loading or parsing an asset. Reuse the application's configured GLTFLoader
16
+ and renderer; preserve its Draco, Meshopt, KTX2, progressive-loading and other
17
+ plugins. Consumers configure compression decoders themselves.
18
+
19
+ The loader detects the asset's declared Needle extensions and dynamically
20
+ imports their handlers. Do not require callers to inspect extensions or invoke
21
+ separate registration functions. An optional typed third argument can disable
22
+ handlers, for example `{ disable: ['NEEDLE_hull_effect'] }`. Everything is enabled
23
+ by default. Disabled optional extensions retain their portable fallback;
24
+ disabled required extensions reject loading.
25
+
26
+ For Needle Engine, call `useLoader(loader, context.renderer)` in the engine's
27
+ custom extension `onImport` hook. Install the integration before creating viewers.
28
+ Use the existing render loop and model teardown hooks rather than starting an
29
+ independent animation loop.
30
+
31
+ ## Runtime updates and ownership
32
+
33
+ - Deformation rigs: obtain `getDeformationRig(scene)` from `/deformation-runtime`.
34
+ Advance the application's AnimationMixer first, then `rig.update(deltaSeconds)`.
35
+ Dispose the rig before releasing its model.
36
+ - Hulls: the versioned scene extension restores the saved effect automatically.
37
+ Obtain `getHullEffect(scene)` from `/hull-effects`. An original model is optional.
38
+ `bindHull(hull, original, { animate: true })` attaches a borrowed original and
39
+ replaces the effect; `bindHull(hull, null)` detaches it. Fetch the current effect
40
+ after rebinding, call `syncAnimation()` after mixers and rig updates, and dispose
41
+ the current effect before unloading. Never dispose the borrowed original's
42
+ geometry, materials or textures as part of binding cleanup.
43
+ - Pixel impostors: extension loading restores atlas bindings. Custom display
44
+ modes still use `createPixelImpostorDisplay` from `/pixel-impostor-runtime`;
45
+ update its viewport and dispose it as documented in the README.
46
+ - Octahedral impostors: pass the actual renderer to `useLoader` so the handler
47
+ can choose the supported material implementation.
48
+
49
+ Hull and other TSL effects require a renderer supporting node materials. Ordinary
50
+ Three.js applications use WebGPURenderer from `three/webgpu`, with its WebGPU or
51
+ WebGL2 backend. Some hosts provide their own TSL integration; inspect it before
52
+ changing their renderer or disabling existing rendering features.
53
+
54
+ When a scene is cleared while asynchronous initialization is pending, dispose
55
+ any runtimes that finish afterward. Track scenes separately per viewer/context,
56
+ including assets with multiple scenes. Avoid loading optional runtime modules
57
+ just to poll ordinary models that have no corresponding extension.
58
+
59
+ ## Verification
60
+
61
+ Exercise real GLTFLoader parsing and the host's update/clear lifecycle. Cover
62
+ ordinary assets, mixed extensions, opt-outs, disposal and asynchronous clear/load
63
+ races. Verify renderer compatibility when shader effects are involved; mocked
64
+ lifecycle tests alone do not establish visual correctness. Report checks that
65
+ were not run.
66
+
67
+ When extending this package, every new Needle glTF runtime extension must also
68
+ work through `useLoader`, including its typed disable key and lazy handler.
69
+ Preserve existing manual APIs. Use a versioned glTF extension for runtime data,
70
+ retain a portable fallback, and keep runtime contracts out of `extras`.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@needle-tools/three-mesh-effects",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "description": "Three.js loaders and TSL effects for Needle Mesh Baker outputs.",
5
5
  "keywords": [
6
6
  "three.js",
@@ -78,7 +78,7 @@
78
78
  },
79
79
  "./package.json": "./package.json"
80
80
  },
81
- "files": ["build/", "src/", "README.md", "CHANGELOG.md", "LICENSE"],
81
+ "files": ["build/", "src/", "README.md", "CHANGELOG.md", "SKILL.md", "LICENSE"],
82
82
  "scripts": {
83
83
  "build": "node scripts/build.mjs",
84
84
  "test": "npm run build && node --test tests/use-loader.test.js",