@needle-tools/three-mesh-effects 0.3.5 → 0.3.7

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 (63) hide show
  1. package/CHANGELOG.md +33 -28
  2. package/README.md +63 -231
  3. package/SKILL.md +11 -68
  4. package/build/box-impostor-runtime.js +652 -257
  5. package/build/box-impostor-runtime.js.map +4 -4
  6. package/build/deformation-runtime.js +1 -1
  7. package/build/deformation-runtime.js.map +1 -1
  8. package/build/hull-effects.js.map +1 -1
  9. package/build/impostor-runtime.js +2 -2
  10. package/build/impostor-runtime.js.map +2 -2
  11. package/build/index.js +2 -2
  12. package/build/index.js.map +2 -2
  13. package/build/internal/box-impostor/box-impostor-display.js +662 -265
  14. package/build/internal/box-impostor/box-impostor-display.js.map +4 -4
  15. package/build/internal/box-impostor/box-impostor-material.js +662 -265
  16. package/build/internal/box-impostor/box-impostor-material.js.map +4 -4
  17. package/build/internal/box-impostor/box-impostor-ray-bounds.js +369 -0
  18. package/build/internal/box-impostor/box-impostor-ray-bounds.js.map +7 -0
  19. package/build/internal/box-impostor/box-impostor-runtime.js +652 -257
  20. package/build/internal/box-impostor/box-impostor-runtime.js.map +4 -4
  21. package/build/internal/deformation/rig-runtime.js +1 -1
  22. package/build/internal/deformation/rig-runtime.js.map +1 -1
  23. package/build/internal/impostor/impostor-node-material.js +2 -2
  24. package/build/internal/impostor/impostor-node-material.js.map +2 -2
  25. package/build/internal/impostor/octahedral.js.map +1 -1
  26. package/build/internal/pixel-impostor/pixel-impostor-display.js +39 -16
  27. package/build/internal/pixel-impostor/pixel-impostor-display.js.map +2 -2
  28. package/build/internal/pixel-impostor/pixel-impostor-metadata.js +61 -6
  29. package/build/internal/pixel-impostor/pixel-impostor-metadata.js.map +2 -2
  30. package/build/internal/pixel-impostor/pixel-impostor-runtime.js +980 -26
  31. package/build/internal/pixel-impostor/pixel-impostor-runtime.js.map +4 -4
  32. package/build/internal/rendering/hull-effect-runtime.js.map +1 -1
  33. package/build/internal/rendering/renderer-support.js.map +1 -1
  34. package/build/internal/rendering/skin-projection.js.map +1 -1
  35. package/build/internal/rendering/surface-query.js.map +1 -1
  36. package/build/internal/rendering/wrap-preview.js.map +1 -1
  37. package/build/internal/rendering/wrap-skin.js.map +1 -1
  38. package/build/pixel-impostor-runtime.js +362 -172
  39. package/build/pixel-impostor-runtime.js.map +4 -4
  40. package/build/types/box-impostor/box-impostor-material.d.ts +2 -1
  41. package/build/types/box-impostor/box-impostor-ray-bounds.d.ts +6 -0
  42. package/build/types/box-impostor/box-impostor-ray-bounds.js +1 -0
  43. package/build/types/deformation/rig-runtime.d.ts +1 -1
  44. package/build/types/impostor/octahedral.d.ts +1 -1
  45. package/build/types/pixel-impostor/pixel-impostor-display.d.ts +3 -3
  46. package/build/types/pixel-impostor/pixel-impostor-metadata.d.ts +76 -5
  47. package/build/types/pixel-impostor/pixel-impostor-runtime.d.ts +19 -7
  48. package/build/types/public/pixel-impostor-runtime.d.ts +1 -1
  49. package/build/types/rendering/renderer-support.d.ts +1 -1
  50. package/build/types/rendering/surface-query.d.ts +2 -2
  51. package/package.json +2 -2
  52. package/src/box-impostor/box-impostor-material.js +128 -90
  53. package/src/box-impostor/box-impostor-ray-bounds.js +452 -0
  54. package/src/deformation/rig-runtime.ts +1 -1
  55. package/src/impostor/impostor-node-material.js +2 -2
  56. package/src/impostor/octahedral.js +1 -1
  57. package/src/pixel-impostor/pixel-impostor-display.js +32 -18
  58. package/src/pixel-impostor/pixel-impostor-metadata.js +69 -9
  59. package/src/pixel-impostor/pixel-impostor-runtime.js +32 -9
  60. package/src/public/index.js +2 -2
  61. package/src/public/pixel-impostor-runtime.js +1 -1
  62. package/src/rendering/renderer-support.js +1 -1
  63. package/src/rendering/surface-query.js +2 -2
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/rendering/renderer-support.js", "../../../src/rendering/classic-webgl-support.js"],
4
- "sourcesContent": ["// @ts-check\nimport {REVISION} from 'three';\nimport * as TSL from 'three/tsl';\nimport {classicWebGLSupportsNodeMaterials} from './classic-webgl-support.js';\n\n/**\n * @typedef {object} ImpostorRenderer\n * @property {boolean=} isWebGPURenderer\n * @property {boolean=} isWebGLRenderer\n * @property {(object & {supportsNodeMaterials?: boolean})=} capabilities\n * @property {((handler: import('three/addons/tsl/WebGLNodesHandler.js').WebGLNodesHandler) => void)=} setNodesHandler\n */\n\n/**\n * Reports whether a renderer can compile Baker's TSL impostor material.\n * WebGPURenderer supports node materials directly. Classic WebGLRenderer\n * integrations must advertise that they installed a compatible nodes handler.\n *\n * @param {ImpostorRenderer | undefined} renderer\n */\nexport function rendererSupportsImpostorNodeMaterials(renderer) {\n\tif (typeof Reflect.get(TSL, 'struct') !== 'function') return false;\n\treturn renderer?.isWebGPURenderer === true\n\t\t|| renderer?.capabilities?.supportsNodeMaterials === true;\n}\n\n/** @type {WeakMap<ImpostorRenderer, Promise<void>>} */\nconst pending = new WeakMap();\n\n/** Enable Three's existing TSL handler only when an enabled asset needs it.\n * Hosts with their own compiler advertise supportsNodeMaterials to retain it.\n * @param {ImpostorRenderer | undefined} renderer */\nexport async function enableRendererNodeMaterials(renderer) {\n\tif (rendererSupportsImpostorNodeMaterials(renderer) ||\n\t\t!renderer?.isWebGLRenderer || !renderer.setNodesHandler ||\n\t\ttypeof Reflect.get(TSL, 'struct') !== 'function') return;\n\tlet setup = pending.get(renderer);\n\tif (!setup) {\n\t\tsetup = import('three/addons/tsl/WebGLNodesHandler.js').then(({WebGLNodesHandler}) => {\n\t\t\tif (rendererSupportsImpostorNodeMaterials(renderer)) return;\n\t\t\tif (!classicWebGLSupportsNodeMaterials(REVISION)) {\n\t\t\t\tconsole.warn(`Mesh Effects: WebGLRenderer from three r${REVISION} stops drawing node materials after about a dozen are in use. Use three r187 or later, or WebGPURenderer.`);\n\t\t\t}\n\t\t\trenderer.setNodesHandler?.(new WebGLNodesHandler());\n\t\t\trenderer.capabilities ??= {};\n\t\t\trenderer.capabilities.supportsNodeMaterials = true;\n\t\t}).catch(error => {\n\t\t\tpending.delete(renderer);\n\t\t\tthrow error;\n\t\t});\n\t\tpending.set(renderer, setup);\n\t}\n\tawait setup;\n}\n\n", "// @ts-check\n\n/**\n * Reports whether WebGLRenderer from a three revision can keep many node\n * materials alive. Before r187 every uniform block holds one of a few binding\n * points until its material is disposed, so node materials stop drawing after\n * about a dozen. The Needle fork backports the fix from 0.186.2-alpha.2.\n *\n * @param {string} revision three's `REVISION`, such as `'187'` or `'186.2-alpha.2'`\n */\nexport function classicWebGLSupportsNodeMaterials(revision) {\n\tconst fork = /^186\\.2-alpha\\.(\\d+)$/.exec(revision);\n\tif (fork) return Number(fork[1]) >= 2;\n\treturn Number.parseInt(revision, 10) >= 187;\n}\n"],
4
+ "sourcesContent": ["// @ts-check\nimport {REVISION} from 'three';\nimport * as TSL from 'three/tsl';\nimport {classicWebGLSupportsNodeMaterials} from './classic-webgl-support.js';\n\n/**\n * @typedef {object} ImpostorRenderer\n * @property {boolean=} isWebGPURenderer\n * @property {boolean=} isWebGLRenderer\n * @property {(object & {supportsNodeMaterials?: boolean})=} capabilities\n * @property {((handler: import('three/addons/tsl/WebGLNodesHandler.js').WebGLNodesHandler) => void)=} setNodesHandler\n */\n\n/**\n * Reports whether a renderer can compile TSL impostor materials.\n * WebGPURenderer supports node materials directly. Classic WebGLRenderer\n * integrations must advertise that they installed a compatible nodes handler.\n *\n * @param {ImpostorRenderer | undefined} renderer\n */\nexport function rendererSupportsImpostorNodeMaterials(renderer) {\n\tif (typeof Reflect.get(TSL, 'struct') !== 'function') return false;\n\treturn renderer?.isWebGPURenderer === true\n\t\t|| renderer?.capabilities?.supportsNodeMaterials === true;\n}\n\n/** @type {WeakMap<ImpostorRenderer, Promise<void>>} */\nconst pending = new WeakMap();\n\n/** Enable Three's existing TSL handler only when an enabled asset needs it.\n * Hosts with their own compiler advertise supportsNodeMaterials to retain it.\n * @param {ImpostorRenderer | undefined} renderer */\nexport async function enableRendererNodeMaterials(renderer) {\n\tif (rendererSupportsImpostorNodeMaterials(renderer) ||\n\t\t!renderer?.isWebGLRenderer || !renderer.setNodesHandler ||\n\t\ttypeof Reflect.get(TSL, 'struct') !== 'function') return;\n\tlet setup = pending.get(renderer);\n\tif (!setup) {\n\t\tsetup = import('three/addons/tsl/WebGLNodesHandler.js').then(({WebGLNodesHandler}) => {\n\t\t\tif (rendererSupportsImpostorNodeMaterials(renderer)) return;\n\t\t\tif (!classicWebGLSupportsNodeMaterials(REVISION)) {\n\t\t\t\tconsole.warn(`Mesh Effects: WebGLRenderer from three r${REVISION} stops drawing node materials after about a dozen are in use. Use three r187 or later, or WebGPURenderer.`);\n\t\t\t}\n\t\t\trenderer.setNodesHandler?.(new WebGLNodesHandler());\n\t\t\trenderer.capabilities ??= {};\n\t\t\trenderer.capabilities.supportsNodeMaterials = true;\n\t\t}).catch(error => {\n\t\t\tpending.delete(renderer);\n\t\t\tthrow error;\n\t\t});\n\t\tpending.set(renderer, setup);\n\t}\n\tawait setup;\n}\n\n", "// @ts-check\n\n/**\n * Reports whether WebGLRenderer from a three revision can keep many node\n * materials alive. Before r187 every uniform block holds one of a few binding\n * points until its material is disposed, so node materials stop drawing after\n * about a dozen. The Needle fork backports the fix from 0.186.2-alpha.2.\n *\n * @param {string} revision three's `REVISION`, such as `'187'` or `'186.2-alpha.2'`\n */\nexport function classicWebGLSupportsNodeMaterials(revision) {\n\tconst fork = /^186\\.2-alpha\\.(\\d+)$/.exec(revision);\n\tif (fork) return Number(fork[1]) >= 2;\n\treturn Number.parseInt(revision, 10) >= 187;\n}\n"],
5
5
  "mappings": ";;;AACA,SAAQ,gBAAe;AACvB,YAAY,SAAS;;;ACQd,SAAS,kCAAkC,UAAU;AAC3D,QAAM,OAAO,wBAAwB,KAAK,QAAQ;AAClD,MAAI,KAAM,QAAO,OAAO,KAAK,CAAC,CAAC,KAAK;AACpC,SAAO,OAAO,SAAS,UAAU,EAAE,KAAK;AACzC;;;ADMO,SAAS,sCAAsC,UAAU;AAC/D,MAAI,OAAO,QAAQ,IAAI,KAAK,QAAQ,MAAM,WAAY,QAAO;AAC7D,SAAO,UAAU,qBAAqB,QAClC,UAAU,cAAc,0BAA0B;AACvD;AAGA,IAAM,UAAU,oBAAI,QAAQ;AAK5B,eAAsB,4BAA4B,UAAU;AAC3D,MAAI,sCAAsC,QAAQ,KACjD,CAAC,UAAU,mBAAmB,CAAC,SAAS,mBACxC,OAAO,QAAQ,IAAI,KAAK,QAAQ,MAAM,WAAY;AACnD,MAAI,QAAQ,QAAQ,IAAI,QAAQ;AAChC,MAAI,CAAC,OAAO;AACX,YAAQ,OAAO,uCAAuC,EAAE,KAAK,CAAC,EAAC,kBAAiB,MAAM;AACrF,UAAI,sCAAsC,QAAQ,EAAG;AACrD,UAAI,CAAC,kCAAkC,QAAQ,GAAG;AACjD,gBAAQ,KAAK,2CAA2C,QAAQ,2GAA2G;AAAA,MAC5K;AACA,eAAS,kBAAkB,IAAI,kBAAkB,CAAC;AAClD,eAAS,iBAAiB,CAAC;AAC3B,eAAS,aAAa,wBAAwB;AAAA,IAC/C,CAAC,EAAE,MAAM,WAAS;AACjB,cAAQ,OAAO,QAAQ;AACvB,YAAM;AAAA,IACP,CAAC;AACD,YAAQ,IAAI,UAAU,KAAK;AAAA,EAC5B;AACA,QAAM;AACP;",
6
6
  "names": []
7
7
  }