@realsee/five-webgpu 1.0.0-alpha.10 → 1.0.0-alpha.11

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 (181) hide show
  1. package/_virtual/_rolldown/runtime.js +2 -2
  2. package/five/index.js +50 -50
  3. package/five/index.mjs +1149 -1186
  4. package/five/renderer/postprocessing/passes/pass.js +2 -2
  5. package/five/renderer/postprocessing/passes/pass.mjs +2 -2
  6. package/five/renderer/tools/full-screen-quad.js +2 -2
  7. package/five/renderer/tools/full-screen-quad.mjs +2 -2
  8. package/five/utils/calculateThreeMouse.js +2 -2
  9. package/five/utils/calculateThreeMouse.mjs +2 -2
  10. package/five/utils/distance.js +2 -2
  11. package/five/utils/distance.mjs +2 -2
  12. package/five/utils/isNil.js +2 -2
  13. package/five/utils/isNil.mjs +2 -2
  14. package/five/utils/uuid.js +2 -2
  15. package/five/utils/uuid.mjs +2 -2
  16. package/gltf-loader/index.js +3 -3
  17. package/gltf-loader/index.mjs +3 -3
  18. package/line/index.js +3 -3
  19. package/line/index.mjs +3 -3
  20. package/package.json +1 -1
  21. package/plugins/BackgroundPlugin/Controller.js +3 -3
  22. package/plugins/BackgroundPlugin/Controller.mjs +3 -3
  23. package/plugins/BackgroundPlugin/index.js +2 -2
  24. package/plugins/BackgroundPlugin/index.mjs +2 -2
  25. package/plugins/BasePlugin/index.js +2 -2
  26. package/plugins/BasePlugin/index.mjs +2 -2
  27. package/plugins/CSS2DPlugin/Controller.js +3 -3
  28. package/plugins/CSS2DPlugin/Controller.mjs +3 -3
  29. package/plugins/CSS2DPlugin/index.js +2 -2
  30. package/plugins/CSS2DPlugin/index.mjs +2 -2
  31. package/plugins/CSS2DPlugin/style.css_raw.js +2 -2
  32. package/plugins/CSS2DPlugin/style.css_raw.mjs +2 -2
  33. package/plugins/CSS3DPlugin/Controller.js +3 -3
  34. package/plugins/CSS3DPlugin/Controller.mjs +3 -3
  35. package/plugins/CSS3DPlugin/index.js +2 -2
  36. package/plugins/CSS3DPlugin/index.mjs +2 -2
  37. package/plugins/CSS3DPlugin/style.css_raw.js +2 -2
  38. package/plugins/CSS3DPlugin/style.css_raw.mjs +2 -2
  39. package/plugins/FloorplanPlugin/Controller.js +3 -3
  40. package/plugins/FloorplanPlugin/Controller.mjs +3 -3
  41. package/plugins/FloorplanPlugin/index.js +2 -2
  42. package/plugins/FloorplanPlugin/index.mjs +2 -2
  43. package/plugins/FloorplanPlugin/render/assets.js +2 -2
  44. package/plugins/FloorplanPlugin/render/assets.mjs +2 -2
  45. package/plugins/FloorplanPlugin/render/index.js +2 -2
  46. package/plugins/FloorplanPlugin/render/index.mjs +2 -2
  47. package/plugins/FloorplanPlugin/render/isPointInPolygon.js +2 -2
  48. package/plugins/FloorplanPlugin/render/isPointInPolygon.mjs +2 -2
  49. package/plugins/FloorplanPlugin/render/renderFloor.js +2 -2
  50. package/plugins/FloorplanPlugin/render/renderFloor.mjs +2 -2
  51. package/plugins/FloorplanPlugin/render/roomLabelVisibility.js +2 -2
  52. package/plugins/FloorplanPlugin/render/roomLabelVisibility.mjs +2 -2
  53. package/plugins/FloorplanPlugin/render/style.css_raw.js +2 -2
  54. package/plugins/FloorplanPlugin/render/style.css_raw.mjs +2 -2
  55. package/plugins/FloorplanPlugin/utils/changeMode.js +3 -3
  56. package/plugins/FloorplanPlugin/utils/changeMode.mjs +3 -3
  57. package/plugins/FloorplanPlugin/utils/changeModelCanvasOpacity.js +2 -2
  58. package/plugins/FloorplanPlugin/utils/changeModelCanvasOpacity.mjs +2 -2
  59. package/plugins/FloorplanPlugin/utils/correctFiveState.js +3 -3
  60. package/plugins/FloorplanPlugin/utils/correctFiveState.mjs +3 -3
  61. package/plugins/FloorplanPlugin/utils/equal.js +2 -2
  62. package/plugins/FloorplanPlugin/utils/equal.mjs +2 -2
  63. package/plugins/FloorplanPlugin/utils/filter.js +2 -2
  64. package/plugins/FloorplanPlugin/utils/filter.mjs +2 -2
  65. package/plugins/FloorplanPlugin/utils/fiveModelLoad.js +3 -3
  66. package/plugins/FloorplanPlugin/utils/fiveModelLoad.mjs +3 -3
  67. package/plugins/FloorplanPlugin/utils/formatData.js +3 -3
  68. package/plugins/FloorplanPlugin/utils/formatData.mjs +3 -3
  69. package/plugins/FloorplanPlugin/utils/formatFloorplanJson.js +2 -2
  70. package/plugins/FloorplanPlugin/utils/formatFloorplanJson.mjs +2 -2
  71. package/plugins/FloorplanPlugin/utils/formatPosition.js +2 -2
  72. package/plugins/FloorplanPlugin/utils/formatPosition.mjs +2 -2
  73. package/plugins/FloorplanPlugin/utils/getDistanceFromModel.js +2 -2
  74. package/plugins/FloorplanPlugin/utils/getDistanceFromModel.mjs +2 -2
  75. package/plugins/FloorplanPlugin/utils/getPxmm.js +2 -2
  76. package/plugins/FloorplanPlugin/utils/getPxmm.mjs +2 -2
  77. package/plugins/FloorplanPlugin/utils/isTruelyObject.js +2 -2
  78. package/plugins/FloorplanPlugin/utils/isTruelyObject.mjs +2 -2
  79. package/plugins/FloorplanPlugin/utils/nearlyEqual.js +2 -2
  80. package/plugins/FloorplanPlugin/utils/nearlyEqual.mjs +2 -2
  81. package/plugins/FloorplanPlugin/utils/polylabel.js +2 -2
  82. package/plugins/FloorplanPlugin/utils/polylabel.mjs +2 -2
  83. package/plugins/FloorplanPlugin/utils/to.js +3 -3
  84. package/plugins/FloorplanPlugin/utils/to.mjs +3 -3
  85. package/plugins/GaussianSplattingEntranceAnimationPlugin/Controller.js +3 -3
  86. package/plugins/GaussianSplattingEntranceAnimationPlugin/Controller.mjs +3 -3
  87. package/plugins/GaussianSplattingEntranceAnimationPlugin/index.js +2 -2
  88. package/plugins/GaussianSplattingEntranceAnimationPlugin/index.mjs +2 -2
  89. package/plugins/Object3DHelperPlugin/Controller.js +3 -3
  90. package/plugins/Object3DHelperPlugin/Controller.mjs +3 -3
  91. package/plugins/Object3DHelperPlugin/Controllers/BaseController.js +2 -2
  92. package/plugins/Object3DHelperPlugin/Controllers/BaseController.mjs +2 -2
  93. package/plugins/Object3DHelperPlugin/Controllers/BoundingBoxController.js +2 -2
  94. package/plugins/Object3DHelperPlugin/Controllers/BoundingBoxController.mjs +2 -2
  95. package/plugins/Object3DHelperPlugin/Controllers/MoveController.js +2 -2
  96. package/plugins/Object3DHelperPlugin/Controllers/MoveController.mjs +2 -2
  97. package/plugins/Object3DHelperPlugin/Controllers/RotateController.js +2 -2
  98. package/plugins/Object3DHelperPlugin/Controllers/RotateController.mjs +2 -2
  99. package/plugins/Object3DHelperPlugin/FiveControllerWrapper.js +2 -2
  100. package/plugins/Object3DHelperPlugin/FiveControllerWrapper.mjs +2 -2
  101. package/plugins/Object3DHelperPlugin/Helper/BaseHelper.js +2 -2
  102. package/plugins/Object3DHelperPlugin/Helper/BaseHelper.mjs +2 -2
  103. package/plugins/Object3DHelperPlugin/Helper/BoundingBoxHelper.js +2 -2
  104. package/plugins/Object3DHelperPlugin/Helper/BoundingBoxHelper.mjs +2 -2
  105. package/plugins/Object3DHelperPlugin/Helper/MoveHelper.js +2 -2
  106. package/plugins/Object3DHelperPlugin/Helper/MoveHelper.mjs +2 -2
  107. package/plugins/Object3DHelperPlugin/Helper/RotateHelper.js +2 -2
  108. package/plugins/Object3DHelperPlugin/Helper/RotateHelper.mjs +2 -2
  109. package/plugins/Object3DHelperPlugin/constant.js +2 -2
  110. package/plugins/Object3DHelperPlugin/constant.mjs +2 -2
  111. package/plugins/Object3DHelperPlugin/index.js +2 -2
  112. package/plugins/Object3DHelperPlugin/index.mjs +2 -2
  113. package/plugins/Object3DHelperPlugin/utils/ArrowGroup.js +2 -2
  114. package/plugins/Object3DHelperPlugin/utils/ArrowGroup.mjs +2 -2
  115. package/plugins/Object3DHelperPlugin/utils/CenterHandle.js +2 -2
  116. package/plugins/Object3DHelperPlugin/utils/CenterHandle.mjs +2 -2
  117. package/plugins/Object3DHelperPlugin/utils/PlaneHandle.js +2 -2
  118. package/plugins/Object3DHelperPlugin/utils/PlaneHandle.mjs +2 -2
  119. package/plugins/Object3DHelperPlugin/utils/calculateScaleByCamera.js +2 -2
  120. package/plugins/Object3DHelperPlugin/utils/calculateScaleByCamera.mjs +2 -2
  121. package/plugins/Object3DHelperPlugin/utils/cameraHooks.js +2 -2
  122. package/plugins/Object3DHelperPlugin/utils/cameraHooks.mjs +2 -2
  123. package/plugins/Object3DHelperPlugin/utils/direction.js +2 -2
  124. package/plugins/Object3DHelperPlugin/utils/direction.mjs +2 -2
  125. package/plugins/Object3DHelperPlugin/utils/getMouseRaycaster.js +2 -2
  126. package/plugins/Object3DHelperPlugin/utils/getMouseRaycaster.mjs +2 -2
  127. package/plugins/Object3DHelperPlugin/utils/getOrthographicCameraDirection.js +2 -2
  128. package/plugins/Object3DHelperPlugin/utils/getOrthographicCameraDirection.mjs +2 -2
  129. package/plugins/Object3DHelperPlugin/utils/setObjectQuaternion.js +2 -2
  130. package/plugins/Object3DHelperPlugin/utils/setObjectQuaternion.mjs +2 -2
  131. package/plugins/Object3DHelperPlugin/utils/solidGuide.js +2 -2
  132. package/plugins/Object3DHelperPlugin/utils/solidGuide.mjs +2 -2
  133. package/plugins/Object3DHelperPlugin/utils/tipsDom.js +2 -2
  134. package/plugins/Object3DHelperPlugin/utils/tipsDom.mjs +2 -2
  135. package/plugins/PanoAnimePlugin/Controller.js +3 -3
  136. package/plugins/PanoAnimePlugin/Controller.mjs +3 -3
  137. package/plugins/PanoAnimePlugin/index.js +2 -2
  138. package/plugins/PanoAnimePlugin/index.mjs +2 -2
  139. package/plugins/WordPassPlugin/Controller.js +3 -3
  140. package/plugins/WordPassPlugin/Controller.mjs +3 -3
  141. package/plugins/WordPassPlugin/hersheyFont.js +2 -2
  142. package/plugins/WordPassPlugin/hersheyFont.mjs +2 -2
  143. package/plugins/WordPassPlugin/index.js +2 -2
  144. package/plugins/WordPassPlugin/index.mjs +2 -2
  145. package/plugins/WordPassPlugin/textToStrokeOrderStrokes.js +3 -3
  146. package/plugins/WordPassPlugin/textToStrokeOrderStrokes.mjs +4 -4
  147. package/plugins/WordPassPlugin/word-pass.js +3 -3
  148. package/plugins/WordPassPlugin/word-pass.mjs +3 -3
  149. package/plugins/index.js +2 -2
  150. package/plugins/index.mjs +2 -2
  151. package/plugins/thirdParty/CSS2DRenderer.js +2 -2
  152. package/plugins/thirdParty/CSS2DRenderer.mjs +2 -2
  153. package/plugins/thirdParty/CSS3DRenderer.js +2 -2
  154. package/plugins/thirdParty/CSS3DRenderer.mjs +2 -2
  155. package/plugins/thirdParty/doctorstrange-model.js +2 -2
  156. package/plugins/thirdParty/doctorstrange-model.mjs +2 -2
  157. package/plugins/thirdParty/domevents.js +2 -2
  158. package/plugins/thirdParty/domevents.mjs +2 -2
  159. package/plugins/utils/absoluteUrl.js +2 -2
  160. package/plugins/utils/absoluteUrl.mjs +2 -2
  161. package/plugins/utils/calculatePath.js +2 -2
  162. package/plugins/utils/calculatePath.mjs +2 -2
  163. package/plugins/utils/clamp.js +2 -2
  164. package/plugins/utils/clamp.mjs +2 -2
  165. package/plugins/utils/uuid.js +2 -2
  166. package/plugins/utils/uuid.mjs +2 -2
  167. package/react/index.js +2 -2
  168. package/react/index.mjs +2 -2
  169. package/sticker/index.js +3 -3
  170. package/sticker/index.mjs +3 -3
  171. package/umd/five-gltf-loader.js +3 -3
  172. package/umd/five-line.js +3 -3
  173. package/umd/five-plugins.js +2 -2
  174. package/umd/five-react.js +2 -2
  175. package/umd/five-sticker.js +3 -3
  176. package/umd/five-vfx.js +2 -2
  177. package/umd/five.js +3 -3
  178. package/vfx/index.js +2 -2
  179. package/vfx/index.mjs +2 -2
  180. package/work-downloader/index.js +3 -3
  181. package/work-downloader/index.mjs +152 -180
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * @license
3
3
  * @realsee/five-webgpu
4
- * Generated: 10/26/2026
5
- * Version: 1.0.0-alpha.10
4
+ * Generated: 10/27/2026
5
+ * Version: 1.0.0-alpha.11
6
6
  * Terms:
7
7
  * Realsee SDK License Agreement
8
8
  * Update: July 28, 2021
@@ -252,4 +252,4 @@
252
252
  * No amendment to or modification of this Agreement will be binding unless in
253
253
  * writing and signed by Realsee. You and Realsee hereto confirm that this
254
254
  * Agreement and all related documents shall be drafted in English.
255
- */const e=require("../../_virtual/_rolldown/runtime.js"),t=require("../../node_modules/tslib/tslib.es6.js"),n=require("../../five/renderer/tools/full-screen-quad.js"),r=require("../../five/renderer/postprocessing/passes/pass.js"),i=require("../../five/utils/uuid.js");let a=require("three/webgpu");a=e.__toESM(a,1);let o=require("three/tsl");var s=16767392,c=3,l=class extends r.FivePass{constructor(e,t=a.UnsignedByteType){super(),this.uTime=0,this.words=[],this.lineMesh=null,this.lineMaterial=null,this.points=null,this.particleMaterial=null,this.particleGeometry=null,this.arrPosition=null,this.arrVelocity=null,this.arrAccel=null,this.arrColor=null,this.arrParams=null,this._tmpTip=new a.Vector3,this.uTimeLine=(0,o.uniform)(0),this.uResolutionLine=(0,o.uniform)(new a.Vector2(1,1)),this.uProjLine=(0,o.uniform)(new a.Matrix4),this.uViewLine=(0,o.uniform)(new a.Matrix4),this.uPixelRatioLine=(0,o.uniform)(1),this.uMaxDisplayBoost=(0,o.uniform)(1),this.uTimeParticle=(0,o.uniform)(0),this.uResolutionParticle=(0,o.uniform)(new a.Vector2(1,1)),this.uProjParticle=(0,o.uniform)(new a.Matrix4),this.uViewParticle=(0,o.uniform)(new a.Matrix4),this.uBase=(0,o.texture)(new a.Texture),this.uEffect=(0,o.texture)(new a.Texture),this.camera=e,this.effectScene=new a.Scene,this.orthoCamera=new a.OrthographicCamera(-1,1,1,-1,0,1),this.effectRenderTarget=new a.RenderTarget(Math.max(1,this.camera.resolution.x),Math.max(1,this.camera.resolution.y),{type:t,minFilter:a.LinearFilter,magFilter:a.LinearFilter,format:a.RGBAFormat}),this.blendMaterial=this.createBlendMaterial(),this.blendQuad=new n.FullScreenQuad(this.blendMaterial)}setWords(e){return this.words=e.map(e=>{var t;return this._resolveWord(e,this.uTime+((t=e.startTime)==null?0:t)/1e3)}),this._rebuild(),this.words.map(e=>e.id)}addWord(...e){let t=e.map(e=>{var t;return this._resolveWord(e,this.uTime+((t=e.startTime)==null?0:t)/1e3)});return this.words.push(...t),this._rebuild(),t.map(e=>e.id)}hasWord(e){return this.words.some(t=>t.id===e)}removeWord(...e){let t=0;for(let n of e){let e=this.words.findIndex(e=>e.id===n);if(e===-1){console.warn(`WordPass: word "${n}" not found`);continue}this.words.splice(e,1),t++}return t>0&&this._rebuild(),t}setWord(e){var n;let{id:r}=e,i=t.__rest(e,[`id`]),a=this.words.findIndex(e=>e.id===r);if(a===-1){console.warn(`WordPass: word "${r}" not found`);return}let o=this.words[a],s=Object.assign(Object.assign(Object.assign({},o.source),i),{id:r}),c=i.startTime===void 0?o.wordStart:this.uTime+((n=i.startTime)==null?0:n)/1e3;this.words[a]=this._resolveWord(s,c),this._rebuild()}clearWords(){this.words=[],this._rebuild()}setMaxDisplayBoost(e){this.uMaxDisplayBoost.value=Math.max(e,1)}_resolveWord(e,t){let{color:n=new a.Color(s),opacity:r=1,lineWidth:o=3,hdrIntensity:c=1,writeSpeed:l=4,minStrokeDuration:u=200,strokeGap:d=120,holdDuration:f=1500,fadeDuration:p=1200,loop:m=!0,restartPause:h=800,persist:g=!1,fireworks:_=!0,fireworksColor:v,particleCount:y=400,emissionRate:b=500,sparkSpeed:x=.6,particleSize:S=.012,particleLife:C=.8,gravity:w}=e,T=e.strokes.filter(e=>e.points.length>=2),E=[],D=0,O=d/1e3;for(let e of T){let t=Math.max(e.totalLength/Math.max(l,1e-4),u/1e3);E.push({points:e.points,strokeLength:e.totalLength,writeStart:D,writeDuration:t}),D+=t+O}let k=D>0?D-O:0,A=g?1e9:k+f/1e3,j=g?1:p/1e3,M=g?0:m?A+j+h/1e3:0;return{id:e.id||i.uuid(),source:Object.assign(Object.assign({},e),{id:e.id}),blocks:E,color:n.clone(),opacity:r,lineWidth:o,hdrIntensity:Math.max(c,1),wordStart:t,fadeStart:A,fadeDuration:j,cycleLength:M,fireworks:_,sparkColor:v?v.clone():n.clone().lerp(new a.Color(16777215),.4),emissionRate:b,sparkSpeed:x,particleSize:S,particleLife:C,gravity:w?w.clone():new a.Vector3(0,-.6,0),particleCount:_?Math.max(1,Math.floor(y)):0,particleOffset:0,particleCursor:0,emitAccum:E.map(()=>0)}}_rebuild(){this._buildLineMesh(),this._buildParticles()}createLineMaterial(){let e=(0,o.varyingProperty)(`vec4`,`wpColor`),t=(0,o.varyingProperty)(`float`,`wpSegLen`),n=(0,o.varyingProperty)(`float`,`wpAccum`),r=(0,o.varyingProperty)(`float`,`wpStrokeLen`),i=(0,o.varyingProperty)(`float`,`wpDrawnLen`),s=(0,o.varyingProperty)(`float`,`wpFade`),l=(0,o.varyingProperty)(`vec2`,`wpStart`),u=(0,o.varyingProperty)(`vec2`,`wpEnd`),d=(0,o.varyingProperty)(`float`,`wpLineWidth`),f=(0,o.varyingProperty)(`float`,`wpHdrBoost`),p=(0,o.varyingProperty)(`vec2`,`wpNdc`),m=.001,h=(e,t)=>(0,o.attribute)(e,t),g=(0,o.Fn)(()=>{let a=h(`instanceStart`,`vec3`),g=h(`instanceEnd`,`vec3`),_=h(`instanceColor`,`vec4`),v=h(`instanceData`,`vec4`),y=h(`instanceReveal`,`vec2`),b=h(`instanceTime`,`vec4`),x=o.positionGeometry,S=v.x,C=v.y.mul(this.uPixelRatioLine),w=v.z,T=y.x,E=y.y,D=b.x,O=b.y,k=b.z,A=b.w;e.assign(_);let j=(0,o.length)(g.sub(a));t.assign(j),n.assign(S),r.assign(w),d.assign(C);let M=this.uTimeLine.sub(D),N=(0,o.select)(A.greaterThan(0),(0,o.mod)((0,o.max)(M,0),A),M),P=(0,o.clamp)(N.sub(T).div((0,o.max)(E,1e-4)),0,1).mul(w).toVar(),F=(0,o.float)(1).toVar();(0,o.If)(N.greaterThanEqual(O),()=>{F.assign((0,o.float)(1).sub((0,o.clamp)(N.sub(O).div((0,o.max)(k,1e-4)),0,1)))}),(0,o.If)(M.lessThan(0),()=>{F.assign(0),P.assign(0)}),s.assign(F),i.assign(P);let I=v.w,ee=(0,o.max)((0,o.log2)((0,o.max)(I,1.0001)),1e-4),te=(0,o.clamp)((0,o.log2)((0,o.max)(this.uMaxDisplayBoost,1)).div(ee),0,1);f.assign((0,o.mix)(1,I,te));let L=this.uProjLine.mul(this.uViewLine).mul((0,o.vec4)(a,1)).toVar(),R=this.uProjLine.mul(this.uViewLine).mul((0,o.vec4)(g,1)).toVar(),z=(0,o.float)(0).toVar(),B=L.w.lessThan(m).toVar(),V=R.w.lessThan(m).toVar();(0,o.If)(B.and(V),()=>{z.assign(1)}),(0,o.If)(B,()=>{let e=(0,o.float)(m).sub(L.w).div(R.w.sub(L.w));L.assign((0,o.mix)(L,R,e))}),(0,o.If)(V,()=>{let e=(0,o.float)(m).sub(R.w).div(L.w.sub(R.w));R.assign((0,o.mix)(R,L,e))});let H=L.xy.div(L.w),U=R.xy.div(R.w);l.assign(H),u.assign(U);let W=H.add(1).mul(.5).mul(this.uResolutionLine),G=U.add(1).mul(.5).mul(this.uResolutionLine),K=G.sub(W),q=(0,o.length)(K),J=(0,o.select)(q.greaterThan(1e-5),K.div((0,o.max)(q,1e-5)),(0,o.vec2)(1,0)),ne=(0,o.vec2)(J.y.negate(),J.x),Y=x.y.add(.5),X=(0,o.max)(C.mul(.5),.5).add(c),re=W.sub(J.mul(X)),ie=G.add(J.mul(X)),ae=ne.mul(x.x).mul(2).mul(X),Z=(0,o.mix)(re,ie,Y).add(ae).div(this.uResolutionLine).mul(2).sub(1);p.assign(Z);let Q=(0,o.mix)(L,R,Y),$=(0,o.max)(Q.w,m);return(0,o.mix)((0,o.vec4)(Z.mul($),Q.z,$),(0,o.vec4)(0,0,-2,1),z)}),_=(0,o.Fn)(([e,t,n])=>{let r=e.sub(t),i=n.sub(t),a=(0,o.clamp)((0,o.dot)(r,i).div((0,o.dot)(i,i)),0,1);return(0,o.length)(r.sub(i.mul(a)))}),v=(0,o.Fn)(()=>{let a=p,m=u.sub(l),h=(0,o.max)((0,o.length)(m),1e-6),g=m.div(h),v=(0,o.clamp)((0,o.dot)(a.sub(l),g),0,h).div(h),y=n.add(v.mul(t)),b=i.lessThanEqual(1e-4).or(y.greaterThan(i)),x=(0,o.vec2)(this.uResolutionLine.x.div(this.uResolutionLine.y),1),S=_(a.mul(x),l.mul(x),u.mul(x)).mul(this.uResolutionLine.y).mul(.5),C=(0,o.max)(d.mul(.5),.5),w=(0,o.float)(1).sub((0,o.smoothstep)(C.sub(1),C.add(1),S)),T=C.add(c),E=(0,o.clamp)((0,o.max)(S.sub(C),0).div((0,o.max)(T.sub(C),1e-4)),0,1),D=(0,o.pow)((0,o.float)(1).sub(E),4).mul(.9),O=(0,o.clamp)(w.add(D.mul((0,o.float)(1).sub(w))),0,1),k=(0,o.exp)((0,o.max)(i.sub(y),0).mul(-5).div((0,o.max)(r,1e-4))),A=(0,o.float)(1).sub((0,o.smoothstep)(r.mul(.98),r,i)),j=(0,o.float)(1).add(k.mul(.6).mul(A)),M=O.mul(e.a).mul(s),N=(0,o.select)(b.not().and(M.greaterThanEqual(.004)),M,0);return(0,o.vec4)(e.rgb.mul(j).mul(f).mul(N),N)}),y=new a.NodeMaterial;return y.vertexNode=g(),y.fragmentNode=v(),y.transparent=!0,y.depthTest=!1,y.depthWrite=!1,y.side=a.DoubleSide,y.blending=a.CustomBlending,y.blendEquation=a.MaxEquation,y.blendSrc=a.OneFactor,y.blendDst=a.OneFactor,y}_buildLineMesh(){this._disposeLineMesh();let e=0;for(let t of this.words)for(let n of t.blocks)e+=n.points.length-1;if(e===0)return;let t=new a.PlaneGeometry(1,1,1,1),n=new a.InstancedBufferGeometry;n.index=t.index,n.attributes=t.attributes,n.instanceCount=e;let r=new Float32Array(e*3),i=new Float32Array(e*3),o=new Float32Array(e*4),s=new Float32Array(e*4),c=new Float32Array(e*2),l=new Float32Array(e*4),u=0;for(let e of this.words)for(let t of e.blocks){let n=0;for(let a=0;a<t.points.length-1;a++){let d=t.points[a],f=t.points[a+1],p=d.distanceTo(f),m=u*2,h=u*3,g=u*4;r[h+0]=d.x,r[h+1]=d.y,r[h+2]=d.z,i[h+0]=f.x,i[h+1]=f.y,i[h+2]=f.z,o[g+0]=e.color.r,o[g+1]=e.color.g,o[g+2]=e.color.b,o[g+3]=e.opacity,s[g+0]=n,s[g+1]=e.lineWidth,s[g+2]=t.strokeLength,s[g+3]=e.hdrIntensity,c[m+0]=t.writeStart,c[m+1]=t.writeDuration,l[g+0]=e.wordStart,l[g+1]=e.fadeStart,l[g+2]=e.fadeDuration,l[g+3]=e.cycleLength,n+=p,u++}}n.setAttribute(`instanceStart`,new a.InstancedBufferAttribute(r,3)),n.setAttribute(`instanceEnd`,new a.InstancedBufferAttribute(i,3)),n.setAttribute(`instanceColor`,new a.InstancedBufferAttribute(o,4)),n.setAttribute(`instanceData`,new a.InstancedBufferAttribute(s,4)),n.setAttribute(`instanceReveal`,new a.InstancedBufferAttribute(c,2)),n.setAttribute(`instanceTime`,new a.InstancedBufferAttribute(l,4)),this.lineMaterial=this.createLineMaterial(),this.lineMesh=new a.Mesh(n,this.lineMaterial),this.lineMesh.frustumCulled=!1,this.effectScene.add(this.lineMesh)}createParticleMaterial(){let e=(0,o.varyingProperty)(`vec4`,`wpSparkColor`),t=(0,o.varyingProperty)(`float`,`wpSparkAlpha`),n=(0,o.varyingProperty)(`vec2`,`wpSparkLocal`),r=.001,i=(e,t)=>(0,o.attribute)(e,t),s=(0,o.Fn)(()=>{let a=i(`aPosition`,`vec3`),s=i(`aVelocity`,`vec3`),c=i(`aAccel`,`vec3`),l=i(`aColor`,`vec4`),u=i(`aParams`,`vec4`),d=u.x,f=u.y,p=u.z,m=u.w,h=o.positionGeometry.xy;e.assign(l),n.assign(h);let g=this.uTimeParticle.sub(d),_=(0,o.float)(0).toVar();(0,o.If)(f.lessThanEqual(0).or(g.lessThan(0)).or(g.greaterThan(f)),()=>{_.assign(1)});let v=g.div((0,o.max)(f,r)),y=a.add(s.mul(g)).add(c.mul(.5).mul(g).mul(g)),b=this.uProjParticle.mul(this.uViewParticle).mul((0,o.vec4)(y,1)).toVar();(0,o.If)(b.w.lessThanEqual(r),()=>{_.assign(1)});let x=(0,o.max)(b.w,r),S=b.xy.div(x),C=this.uProjParticle.element(1).y,w=(0,o.float)(1).sub(v.mul(.7)),T=(0,o.max)(m.mul(C).mul(.5).mul(this.uResolutionParticle.y).div(x).mul(w),0),E=S.add(1).mul(.5).mul(this.uResolutionParticle).add(h.mul(T)).div(this.uResolutionParticle).mul(2).sub(1),D=(0,o.float)(.7).add((0,o.float)(.3).mul((0,o.sin)(this.uTimeParticle.mul(30).add(p.mul(6.2831)))));return t.assign((0,o.pow)((0,o.float)(1).sub(v),.8).mul(D)),(0,o.mix)((0,o.vec4)(E.mul(x),b.z,x),(0,o.vec4)(0,0,-2,1),_)}),c=(0,o.Fn)(()=>{let r=(0,o.smoothstep)(.5,0,(0,o.length)(n)),i=r.mul(r).mul(t).mul(e.a);return(0,o.vec4)(e.rgb,i)}),l=new a.NodeMaterial;return l.vertexNode=s(),l.fragmentNode=c(),l.transparent=!0,l.depthTest=!1,l.depthWrite=!1,l.blending=a.AdditiveBlending,l}createBlendMaterial(){let e=new a.NodeMaterial,t=this.uBase.sample((0,o.uv)()),n=this.uEffect.sample((0,o.uv)());return e.fragmentNode=(0,o.vec4)(t.rgb.add(n.rgb),t.a),e.transparent=!1,e.depthTest=!1,e.depthWrite=!1,e}_buildParticles(){this._disposeParticles();let e=0;for(let t of this.words)t.particleOffset=e,t.particleCursor=0,e+=t.particleCount;if(e===0)return;this.arrPosition=new Float32Array(e*3),this.arrVelocity=new Float32Array(e*3),this.arrAccel=new Float32Array(e*3),this.arrColor=new Float32Array(e*4),this.arrParams=new Float32Array(e*4);let t=new a.PlaneGeometry(1,1,1,1),n=new a.InstancedBufferGeometry;n.index=t.index,n.attributes=t.attributes,n.instanceCount=e,n.setAttribute(`aPosition`,new a.InstancedBufferAttribute(this.arrPosition,3)),n.setAttribute(`aVelocity`,new a.InstancedBufferAttribute(this.arrVelocity,3)),n.setAttribute(`aAccel`,new a.InstancedBufferAttribute(this.arrAccel,3)),n.setAttribute(`aColor`,new a.InstancedBufferAttribute(this.arrColor,4)),n.setAttribute(`aParams`,new a.InstancedBufferAttribute(this.arrParams,4)),this.particleGeometry=n,this.particleMaterial=this.createParticleMaterial(),this.points=new a.Mesh(n,this.particleMaterial),this.points.frustumCulled=!1,this.effectScene.add(this.points)}_samplePointAtLength(e,t,n){if(e.length===1||t<=0){n.copy(e[0]);return}let r=0;for(let i=0;i<e.length-1;i++){let a=e[i],o=e[i+1],s=a.distanceTo(o);if(!(s<=1e-9)){if(r+s>=t){n.lerpVectors(a,o,(t-r)/s);return}r+=s}}n.copy(e[e.length-1])}_emitParticle(e,t){if(!this.arrPosition)return;let n=e.particleOffset+e.particleCursor;e.particleCursor=(e.particleCursor+1)%e.particleCount;let r=n*3,i=n*4,a=Math.random()*Math.PI*2,o=Math.random(),s=Math.cos(a)*o,c=Math.sin(a)*o,l=.3+Math.random()*.7,u=e.sparkSpeed*(.4+Math.random()*.8);this.arrPosition[r+0]=t.x,this.arrPosition[r+1]=t.y,this.arrPosition[r+2]=t.z,this.arrVelocity[r+0]=s*u,this.arrVelocity[r+1]=l*u,this.arrVelocity[r+2]=c*u,this.arrAccel[r+0]=e.gravity.x,this.arrAccel[r+1]=e.gravity.y,this.arrAccel[r+2]=e.gravity.z;let d=.8+Math.random()*.5;this.arrColor[i+0]=e.sparkColor.r*d,this.arrColor[i+1]=e.sparkColor.g*d,this.arrColor[i+2]=e.sparkColor.b*d,this.arrColor[i+3]=1,this.arrParams[i+0]=this.uTime,this.arrParams[i+1]=e.particleLife*(.6+Math.random()*.8),this.arrParams[i+2]=Math.random(),this.arrParams[i+3]=e.particleSize*(.6+Math.random()*.9)}_emit(e){if(!this.particleGeometry)return;let t=!1;for(let n of this.words){if(!n.fireworks||n.particleCount===0)continue;let r=this.uTime-n.wordStart;if(r<0)continue;let i=n.cycleLength>0?r%n.cycleLength:r;for(let r=0;r<n.blocks.length;r++){let a=n.blocks[r],o=i-a.writeStart;if(o<0||o>a.writeDuration)continue;let s=o/a.writeDuration;this._samplePointAtLength(a.points,s*a.strokeLength,this._tmpTip),n.emitAccum[r]+=n.emissionRate*e;let c=Math.floor(n.emitAccum[r]);n.emitAccum[r]-=c,c=Math.min(c,n.particleCount);for(let e=0;e<c;e++)this._emitParticle(n,this._tmpTip),t=!0}}if(t){let e=this.particleGeometry;e.getAttribute(`aPosition`).needsUpdate=!0,e.getAttribute(`aVelocity`).needsUpdate=!0,e.getAttribute(`aAccel`).needsUpdate=!0,e.getAttribute(`aColor`).needsUpdate=!0,e.getAttribute(`aParams`).needsUpdate=!0}}render(e,t,n,r,i){let a=!!(this.lineMesh||this.points);a&&(this.uTime+=r==null?0:r,this._emit(r==null?0:r));let o=n.width,s=n.height;(this.effectRenderTarget.width!==o||this.effectRenderTarget.height!==s)&&this.effectRenderTarget.setSize(o,s);let c=e.getRenderTarget();if(e.setRenderTarget(this.effectRenderTarget),e.setClearColor(0,0),e.clear(),a){let t=this.camera.projectionMatrix,n=this.camera.matrixWorldInverse;this.lineMaterial&&(this.uTimeLine.value=this.uTime,this.uResolutionLine.value.set(o,s),this.uProjLine.value=t,this.uViewLine.value=n,this.uPixelRatioLine.value=this.camera.pixelRatio),this.particleMaterial&&(this.uTimeParticle.value=this.uTime,this.uResolutionParticle.value.set(o,s),this.uProjParticle.value=t,this.uViewParticle.value=n),e.render(this.effectScene,this.orthoCamera)}e.setRenderTarget(c),this.uBase.value=n.texture,this.uEffect.value=this.effectRenderTarget.texture,e.setRenderTarget(this.renderToScreen?null:t),this.blendQuad.render(e)}_disposeLineMesh(){this.lineMesh&&(this.effectScene.remove(this.lineMesh),this.lineMesh.geometry.dispose(),this.lineMesh=null),this.lineMaterial&&(this.lineMaterial.dispose(),this.lineMaterial=null)}_disposeParticles(){this.points&&(this.effectScene.remove(this.points),this.points=null),this.particleGeometry&&(this.particleGeometry.dispose(),this.particleGeometry=null),this.particleMaterial&&(this.particleMaterial.dispose(),this.particleMaterial=null),this.arrPosition=null,this.arrVelocity=null,this.arrAccel=null,this.arrColor=null,this.arrParams=null}dispose(){this._disposeLineMesh(),this._disposeParticles(),this.effectRenderTarget.dispose(),this.blendMaterial.dispose(),this.blendQuad.dispose()}};exports.WordPass=l;
255
+ */const e=require("../../_virtual/_rolldown/runtime.js"),t=require("../../five/renderer/tools/full-screen-quad.js"),n=require("../../five/renderer/postprocessing/passes/pass.js"),r=require("../../five/utils/uuid.js");let i=require("tslib"),a=require("three/webgpu");a=e.__toESM(a,1);let o=require("three/tsl");var s=16767392,c=3,l=class extends n.FivePass{constructor(e,n=a.UnsignedByteType){super(),this.uTime=0,this.words=[],this.lineMesh=null,this.lineMaterial=null,this.points=null,this.particleMaterial=null,this.particleGeometry=null,this.arrPosition=null,this.arrVelocity=null,this.arrAccel=null,this.arrColor=null,this.arrParams=null,this._tmpTip=new a.Vector3,this.uTimeLine=(0,o.uniform)(0),this.uResolutionLine=(0,o.uniform)(new a.Vector2(1,1)),this.uProjLine=(0,o.uniform)(new a.Matrix4),this.uViewLine=(0,o.uniform)(new a.Matrix4),this.uPixelRatioLine=(0,o.uniform)(1),this.uMaxDisplayBoost=(0,o.uniform)(1),this.uTimeParticle=(0,o.uniform)(0),this.uResolutionParticle=(0,o.uniform)(new a.Vector2(1,1)),this.uProjParticle=(0,o.uniform)(new a.Matrix4),this.uViewParticle=(0,o.uniform)(new a.Matrix4),this.uBase=(0,o.texture)(new a.Texture),this.uEffect=(0,o.texture)(new a.Texture),this.camera=e,this.effectScene=new a.Scene,this.orthoCamera=new a.OrthographicCamera(-1,1,1,-1,0,1),this.effectRenderTarget=new a.RenderTarget(Math.max(1,this.camera.resolution.x),Math.max(1,this.camera.resolution.y),{type:n,minFilter:a.LinearFilter,magFilter:a.LinearFilter,format:a.RGBAFormat}),this.blendMaterial=this.createBlendMaterial(),this.blendQuad=new t.FullScreenQuad(this.blendMaterial)}setWords(e){return this.words=e.map(e=>{var t;return this._resolveWord(e,this.uTime+((t=e.startTime)==null?0:t)/1e3)}),this._rebuild(),this.words.map(e=>e.id)}addWord(...e){let t=e.map(e=>{var t;return this._resolveWord(e,this.uTime+((t=e.startTime)==null?0:t)/1e3)});return this.words.push(...t),this._rebuild(),t.map(e=>e.id)}hasWord(e){return this.words.some(t=>t.id===e)}removeWord(...e){let t=0;for(let n of e){let e=this.words.findIndex(e=>e.id===n);if(e===-1){console.warn(`WordPass: word "${n}" not found`);continue}this.words.splice(e,1),t++}return t>0&&this._rebuild(),t}setWord(e){var t;let{id:n}=e,r=(0,i.__rest)(e,[`id`]),a=this.words.findIndex(e=>e.id===n);if(a===-1){console.warn(`WordPass: word "${n}" not found`);return}let o=this.words[a],s=Object.assign(Object.assign(Object.assign({},o.source),r),{id:n}),c=r.startTime===void 0?o.wordStart:this.uTime+((t=r.startTime)==null?0:t)/1e3;this.words[a]=this._resolveWord(s,c),this._rebuild()}clearWords(){this.words=[],this._rebuild()}setMaxDisplayBoost(e){this.uMaxDisplayBoost.value=Math.max(e,1)}_resolveWord(e,t){let{color:n=new a.Color(s),opacity:i=1,lineWidth:o=3,hdrIntensity:c=1,writeSpeed:l=4,minStrokeDuration:u=200,strokeGap:d=120,holdDuration:f=1500,fadeDuration:p=1200,loop:m=!0,restartPause:h=800,persist:g=!1,fireworks:_=!0,fireworksColor:v,particleCount:y=400,emissionRate:b=500,sparkSpeed:x=.6,particleSize:S=.012,particleLife:C=.8,gravity:w}=e,T=e.strokes.filter(e=>e.points.length>=2),E=[],D=0,O=d/1e3;for(let e of T){let t=Math.max(e.totalLength/Math.max(l,1e-4),u/1e3);E.push({points:e.points,strokeLength:e.totalLength,writeStart:D,writeDuration:t}),D+=t+O}let k=D>0?D-O:0,A=g?1e9:k+f/1e3,j=g?1:p/1e3,M=g?0:m?A+j+h/1e3:0;return{id:e.id||r.uuid(),source:Object.assign(Object.assign({},e),{id:e.id}),blocks:E,color:n.clone(),opacity:i,lineWidth:o,hdrIntensity:Math.max(c,1),wordStart:t,fadeStart:A,fadeDuration:j,cycleLength:M,fireworks:_,sparkColor:v?v.clone():n.clone().lerp(new a.Color(16777215),.4),emissionRate:b,sparkSpeed:x,particleSize:S,particleLife:C,gravity:w?w.clone():new a.Vector3(0,-.6,0),particleCount:_?Math.max(1,Math.floor(y)):0,particleOffset:0,particleCursor:0,emitAccum:E.map(()=>0)}}_rebuild(){this._buildLineMesh(),this._buildParticles()}createLineMaterial(){let e=(0,o.varyingProperty)(`vec4`,`wpColor`),t=(0,o.varyingProperty)(`float`,`wpSegLen`),n=(0,o.varyingProperty)(`float`,`wpAccum`),r=(0,o.varyingProperty)(`float`,`wpStrokeLen`),i=(0,o.varyingProperty)(`float`,`wpDrawnLen`),s=(0,o.varyingProperty)(`float`,`wpFade`),l=(0,o.varyingProperty)(`vec2`,`wpStart`),u=(0,o.varyingProperty)(`vec2`,`wpEnd`),d=(0,o.varyingProperty)(`float`,`wpLineWidth`),f=(0,o.varyingProperty)(`float`,`wpHdrBoost`),p=(0,o.varyingProperty)(`vec2`,`wpNdc`),m=.001,h=(e,t)=>(0,o.attribute)(e,t),g=(0,o.Fn)(()=>{let a=h(`instanceStart`,`vec3`),g=h(`instanceEnd`,`vec3`),_=h(`instanceColor`,`vec4`),v=h(`instanceData`,`vec4`),y=h(`instanceReveal`,`vec2`),b=h(`instanceTime`,`vec4`),x=o.positionGeometry,S=v.x,C=v.y.mul(this.uPixelRatioLine),w=v.z,T=y.x,E=y.y,D=b.x,O=b.y,k=b.z,A=b.w;e.assign(_);let j=(0,o.length)(g.sub(a));t.assign(j),n.assign(S),r.assign(w),d.assign(C);let M=this.uTimeLine.sub(D),N=(0,o.select)(A.greaterThan(0),(0,o.mod)((0,o.max)(M,0),A),M),P=(0,o.clamp)(N.sub(T).div((0,o.max)(E,1e-4)),0,1).mul(w).toVar(),F=(0,o.float)(1).toVar();(0,o.If)(N.greaterThanEqual(O),()=>{F.assign((0,o.float)(1).sub((0,o.clamp)(N.sub(O).div((0,o.max)(k,1e-4)),0,1)))}),(0,o.If)(M.lessThan(0),()=>{F.assign(0),P.assign(0)}),s.assign(F),i.assign(P);let I=v.w,ee=(0,o.max)((0,o.log2)((0,o.max)(I,1.0001)),1e-4),te=(0,o.clamp)((0,o.log2)((0,o.max)(this.uMaxDisplayBoost,1)).div(ee),0,1);f.assign((0,o.mix)(1,I,te));let L=this.uProjLine.mul(this.uViewLine).mul((0,o.vec4)(a,1)).toVar(),R=this.uProjLine.mul(this.uViewLine).mul((0,o.vec4)(g,1)).toVar(),z=(0,o.float)(0).toVar(),B=L.w.lessThan(m).toVar(),V=R.w.lessThan(m).toVar();(0,o.If)(B.and(V),()=>{z.assign(1)}),(0,o.If)(B,()=>{let e=(0,o.float)(m).sub(L.w).div(R.w.sub(L.w));L.assign((0,o.mix)(L,R,e))}),(0,o.If)(V,()=>{let e=(0,o.float)(m).sub(R.w).div(L.w.sub(R.w));R.assign((0,o.mix)(R,L,e))});let H=L.xy.div(L.w),U=R.xy.div(R.w);l.assign(H),u.assign(U);let W=H.add(1).mul(.5).mul(this.uResolutionLine),G=U.add(1).mul(.5).mul(this.uResolutionLine),K=G.sub(W),q=(0,o.length)(K),J=(0,o.select)(q.greaterThan(1e-5),K.div((0,o.max)(q,1e-5)),(0,o.vec2)(1,0)),ne=(0,o.vec2)(J.y.negate(),J.x),Y=x.y.add(.5),X=(0,o.max)(C.mul(.5),.5).add(c),re=W.sub(J.mul(X)),ie=G.add(J.mul(X)),ae=ne.mul(x.x).mul(2).mul(X),Z=(0,o.mix)(re,ie,Y).add(ae).div(this.uResolutionLine).mul(2).sub(1);p.assign(Z);let Q=(0,o.mix)(L,R,Y),$=(0,o.max)(Q.w,m);return(0,o.mix)((0,o.vec4)(Z.mul($),Q.z,$),(0,o.vec4)(0,0,-2,1),z)}),_=(0,o.Fn)(([e,t,n])=>{let r=e.sub(t),i=n.sub(t),a=(0,o.clamp)((0,o.dot)(r,i).div((0,o.dot)(i,i)),0,1);return(0,o.length)(r.sub(i.mul(a)))}),v=(0,o.Fn)(()=>{let a=p,m=u.sub(l),h=(0,o.max)((0,o.length)(m),1e-6),g=m.div(h),v=(0,o.clamp)((0,o.dot)(a.sub(l),g),0,h).div(h),y=n.add(v.mul(t)),b=i.lessThanEqual(1e-4).or(y.greaterThan(i)),x=(0,o.vec2)(this.uResolutionLine.x.div(this.uResolutionLine.y),1),S=_(a.mul(x),l.mul(x),u.mul(x)).mul(this.uResolutionLine.y).mul(.5),C=(0,o.max)(d.mul(.5),.5),w=(0,o.float)(1).sub((0,o.smoothstep)(C.sub(1),C.add(1),S)),T=C.add(c),E=(0,o.clamp)((0,o.max)(S.sub(C),0).div((0,o.max)(T.sub(C),1e-4)),0,1),D=(0,o.pow)((0,o.float)(1).sub(E),4).mul(.9),O=(0,o.clamp)(w.add(D.mul((0,o.float)(1).sub(w))),0,1),k=(0,o.exp)((0,o.max)(i.sub(y),0).mul(-5).div((0,o.max)(r,1e-4))),A=(0,o.float)(1).sub((0,o.smoothstep)(r.mul(.98),r,i)),j=(0,o.float)(1).add(k.mul(.6).mul(A)),M=O.mul(e.a).mul(s),N=(0,o.select)(b.not().and(M.greaterThanEqual(.004)),M,0);return(0,o.vec4)(e.rgb.mul(j).mul(f).mul(N),N)}),y=new a.NodeMaterial;return y.vertexNode=g(),y.fragmentNode=v(),y.transparent=!0,y.depthTest=!1,y.depthWrite=!1,y.side=a.DoubleSide,y.blending=a.CustomBlending,y.blendEquation=a.MaxEquation,y.blendSrc=a.OneFactor,y.blendDst=a.OneFactor,y}_buildLineMesh(){this._disposeLineMesh();let e=0;for(let t of this.words)for(let n of t.blocks)e+=n.points.length-1;if(e===0)return;let t=new a.PlaneGeometry(1,1,1,1),n=new a.InstancedBufferGeometry;n.index=t.index,n.attributes=t.attributes,n.instanceCount=e;let r=new Float32Array(e*3),i=new Float32Array(e*3),o=new Float32Array(e*4),s=new Float32Array(e*4),c=new Float32Array(e*2),l=new Float32Array(e*4),u=0;for(let e of this.words)for(let t of e.blocks){let n=0;for(let a=0;a<t.points.length-1;a++){let d=t.points[a],f=t.points[a+1],p=d.distanceTo(f),m=u*2,h=u*3,g=u*4;r[h+0]=d.x,r[h+1]=d.y,r[h+2]=d.z,i[h+0]=f.x,i[h+1]=f.y,i[h+2]=f.z,o[g+0]=e.color.r,o[g+1]=e.color.g,o[g+2]=e.color.b,o[g+3]=e.opacity,s[g+0]=n,s[g+1]=e.lineWidth,s[g+2]=t.strokeLength,s[g+3]=e.hdrIntensity,c[m+0]=t.writeStart,c[m+1]=t.writeDuration,l[g+0]=e.wordStart,l[g+1]=e.fadeStart,l[g+2]=e.fadeDuration,l[g+3]=e.cycleLength,n+=p,u++}}n.setAttribute(`instanceStart`,new a.InstancedBufferAttribute(r,3)),n.setAttribute(`instanceEnd`,new a.InstancedBufferAttribute(i,3)),n.setAttribute(`instanceColor`,new a.InstancedBufferAttribute(o,4)),n.setAttribute(`instanceData`,new a.InstancedBufferAttribute(s,4)),n.setAttribute(`instanceReveal`,new a.InstancedBufferAttribute(c,2)),n.setAttribute(`instanceTime`,new a.InstancedBufferAttribute(l,4)),this.lineMaterial=this.createLineMaterial(),this.lineMesh=new a.Mesh(n,this.lineMaterial),this.lineMesh.frustumCulled=!1,this.effectScene.add(this.lineMesh)}createParticleMaterial(){let e=(0,o.varyingProperty)(`vec4`,`wpSparkColor`),t=(0,o.varyingProperty)(`float`,`wpSparkAlpha`),n=(0,o.varyingProperty)(`vec2`,`wpSparkLocal`),r=.001,i=(e,t)=>(0,o.attribute)(e,t),s=(0,o.Fn)(()=>{let a=i(`aPosition`,`vec3`),s=i(`aVelocity`,`vec3`),c=i(`aAccel`,`vec3`),l=i(`aColor`,`vec4`),u=i(`aParams`,`vec4`),d=u.x,f=u.y,p=u.z,m=u.w,h=o.positionGeometry.xy;e.assign(l),n.assign(h);let g=this.uTimeParticle.sub(d),_=(0,o.float)(0).toVar();(0,o.If)(f.lessThanEqual(0).or(g.lessThan(0)).or(g.greaterThan(f)),()=>{_.assign(1)});let v=g.div((0,o.max)(f,r)),y=a.add(s.mul(g)).add(c.mul(.5).mul(g).mul(g)),b=this.uProjParticle.mul(this.uViewParticle).mul((0,o.vec4)(y,1)).toVar();(0,o.If)(b.w.lessThanEqual(r),()=>{_.assign(1)});let x=(0,o.max)(b.w,r),S=b.xy.div(x),C=this.uProjParticle.element(1).y,w=(0,o.float)(1).sub(v.mul(.7)),T=(0,o.max)(m.mul(C).mul(.5).mul(this.uResolutionParticle.y).div(x).mul(w),0),E=S.add(1).mul(.5).mul(this.uResolutionParticle).add(h.mul(T)).div(this.uResolutionParticle).mul(2).sub(1),D=(0,o.float)(.7).add((0,o.float)(.3).mul((0,o.sin)(this.uTimeParticle.mul(30).add(p.mul(6.2831)))));return t.assign((0,o.pow)((0,o.float)(1).sub(v),.8).mul(D)),(0,o.mix)((0,o.vec4)(E.mul(x),b.z,x),(0,o.vec4)(0,0,-2,1),_)}),c=(0,o.Fn)(()=>{let r=(0,o.smoothstep)(.5,0,(0,o.length)(n)),i=r.mul(r).mul(t).mul(e.a);return(0,o.vec4)(e.rgb,i)}),l=new a.NodeMaterial;return l.vertexNode=s(),l.fragmentNode=c(),l.transparent=!0,l.depthTest=!1,l.depthWrite=!1,l.blending=a.AdditiveBlending,l}createBlendMaterial(){let e=new a.NodeMaterial,t=this.uBase.sample((0,o.uv)()),n=this.uEffect.sample((0,o.uv)());return e.fragmentNode=(0,o.vec4)(t.rgb.add(n.rgb),t.a),e.transparent=!1,e.depthTest=!1,e.depthWrite=!1,e}_buildParticles(){this._disposeParticles();let e=0;for(let t of this.words)t.particleOffset=e,t.particleCursor=0,e+=t.particleCount;if(e===0)return;this.arrPosition=new Float32Array(e*3),this.arrVelocity=new Float32Array(e*3),this.arrAccel=new Float32Array(e*3),this.arrColor=new Float32Array(e*4),this.arrParams=new Float32Array(e*4);let t=new a.PlaneGeometry(1,1,1,1),n=new a.InstancedBufferGeometry;n.index=t.index,n.attributes=t.attributes,n.instanceCount=e,n.setAttribute(`aPosition`,new a.InstancedBufferAttribute(this.arrPosition,3)),n.setAttribute(`aVelocity`,new a.InstancedBufferAttribute(this.arrVelocity,3)),n.setAttribute(`aAccel`,new a.InstancedBufferAttribute(this.arrAccel,3)),n.setAttribute(`aColor`,new a.InstancedBufferAttribute(this.arrColor,4)),n.setAttribute(`aParams`,new a.InstancedBufferAttribute(this.arrParams,4)),this.particleGeometry=n,this.particleMaterial=this.createParticleMaterial(),this.points=new a.Mesh(n,this.particleMaterial),this.points.frustumCulled=!1,this.effectScene.add(this.points)}_samplePointAtLength(e,t,n){if(e.length===1||t<=0){n.copy(e[0]);return}let r=0;for(let i=0;i<e.length-1;i++){let a=e[i],o=e[i+1],s=a.distanceTo(o);if(!(s<=1e-9)){if(r+s>=t){n.lerpVectors(a,o,(t-r)/s);return}r+=s}}n.copy(e[e.length-1])}_emitParticle(e,t){if(!this.arrPosition)return;let n=e.particleOffset+e.particleCursor;e.particleCursor=(e.particleCursor+1)%e.particleCount;let r=n*3,i=n*4,a=Math.random()*Math.PI*2,o=Math.random(),s=Math.cos(a)*o,c=Math.sin(a)*o,l=.3+Math.random()*.7,u=e.sparkSpeed*(.4+Math.random()*.8);this.arrPosition[r+0]=t.x,this.arrPosition[r+1]=t.y,this.arrPosition[r+2]=t.z,this.arrVelocity[r+0]=s*u,this.arrVelocity[r+1]=l*u,this.arrVelocity[r+2]=c*u,this.arrAccel[r+0]=e.gravity.x,this.arrAccel[r+1]=e.gravity.y,this.arrAccel[r+2]=e.gravity.z;let d=.8+Math.random()*.5;this.arrColor[i+0]=e.sparkColor.r*d,this.arrColor[i+1]=e.sparkColor.g*d,this.arrColor[i+2]=e.sparkColor.b*d,this.arrColor[i+3]=1,this.arrParams[i+0]=this.uTime,this.arrParams[i+1]=e.particleLife*(.6+Math.random()*.8),this.arrParams[i+2]=Math.random(),this.arrParams[i+3]=e.particleSize*(.6+Math.random()*.9)}_emit(e){if(!this.particleGeometry)return;let t=!1;for(let n of this.words){if(!n.fireworks||n.particleCount===0)continue;let r=this.uTime-n.wordStart;if(r<0)continue;let i=n.cycleLength>0?r%n.cycleLength:r;for(let r=0;r<n.blocks.length;r++){let a=n.blocks[r],o=i-a.writeStart;if(o<0||o>a.writeDuration)continue;let s=o/a.writeDuration;this._samplePointAtLength(a.points,s*a.strokeLength,this._tmpTip),n.emitAccum[r]+=n.emissionRate*e;let c=Math.floor(n.emitAccum[r]);n.emitAccum[r]-=c,c=Math.min(c,n.particleCount);for(let e=0;e<c;e++)this._emitParticle(n,this._tmpTip),t=!0}}if(t){let e=this.particleGeometry;e.getAttribute(`aPosition`).needsUpdate=!0,e.getAttribute(`aVelocity`).needsUpdate=!0,e.getAttribute(`aAccel`).needsUpdate=!0,e.getAttribute(`aColor`).needsUpdate=!0,e.getAttribute(`aParams`).needsUpdate=!0}}render(e,t,n,r,i){let a=!!(this.lineMesh||this.points);a&&(this.uTime+=r==null?0:r,this._emit(r==null?0:r));let o=n.width,s=n.height;(this.effectRenderTarget.width!==o||this.effectRenderTarget.height!==s)&&this.effectRenderTarget.setSize(o,s);let c=e.getRenderTarget();if(e.setRenderTarget(this.effectRenderTarget),e.setClearColor(0,0),e.clear(),a){let t=this.camera.projectionMatrix,n=this.camera.matrixWorldInverse;this.lineMaterial&&(this.uTimeLine.value=this.uTime,this.uResolutionLine.value.set(o,s),this.uProjLine.value=t,this.uViewLine.value=n,this.uPixelRatioLine.value=this.camera.pixelRatio),this.particleMaterial&&(this.uTimeParticle.value=this.uTime,this.uResolutionParticle.value.set(o,s),this.uProjParticle.value=t,this.uViewParticle.value=n),e.render(this.effectScene,this.orthoCamera)}e.setRenderTarget(c),this.uBase.value=n.texture,this.uEffect.value=this.effectRenderTarget.texture,e.setRenderTarget(this.renderToScreen?null:t),this.blendQuad.render(e)}_disposeLineMesh(){this.lineMesh&&(this.effectScene.remove(this.lineMesh),this.lineMesh.geometry.dispose(),this.lineMesh=null),this.lineMaterial&&(this.lineMaterial.dispose(),this.lineMaterial=null)}_disposeParticles(){this.points&&(this.effectScene.remove(this.points),this.points=null),this.particleGeometry&&(this.particleGeometry.dispose(),this.particleGeometry=null),this.particleMaterial&&(this.particleMaterial.dispose(),this.particleMaterial=null),this.arrPosition=null,this.arrVelocity=null,this.arrAccel=null,this.arrColor=null,this.arrParams=null}dispose(){this._disposeLineMesh(),this._disposeParticles(),this.effectRenderTarget.dispose(),this.blendMaterial.dispose(),this.blendQuad.dispose()}};exports.WordPass=l;
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * @license
3
3
  * @realsee/five-webgpu
4
- * Generated: 10/26/2026
5
- * Version: 1.0.0-alpha.10
4
+ * Generated: 10/27/2026
5
+ * Version: 1.0.0-alpha.11
6
6
  * Terms:
7
7
  * Realsee SDK License Agreement
8
8
  * Update: July 28, 2021
@@ -252,4 +252,4 @@
252
252
  * No amendment to or modification of this Agreement will be binding unless in
253
253
  * writing and signed by Realsee. You and Realsee hereto confirm that this
254
254
  * Agreement and all related documents shall be drafted in English.
255
- */import{__rest as e}from"../../node_modules/tslib/tslib.es6.mjs";import{FullScreenQuad as t}from"../../five/renderer/tools/full-screen-quad.mjs";import{FivePass as n}from"../../five/renderer/postprocessing/passes/pass.mjs";import{uuid as r}from"../../five/utils/uuid.mjs";import*as i from"three/webgpu";import{Fn as a,If as o,attribute as s,clamp as c,dot as l,exp as u,float as d,length as f,log2 as p,max as m,mix as h,mod as g,positionGeometry as _,pow as v,select as y,sin as b,smoothstep as x,texture as S,uniform as C,uv as w,varyingProperty as T,vec2 as E,vec4 as D}from"three/tsl";var O=16767392,k=3,A=class extends n{constructor(e,n=i.UnsignedByteType){super(),this.uTime=0,this.words=[],this.lineMesh=null,this.lineMaterial=null,this.points=null,this.particleMaterial=null,this.particleGeometry=null,this.arrPosition=null,this.arrVelocity=null,this.arrAccel=null,this.arrColor=null,this.arrParams=null,this._tmpTip=new i.Vector3,this.uTimeLine=C(0),this.uResolutionLine=C(new i.Vector2(1,1)),this.uProjLine=C(new i.Matrix4),this.uViewLine=C(new i.Matrix4),this.uPixelRatioLine=C(1),this.uMaxDisplayBoost=C(1),this.uTimeParticle=C(0),this.uResolutionParticle=C(new i.Vector2(1,1)),this.uProjParticle=C(new i.Matrix4),this.uViewParticle=C(new i.Matrix4),this.uBase=S(new i.Texture),this.uEffect=S(new i.Texture),this.camera=e,this.effectScene=new i.Scene,this.orthoCamera=new i.OrthographicCamera(-1,1,1,-1,0,1),this.effectRenderTarget=new i.RenderTarget(Math.max(1,this.camera.resolution.x),Math.max(1,this.camera.resolution.y),{type:n,minFilter:i.LinearFilter,magFilter:i.LinearFilter,format:i.RGBAFormat}),this.blendMaterial=this.createBlendMaterial(),this.blendQuad=new t(this.blendMaterial)}setWords(e){return this.words=e.map(e=>{var t;return this._resolveWord(e,this.uTime+((t=e.startTime)==null?0:t)/1e3)}),this._rebuild(),this.words.map(e=>e.id)}addWord(...e){let t=e.map(e=>{var t;return this._resolveWord(e,this.uTime+((t=e.startTime)==null?0:t)/1e3)});return this.words.push(...t),this._rebuild(),t.map(e=>e.id)}hasWord(e){return this.words.some(t=>t.id===e)}removeWord(...e){let t=0;for(let n of e){let e=this.words.findIndex(e=>e.id===n);if(e===-1){console.warn(`WordPass: word "${n}" not found`);continue}this.words.splice(e,1),t++}return t>0&&this._rebuild(),t}setWord(t){var n;let{id:r}=t,i=e(t,[`id`]),a=this.words.findIndex(e=>e.id===r);if(a===-1){console.warn(`WordPass: word "${r}" not found`);return}let o=this.words[a],s=Object.assign(Object.assign(Object.assign({},o.source),i),{id:r}),c=i.startTime===void 0?o.wordStart:this.uTime+((n=i.startTime)==null?0:n)/1e3;this.words[a]=this._resolveWord(s,c),this._rebuild()}clearWords(){this.words=[],this._rebuild()}setMaxDisplayBoost(e){this.uMaxDisplayBoost.value=Math.max(e,1)}_resolveWord(e,t){let{color:n=new i.Color(O),opacity:a=1,lineWidth:o=3,hdrIntensity:s=1,writeSpeed:c=4,minStrokeDuration:l=200,strokeGap:u=120,holdDuration:d=1500,fadeDuration:f=1200,loop:p=!0,restartPause:m=800,persist:h=!1,fireworks:g=!0,fireworksColor:_,particleCount:v=400,emissionRate:y=500,sparkSpeed:b=.6,particleSize:x=.012,particleLife:S=.8,gravity:C}=e,w=e.strokes.filter(e=>e.points.length>=2),T=[],E=0,D=u/1e3;for(let e of w){let t=Math.max(e.totalLength/Math.max(c,1e-4),l/1e3);T.push({points:e.points,strokeLength:e.totalLength,writeStart:E,writeDuration:t}),E+=t+D}let k=E>0?E-D:0,A=h?1e9:k+d/1e3,j=h?1:f/1e3,M=h?0:p?A+j+m/1e3:0;return{id:e.id||r(),source:Object.assign(Object.assign({},e),{id:e.id}),blocks:T,color:n.clone(),opacity:a,lineWidth:o,hdrIntensity:Math.max(s,1),wordStart:t,fadeStart:A,fadeDuration:j,cycleLength:M,fireworks:g,sparkColor:_?_.clone():n.clone().lerp(new i.Color(16777215),.4),emissionRate:y,sparkSpeed:b,particleSize:x,particleLife:S,gravity:C?C.clone():new i.Vector3(0,-.6,0),particleCount:g?Math.max(1,Math.floor(v)):0,particleOffset:0,particleCursor:0,emitAccum:T.map(()=>0)}}_rebuild(){this._buildLineMesh(),this._buildParticles()}createLineMaterial(){let e=T(`vec4`,`wpColor`),t=T(`float`,`wpSegLen`),n=T(`float`,`wpAccum`),r=T(`float`,`wpStrokeLen`),b=T(`float`,`wpDrawnLen`),S=T(`float`,`wpFade`),C=T(`vec2`,`wpStart`),w=T(`vec2`,`wpEnd`),O=T(`float`,`wpLineWidth`),A=T(`float`,`wpHdrBoost`),j=T(`vec2`,`wpNdc`),M=.001,N=(e,t)=>s(e,t),P=a(()=>{let i=N(`instanceStart`,`vec3`),a=N(`instanceEnd`,`vec3`),s=N(`instanceColor`,`vec4`),l=N(`instanceData`,`vec4`),u=N(`instanceReveal`,`vec2`),v=N(`instanceTime`,`vec4`),x=_,T=l.x,P=l.y.mul(this.uPixelRatioLine),F=l.z,I=u.x,L=u.y,R=v.x,z=v.y,ee=v.z,B=v.w;e.assign(s);let V=f(a.sub(i));t.assign(V),n.assign(T),r.assign(F),O.assign(P);let H=this.uTimeLine.sub(R),U=y(B.greaterThan(0),g(m(H,0),B),H),W=c(U.sub(I).div(m(L,1e-4)),0,1).mul(F).toVar(),G=d(1).toVar();o(U.greaterThanEqual(z),()=>{G.assign(d(1).sub(c(U.sub(z).div(m(ee,1e-4)),0,1)))}),o(H.lessThan(0),()=>{G.assign(0),W.assign(0)}),S.assign(G),b.assign(W);let K=l.w,te=m(p(m(K,1.0001)),1e-4),ne=c(p(m(this.uMaxDisplayBoost,1)).div(te),0,1);A.assign(h(1,K,ne));let q=this.uProjLine.mul(this.uViewLine).mul(D(i,1)).toVar(),J=this.uProjLine.mul(this.uViewLine).mul(D(a,1)).toVar(),Y=d(0).toVar(),X=q.w.lessThan(M).toVar(),Z=J.w.lessThan(M).toVar();o(X.and(Z),()=>{Y.assign(1)}),o(X,()=>{let e=d(M).sub(q.w).div(J.w.sub(q.w));q.assign(h(q,J,e))}),o(Z,()=>{let e=d(M).sub(J.w).div(q.w.sub(J.w));J.assign(h(J,q,e))});let re=q.xy.div(q.w),ie=J.xy.div(J.w);C.assign(re),w.assign(ie);let ae=re.add(1).mul(.5).mul(this.uResolutionLine),oe=ie.add(1).mul(.5).mul(this.uResolutionLine),se=oe.sub(ae),ce=f(se),Q=y(ce.greaterThan(1e-5),se.div(m(ce,1e-5)),E(1,0)),le=E(Q.y.negate(),Q.x),ue=x.y.add(.5),$=m(P.mul(.5),.5).add(k),de=ae.sub(Q.mul($)),fe=oe.add(Q.mul($)),pe=le.mul(x.x).mul(2).mul($),me=h(de,fe,ue).add(pe).div(this.uResolutionLine).mul(2).sub(1);j.assign(me);let he=h(q,J,ue),ge=m(he.w,M);return h(D(me.mul(ge),he.z,ge),D(0,0,-2,1),Y)}),F=a(([e,t,n])=>{let r=e.sub(t),i=n.sub(t),a=c(l(r,i).div(l(i,i)),0,1);return f(r.sub(i.mul(a)))}),I=a(()=>{let i=j,a=w.sub(C),o=m(f(a),1e-6),s=a.div(o),p=c(l(i.sub(C),s),0,o).div(o),h=n.add(p.mul(t)),g=b.lessThanEqual(1e-4).or(h.greaterThan(b)),_=E(this.uResolutionLine.x.div(this.uResolutionLine.y),1),T=F(i.mul(_),C.mul(_),w.mul(_)).mul(this.uResolutionLine.y).mul(.5),M=m(O.mul(.5),.5),N=d(1).sub(x(M.sub(1),M.add(1),T)),P=M.add(k),I=c(m(T.sub(M),0).div(m(P.sub(M),1e-4)),0,1),L=v(d(1).sub(I),4).mul(.9),R=c(N.add(L.mul(d(1).sub(N))),0,1),z=u(m(b.sub(h),0).mul(-5).div(m(r,1e-4))),ee=d(1).sub(x(r.mul(.98),r,b)),B=d(1).add(z.mul(.6).mul(ee)),V=R.mul(e.a).mul(S),H=y(g.not().and(V.greaterThanEqual(.004)),V,0);return D(e.rgb.mul(B).mul(A).mul(H),H)}),L=new i.NodeMaterial;return L.vertexNode=P(),L.fragmentNode=I(),L.transparent=!0,L.depthTest=!1,L.depthWrite=!1,L.side=i.DoubleSide,L.blending=i.CustomBlending,L.blendEquation=i.MaxEquation,L.blendSrc=i.OneFactor,L.blendDst=i.OneFactor,L}_buildLineMesh(){this._disposeLineMesh();let e=0;for(let t of this.words)for(let n of t.blocks)e+=n.points.length-1;if(e===0)return;let t=new i.PlaneGeometry(1,1,1,1),n=new i.InstancedBufferGeometry;n.index=t.index,n.attributes=t.attributes,n.instanceCount=e;let r=new Float32Array(e*3),a=new Float32Array(e*3),o=new Float32Array(e*4),s=new Float32Array(e*4),c=new Float32Array(e*2),l=new Float32Array(e*4),u=0;for(let e of this.words)for(let t of e.blocks){let n=0;for(let i=0;i<t.points.length-1;i++){let d=t.points[i],f=t.points[i+1],p=d.distanceTo(f),m=u*2,h=u*3,g=u*4;r[h+0]=d.x,r[h+1]=d.y,r[h+2]=d.z,a[h+0]=f.x,a[h+1]=f.y,a[h+2]=f.z,o[g+0]=e.color.r,o[g+1]=e.color.g,o[g+2]=e.color.b,o[g+3]=e.opacity,s[g+0]=n,s[g+1]=e.lineWidth,s[g+2]=t.strokeLength,s[g+3]=e.hdrIntensity,c[m+0]=t.writeStart,c[m+1]=t.writeDuration,l[g+0]=e.wordStart,l[g+1]=e.fadeStart,l[g+2]=e.fadeDuration,l[g+3]=e.cycleLength,n+=p,u++}}n.setAttribute(`instanceStart`,new i.InstancedBufferAttribute(r,3)),n.setAttribute(`instanceEnd`,new i.InstancedBufferAttribute(a,3)),n.setAttribute(`instanceColor`,new i.InstancedBufferAttribute(o,4)),n.setAttribute(`instanceData`,new i.InstancedBufferAttribute(s,4)),n.setAttribute(`instanceReveal`,new i.InstancedBufferAttribute(c,2)),n.setAttribute(`instanceTime`,new i.InstancedBufferAttribute(l,4)),this.lineMaterial=this.createLineMaterial(),this.lineMesh=new i.Mesh(n,this.lineMaterial),this.lineMesh.frustumCulled=!1,this.effectScene.add(this.lineMesh)}createParticleMaterial(){let e=T(`vec4`,`wpSparkColor`),t=T(`float`,`wpSparkAlpha`),n=T(`vec2`,`wpSparkLocal`),r=.001,c=(e,t)=>s(e,t),l=a(()=>{let i=c(`aPosition`,`vec3`),a=c(`aVelocity`,`vec3`),s=c(`aAccel`,`vec3`),l=c(`aColor`,`vec4`),u=c(`aParams`,`vec4`),f=u.x,p=u.y,g=u.z,y=u.w,x=_.xy;e.assign(l),n.assign(x);let S=this.uTimeParticle.sub(f),C=d(0).toVar();o(p.lessThanEqual(0).or(S.lessThan(0)).or(S.greaterThan(p)),()=>{C.assign(1)});let w=S.div(m(p,r)),T=i.add(a.mul(S)).add(s.mul(.5).mul(S).mul(S)),E=this.uProjParticle.mul(this.uViewParticle).mul(D(T,1)).toVar();o(E.w.lessThanEqual(r),()=>{C.assign(1)});let O=m(E.w,r),k=E.xy.div(O),A=this.uProjParticle.element(1).y,j=d(1).sub(w.mul(.7)),M=m(y.mul(A).mul(.5).mul(this.uResolutionParticle.y).div(O).mul(j),0),N=k.add(1).mul(.5).mul(this.uResolutionParticle).add(x.mul(M)).div(this.uResolutionParticle).mul(2).sub(1),P=d(.7).add(d(.3).mul(b(this.uTimeParticle.mul(30).add(g.mul(6.2831)))));return t.assign(v(d(1).sub(w),.8).mul(P)),h(D(N.mul(O),E.z,O),D(0,0,-2,1),C)}),u=a(()=>{let r=x(.5,0,f(n)),i=r.mul(r).mul(t).mul(e.a);return D(e.rgb,i)}),p=new i.NodeMaterial;return p.vertexNode=l(),p.fragmentNode=u(),p.transparent=!0,p.depthTest=!1,p.depthWrite=!1,p.blending=i.AdditiveBlending,p}createBlendMaterial(){let e=new i.NodeMaterial,t=this.uBase.sample(w()),n=this.uEffect.sample(w());return e.fragmentNode=D(t.rgb.add(n.rgb),t.a),e.transparent=!1,e.depthTest=!1,e.depthWrite=!1,e}_buildParticles(){this._disposeParticles();let e=0;for(let t of this.words)t.particleOffset=e,t.particleCursor=0,e+=t.particleCount;if(e===0)return;this.arrPosition=new Float32Array(e*3),this.arrVelocity=new Float32Array(e*3),this.arrAccel=new Float32Array(e*3),this.arrColor=new Float32Array(e*4),this.arrParams=new Float32Array(e*4);let t=new i.PlaneGeometry(1,1,1,1),n=new i.InstancedBufferGeometry;n.index=t.index,n.attributes=t.attributes,n.instanceCount=e,n.setAttribute(`aPosition`,new i.InstancedBufferAttribute(this.arrPosition,3)),n.setAttribute(`aVelocity`,new i.InstancedBufferAttribute(this.arrVelocity,3)),n.setAttribute(`aAccel`,new i.InstancedBufferAttribute(this.arrAccel,3)),n.setAttribute(`aColor`,new i.InstancedBufferAttribute(this.arrColor,4)),n.setAttribute(`aParams`,new i.InstancedBufferAttribute(this.arrParams,4)),this.particleGeometry=n,this.particleMaterial=this.createParticleMaterial(),this.points=new i.Mesh(n,this.particleMaterial),this.points.frustumCulled=!1,this.effectScene.add(this.points)}_samplePointAtLength(e,t,n){if(e.length===1||t<=0){n.copy(e[0]);return}let r=0;for(let i=0;i<e.length-1;i++){let a=e[i],o=e[i+1],s=a.distanceTo(o);if(!(s<=1e-9)){if(r+s>=t){n.lerpVectors(a,o,(t-r)/s);return}r+=s}}n.copy(e[e.length-1])}_emitParticle(e,t){if(!this.arrPosition)return;let n=e.particleOffset+e.particleCursor;e.particleCursor=(e.particleCursor+1)%e.particleCount;let r=n*3,i=n*4,a=Math.random()*Math.PI*2,o=Math.random(),s=Math.cos(a)*o,c=Math.sin(a)*o,l=.3+Math.random()*.7,u=e.sparkSpeed*(.4+Math.random()*.8);this.arrPosition[r+0]=t.x,this.arrPosition[r+1]=t.y,this.arrPosition[r+2]=t.z,this.arrVelocity[r+0]=s*u,this.arrVelocity[r+1]=l*u,this.arrVelocity[r+2]=c*u,this.arrAccel[r+0]=e.gravity.x,this.arrAccel[r+1]=e.gravity.y,this.arrAccel[r+2]=e.gravity.z;let d=.8+Math.random()*.5;this.arrColor[i+0]=e.sparkColor.r*d,this.arrColor[i+1]=e.sparkColor.g*d,this.arrColor[i+2]=e.sparkColor.b*d,this.arrColor[i+3]=1,this.arrParams[i+0]=this.uTime,this.arrParams[i+1]=e.particleLife*(.6+Math.random()*.8),this.arrParams[i+2]=Math.random(),this.arrParams[i+3]=e.particleSize*(.6+Math.random()*.9)}_emit(e){if(!this.particleGeometry)return;let t=!1;for(let n of this.words){if(!n.fireworks||n.particleCount===0)continue;let r=this.uTime-n.wordStart;if(r<0)continue;let i=n.cycleLength>0?r%n.cycleLength:r;for(let r=0;r<n.blocks.length;r++){let a=n.blocks[r],o=i-a.writeStart;if(o<0||o>a.writeDuration)continue;let s=o/a.writeDuration;this._samplePointAtLength(a.points,s*a.strokeLength,this._tmpTip),n.emitAccum[r]+=n.emissionRate*e;let c=Math.floor(n.emitAccum[r]);n.emitAccum[r]-=c,c=Math.min(c,n.particleCount);for(let e=0;e<c;e++)this._emitParticle(n,this._tmpTip),t=!0}}if(t){let e=this.particleGeometry;e.getAttribute(`aPosition`).needsUpdate=!0,e.getAttribute(`aVelocity`).needsUpdate=!0,e.getAttribute(`aAccel`).needsUpdate=!0,e.getAttribute(`aColor`).needsUpdate=!0,e.getAttribute(`aParams`).needsUpdate=!0}}render(e,t,n,r,i){let a=!!(this.lineMesh||this.points);a&&(this.uTime+=r==null?0:r,this._emit(r==null?0:r));let o=n.width,s=n.height;(this.effectRenderTarget.width!==o||this.effectRenderTarget.height!==s)&&this.effectRenderTarget.setSize(o,s);let c=e.getRenderTarget();if(e.setRenderTarget(this.effectRenderTarget),e.setClearColor(0,0),e.clear(),a){let t=this.camera.projectionMatrix,n=this.camera.matrixWorldInverse;this.lineMaterial&&(this.uTimeLine.value=this.uTime,this.uResolutionLine.value.set(o,s),this.uProjLine.value=t,this.uViewLine.value=n,this.uPixelRatioLine.value=this.camera.pixelRatio),this.particleMaterial&&(this.uTimeParticle.value=this.uTime,this.uResolutionParticle.value.set(o,s),this.uProjParticle.value=t,this.uViewParticle.value=n),e.render(this.effectScene,this.orthoCamera)}e.setRenderTarget(c),this.uBase.value=n.texture,this.uEffect.value=this.effectRenderTarget.texture,e.setRenderTarget(this.renderToScreen?null:t),this.blendQuad.render(e)}_disposeLineMesh(){this.lineMesh&&(this.effectScene.remove(this.lineMesh),this.lineMesh.geometry.dispose(),this.lineMesh=null),this.lineMaterial&&(this.lineMaterial.dispose(),this.lineMaterial=null)}_disposeParticles(){this.points&&(this.effectScene.remove(this.points),this.points=null),this.particleGeometry&&(this.particleGeometry.dispose(),this.particleGeometry=null),this.particleMaterial&&(this.particleMaterial.dispose(),this.particleMaterial=null),this.arrPosition=null,this.arrVelocity=null,this.arrAccel=null,this.arrColor=null,this.arrParams=null}dispose(){this._disposeLineMesh(),this._disposeParticles(),this.effectRenderTarget.dispose(),this.blendMaterial.dispose(),this.blendQuad.dispose()}};export{A as WordPass};
255
+ */import{FullScreenQuad as e}from"../../five/renderer/tools/full-screen-quad.mjs";import{FivePass as t}from"../../five/renderer/postprocessing/passes/pass.mjs";import{uuid as n}from"../../five/utils/uuid.mjs";import{__rest as r}from"tslib";import*as i from"three/webgpu";import{Fn as a,If as o,attribute as s,clamp as c,dot as l,exp as u,float as d,length as f,log2 as p,max as m,mix as h,mod as g,positionGeometry as _,pow as v,select as y,sin as b,smoothstep as x,texture as S,uniform as C,uv as w,varyingProperty as T,vec2 as E,vec4 as D}from"three/tsl";var O=16767392,k=3,A=class extends t{constructor(t,n=i.UnsignedByteType){super(),this.uTime=0,this.words=[],this.lineMesh=null,this.lineMaterial=null,this.points=null,this.particleMaterial=null,this.particleGeometry=null,this.arrPosition=null,this.arrVelocity=null,this.arrAccel=null,this.arrColor=null,this.arrParams=null,this._tmpTip=new i.Vector3,this.uTimeLine=C(0),this.uResolutionLine=C(new i.Vector2(1,1)),this.uProjLine=C(new i.Matrix4),this.uViewLine=C(new i.Matrix4),this.uPixelRatioLine=C(1),this.uMaxDisplayBoost=C(1),this.uTimeParticle=C(0),this.uResolutionParticle=C(new i.Vector2(1,1)),this.uProjParticle=C(new i.Matrix4),this.uViewParticle=C(new i.Matrix4),this.uBase=S(new i.Texture),this.uEffect=S(new i.Texture),this.camera=t,this.effectScene=new i.Scene,this.orthoCamera=new i.OrthographicCamera(-1,1,1,-1,0,1),this.effectRenderTarget=new i.RenderTarget(Math.max(1,this.camera.resolution.x),Math.max(1,this.camera.resolution.y),{type:n,minFilter:i.LinearFilter,magFilter:i.LinearFilter,format:i.RGBAFormat}),this.blendMaterial=this.createBlendMaterial(),this.blendQuad=new e(this.blendMaterial)}setWords(e){return this.words=e.map(e=>{var t;return this._resolveWord(e,this.uTime+((t=e.startTime)==null?0:t)/1e3)}),this._rebuild(),this.words.map(e=>e.id)}addWord(...e){let t=e.map(e=>{var t;return this._resolveWord(e,this.uTime+((t=e.startTime)==null?0:t)/1e3)});return this.words.push(...t),this._rebuild(),t.map(e=>e.id)}hasWord(e){return this.words.some(t=>t.id===e)}removeWord(...e){let t=0;for(let n of e){let e=this.words.findIndex(e=>e.id===n);if(e===-1){console.warn(`WordPass: word "${n}" not found`);continue}this.words.splice(e,1),t++}return t>0&&this._rebuild(),t}setWord(e){var t;let{id:n}=e,i=r(e,[`id`]),a=this.words.findIndex(e=>e.id===n);if(a===-1){console.warn(`WordPass: word "${n}" not found`);return}let o=this.words[a],s=Object.assign(Object.assign(Object.assign({},o.source),i),{id:n}),c=i.startTime===void 0?o.wordStart:this.uTime+((t=i.startTime)==null?0:t)/1e3;this.words[a]=this._resolveWord(s,c),this._rebuild()}clearWords(){this.words=[],this._rebuild()}setMaxDisplayBoost(e){this.uMaxDisplayBoost.value=Math.max(e,1)}_resolveWord(e,t){let{color:r=new i.Color(O),opacity:a=1,lineWidth:o=3,hdrIntensity:s=1,writeSpeed:c=4,minStrokeDuration:l=200,strokeGap:u=120,holdDuration:d=1500,fadeDuration:f=1200,loop:p=!0,restartPause:m=800,persist:h=!1,fireworks:g=!0,fireworksColor:_,particleCount:v=400,emissionRate:y=500,sparkSpeed:b=.6,particleSize:x=.012,particleLife:S=.8,gravity:C}=e,w=e.strokes.filter(e=>e.points.length>=2),T=[],E=0,D=u/1e3;for(let e of w){let t=Math.max(e.totalLength/Math.max(c,1e-4),l/1e3);T.push({points:e.points,strokeLength:e.totalLength,writeStart:E,writeDuration:t}),E+=t+D}let k=E>0?E-D:0,A=h?1e9:k+d/1e3,j=h?1:f/1e3,M=h?0:p?A+j+m/1e3:0;return{id:e.id||n(),source:Object.assign(Object.assign({},e),{id:e.id}),blocks:T,color:r.clone(),opacity:a,lineWidth:o,hdrIntensity:Math.max(s,1),wordStart:t,fadeStart:A,fadeDuration:j,cycleLength:M,fireworks:g,sparkColor:_?_.clone():r.clone().lerp(new i.Color(16777215),.4),emissionRate:y,sparkSpeed:b,particleSize:x,particleLife:S,gravity:C?C.clone():new i.Vector3(0,-.6,0),particleCount:g?Math.max(1,Math.floor(v)):0,particleOffset:0,particleCursor:0,emitAccum:T.map(()=>0)}}_rebuild(){this._buildLineMesh(),this._buildParticles()}createLineMaterial(){let e=T(`vec4`,`wpColor`),t=T(`float`,`wpSegLen`),n=T(`float`,`wpAccum`),r=T(`float`,`wpStrokeLen`),b=T(`float`,`wpDrawnLen`),S=T(`float`,`wpFade`),C=T(`vec2`,`wpStart`),w=T(`vec2`,`wpEnd`),O=T(`float`,`wpLineWidth`),A=T(`float`,`wpHdrBoost`),j=T(`vec2`,`wpNdc`),M=.001,N=(e,t)=>s(e,t),P=a(()=>{let i=N(`instanceStart`,`vec3`),a=N(`instanceEnd`,`vec3`),s=N(`instanceColor`,`vec4`),l=N(`instanceData`,`vec4`),u=N(`instanceReveal`,`vec2`),v=N(`instanceTime`,`vec4`),x=_,T=l.x,P=l.y.mul(this.uPixelRatioLine),F=l.z,I=u.x,L=u.y,R=v.x,z=v.y,ee=v.z,B=v.w;e.assign(s);let V=f(a.sub(i));t.assign(V),n.assign(T),r.assign(F),O.assign(P);let H=this.uTimeLine.sub(R),U=y(B.greaterThan(0),g(m(H,0),B),H),W=c(U.sub(I).div(m(L,1e-4)),0,1).mul(F).toVar(),G=d(1).toVar();o(U.greaterThanEqual(z),()=>{G.assign(d(1).sub(c(U.sub(z).div(m(ee,1e-4)),0,1)))}),o(H.lessThan(0),()=>{G.assign(0),W.assign(0)}),S.assign(G),b.assign(W);let K=l.w,te=m(p(m(K,1.0001)),1e-4),ne=c(p(m(this.uMaxDisplayBoost,1)).div(te),0,1);A.assign(h(1,K,ne));let q=this.uProjLine.mul(this.uViewLine).mul(D(i,1)).toVar(),J=this.uProjLine.mul(this.uViewLine).mul(D(a,1)).toVar(),Y=d(0).toVar(),X=q.w.lessThan(M).toVar(),Z=J.w.lessThan(M).toVar();o(X.and(Z),()=>{Y.assign(1)}),o(X,()=>{let e=d(M).sub(q.w).div(J.w.sub(q.w));q.assign(h(q,J,e))}),o(Z,()=>{let e=d(M).sub(J.w).div(q.w.sub(J.w));J.assign(h(J,q,e))});let re=q.xy.div(q.w),ie=J.xy.div(J.w);C.assign(re),w.assign(ie);let ae=re.add(1).mul(.5).mul(this.uResolutionLine),oe=ie.add(1).mul(.5).mul(this.uResolutionLine),se=oe.sub(ae),ce=f(se),Q=y(ce.greaterThan(1e-5),se.div(m(ce,1e-5)),E(1,0)),le=E(Q.y.negate(),Q.x),ue=x.y.add(.5),$=m(P.mul(.5),.5).add(k),de=ae.sub(Q.mul($)),fe=oe.add(Q.mul($)),pe=le.mul(x.x).mul(2).mul($),me=h(de,fe,ue).add(pe).div(this.uResolutionLine).mul(2).sub(1);j.assign(me);let he=h(q,J,ue),ge=m(he.w,M);return h(D(me.mul(ge),he.z,ge),D(0,0,-2,1),Y)}),F=a(([e,t,n])=>{let r=e.sub(t),i=n.sub(t),a=c(l(r,i).div(l(i,i)),0,1);return f(r.sub(i.mul(a)))}),I=a(()=>{let i=j,a=w.sub(C),o=m(f(a),1e-6),s=a.div(o),p=c(l(i.sub(C),s),0,o).div(o),h=n.add(p.mul(t)),g=b.lessThanEqual(1e-4).or(h.greaterThan(b)),_=E(this.uResolutionLine.x.div(this.uResolutionLine.y),1),T=F(i.mul(_),C.mul(_),w.mul(_)).mul(this.uResolutionLine.y).mul(.5),M=m(O.mul(.5),.5),N=d(1).sub(x(M.sub(1),M.add(1),T)),P=M.add(k),I=c(m(T.sub(M),0).div(m(P.sub(M),1e-4)),0,1),L=v(d(1).sub(I),4).mul(.9),R=c(N.add(L.mul(d(1).sub(N))),0,1),z=u(m(b.sub(h),0).mul(-5).div(m(r,1e-4))),ee=d(1).sub(x(r.mul(.98),r,b)),B=d(1).add(z.mul(.6).mul(ee)),V=R.mul(e.a).mul(S),H=y(g.not().and(V.greaterThanEqual(.004)),V,0);return D(e.rgb.mul(B).mul(A).mul(H),H)}),L=new i.NodeMaterial;return L.vertexNode=P(),L.fragmentNode=I(),L.transparent=!0,L.depthTest=!1,L.depthWrite=!1,L.side=i.DoubleSide,L.blending=i.CustomBlending,L.blendEquation=i.MaxEquation,L.blendSrc=i.OneFactor,L.blendDst=i.OneFactor,L}_buildLineMesh(){this._disposeLineMesh();let e=0;for(let t of this.words)for(let n of t.blocks)e+=n.points.length-1;if(e===0)return;let t=new i.PlaneGeometry(1,1,1,1),n=new i.InstancedBufferGeometry;n.index=t.index,n.attributes=t.attributes,n.instanceCount=e;let r=new Float32Array(e*3),a=new Float32Array(e*3),o=new Float32Array(e*4),s=new Float32Array(e*4),c=new Float32Array(e*2),l=new Float32Array(e*4),u=0;for(let e of this.words)for(let t of e.blocks){let n=0;for(let i=0;i<t.points.length-1;i++){let d=t.points[i],f=t.points[i+1],p=d.distanceTo(f),m=u*2,h=u*3,g=u*4;r[h+0]=d.x,r[h+1]=d.y,r[h+2]=d.z,a[h+0]=f.x,a[h+1]=f.y,a[h+2]=f.z,o[g+0]=e.color.r,o[g+1]=e.color.g,o[g+2]=e.color.b,o[g+3]=e.opacity,s[g+0]=n,s[g+1]=e.lineWidth,s[g+2]=t.strokeLength,s[g+3]=e.hdrIntensity,c[m+0]=t.writeStart,c[m+1]=t.writeDuration,l[g+0]=e.wordStart,l[g+1]=e.fadeStart,l[g+2]=e.fadeDuration,l[g+3]=e.cycleLength,n+=p,u++}}n.setAttribute(`instanceStart`,new i.InstancedBufferAttribute(r,3)),n.setAttribute(`instanceEnd`,new i.InstancedBufferAttribute(a,3)),n.setAttribute(`instanceColor`,new i.InstancedBufferAttribute(o,4)),n.setAttribute(`instanceData`,new i.InstancedBufferAttribute(s,4)),n.setAttribute(`instanceReveal`,new i.InstancedBufferAttribute(c,2)),n.setAttribute(`instanceTime`,new i.InstancedBufferAttribute(l,4)),this.lineMaterial=this.createLineMaterial(),this.lineMesh=new i.Mesh(n,this.lineMaterial),this.lineMesh.frustumCulled=!1,this.effectScene.add(this.lineMesh)}createParticleMaterial(){let e=T(`vec4`,`wpSparkColor`),t=T(`float`,`wpSparkAlpha`),n=T(`vec2`,`wpSparkLocal`),r=.001,c=(e,t)=>s(e,t),l=a(()=>{let i=c(`aPosition`,`vec3`),a=c(`aVelocity`,`vec3`),s=c(`aAccel`,`vec3`),l=c(`aColor`,`vec4`),u=c(`aParams`,`vec4`),f=u.x,p=u.y,g=u.z,y=u.w,x=_.xy;e.assign(l),n.assign(x);let S=this.uTimeParticle.sub(f),C=d(0).toVar();o(p.lessThanEqual(0).or(S.lessThan(0)).or(S.greaterThan(p)),()=>{C.assign(1)});let w=S.div(m(p,r)),T=i.add(a.mul(S)).add(s.mul(.5).mul(S).mul(S)),E=this.uProjParticle.mul(this.uViewParticle).mul(D(T,1)).toVar();o(E.w.lessThanEqual(r),()=>{C.assign(1)});let O=m(E.w,r),k=E.xy.div(O),A=this.uProjParticle.element(1).y,j=d(1).sub(w.mul(.7)),M=m(y.mul(A).mul(.5).mul(this.uResolutionParticle.y).div(O).mul(j),0),N=k.add(1).mul(.5).mul(this.uResolutionParticle).add(x.mul(M)).div(this.uResolutionParticle).mul(2).sub(1),P=d(.7).add(d(.3).mul(b(this.uTimeParticle.mul(30).add(g.mul(6.2831)))));return t.assign(v(d(1).sub(w),.8).mul(P)),h(D(N.mul(O),E.z,O),D(0,0,-2,1),C)}),u=a(()=>{let r=x(.5,0,f(n)),i=r.mul(r).mul(t).mul(e.a);return D(e.rgb,i)}),p=new i.NodeMaterial;return p.vertexNode=l(),p.fragmentNode=u(),p.transparent=!0,p.depthTest=!1,p.depthWrite=!1,p.blending=i.AdditiveBlending,p}createBlendMaterial(){let e=new i.NodeMaterial,t=this.uBase.sample(w()),n=this.uEffect.sample(w());return e.fragmentNode=D(t.rgb.add(n.rgb),t.a),e.transparent=!1,e.depthTest=!1,e.depthWrite=!1,e}_buildParticles(){this._disposeParticles();let e=0;for(let t of this.words)t.particleOffset=e,t.particleCursor=0,e+=t.particleCount;if(e===0)return;this.arrPosition=new Float32Array(e*3),this.arrVelocity=new Float32Array(e*3),this.arrAccel=new Float32Array(e*3),this.arrColor=new Float32Array(e*4),this.arrParams=new Float32Array(e*4);let t=new i.PlaneGeometry(1,1,1,1),n=new i.InstancedBufferGeometry;n.index=t.index,n.attributes=t.attributes,n.instanceCount=e,n.setAttribute(`aPosition`,new i.InstancedBufferAttribute(this.arrPosition,3)),n.setAttribute(`aVelocity`,new i.InstancedBufferAttribute(this.arrVelocity,3)),n.setAttribute(`aAccel`,new i.InstancedBufferAttribute(this.arrAccel,3)),n.setAttribute(`aColor`,new i.InstancedBufferAttribute(this.arrColor,4)),n.setAttribute(`aParams`,new i.InstancedBufferAttribute(this.arrParams,4)),this.particleGeometry=n,this.particleMaterial=this.createParticleMaterial(),this.points=new i.Mesh(n,this.particleMaterial),this.points.frustumCulled=!1,this.effectScene.add(this.points)}_samplePointAtLength(e,t,n){if(e.length===1||t<=0){n.copy(e[0]);return}let r=0;for(let i=0;i<e.length-1;i++){let a=e[i],o=e[i+1],s=a.distanceTo(o);if(!(s<=1e-9)){if(r+s>=t){n.lerpVectors(a,o,(t-r)/s);return}r+=s}}n.copy(e[e.length-1])}_emitParticle(e,t){if(!this.arrPosition)return;let n=e.particleOffset+e.particleCursor;e.particleCursor=(e.particleCursor+1)%e.particleCount;let r=n*3,i=n*4,a=Math.random()*Math.PI*2,o=Math.random(),s=Math.cos(a)*o,c=Math.sin(a)*o,l=.3+Math.random()*.7,u=e.sparkSpeed*(.4+Math.random()*.8);this.arrPosition[r+0]=t.x,this.arrPosition[r+1]=t.y,this.arrPosition[r+2]=t.z,this.arrVelocity[r+0]=s*u,this.arrVelocity[r+1]=l*u,this.arrVelocity[r+2]=c*u,this.arrAccel[r+0]=e.gravity.x,this.arrAccel[r+1]=e.gravity.y,this.arrAccel[r+2]=e.gravity.z;let d=.8+Math.random()*.5;this.arrColor[i+0]=e.sparkColor.r*d,this.arrColor[i+1]=e.sparkColor.g*d,this.arrColor[i+2]=e.sparkColor.b*d,this.arrColor[i+3]=1,this.arrParams[i+0]=this.uTime,this.arrParams[i+1]=e.particleLife*(.6+Math.random()*.8),this.arrParams[i+2]=Math.random(),this.arrParams[i+3]=e.particleSize*(.6+Math.random()*.9)}_emit(e){if(!this.particleGeometry)return;let t=!1;for(let n of this.words){if(!n.fireworks||n.particleCount===0)continue;let r=this.uTime-n.wordStart;if(r<0)continue;let i=n.cycleLength>0?r%n.cycleLength:r;for(let r=0;r<n.blocks.length;r++){let a=n.blocks[r],o=i-a.writeStart;if(o<0||o>a.writeDuration)continue;let s=o/a.writeDuration;this._samplePointAtLength(a.points,s*a.strokeLength,this._tmpTip),n.emitAccum[r]+=n.emissionRate*e;let c=Math.floor(n.emitAccum[r]);n.emitAccum[r]-=c,c=Math.min(c,n.particleCount);for(let e=0;e<c;e++)this._emitParticle(n,this._tmpTip),t=!0}}if(t){let e=this.particleGeometry;e.getAttribute(`aPosition`).needsUpdate=!0,e.getAttribute(`aVelocity`).needsUpdate=!0,e.getAttribute(`aAccel`).needsUpdate=!0,e.getAttribute(`aColor`).needsUpdate=!0,e.getAttribute(`aParams`).needsUpdate=!0}}render(e,t,n,r,i){let a=!!(this.lineMesh||this.points);a&&(this.uTime+=r==null?0:r,this._emit(r==null?0:r));let o=n.width,s=n.height;(this.effectRenderTarget.width!==o||this.effectRenderTarget.height!==s)&&this.effectRenderTarget.setSize(o,s);let c=e.getRenderTarget();if(e.setRenderTarget(this.effectRenderTarget),e.setClearColor(0,0),e.clear(),a){let t=this.camera.projectionMatrix,n=this.camera.matrixWorldInverse;this.lineMaterial&&(this.uTimeLine.value=this.uTime,this.uResolutionLine.value.set(o,s),this.uProjLine.value=t,this.uViewLine.value=n,this.uPixelRatioLine.value=this.camera.pixelRatio),this.particleMaterial&&(this.uTimeParticle.value=this.uTime,this.uResolutionParticle.value.set(o,s),this.uProjParticle.value=t,this.uViewParticle.value=n),e.render(this.effectScene,this.orthoCamera)}e.setRenderTarget(c),this.uBase.value=n.texture,this.uEffect.value=this.effectRenderTarget.texture,e.setRenderTarget(this.renderToScreen?null:t),this.blendQuad.render(e)}_disposeLineMesh(){this.lineMesh&&(this.effectScene.remove(this.lineMesh),this.lineMesh.geometry.dispose(),this.lineMesh=null),this.lineMaterial&&(this.lineMaterial.dispose(),this.lineMaterial=null)}_disposeParticles(){this.points&&(this.effectScene.remove(this.points),this.points=null),this.particleGeometry&&(this.particleGeometry.dispose(),this.particleGeometry=null),this.particleMaterial&&(this.particleMaterial.dispose(),this.particleMaterial=null),this.arrPosition=null,this.arrVelocity=null,this.arrAccel=null,this.arrColor=null,this.arrParams=null}dispose(){this._disposeLineMesh(),this._disposeParticles(),this.effectRenderTarget.dispose(),this.blendMaterial.dispose(),this.blendQuad.dispose()}};export{A as WordPass};
package/plugins/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * @license
3
3
  * @realsee/five-webgpu
4
- * Generated: 10/26/2026
5
- * Version: 1.0.0-alpha.10
4
+ * Generated: 10/27/2026
5
+ * Version: 1.0.0-alpha.11
6
6
  * Terms:
7
7
  * Realsee SDK License Agreement
8
8
  * Update: July 28, 2021
package/plugins/index.mjs CHANGED
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * @license
3
3
  * @realsee/five-webgpu
4
- * Generated: 10/26/2026
5
- * Version: 1.0.0-alpha.10
4
+ * Generated: 10/27/2026
5
+ * Version: 1.0.0-alpha.11
6
6
  * Terms:
7
7
  * Realsee SDK License Agreement
8
8
  * Update: July 28, 2021
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * @license
3
3
  * @realsee/five-webgpu
4
- * Generated: 10/26/2026
5
- * Version: 1.0.0-alpha.10
4
+ * Generated: 10/27/2026
5
+ * Version: 1.0.0-alpha.11
6
6
  * Terms:
7
7
  * Realsee SDK License Agreement
8
8
  * Update: July 28, 2021
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * @license
3
3
  * @realsee/five-webgpu
4
- * Generated: 10/26/2026
5
- * Version: 1.0.0-alpha.10
4
+ * Generated: 10/27/2026
5
+ * Version: 1.0.0-alpha.11
6
6
  * Terms:
7
7
  * Realsee SDK License Agreement
8
8
  * Update: July 28, 2021
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * @license
3
3
  * @realsee/five-webgpu
4
- * Generated: 10/26/2026
5
- * Version: 1.0.0-alpha.10
4
+ * Generated: 10/27/2026
5
+ * Version: 1.0.0-alpha.11
6
6
  * Terms:
7
7
  * Realsee SDK License Agreement
8
8
  * Update: July 28, 2021
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * @license
3
3
  * @realsee/five-webgpu
4
- * Generated: 10/26/2026
5
- * Version: 1.0.0-alpha.10
4
+ * Generated: 10/27/2026
5
+ * Version: 1.0.0-alpha.11
6
6
  * Terms:
7
7
  * Realsee SDK License Agreement
8
8
  * Update: July 28, 2021
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * @license
3
3
  * @realsee/five-webgpu
4
- * Generated: 10/26/2026
5
- * Version: 1.0.0-alpha.10
4
+ * Generated: 10/27/2026
5
+ * Version: 1.0.0-alpha.11
6
6
  * Terms:
7
7
  * Realsee SDK License Agreement
8
8
  * Update: July 28, 2021
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * @license
3
3
  * @realsee/five-webgpu
4
- * Generated: 10/26/2026
5
- * Version: 1.0.0-alpha.10
4
+ * Generated: 10/27/2026
5
+ * Version: 1.0.0-alpha.11
6
6
  * Terms:
7
7
  * Realsee SDK License Agreement
8
8
  * Update: July 28, 2021
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * @license
3
3
  * @realsee/five-webgpu
4
- * Generated: 10/26/2026
5
- * Version: 1.0.0-alpha.10
4
+ * Generated: 10/27/2026
5
+ * Version: 1.0.0-alpha.11
6
6
  * Terms:
7
7
  * Realsee SDK License Agreement
8
8
  * Update: July 28, 2021
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * @license
3
3
  * @realsee/five-webgpu
4
- * Generated: 10/26/2026
5
- * Version: 1.0.0-alpha.10
4
+ * Generated: 10/27/2026
5
+ * Version: 1.0.0-alpha.11
6
6
  * Terms:
7
7
  * Realsee SDK License Agreement
8
8
  * Update: July 28, 2021
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * @license
3
3
  * @realsee/five-webgpu
4
- * Generated: 10/26/2026
5
- * Version: 1.0.0-alpha.10
4
+ * Generated: 10/27/2026
5
+ * Version: 1.0.0-alpha.11
6
6
  * Terms:
7
7
  * Realsee SDK License Agreement
8
8
  * Update: July 28, 2021
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * @license
3
3
  * @realsee/five-webgpu
4
- * Generated: 10/26/2026
5
- * Version: 1.0.0-alpha.10
4
+ * Generated: 10/27/2026
5
+ * Version: 1.0.0-alpha.11
6
6
  * Terms:
7
7
  * Realsee SDK License Agreement
8
8
  * Update: July 28, 2021
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * @license
3
3
  * @realsee/five-webgpu
4
- * Generated: 10/26/2026
5
- * Version: 1.0.0-alpha.10
4
+ * Generated: 10/27/2026
5
+ * Version: 1.0.0-alpha.11
6
6
  * Terms:
7
7
  * Realsee SDK License Agreement
8
8
  * Update: July 28, 2021
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * @license
3
3
  * @realsee/five-webgpu
4
- * Generated: 10/26/2026
5
- * Version: 1.0.0-alpha.10
4
+ * Generated: 10/27/2026
5
+ * Version: 1.0.0-alpha.11
6
6
  * Terms:
7
7
  * Realsee SDK License Agreement
8
8
  * Update: July 28, 2021
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * @license
3
3
  * @realsee/five-webgpu
4
- * Generated: 10/26/2026
5
- * Version: 1.0.0-alpha.10
4
+ * Generated: 10/27/2026
5
+ * Version: 1.0.0-alpha.11
6
6
  * Terms:
7
7
  * Realsee SDK License Agreement
8
8
  * Update: July 28, 2021
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * @license
3
3
  * @realsee/five-webgpu
4
- * Generated: 10/26/2026
5
- * Version: 1.0.0-alpha.10
4
+ * Generated: 10/27/2026
5
+ * Version: 1.0.0-alpha.11
6
6
  * Terms:
7
7
  * Realsee SDK License Agreement
8
8
  * Update: July 28, 2021
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * @license
3
3
  * @realsee/five-webgpu
4
- * Generated: 10/26/2026
5
- * Version: 1.0.0-alpha.10
4
+ * Generated: 10/27/2026
5
+ * Version: 1.0.0-alpha.11
6
6
  * Terms:
7
7
  * Realsee SDK License Agreement
8
8
  * Update: July 28, 2021
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * @license
3
3
  * @realsee/five-webgpu
4
- * Generated: 10/26/2026
5
- * Version: 1.0.0-alpha.10
4
+ * Generated: 10/27/2026
5
+ * Version: 1.0.0-alpha.11
6
6
  * Terms:
7
7
  * Realsee SDK License Agreement
8
8
  * Update: July 28, 2021
package/react/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * @license
3
3
  * @realsee/five-webgpu
4
- * Generated: 10/26/2026
5
- * Version: 1.0.0-alpha.10
4
+ * Generated: 10/27/2026
5
+ * Version: 1.0.0-alpha.11
6
6
  * Terms:
7
7
  * Realsee SDK License Agreement
8
8
  * Update: July 28, 2021
package/react/index.mjs CHANGED
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * @license
3
3
  * @realsee/five-webgpu
4
- * Generated: 10/26/2026
5
- * Version: 1.0.0-alpha.10
4
+ * Generated: 10/27/2026
5
+ * Version: 1.0.0-alpha.11
6
6
  * Terms:
7
7
  * Realsee SDK License Agreement
8
8
  * Update: July 28, 2021
package/sticker/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * @license
3
3
  * @realsee/five-webgpu
4
- * Generated: 10/26/2026
5
- * Version: 1.0.0-alpha.10
4
+ * Generated: 10/27/2026
5
+ * Version: 1.0.0-alpha.11
6
6
  * Terms:
7
7
  * Realsee SDK License Agreement
8
8
  * Update: July 28, 2021
@@ -252,4 +252,4 @@
252
252
  * No amendment to or modification of this Agreement will be binding unless in
253
253
  * writing and signed by Realsee. You and Realsee hereto confirm that this
254
254
  * Agreement and all related documents shall be drafted in English.
255
- */Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));let c=require("three/webgpu");c=s(c,1);var l=new Float32Array([-.5,-.5,0,.5,-.5,0,-.5,.5,0,.5,.5,0]),u=new Float32Array([0,0,1,0,0,1,1,1]),d=new Uint8Array([0,1,2,1,3,2]),f=new c.BufferGeometry;f.setAttribute(`position`,new c.BufferAttribute(l,3)),f.setAttribute(`uv`,new c.BufferAttribute(u,2)),f.setIndex(new c.BufferAttribute(d,1));var p=window,m=p.requestAnimationFrame||p.mozRequestAnimationFrame||p.webkitRequestAnimationFrame||p.msRequestAnimationFrame||(e=>setTimeout(e,16)),h=typeof performance<`u`&&performance.timing!==void 0?performance.timing.navigationStart:Date.now(),g=typeof performance<`u`?(()=>h+performance.now()):(()=>Date.now());function _(e,t){e.naturalWidth>0&&m(()=>t());let n=()=>t();return e.addEventListener(`load`,n,!1),()=>e.removeEventListener(`load`,n,!1)}function v(e,t){let n=g(),r=!1,i=()=>{r=!0,t(),g()-n<3e3?m(i):r=!1},a=()=>{n=g(),r===!1&&i()};return e.addEventListener(`timeupdate`,a,!1),()=>{e.removeEventListener(`timeupdate`,a,!1),r=!1}}function y(e,t){let n=e.dispose;e.dispose=()=>{t(),n.call(e)}}var b=class extends c.Mesh{static get version(){return`1.0.0-alpha.10`}constructor(e,t,n){let r=new c.MeshBasicMaterial;if(super(f,r),this._needsRender=!1,this.scale.set(e,t,1),typeof n==`string`){r.transparent=/\.png$/.test(n);let e=new Image;e.src=n,e.crossOrigin=``,n=e}if(n instanceof HTMLImageElement){let e=r.map=new c.Texture;e.wrapS=c.ClampToEdgeWrapping,e.wrapT=c.ClampToEdgeWrapping,e.minFilter=c.LinearFilter,e.colorSpace=c.SRGBColorSpace,y(e,_(n,()=>{e.image=n,e.needsUpdate=!0,this._needsRender=!0}))}else if(n instanceof HTMLCanvasElement)r.map=new c.CanvasTexture(n);else if(n instanceof HTMLVideoElement){let e=r.map=new c.VideoTexture(n);e.wrapS=c.ClampToEdgeWrapping,e.wrapT=c.ClampToEdgeWrapping,e.minFilter=c.LinearFilter,e.colorSpace=c.SRGBColorSpace,y(e,v(n,()=>{this._needsRender=!0}))}}get needsRender(){return this._needsRender}set needsRender(e){this._needsRender=e,e===!0&&this.material.map&&(this.material.map.needsUpdate=!0)}setSize(e,t){this.scale.set(e,t,1),this._needsRender=!0}setTransparent(e){this.material.transparent=e,this._needsRender=!0}locationWithIntersection(e,t=.005){let{point:n,face:r}=e;this.position.copy(n),r&&(this.position.add(r.normal.clone().setLength(t)),this.lookAt(n.clone().add(r.normal))),this._needsRender=!0}dispose(){var e;(e=this.material.map)==null||e.dispose(),this.material.dispose()}};exports.Sticker=b;
255
+ */Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));let c=require("three/webgpu");c=s(c,1);var l=new Float32Array([-.5,-.5,0,.5,-.5,0,-.5,.5,0,.5,.5,0]),u=new Float32Array([0,0,1,0,0,1,1,1]),d=new Uint8Array([0,1,2,1,3,2]),f=new c.BufferGeometry;f.setAttribute(`position`,new c.BufferAttribute(l,3)),f.setAttribute(`uv`,new c.BufferAttribute(u,2)),f.setIndex(new c.BufferAttribute(d,1));var p=window,m=p.requestAnimationFrame||p.mozRequestAnimationFrame||p.webkitRequestAnimationFrame||p.msRequestAnimationFrame||(e=>setTimeout(e,16)),h=typeof performance<`u`&&performance.timing!==void 0?performance.timing.navigationStart:Date.now(),g=typeof performance<`u`?(()=>h+performance.now()):(()=>Date.now());function _(e,t){e.naturalWidth>0&&m(()=>t());let n=()=>t();return e.addEventListener(`load`,n,!1),()=>e.removeEventListener(`load`,n,!1)}function v(e,t){let n=g(),r=!1,i=()=>{r=!0,t(),g()-n<3e3?m(i):r=!1},a=()=>{n=g(),r===!1&&i()};return e.addEventListener(`timeupdate`,a,!1),()=>{e.removeEventListener(`timeupdate`,a,!1),r=!1}}function y(e,t){let n=e.dispose;e.dispose=()=>{t(),n.call(e)}}var b=class extends c.Mesh{static get version(){return`1.0.0-alpha.11`}constructor(e,t,n){let r=new c.MeshBasicMaterial;if(super(f,r),this._needsRender=!1,this.scale.set(e,t,1),typeof n==`string`){r.transparent=/\.png$/.test(n);let e=new Image;e.src=n,e.crossOrigin=``,n=e}if(n instanceof HTMLImageElement){let e=r.map=new c.Texture;e.wrapS=c.ClampToEdgeWrapping,e.wrapT=c.ClampToEdgeWrapping,e.minFilter=c.LinearFilter,e.colorSpace=c.SRGBColorSpace,y(e,_(n,()=>{e.image=n,e.needsUpdate=!0,this._needsRender=!0}))}else if(n instanceof HTMLCanvasElement)r.map=new c.CanvasTexture(n);else if(n instanceof HTMLVideoElement){let e=r.map=new c.VideoTexture(n);e.wrapS=c.ClampToEdgeWrapping,e.wrapT=c.ClampToEdgeWrapping,e.minFilter=c.LinearFilter,e.colorSpace=c.SRGBColorSpace,y(e,v(n,()=>{this._needsRender=!0}))}}get needsRender(){return this._needsRender}set needsRender(e){this._needsRender=e,e===!0&&this.material.map&&(this.material.map.needsUpdate=!0)}setSize(e,t){this.scale.set(e,t,1),this._needsRender=!0}setTransparent(e){this.material.transparent=e,this._needsRender=!0}locationWithIntersection(e,t=.005){let{point:n,face:r}=e;this.position.copy(n),r&&(this.position.add(r.normal.clone().setLength(t)),this.lookAt(n.clone().add(r.normal))),this._needsRender=!0}dispose(){var e;(e=this.material.map)==null||e.dispose(),this.material.dispose()}};exports.Sticker=b;
package/sticker/index.mjs CHANGED
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * @license
3
3
  * @realsee/five-webgpu
4
- * Generated: 10/26/2026
5
- * Version: 1.0.0-alpha.10
4
+ * Generated: 10/27/2026
5
+ * Version: 1.0.0-alpha.11
6
6
  * Terms:
7
7
  * Realsee SDK License Agreement
8
8
  * Update: July 28, 2021
@@ -311,7 +311,7 @@ function d(e, t) {
311
311
  }
312
312
  var f = class extends e.Mesh {
313
313
  static get version() {
314
- return "1.0.0-alpha.10";
314
+ return "1.0.0-alpha.11";
315
315
  }
316
316
  constructor(t, n, r) {
317
317
  let a = new e.MeshBasicMaterial();