x_ite 16.2.0 → 16.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/README.md +6 -6
  2. package/dist/assets/components/AnnotationComponent.js +1 -1
  3. package/dist/assets/components/AnnotationComponent.min.js +1 -1
  4. package/dist/assets/components/CADGeometryComponent.js +1 -1
  5. package/dist/assets/components/CADGeometryComponent.min.js +1 -1
  6. package/dist/assets/components/CubeMapTexturingComponent.js +1 -1
  7. package/dist/assets/components/CubeMapTexturingComponent.min.js +1 -1
  8. package/dist/assets/components/DISComponent.js +1 -1
  9. package/dist/assets/components/DISComponent.min.js +1 -1
  10. package/dist/assets/components/EventUtilitiesComponent.js +1 -1
  11. package/dist/assets/components/EventUtilitiesComponent.min.js +1 -1
  12. package/dist/assets/components/GaussianSplatsComponent.js +1 -1
  13. package/dist/assets/components/GaussianSplatsComponent.min.js +1 -1
  14. package/dist/assets/components/Geometry2DComponent.js +1 -1
  15. package/dist/assets/components/Geometry2DComponent.min.js +1 -1
  16. package/dist/assets/components/Geometry3DComponent.js +1 -1
  17. package/dist/assets/components/Geometry3DComponent.min.js +1 -1
  18. package/dist/assets/components/GeospatialComponent.js +1 -1
  19. package/dist/assets/components/GeospatialComponent.min.js +1 -1
  20. package/dist/assets/components/HAnimComponent.js +1 -1
  21. package/dist/assets/components/HAnimComponent.min.js +1 -1
  22. package/dist/assets/components/KeyDeviceSensorComponent.js +1 -1
  23. package/dist/assets/components/KeyDeviceSensorComponent.min.js +1 -1
  24. package/dist/assets/components/LayoutComponent.js +1 -1
  25. package/dist/assets/components/LayoutComponent.min.js +1 -1
  26. package/dist/assets/components/NURBSComponent.js +1 -1
  27. package/dist/assets/components/NURBSComponent.min.js +1 -1
  28. package/dist/assets/components/ParticleSystemsComponent.js +1 -1
  29. package/dist/assets/components/ParticleSystemsComponent.min.js +1 -1
  30. package/dist/assets/components/PickingComponent.js +1 -1
  31. package/dist/assets/components/PickingComponent.min.js +1 -1
  32. package/dist/assets/components/RigidBodyPhysicsComponent.js +2 -2
  33. package/dist/assets/components/RigidBodyPhysicsComponent.min.js +1 -1
  34. package/dist/assets/components/ScriptingComponent.js +1 -1
  35. package/dist/assets/components/ScriptingComponent.min.js +1 -1
  36. package/dist/assets/components/TextComponent.js +1 -1
  37. package/dist/assets/components/TextComponent.min.js +1 -1
  38. package/dist/assets/components/TextureProjectionComponent.js +1 -1
  39. package/dist/assets/components/TextureProjectionComponent.min.js +1 -1
  40. package/dist/assets/components/Texturing3DComponent.js +9 -9
  41. package/dist/assets/components/Texturing3DComponent.min.js +2 -2
  42. package/dist/assets/components/VolumeRenderingComponent.js +1 -1
  43. package/dist/assets/components/VolumeRenderingComponent.min.js +1 -1
  44. package/dist/assets/components/WebXRComponent.js +1 -1
  45. package/dist/assets/components/WebXRComponent.min.js +1 -1
  46. package/dist/assets/components/X_ITEComponent.js +107 -1
  47. package/dist/assets/components/X_ITEComponent.min.js +2 -2
  48. package/dist/example.html +1 -1
  49. package/dist/x_ite.css +1 -1
  50. package/dist/x_ite.js +89 -30
  51. package/dist/x_ite.min.js +2 -2
  52. package/dist/x_ite.min.mjs +2 -2
  53. package/dist/x_ite.mjs +89 -30
  54. package/dist/x_ite.zip +0 -0
  55. package/package.json +5 -5
@@ -1,2 +1,2 @@
1
- /* X_ITE v16.2.0 */
1
+ /* X_ITE v16.3.0 */
2
2
  const e=window[Symbol.for("X_ITE.X3D")];(()=>{const t={n:e=>{const n=e&&e.__esModule?()=>e.default:()=>e;return t.d(n,{a:n}),n},d:(e,n)=>{for(var i in n)t.o(n,i)&&!t.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:n[i]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)},n=e.Components;var i=t.n(n);const s=e.Fields;var o=t.n(s);const r=e.X3DFieldDefinition;var a=t.n(r);const d=e.FieldDefinitionArray;var h=t.n(d);const c=e.X3DNode;var _=t.n(c);const l=e.X3DGeometricPropertyNode;var u=t.n(l);const p=e.X3DConstants;var m=t.n(p);const f=e.Namespace;var g=t.n(f);function x(e){u().call(this,e),this.addType(m().HAnimDisplacer),this._displacements.setUnit("length")}Object.setPrototypeOf(x.prototype,u().prototype),Object.defineProperties(x,{..._().getStaticProperties("HAnimDisplacer","HAnim",1,"displacers","3.0"),fieldDefinitions:{value:new(h())([new(a())(m().inputOutput,"metadata",new(o().SFNode)),new(a())(m().inputOutput,"description",new(o().SFString)),new(a())(m().inputOutput,"name",new(o().SFString)),new(a())(m().inputOutput,"weight",new(o().SFFloat)),new(a())(m().inputOutput,"coordIndex",new(o().MFInt32)),new(a())(m().inputOutput,"displacements",new(o().MFVec3f))]),enumerable:!0}});const T=x,w=g().add("HAnimDisplacer",T),S=e.X3DChildNode;var F=t.n(S);const I=e.Group;var N=t.n(I);const v=e.Transform;var O=t.n(v);const E=e.X3DBoundedObject;var M=t.n(E);const D=e.TraverseType;var y=t.n(D);const A=e.X3DCast;var b=t.n(A);const j=e.Matrix4;var k=t.n(j);const R=e.Algorithm;var C=t.n(R);const X=e.ShaderRegistry;var J=t.n(X);const U=g().add("Skin2.glsl",()=>"\n#if defined(X3D_SKINNING)\nin uint x3d_CoordIndex;\n#if X3D_NUM_JOINT_SETS>0\nuniform sampler2D x3d_JointsTexture;\n#endif\n#if X3D_NUM_DISPLACEMENTS>0\nuniform sampler2D x3d_DisplacementsTexture;uniform sampler2D x3d_DisplacementWeightsTexture;\n#endif\n#if X3D_NUM_JOINT_SETS>0||X3D_NUM_DISPLACEMENTS>0\nuniform sampler2D x3d_JointMatricesTexture;\n#endif\n#if X3D_NUM_JOINT_SETS>0\nmat4 getJointMatrix(const in int joint){vec4 a=texelFetch(x3d_JointMatricesTexture,joint*8,0);vec4 b=texelFetch(x3d_JointMatricesTexture,joint*8+1,0);vec4 c=texelFetch(x3d_JointMatricesTexture,joint*8+2,0);vec4 d=texelFetch(x3d_JointMatricesTexture,joint*8+3,0);return mat4(a,b,c,d);}\n#if defined(X3D_NORMALS)\nmat3 getJointNormalMatrix(const in int joint){vec4 a=texelFetch(x3d_JointMatricesTexture,joint*8+4,0);vec4 b=texelFetch(x3d_JointMatricesTexture,joint*8+5,0);vec4 c=texelFetch(x3d_JointMatricesTexture,joint*8+6,0);return mat3(a.xyz,vec3(a.w,b.xy),vec3(b.zw,c.x));}\n#endif\n#endif\n#if X3D_NUM_DISPLACEMENTS>0\nmat3 getDisplacementJointMatrix(const in int joint){vec4 a=texelFetch(x3d_JointMatricesTexture,joint*8,0);vec4 b=texelFetch(x3d_JointMatricesTexture,joint*8+1,0);vec4 c=texelFetch(x3d_JointMatricesTexture,joint*8+2,0);return mat3(a.xyz,b.xyz,c.xyz);}\n#endif\n#if defined(X3D_NORMALS)\nvec3 skinNormal=vec3(0);\n#if defined(X3D_TANGENTS)\nvec3 skinTangent=vec3(0);\n#endif\n#define getSkinNormal(normal)(skinNormal)\n#if defined(X3D_TANGENTS)\n#define getSkinTangent(tangent)(skinTangent)\n#endif\n#else\n#define getSkinNormal(normal)(normal)\n#define getSkinTangent(tangent)(tangent)\n#endif\nvec4 getSkinVertex(const in vec4 vertex,const in vec3 normal,const in vec3 tangent){int coordIndex=int(x3d_CoordIndex);vec4 skin=vertex;\n#if defined(X3D_NORMALS)\nskinNormal=normal;\n#if defined(X3D_TANGENTS)\nskinTangent=tangent;\n#endif\n#endif\n#if X3D_NUM_DISPLACEMENTS>0\n{int coordIndexD=coordIndex*(X3D_NUM_DISPLACEMENTS*2);for(int i=0;i<X3D_NUM_DISPLACEMENTS;++i){int index=coordIndexD+i*2;vec4 displacement=texelFetch(x3d_DisplacementsTexture,index,0);int weightIndex=int(texelFetch(x3d_DisplacementsTexture,index+1,0).x);float weight=texelFetch(x3d_DisplacementWeightsTexture,weightIndex,0).x;skin.xyz+=getDisplacementJointMatrix(int(displacement.w))*(displacement.xyz*weight);}}\n#endif\n#if X3D_NUM_JOINT_SETS>0\n{int coordIndexJ=coordIndex*(X3D_NUM_JOINT_SETS*2);for(int i=0;i<X3D_NUM_JOINT_SETS;++i){int index=coordIndexJ+i;ivec4 joints=ivec4(texelFetch(x3d_JointsTexture,index,0));vec4 weights=texelFetch(x3d_JointsTexture,index+X3D_NUM_JOINT_SETS,0);for(int i=0;i<4;++i){int joint=joints[i];float weight=weights[i];skin+=(getJointMatrix(joint)*vertex-vertex)*weight;\n#if defined(X3D_NORMALS)\nmat3 jointNormalMatrix=getJointNormalMatrix(joint);skinNormal+=(jointNormalMatrix*normal-normal)*weight;\n#if defined(X3D_TANGENTS)\nskinTangent+=(jointNormalMatrix*tangent-tangent)*weight;\n#endif\n#endif\n}}}\n#endif\nreturn skin;}\n#endif\n");function V(e){F().call(this,e),M().call(this,e),this.addType(m().X3DTransformMatrix3DNode),this.addType(m().HAnimHumanoid),this.addChildObjects(m().outputOnly,"jointName",new(o().SFTime),m().outputOnly,"jointTextures",new(o().SFTime),m().outputOnly,"displacementsTexture",new(o().SFTime),m().outputOnly,"displacementWeightsTexture",new(o().SFTime)),this._translation.setUnit("length"),this._center.setUnit("length"),this._bboxSize.setUnit("length"),this._bboxCenter.setUnit("length"),e.getSpecificationVersion()<=3.3&&(this._version=""),this.skeletonNode=new(N())(e),this.viewpointsNode=new(N())(e),this.skinNode=new P(e,this),this.transformNode=new(O())(e),this.poseNodes=[],this.motionNodes=[],this.jointNodes=[],this.jointBindingMatrices=[],this.displacementWeights=[],this.numJoints=0,this.numDisplacements=0,this.update=new W,this.skinning=Function.prototype}J().addIncludeFile("Skin",U),Object.assign(Object.setPrototypeOf(V.prototype,F().prototype),M().prototype,{initialize(){F().prototype.initialize.call(this),M().prototype.initialize.call(this),this.skeletonNode.addAllowedTypes(m().HAnimJoint,m().HAnimSite),this.viewpointsNode.addAllowedTypes(m().HAnimSite),this._skeleton.addFieldInterest(this.skeletonNode._children),this._viewpoints.addFieldInterest(this.viewpointsNode._children),this._skin.addFieldInterest(this.skinNode._children),this.skeletonNode._children=this._skeleton,this.viewpointsNode._children=this._viewpoints,this.skinNode._children=this._skin,this.skeletonNode.setPrivate(!0),this.viewpointsNode.setPrivate(!0),this.skinNode.setPrivate(!0),this._translation.addFieldInterest(this.transformNode._translation),this._rotation.addFieldInterest(this.transformNode._rotation),this._scale.addFieldInterest(this.transformNode._scale),this._scaleOrientation.addFieldInterest(this.transformNode._scaleOrientation),this._center.addFieldInterest(this.transformNode._center),this._bboxSize.addFieldInterest(this.transformNode._bboxSize),this._bboxCenter.addFieldInterest(this.transformNode._bboxCenter),this.transformNode._translation=this._translation,this.transformNode._rotation=this._rotation,this.transformNode._scale=this._scale,this.transformNode._scaleOrientation=this._scaleOrientation,this.transformNode._center=this._center,this.transformNode._bboxSize=this._bboxSize,this.transformNode._bboxCenter=this._bboxCenter,this.transformNode._children=[this.skeletonNode,this.viewpointsNode,this.skinNode],this.skeletonNode.setup(),this.viewpointsNode.setup(),this.skinNode.setup(),this.transformNode.setup(),this.connectChildNode(this.transformNode);const e=this.getBrowser().getContext();this.jointsTexture=e.createTexture(),this.displacementsTexture=e.createTexture(),this.displacementWeightsTexture=e.createTexture(),this.jointMatricesTexture=e.createTexture();for(const t of[this.jointsTexture,this.displacementsTexture,this.displacementWeightsTexture,this.jointMatricesTexture])e.bindTexture(e.TEXTURE_2D,t),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.NEAREST);this._children.addInterest("set_children__",this),this._motionsEnabled.addInterest("set_motions__",this),this._motions.addInterest("set_motions__",this),this._jointBindingPositions.addInterest("set_joints__",this),this._jointBindingRotations.addInterest("set_joints__",this),this._jointBindingScales.addInterest("set_joints__",this),this._joints.addInterest("set_joints__",this),this._jointName.addInterest("set_connectAllJoints__",this),this._jointTextures.addInterest("set_jointTextures__",this),this._displacementsTexture.addInterest("set_displacementsTexture__",this),this._displacementWeightsTexture.addInterest("set_displacementWeightsTexture__",this),this._skinCoord.addInterest("set_skinCoord__",this),this.set_children__(),this.set_motions__(),this.set_joints__(),this.set_skinCoord__(),this._segments.addInterest("set_depreciated__",this),this._sites.addInterest("set_depreciated__",this),this.set_depreciated__(this._segments,"4.1"),this.set_depreciated__(this._sites,"4.1")},set_depreciated__(e,t){e.length&&(this.getExecutionContext().getSpecificationVersion()<t||console.warn(`Use of field ${this.getTypeName()}.${e.getName()} is deprecated. This field may be removed in future versions of X3D.`))},getBBox(e,t){return this.transformNode.getBBox(e,t)},getSubBBox(e,t){return this.transformNode.getSubBBox(e,t)},getShapes(e,t){return this.transformNode.getShapes(e,t)},getMatrix(){return this.transformNode.getMatrix()},getHAnimKey(){return this.humanoidKey},set_humanoidKey__(){this.humanoidKey=`[${this.numJoints}.${this.numDisplacements}]`},set_children__(){const e=this.poseNodes;for(const e of this.poseNodes)e._set_fraction.removeInterest("set_pose_fraction__",this),e._isActive.removeInterest("set_pose_active__",this),e.removeJoints(this.jointNodes);e.length=0;for(const t of this._children){const n=b()(m().HAnimPose,t);n&&e.push(n)}for(const e of this.poseNodes)e._set_fraction.addInterest("set_pose_fraction__",this,e),e._isActive.addInterest("set_pose_active__",this),e.addJoints(this.jointNodes)},set_pose_fraction__(e){for(const t of this.poseNodes)t!==e&&t.setNeedsUpdateInterpolators()},set_pose_active__(e){if(!e.getValue())for(const e of this.poseNodes)e.setNeedsUpdateInterpolators()},set_motions__(){const e=this._motionsEnabled,t=this.motionNodes;for(const e of t)e._joints.removeInterest("set_connectJoints__",this),e._channelsEnabled.removeInterest("set_connectJoints__",this),e._channels.removeInterest("set_connectJoints__",this),e._values.removeInterest("set_connectJoints__",this),e.disconnectJoints();t.length=0;for(const[n,i]of this._motions.entries()){if(n<e.length&&!e[n])continue;const s=b()(m().HAnimMotion,i);s&&t.push(s)}for(const e of t)e._joints.addInterest("set_connectJoints__",this,e),e._channelsEnabled.addInterest("set_connectJoints__",this,e),e._channels.addInterest("set_connectJoints__",this,e),e._values.addInterest("set_connectJoints__",this,e),e.connectJoints(this.jointNodes)},set_connectAllJoints__(){for(const e of this.motionNodes)this.set_connectJoints__(e)},set_connectJoints__(e){e.disconnectJoints(),e.connectJoints(this.jointNodes)},set_joints__(){const e=this.jointNodes,t=this.jointBindingMatrices,n=this._jointBindingPositions,i=this._jointBindingRotations,s=this._jointBindingScales;for(const t of this.poseNodes)t.removeJoints(e);for(const e of this.motionNodes)e.disconnectJoints();for(const t of e)t.removeInterest("unlock",this.update),t._name.removeInterest("addEvent",this._jointName),t._skinCoordIndex.removeInterest("addEvent",this._jointTextures),t._skinCoordWeight.removeInterest("addEvent",this._jointTextures),t._displacements.removeInterest("addEvent",this._displacementsTexture),t._displacementWeights.removeInterest("addEvent",this._displacementWeightsTexture);e.length=0,t.length=0;for(const[o,r]of this._joints.entries()){const a=b()(m().HAnimJoint,r);if(!a)continue;const d=n[o]?.getValue(),h=i[o]?.getValue(),c=s[o]?.getValue();e.push(a),t.push(k().fromTransform(d,h,c))}for(const t of e)t.addInterest("unlock",this.update),t._name.addInterest("addEvent",this._jointName),t._skinCoordIndex.addInterest("addEvent",this._jointTextures),t._skinCoordWeight.addInterest("addEvent",this._jointTextures),t._displacements.addInterest("addEvent",this._displacementsTexture),t._displacementWeights.addInterest("addEvent",this._displacementWeightsTexture);for(const t of this.poseNodes)t.addJoints(e);for(const t of this.motionNodes)t.connectJoints(e);const o=Math.ceil(Math.sqrt(8*e.length));this.jointMatricesArray=new Float32Array(o*o*4),this._jointTextures.addEvent(),this._displacementsTexture.addEvent(),this._displacementWeightsTexture.addEvent()},set_jointTextures__(){const e=this.skinCoordNode?._point.length||1,t=Array.from({length:e},()=>[]),n=Array.from({length:e},()=>[]);for(const[e,i]of this.jointNodes.entries()){const s=i._skinCoordWeight.getValue();for(const[o,r]of i._skinCoordIndex.entries()){const i=s[o];0!==i&&(t[r]?.push(e),n[r]?.push(i))}}const i=C().roundToMultiple(t.reduce((e,t)=>Math.max(e,t.length),0),4),s=2*i,o=Math.ceil(Math.sqrt(e*s))||1,r=new Float32Array(o*o*4);for(let o=0;o<e;++o)r.set(t[o],o*s),r.set(n[o],o*s+i);this.numJoints=i;const a=this.getBrowser().getContext();a.bindTexture(a.TEXTURE_2D,this.jointsTexture),a.texImage2D(a.TEXTURE_2D,0,a.RGBA32F,o,o,0,a.RGBA,a.FLOAT,r),this.update.unlock(),this.set_humanoidKey__()},set_displacementsTexture__(){const e=this.skinCoordNode?._point.length||1,t=Array.from({length:e},()=>[]);let n=0;this.displacementWeights.length=0;for(const[e,i]of this.jointNodes.entries())for(const{_weight:s,_coordIndex:o,_displacements:r}of i.getDisplacers())if(o.length){this.displacementWeights.push(s,0,0,0);for(const[i,s]of o.entries())t[s]?.push(...r[i],e,n,0,0,0);++n}const i=t.reduce((e,t)=>Math.max(e,t.length),0)/8,s=8*i,o=Math.ceil(Math.sqrt(e*i*2))||1,r=new Float32Array(o*o*4);for(let n=0;n<e;++n)r.set(t[n],n*s);this.numDisplacements=i;const a=this.getBrowser().getContext();a.bindTexture(a.TEXTURE_2D,this.displacementsTexture),a.texImage2D(a.TEXTURE_2D,0,a.RGBA32F,o,o,0,a.RGBA,a.FLOAT,r),this.displacementWeightsSize=Math.ceil(Math.sqrt(n)),this.displacementWeightsArray=new Float32Array(this.displacementWeightsSize*this.displacementWeightsSize*4),this.update.unlock(),this.set_humanoidKey__()},set_displacementWeightsTexture__(){const e=this.getBrowser().getContext(),t=this.displacementWeightsSize,n=this.displacementWeightsArray;n.set(this.displacementWeights),e.bindTexture(e.TEXTURE_2D,this.displacementWeightsTexture),e.texImage2D(e.TEXTURE_2D,0,e.RGBA32F,t,t,0,e.RGBA,e.FLOAT,n)},set_skinCoord__(){this.skinCoordNode&&(this.skinCoordNode.removeInterest("addEvent",this._jointTextures),this.skinCoordNode.removeInterest("addEvent",this._displacementsTexture),this.skinCoordNode.removeInterest("addEvent",this._displacementWeightsTexture)),this.skinCoordNode=b()(m().Coordinate,this._skinCoord)??b()(m().CoordinateDouble,this._skinCoord),this.skinCoordNode?(delete this.skinning,this.skinCoordNode.addInterest("addEvent",this._jointTextures),this.skinCoordNode.addInterest("addEvent",this._displacementsTexture),this.skinCoordNode.addInterest("addEvent",this._displacementWeightsTexture)):this.skinning=Function.prototype,this._jointTextures.addEvent(),this._displacementsTexture.addEvent(),this._displacementWeightsTexture.addEvent()},traverse(e,t){const n=t.getInvHumanoidMatrix();n.push(this.transformNode.getMatrix()),n.multRight(t.getModelViewMatrix().get()),n.inverse(),this.transformNode.traverse(e,t),this.skinning(e,t),n.pop()},skinning(e,t){if(e!==y().DISPLAY||this.update.lock())return;const n=t.getInvHumanoidMatrix().get(),i=this.jointNodes,s=i.length,o=this.jointBindingMatrices,r=this.jointMatricesArray,a=Math.ceil(Math.sqrt(8*s));for(let e=0;e<s;++e){const t=i[e],s=o[e],a=t.getModelViewMatrix().multRight(n).multLeft(s),d=a.submatrix.transpose().inverse();r.set(a,32*e+0),r.set(d,32*e+16)}const d=this.getBrowser().getContext();d.bindTexture(d.TEXTURE_2D,this.jointMatricesTexture),d.texImage2D(d.TEXTURE_2D,0,d.RGBA32F,a,a,0,d.RGBA,d.FLOAT,r)},getShaderOptions(e){e.push("X3D_SKINNING"),e.push("X3D_NUM_JOINT_SETS "+this.numJoints/4),e.push(`X3D_NUM_DISPLACEMENTS ${this.numDisplacements}`)},setShaderUniforms(e,t){const n=this.getBrowser(),i=n.popTextureUnit(),s=n.popTextureUnit();if(e.activeTexture(e.TEXTURE0+i),e.bindTexture(e.TEXTURE_2D,this.jointsTexture),e.uniform1i(t.x3d_JointsTexture,i),e.activeTexture(e.TEXTURE0+s),e.bindTexture(e.TEXTURE_2D,this.jointMatricesTexture),e.uniform1i(t.x3d_JointMatricesTexture,s),!this.numDisplacements)return;const o=n.popTextureUnit(),r=n.popTextureUnit();e.activeTexture(e.TEXTURE0+o),e.bindTexture(e.TEXTURE_2D,this.displacementsTexture),e.uniform1i(t.x3d_DisplacementsTexture,o),e.activeTexture(e.TEXTURE0+r),e.bindTexture(e.TEXTURE_2D,this.displacementWeightsTexture),e.uniform1i(t.x3d_DisplacementWeightsTexture,r)},dispose(){M().prototype.dispose.call(this),F().prototype.dispose.call(this)}}),Object.defineProperties(V,{..._().getStaticProperties("HAnimHumanoid","HAnim",1,"children","3.0"),fieldDefinitions:{value:new(h())([new(a())(m().inputOutput,"metadata",new(o().SFNode)),new(a())(m().inputOutput,"description",new(o().SFString)),new(a())(m().inputOutput,"name",new(o().SFString)),new(a())(m().inputOutput,"info",new(o().MFString)),new(a())(m().inputOutput,"version",new(o().SFString)("2.1")),new(a())(m().inputOutput,"skeletalConfiguration",new(o().SFString)("BASIC")),new(a())(m().inputOutput,"loa",new(o().SFInt32)(-1)),new(a())(m().inputOutput,"translation",new(o().SFVec3f)),new(a())(m().inputOutput,"rotation",new(o().SFRotation)),new(a())(m().inputOutput,"scale",new(o().SFVec3f)(1,1,1)),new(a())(m().inputOutput,"scaleOrientation",new(o().SFRotation)),new(a())(m().inputOutput,"center",new(o().SFVec3f)),new(a())(m().inputOutput,"visible",new(o().SFBool)(!0)),new(a())(m().inputOutput,"bboxDisplay",new(o().SFBool)),new(a())(m().initializeOnly,"bboxSize",new(o().SFVec3f)(-1,-1,-1)),new(a())(m().initializeOnly,"bboxCenter",new(o().SFVec3f)),new(a())(m().inputOutput,"skeleton",new(o().MFNode)),new(a())(m().inputOutput,"jointBindingPositions",new(o().MFVec3f)),new(a())(m().inputOutput,"jointBindingRotations",new(o().MFRotation)),new(a())(m().inputOutput,"jointBindingScales",new(o().MFVec3f)),new(a())(m().inputOutput,"joints",new(o().MFNode)),new(a())(m().inputOutput,"segments",new(o().MFNode)),new(a())(m().inputOutput,"sites",new(o().MFNode)),new(a())(m().inputOutput,"viewpoints",new(o().MFNode)),new(a())(m().inputOutput,"children",new(o().MFNode)),new(a())(m().inputOutput,"motionsEnabled",new(o().MFBool)),new(a())(m().inputOutput,"motions",new(o().MFNode)),new(a())(m().inputOutput,"skinBindingNormals",new(o().SFNode)),new(a())(m().inputOutput,"skinBindingCoords",new(o().SFNode)),new(a())(m().inputOutput,"skinNormal",new(o().SFNode)),new(a())(m().inputOutput,"skinCoord",new(o().SFNode)),new(a())(m().inputOutput,"skin",new(o().MFNode))]),enumerable:!0}});class P extends(N()){#e;constructor(e,t){super(e),this.#e=t}traverse(e,t){t.getHAnimNode().push(this.#e),super.traverse(e,t),t.getHAnimNode().pop()}}class W{#t=!0;unlock(){this.#t=!1}lock(){const e=this.#t;return this.#t=!0,e}}const B=V,H=g().add("HAnimHumanoid",B),z=e.X3DTransformNode;var L=t.n(z);function G(e){L().call(this,e),this.addType(m().HAnimJoint),this.addChildObjects(m().outputOnly,"displacements",new(o().SFTime),m().outputOnly,"displacementWeights",new(o().SFTime)),this.setVisibleObject(!0),this.addAllowedTypes(m().HAnimJoint,m().HAnimSegment),this._minAngle.setUnit("angle"),this._maxAngle.setUnit("angle"),e.getSpecificationVersion()<=3.3&&this.addAllowedTypes(m().HAnimSite),this.displacerNodes=[],this.modelViewMatrix=new(k())}Object.assign(Object.setPrototypeOf(G.prototype,L().prototype),{initialize(){L().prototype.initialize.call(this),this._displacers.addInterest("set_displacers__",this),this.set_displacers__()},getModelViewMatrix(){return this.modelViewMatrix},getDisplacers(){return this.displacerNodes},set_visibleObjects__(){},set_displacers__(){const e=this.displacerNodes;for(const t of e)t._coordIndex.removeInterest("addEvent",this._displacements),t._displacements.removeInterest("addEvent",this._displacements),t._coordIndex.removeInterest("addEvent",this._displacementWeights),t._weight.removeInterest("addEvent",this._displacementWeights);e.length=0;for(const t of this._displacers){const n=b()(m().HAnimDisplacer,t);n&&e.push(n)}for(const t of e)t._coordIndex.addInterest("addEvent",this._displacements),t._displacements.addInterest("addEvent",this._displacements),t._coordIndex.addInterest("addEvent",this._displacementWeights),t._weight.addInterest("addEvent",this._displacementWeights);this._displacements.addEvent(),this._displacementWeights.addEvent()},traverse(e,t){const n=t.getModelViewMatrix();n.push(),n.multLeft(this.getMatrix()),e===y().DISPLAY&&this.modelViewMatrix.assign(n.get()),L().prototype.groupTraverse.call(this,e,t),n.pop()},groupTraverse(e,t){e===y().DISPLAY&&this.modelViewMatrix.assign(t.getModelViewMatrix().get()),L().prototype.groupTraverse.call(this,e,t)}}),Object.defineProperties(G,{..._().getStaticProperties("HAnimJoint","HAnim",1,"children","3.0"),fieldDefinitions:{value:new(h())([new(a())(m().inputOutput,"metadata",new(o().SFNode)),new(a())(m().inputOutput,"description",new(o().SFString)),new(a())(m().inputOutput,"name",new(o().SFString)),new(a())(m().inputOutput,"translation",new(o().SFVec3f)),new(a())(m().inputOutput,"rotation",new(o().SFRotation)),new(a())(m().inputOutput,"scale",new(o().SFVec3f)(1,1,1)),new(a())(m().inputOutput,"scaleOrientation",new(o().SFRotation)),new(a())(m().inputOutput,"center",new(o().SFVec3f)),new(a())(m().inputOutput,"limitOrientation",new(o().SFRotation)),new(a())(m().inputOutput,"llimit",new(o().MFFloat)(0,0,0)),new(a())(m().inputOutput,"ulimit",new(o().MFFloat)(0,0,0)),new(a())(m().inputOutput,"minAngle",new(o().SFFloat)),new(a())(m().inputOutput,"maxAngle",new(o().SFFloat)),new(a())(m().inputOutput,"stiffness",new(o().MFFloat)(0,0,0)),new(a())(m().inputOutput,"skinCoordIndex",new(o().MFInt32)),new(a())(m().inputOutput,"skinCoordWeight",new(o().MFFloat)),new(a())(m().inputOutput,"displacers",new(o().MFNode)),new(a())(m().inputOutput,"visible",new(o().SFBool)(!0)),new(a())(m().inputOutput,"bboxDisplay",new(o().SFBool)),new(a())(m().initializeOnly,"bboxSize",new(o().SFVec3f)(-1,-1,-1)),new(a())(m().initializeOnly,"bboxCenter",new(o().SFVec3f)),new(a())(m().inputOnly,"addChildren",new(o().MFNode)),new(a())(m().inputOnly,"removeChildren",new(o().MFNode)),new(a())(m().inputOutput,"children",new(o().MFNode))]),enumerable:!0}});const K=G,q=g().add("HAnimJoint",K),$=e.TimeSensor;var Y=t.n($);const Z=e.PositionInterpolator;var Q=t.n(Z);const ee=e.OrientationInterpolator;var te=t.n(ee);const ne=e.Vector3;var ie=t.n(ne);const se=e.Rotation4;var oe=t.n(se);function re(e){F().call(this,e),this.addType(m().HAnimMotion),this.timeSensor=new(Y())(this.getExecutionContext()),this.interpolators=[]}Object.assign(Object.setPrototypeOf(re.prototype,F().prototype),{initialize(){F().prototype.initialize.call(this),this._loop.addFieldInterest(this.timeSensor._loop),this.timeSensor._cycleTime.addFieldInterest(this._cycleTime),this.timeSensor._elapsedTime.addFieldInterest(this._elapsedTime),this.timeSensor._enabled=!1,this.timeSensor._loop=this._loop,this.timeSensor._stopTime=1,this.timeSensor.setup(),this._enabled.addInterest("set_enabled__",this),this._joints.addInterest("set_joints__",this),this._channels.addInterest("set_interpolators__",this),this._values.addInterest("set_interpolators__",this),this._next.addInterest("set_next_or_previous__",this,1),this._previous.addInterest("set_next_or_previous__",this,-1),this._frameIndex.addInterest("set_frameIndex__",this),this._frameDuration.addInterest("set_frameDuration__",this),this._frameIncrement.addInterest("set_frameIncrement__",this),this._startFrame.addInterest("set_start_or_endFrame__",this),this._endFrame.addInterest("set_start_or_endFrame__",this),this.set_enabled__(),this.set_joints__(),this.set_frameIncrement__(),this.set_interpolators__()},connectJoints(e){const t=this._channelsEnabled,n=this.joints,i=this.getJointsIndex(e);for(const[e,s]of this.interpolators.entries()){if(e<t.length&&!t[e])continue;const o=i.get(n[e]);if(o)for(const[e,t]of Object.entries(s))t._value_changed.addFieldInterest(o.getField(e))}},disconnectJoints(){for(const e of this.interpolators)for(const t of Object.values(e))Array.from(t._value_changed.getFieldInterests()).forEach(e=>t._value_changed.removeFieldInterest(e))},getJointsIndex(e){const t=new Map(e.map(e=>[e._name.getValue().trim(),e]));return t.delete("IGNORED"),t.set("HumanoidRoot",t.get("humanoid_root")),t},set_enabled__(){this._enabled.getValue()?this.timeSensor._startTime=Date.now()/1e3:this.timeSensor._stopTime=Date.now()/1e3},set_joints__(){this.joints=this._joints.getValue().replace(/^[\s,]+|[\s,]+$/gs,"").split(/[\s,]+/s),this.disconnectJoints()},set_interpolators__:(()=>{const e=["X","Y","Z"];return function(){const t=this.timeSensor;Array.from(t._fraction_changed.getFieldInterests()).forEach(e=>t._fraction_changed.removeFieldInterest(e));const n=this._channels.getValue().replace(/^[\s,\d]+|[\s,\d]+$/gs,"").split(/[\s,]+\d+[\s,]+/s).map(e=>e.split(/[\s,]+/s)),i=this._values,s=n.reduce((e,t)=>e+t.length,0),o=Math.floor(s?i.length/s:0),r=Array.from({length:n.length},()=>({})),a=new(ie()),d=new(oe()),h=new(ie());this.interpolators=r;for(let s=0,c=0;s<o;++s){const _=s/(o-1);for(const[s,o]of n.entries()){let n,l,u=0,p=0,m=0,f=0,g=0,x=0,T="",w=1,S=1,F=1;for(const e of o)switch(e){case"Xposition":n=!0,u=i[c++];break;case"Yposition":n=!0,p=i[c++];break;case"Zposition":n=!0,m=i[c++];break;case"Xrotation":T+="X",f=C().radians(i[c++]);break;case"Yrotation":T+="Y",g=C().radians(i[c++]);break;case"Zrotation":T+="Z",x=C().radians(i[c++]);break;case"Xscale":l=!0,w=i[c++];break;case"Yscale":l=!0,S=i[c++];break;case"Zscale":l=!0,F=i[c++];break;default:c++}if(n){const e=r[s].translation??=(()=>{const e=new(Q())(this.getExecutionContext());return t._fraction_changed.addFieldInterest(e._set_fraction),e})();e._key.push(_),e._keyValue.push(a.set(u,p,m))}if(T.length){const n=r[s].rotation??=(()=>{const e=new(te())(this.getExecutionContext());return t._fraction_changed.addFieldInterest(e._set_fraction),e})();if(3!==T.length)if(T.length<3)for(const t of e)T.includes(t)||(T+=t);else T=T.slice(0,3);n._key.push(_),n._keyValue.push(d.setEuler(f,g,x,T))}if(l){const e=r[s].scale??=(()=>{const e=new(Q())(this.getExecutionContext());return t._fraction_changed.addFieldInterest(e._set_fraction),e})();e._key.push(_),e._keyValue.push(h.set(w,S,F))}}}for(const e of r)for(const t of Object.values(e))t.setup();this._frameIndex=0,this._startFrame=0,this._endFrame=Math.max(o-1,0),this._frameCount=o,this.set_frameDuration__()}})(),set_next_or_previous__(e,t){if(!t.getValue())return;const n=this.getFraction(),i=this._frameCount.getValue(),s=this._frameIncrement.getValue(),o=(i>1?Math.floor(n*(i-1)):0)+s*e;if(o>this.endFrame){if(!this._loop.getValue())return;this._frameIndex=this.startFrame}else if(o<this.startFrame){if(!this._loop.getValue())return;this._frameIndex=this.endFrame}else this._frameIndex=o},set_frameIndex__(){const e=this._frameCount.getValue(),t=C().clamp(this._frameIndex.getValue(),0,e),n=e>1?t/(e-1):0;if(this.timeSensor._range[0]=n,!this.timeSensor._isActive.getValue())for(const e of this.timeSensor._fraction_changed.getFieldInterests())e.setValue(n)},set_frameDuration__(){const e=this._frameCount.getValue(),t=Math.max(this._frameDuration.getValue(),0);this.timeSensor._cycleInterval=e>1?(e-1)*t:0},set_frameIncrement__(){this.timeSensor._enabled=this._frameIncrement.getValue()},set_start_or_endFrame__(){const e=this._frameCount.getValue(),t=C().clamp(this._startFrame.getValue(),0,e),n=C().clamp(this._endFrame.getValue(),0,e);this.startFrame=Math.min(t,n),this.endFrame=Math.max(t,n),this.timeSensor._range[1]=e>1?this.startFrame/(e-1):0,this.timeSensor._range[2]=e>1?this.endFrame/(e-1):0},getFraction(){for(const e of this.timeSensor._fraction_changed.getFieldInterests())return e.getValue();return 0}}),Object.defineProperties(re,{..._().getStaticProperties("HAnimMotion","HAnim",2,"motions","4.0"),fieldDefinitions:{value:new(h())([new(a())(m().inputOutput,"metadata",new(o().SFNode)),new(a())(m().inputOutput,"description",new(o().SFString)),new(a())(m().inputOutput,"name",new(o().SFString)),new(a())(m().inputOutput,"loa",new(o().SFInt32)(-1)),new(a())(m().inputOutput,"enabled",new(o().SFBool)(!0)),new(a())(m().inputOutput,"joints",new(o().SFString)),new(a())(m().inputOutput,"channelsEnabled",new(o().MFBool)),new(a())(m().inputOutput,"channels",new(o().SFString)),new(a())(m().inputOutput,"values",new(o().MFFloat)),new(a())(m().inputOutput,"loop",new(o().SFBool)),new(a())(m().inputOnly,"next",new(o().SFBool)),new(a())(m().inputOnly,"previous",new(o().SFBool)),new(a())(m().inputOutput,"frameIndex",new(o().SFInt32)),new(a())(m().inputOutput,"frameDuration",new(o().SFTime)(.1)),new(a())(m().inputOutput,"frameIncrement",new(o().SFInt32)(1)),new(a())(m().inputOutput,"startFrame",new(o().SFInt32)),new(a())(m().inputOutput,"endFrame",new(o().SFInt32)),new(a())(m().outputOnly,"cycleTime",new(o().SFTime)),new(a())(m().outputOnly,"elapsedTime",new(o().SFTime)),new(a())(m().outputOnly,"frameCount",new(o().SFInt32))]),enumerable:!0}});const ae=re,de=g().add("HAnimMotion",ae);function he(e){F().call(this,e),this.addType(m().HAnimPose),this.timeSensor=new(Y())(this.getExecutionContext()),this.interpolators=[],this.poseJointNodes=new Map,this.joints=new Set}Object.assign(Object.setPrototypeOf(he.prototype,F().prototype),{initialize(){F().prototype.initialize.call(this),this._enabled.addFieldInterest(this.timeSensor._enabled),this._transitionDuration.addFieldInterest(this.timeSensor._cycleInterval),this.timeSensor._isActive.addFieldInterest(this._isActive),this.timeSensor._enabled=this._enabled,this.timeSensor._cycleInterval=this._transitionDuration,this.timeSensor.setup(),this._resetAllJoints.addInterest("set_resetAllJoints__",this),this._commencePose.addInterest("set_commencePose__",this),this._set_startTime.addInterest("set_startTime__",this),this._set_fraction.addInterest("set_fraction__",this),this._children.addInterest("set_children__",this),this.set_children__()},addJoints(e){this.joints.add(e),this.needsUpdateInterpolators=!0},removeJoints(e){this.joints.delete(e)},setNeedsUpdateInterpolators(){this.needsUpdateInterpolators=!0},updateInterpolators(e){this.needsUpdateInterpolators=!1;for(const e of this.interpolators)this.timeSensor._fraction_changed.removeFieldInterest(e._set_fraction);this.interpolators.length=0;for(const t of this.joints)for(const n of t)this.processJoint(n,e);for(const e of this.interpolators)this.timeSensor._fraction_changed.addFieldInterest(e._set_fraction)},processJoint:(()=>{const e=[["translation","PositionInterpolator"],["rotation","OrientationInterpolator"],["scale","PositionInterpolator"]];return function(t,n){let i;if(!n&&(i=this.poseJointNodes.get(t._name.getValue()),!i&&this.poseJointNodes.size))return;const s=this.getExecutionContext();for(const[n,o]of e){const e=t.getField(n),r=i?i.getField(n):t.getFieldDefinition(n).value;if(e.equals(r))continue;const a=s.createNode(o,!1);a._value_changed.addFieldInterest(e),a._key=[0,1],a._keyValue=[...e,...r],a.setup(),this.interpolators.push(a)}}})(),set_resetAllJoints__(){this._resetAllJoints.getValue()&&(this.updateInterpolators(!0),this.timeSensor._startTime=Date.now()/1e3)},set_commencePose__(){this._commencePose.getValue()&&this.set_startTime__()},set_startTime__(){this.updateInterpolators(!1),this.timeSensor._startTime=Date.now()/1e3},set_fraction__(){this.needsUpdateInterpolators&&this.updateInterpolators();const e=this._set_fraction.getValue();for(const t of this.interpolators)t._set_fraction=e},set_children__(){this.poseJointNodes.clear();for(const e of this._children){const t=b()(m().HAnimJoint,e);t&&this.poseJointNodes.set(t._name.getValue(),t)}}}),Object.defineProperties(he,{..._().getStaticProperties("HAnimPose","HAnim",3,"children","4.1"),fieldDefinitions:{value:new(h())([new(a())(m().inputOutput,"metadata",new(o().SFNode)),new(a())(m().inputOutput,"description",new(o().SFString)),new(a())(m().inputOutput,"name",new(o().SFString)),new(a())(m().inputOutput,"loa",new(o().SFInt32)(-1)),new(a())(m().inputOutput,"enabled",new(o().SFBool)(!0)),new(a())(m().inputOutput,"transitionDuration",new(o().SFTime)(0)),new(a())(m().inputOnly,"resetAllJoints",new(o().SFBool)),new(a())(m().inputOnly,"commencePose",new(o().SFBool)),new(a())(m().inputOnly,"set_startTime",new(o().SFTime)),new(a())(m().inputOnly,"set_fraction",new(o().SFFloat)),new(a())(m().outputOnly,"isActive",new(o().SFBool)),new(a())(m().inputOutput,"children",new(o().MFNode))]),enumerable:!0}});const ce=he,_e=g().add("HAnimPose",ce),le=e.X3DGroupingNode;var ue=t.n(le);function pe(e){ue().call(this,e),this.addType(m().HAnimSegment),this.addChildObjects(m().outputOnly,"displacementsTexture",new(o().SFTime),m().outputOnly,"displacementWeightsTexture",new(o().SFTime)),this._mass.setUnit("mass");const t=Math.ceil(Math.sqrt(8));this.numJoints=0,this.numDisplacements=0,this.displacerNodes=[],this.displacementWeights=[],this.jointMatricesArray=new Float32Array(t*t*4)}Object.assign(Object.setPrototypeOf(pe.prototype,ue().prototype),{initialize(){ue().prototype.initialize.call(this);const e=this.getBrowser().getContext();this.displacementsTexture=e.createTexture(),this.displacementWeightsTexture=e.createTexture(),this.jointMatricesTexture=e.createTexture();for(const t of[this.displacementsTexture,this.displacementWeightsTexture,this.jointMatricesTexture])e.bindTexture(e.TEXTURE_2D,t),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.NEAREST);this._displacers.addInterest("set_displacers__",this),this._coord.addInterest("set_coord__",this),this._displacementsTexture.addInterest("set_displacementsTexture__",this),this._displacementWeightsTexture.addInterest("set_displacementWeightsTexture__",this),this.set_displacers__(),this.set_coord__()},getHAnimKey(){return this.humanoidKey},set_humanoidKey__(){this.humanoidKey=`[${this.numJoints}.${this.numDisplacements}]`},set_displacers__(){const e=this.displacerNodes;for(const t of e)t._coordIndex.removeInterest("addEvent",this._displacementsTexture),t._displacements.removeInterest("addEvent",this._displacementsTexture),t._coordIndex.removeInterest("addEvent",this._displacementWeightsTexture),t._weight.removeInterest("addEvent",this._displacementWeightsTexture);e.length=0;for(const t of this._displacers){const n=b()(m().HAnimDisplacer,t);n&&e.push(n)}for(const t of e)t._coordIndex.addInterest("addEvent",this._displacementsTexture),t._displacements.addInterest("addEvent",this._displacementsTexture),t._coordIndex.addInterest("addEvent",this._displacementWeightsTexture),t._weight.addInterest("addEvent",this._displacementWeightsTexture);this._displacementsTexture.addEvent(),this._displacementWeightsTexture.addEvent()},set_displacementsTexture__(){const e=this.coordNode?._point.length||1,t=Array.from({length:e},()=>[]);let n=0;this.displacementWeights.length=0;for(const{_weight:e,_coordIndex:i,_displacements:s}of this.displacerNodes)if(i.length){this.displacementWeights.push(e,0,0,0);for(const[e,o]of i.entries())t[o]?.push(...s[e],0,n,0,0,0);++n}const i=t.reduce((e,t)=>Math.max(e,t.length),0)/8,s=8*i,o=Math.ceil(Math.sqrt(e*i*2))||1,r=new Float32Array(o*o*4);for(let n=0;n<e;++n)r.set(t[n],n*s);this.numDisplacements=i;const a=this.getBrowser().getContext();a.bindTexture(a.TEXTURE_2D,this.displacementsTexture),a.texImage2D(a.TEXTURE_2D,0,a.RGBA32F,o,o,0,a.RGBA,a.FLOAT,r),this.displacementWeightsSize=Math.ceil(Math.sqrt(n)),this.displacementWeightsArray=new Float32Array(this.displacementWeightsSize*this.displacementWeightsSize*4),this.set_humanoidKey__()},set_displacementWeightsTexture__(){const e=this.getBrowser().getContext(),t=this.displacementWeightsSize,n=this.displacementWeightsArray;n.set(this.displacementWeights),e.bindTexture(e.TEXTURE_2D,this.displacementWeightsTexture),e.texImage2D(e.TEXTURE_2D,0,e.RGBA32F,t,t,0,e.RGBA,e.FLOAT,n)},set_coord__(){this.coordNode&&(this.coordNode.removeInterest("addEvent",this._displacementsTexture),this.coordNode.removeInterest("addEvent",this._displacementWeightsTexture)),this.coordNode=b()(m().Coordinate,this._coord)??b()(m().CoordinateDouble,this._coord),this.coordNode?(delete this.skinning,this.coordNode.addInterest("addEvent",this._displacementsTexture),this.coordNode.addInterest("addEvent",this._displacementWeightsTexture)):this.skinning=Function.prototype,this._displacementsTexture.addEvent(),this._displacementWeightsTexture.addEvent()},traverse(e,t){this.coordNode&&this.numDisplacements?(t.getHAnimNode().push(this),ue().prototype.traverse.call(this,e,t),this.skinning(e,t),t.getHAnimNode().pop()):ue().prototype.traverse.call(this,e,t)},skinning:(()=>{const e=new(k());return function(t,n){if(t!==y().DISPLAY)return;const i=n.getInvHumanoidMatrix().get(),s=this.jointMatricesArray,o=Math.ceil(Math.sqrt(8)),r=e.assign(n.getModelViewMatrix().get()).multRight(i);s.set(r,0);const a=this.getBrowser().getContext();a.bindTexture(a.TEXTURE_2D,this.jointMatricesTexture),a.texImage2D(a.TEXTURE_2D,0,a.RGBA32F,o,o,0,a.RGBA,a.FLOAT,s)}})(),getShaderOptions(e){e.push("X3D_SKINNING"),e.push("X3D_NUM_JOINT_SETS "+this.numJoints/4),e.push(`X3D_NUM_DISPLACEMENTS ${this.numDisplacements}`)},setShaderUniforms(e,t){const n=this.getBrowser(),i=n.popTextureUnit(),s=n.popTextureUnit(),o=n.popTextureUnit();e.activeTexture(e.TEXTURE0+i),e.bindTexture(e.TEXTURE_2D,this.jointMatricesTexture),e.uniform1i(t.x3d_JointMatricesTexture,i),e.activeTexture(e.TEXTURE0+s),e.bindTexture(e.TEXTURE_2D,this.displacementsTexture),e.uniform1i(t.x3d_DisplacementsTexture,s),e.activeTexture(e.TEXTURE0+o),e.bindTexture(e.TEXTURE_2D,this.displacementWeightsTexture),e.uniform1i(t.x3d_DisplacementWeightsTexture,o)}}),Object.defineProperties(pe,{..._().getStaticProperties("HAnimSegment","HAnim",1,"children","3.0"),fieldDefinitions:{value:new(h())([new(a())(m().inputOutput,"metadata",new(o().SFNode)),new(a())(m().inputOutput,"description",new(o().SFString)),new(a())(m().inputOutput,"name",new(o().SFString)),new(a())(m().inputOutput,"mass",new(o().SFFloat)),new(a())(m().inputOutput,"centerOfMass",new(o().SFVec3f)),new(a())(m().inputOutput,"momentsOfInertia",new(o().MFFloat)(0,0,0,0,0,0,0,0,0)),new(a())(m().inputOutput,"displacers",new(o().MFNode)),new(a())(m().inputOutput,"coord",new(o().SFNode)),new(a())(m().inputOutput,"visible",new(o().SFBool)(!0)),new(a())(m().inputOutput,"bboxDisplay",new(o().SFBool)),new(a())(m().initializeOnly,"bboxSize",new(o().SFVec3f)(-1,-1,-1)),new(a())(m().initializeOnly,"bboxCenter",new(o().SFVec3f)),new(a())(m().inputOnly,"addChildren",new(o().MFNode)),new(a())(m().inputOnly,"removeChildren",new(o().MFNode)),new(a())(m().inputOutput,"children",new(o().MFNode))]),enumerable:!0}});const me=pe,fe=g().add("HAnimSegment",me);function ge(e){L().call(this,e),this.addType(m().HAnimSite)}Object.setPrototypeOf(ge.prototype,L().prototype),Object.defineProperties(ge,{..._().getStaticProperties("HAnimSite","HAnim",1,"children","3.0"),fieldDefinitions:{value:new(h())([new(a())(m().inputOutput,"metadata",new(o().SFNode)),new(a())(m().inputOutput,"description",new(o().SFString)),new(a())(m().inputOutput,"name",new(o().SFString)),new(a())(m().inputOutput,"translation",new(o().SFVec3f)),new(a())(m().inputOutput,"rotation",new(o().SFRotation)),new(a())(m().inputOutput,"scale",new(o().SFVec3f)(1,1,1)),new(a())(m().inputOutput,"scaleOrientation",new(o().SFRotation)),new(a())(m().inputOutput,"center",new(o().SFVec3f)),new(a())(m().inputOutput,"visible",new(o().SFBool)(!0)),new(a())(m().inputOutput,"bboxDisplay",new(o().SFBool)),new(a())(m().initializeOnly,"bboxSize",new(o().SFVec3f)(-1,-1,-1)),new(a())(m().initializeOnly,"bboxCenter",new(o().SFVec3f)),new(a())(m().inputOnly,"addChildren",new(o().MFNode)),new(a())(m().inputOnly,"removeChildren",new(o().MFNode)),new(a())(m().inputOutput,"children",new(o().MFNode))]),enumerable:!0}});const xe=ge,Te=g().add("HAnimSite",xe);i().add({name:"HAnim",concreteNodes:[w,H,q,de,_e,fe,Te],abstractNodes:[]});g().add("HAnimComponent",void 0)})();
@@ -1,4 +1,4 @@
1
- /* X_ITE v16.2.0 */
1
+ /* X_ITE v16.3.0 */
2
2
  const __X_ITE_X3D__ = window [Symbol .for ("X_ITE.X3D")];
3
3
  /******/ (() => { // webpackBootstrap
4
4
  /******/ "use strict";
@@ -1,2 +1,2 @@
1
- /* X_ITE v16.2.0 */
1
+ /* X_ITE v16.3.0 */
2
2
  const e=window[Symbol.for("X_ITE.X3D")];(()=>{const t={n:e=>{const s=e&&e.__esModule?()=>e.default:()=>e;return t.d(s,{a:s}),s},d:(e,s)=>{for(var a in s)t.o(s,a)&&!t.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:s[a]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)},s=e.Components;var a=t.n(s);const i=e.Namespace;var n=t.n(i);const r=Symbol(),o=Symbol(),c=Symbol(),h=Symbol.for("X_ITE.X3DRoutingContext.processEvents");function l(){this[r]=new Set}Object.assign(l.prototype,{initialize(){const e=this.getElement();e.addEventListener("keydown",this[o].bind(this)),e.addEventListener("keyup",this[c].bind(this))},addKeyDeviceSensorNode(e){this[r].add(e)},removeKeyDeviceSensorNode(e){this[r].delete(e)},getKeyDeviceSensorNodes(){return this[r]},[o](e){this.advanceOnlyTime();for(const t of this[r])t.keydown(e);this[h]()},[c](e){this.advanceOnlyTime();for(const t of this[r])t.keyup(e);this[h]()},dispose(){}});const y=l,d=n().add("X3DKeyDeviceSensorContext",y),_=e.Fields;var b=t.n(_);const k=e.X3DFieldDefinition;var u=t.n(k);const p=e.FieldDefinitionArray;var K=t.n(p);const S=e.X3DNode;var w=t.n(S);const v=e.X3DSensorNode;var g=t.n(v);const f=e.X3DConstants;var P=t.n(f);function O(e){g().call(this,e),this.addType(P().X3DKeyDeviceSensorNode)}Object.assign(Object.setPrototypeOf(O.prototype,g().prototype),{initialize(){g().prototype.initialize.call(this),this.getLive().addInterest("set_live__",this),this.set_live__()},set_live__(){this.getLive().getValue()?(this._enabled.addInterest("set_enabled__",this),this._enabled.getValue()&&this.enable()):(this._enabled.removeInterest("set_enabled__",this),this.disable())},set_enabled__(){this._enabled.getValue()?this.enable():this.disable()},enable(){this.getBrowser().addKeyDeviceSensorNode(this);for(const e of this.getBrowser().getKeyDeviceSensorNodes())e!==this&&e._enabled.getValue()&&(e._enabled=!1)},disable(){this.getBrowser().removeKeyDeviceSensorNode(this),this.release()},keydown(){},keyup(){},release(){}}),Object.defineProperties(O,w().getStaticProperties("X3DKeyDeviceSensorNode","KeyDeviceSensor",1));const D=O,R=n().add("X3DKeyDeviceSensorNode",D);function m(e){R.call(this,e),this.addType(P().KeySensor)}Object.assign(Object.setPrototypeOf(m.prototype,R.prototype),{keydown(e){switch(e.preventDefault(),this._isActive.getValue()||(this._isActive=!0),e.which){case 16:this._shiftKey=!0;break;case 17:this._controlKey=!0;break;case 18:this._altKey=!0;break;case 112:this._actionKeyPress=1;break;case 113:this._actionKeyPress=2;break;case 114:this._actionKeyPress=3;break;case 115:this._actionKeyPress=4;break;case 116:this._actionKeyPress=5;break;case 117:this._actionKeyPress=6;break;case 118:this._actionKeyPress=7;break;case 119:this._actionKeyPress=8;break;case 120:this._actionKeyPress=9;break;case 121:this._actionKeyPress=10;break;case 122:this._actionKeyPress=11;break;case 123:this._actionKeyPress=12;break;case 36:this._actionKeyPress=13;break;case 35:this._actionKeyPress=14;break;case 33:this._actionKeyPress=15;break;case 34:this._actionKeyPress=16;break;case 38:this._actionKeyPress=17;break;case 40:this._actionKeyPress=18;break;case 37:this._actionKeyPress=19;break;case 39:this._actionKeyPress=20;break;default:if(e.charCode||e.keyCode)switch(e.key){case"AltGraph":case"CapsLock":case"Insert":break;case"Backspace":this._keyPress=String.fromCharCode(8);break;case"Delete":this._keyPress=String.fromCharCode(127);break;case"Enter":this._keyPress="\n";break;case"Escape":this._keyPress=String.fromCharCode(27);break;case"Tab":this._keyPress="\t";break;default:1===e.key.length&&(this._keyPress=e.key)}}},keyup(e){switch(e.preventDefault(),e.which){case 16:this._shiftKey=!1;break;case 17:this._controlKey=!1;break;case 18:this._altKey=!1;break;case 112:this._actionKeyRelease=1;break;case 113:this._actionKeyRelease=2;break;case 114:this._actionKeyRelease=3;break;case 115:this._actionKeyRelease=4;break;case 116:this._actionKeyRelease=5;break;case 117:this._actionKeyRelease=6;break;case 118:this._actionKeyRelease=7;break;case 119:this._actionKeyRelease=8;break;case 120:this._actionKeyRelease=9;break;case 121:this._actionKeyRelease=10;break;case 122:this._actionKeyRelease=11;break;case 123:this._actionKeyRelease=12;break;case 36:this._actionKeyRelease=13;break;case 35:this._actionKeyRelease=14;break;case 33:this._actionKeyRelease=15;break;case 34:this._actionKeyRelease=16;break;case 38:this._actionKeyRelease=17;break;case 40:this._actionKeyRelease=18;break;case 37:this._actionKeyRelease=19;break;case 39:this._actionKeyRelease=20;break;default:if(e.charCode||e.keyCode)switch(e.key){case"AltGraph":case"CapsLock":case"Insert":break;case"Backspace":this._keyRelease=String.fromCharCode(8);break;case"Delete":this._keyRelease=String.fromCharCode(127);break;case"Enter":this._keyRelease="\n";break;case"Escape":this._keyRelease=String.fromCharCode(27);break;case"Tab":this._keyRelease="\t";break;default:1===e.key.length&&(this._keyRelease=e.key)}}this._isActive.getValue()&&(this._isActive=!1)},release(){this._shiftKey.getValue()&&(this._shiftKey=!1),this._controlKey.getValue()&&(this._controlKey=!1),this._altKey.getValue()&&(this._altKey=!1),this._isActive.getValue()&&(this._isActive=!1)}}),Object.defineProperties(m,{...w().getStaticProperties("KeySensor","KeyDeviceSensor",1,"children","3.0"),fieldDefinitions:{value:new(K())([new(u())(P().inputOutput,"metadata",new(b().SFNode)),new(u())(P().inputOutput,"description",new(b().SFString)),new(u())(P().inputOutput,"enabled",new(b().SFBool)(!0)),new(u())(P().outputOnly,"controlKey",new(b().SFBool)),new(u())(P().outputOnly,"shiftKey",new(b().SFBool)),new(u())(P().outputOnly,"altKey",new(b().SFBool)),new(u())(P().outputOnly,"actionKeyPress",new(b().SFInt32)),new(u())(P().outputOnly,"actionKeyRelease",new(b().SFInt32)),new(u())(P().outputOnly,"keyPress",new(b().SFString)),new(u())(P().outputOnly,"keyRelease",new(b().SFString)),new(u())(P().outputOnly,"isActive",new(b().SFBool))]),enumerable:!0}});const C=m,T=n().add("KeySensor",C);function F(e){R.call(this,e),this.addType(P().StringSensor)}Object.assign(Object.setPrototypeOf(F.prototype,R.prototype),{keydown(e){switch(e.preventDefault(),e.key){case"Backspace":this._isActive.getValue()&&this._deletionAllowed.getValue()&&this._enteredText.length&&(this._enteredText=this._enteredText.getValue().substring(0,this._enteredText.length-1));break;case"Enter":this._finalText=this._enteredText,this._enteredText.set(""),this._isActive.getValue()&&(this._isActive=!1);break;case"Escape":this._enteredText.set(""),this._isActive.getValue()&&(this._isActive=!1);break;case"Tab":break;default:(e.charCode||e.keyCode)&&1===e.key.length&&(this._isActive.getValue()||(this._isActive=!0,this._enteredText=""),this._enteredText=this._enteredText.getValue()+e.key)}}}),Object.defineProperties(F,{...w().getStaticProperties("StringSensor","KeyDeviceSensor",2,"children","3.0"),fieldDefinitions:{value:new(K())([new(u())(P().inputOutput,"metadata",new(b().SFNode)),new(u())(P().inputOutput,"description",new(b().SFString)),new(u())(P().inputOutput,"enabled",new(b().SFBool)(!0)),new(u())(P().inputOutput,"deletionAllowed",new(b().SFBool)(!0)),new(u())(P().outputOnly,"enteredText",new(b().SFString)),new(u())(P().outputOnly,"finalText",new(b().SFString)),new(u())(P().outputOnly,"isActive",new(b().SFBool))]),enumerable:!0}});const A=F,V=n().add("StringSensor",A);a().add({name:"KeyDeviceSensor",concreteNodes:[T,V],abstractNodes:[R],browserContext:d});n().add("KeyDeviceSensorComponent",void 0)})();
@@ -1,4 +1,4 @@
1
- /* X_ITE v16.2.0 */
1
+ /* X_ITE v16.3.0 */
2
2
  const __X_ITE_X3D__ = window [Symbol .for ("X_ITE.X3D")];
3
3
  /******/ (() => { // webpackBootstrap
4
4
  /******/ "use strict";
@@ -1,2 +1,2 @@
1
- /* X_ITE v16.2.0 */
1
+ /* X_ITE v16.3.0 */
2
2
  const t=window[Symbol.for("X_ITE.X3D")];(()=>{const e={n:t=>{const i=t&&t.__esModule?()=>t.default:()=>t;return e.d(i,{a:i}),i},d:(t,i)=>{for(var s in i)e.o(i,s)&&!e.o(t,s)&&Object.defineProperty(t,s,{enumerable:!0,get:i[s]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e)},i=t.Components;var s=e.n(i);const n=t.TextureProperties;var o=e.n(n);const a=t.Vector3;var r=e.n(a);const l=t.Matrix4;var h=e.n(l);const u=t.ViewVolume;var c=e.n(u);const p=t.Namespace;var d=e.n(p);const g=Symbol();function y(){}Object.assign(y.prototype,{getScreenTextureProperties(){return this[g]??=(()=>{const t=new(o())(this.getPrivateScene());return t._boundaryModeS="CLAMP_TO_EDGE",t._boundaryModeT="CLAMP_TO_EDGE",t._boundaryModeR="CLAMP_TO_EDGE",t._minificationFilter="NEAREST_PIXEL",t._magnificationFilter="NEAREST_PIXEL",t.setup(),t})()},getScreenScaleMatrix:(()=>{const t=new(r()),e=new(r()),i=new(h());return function(s,n,o,a){const l=s.getModelViewMatrix().get(),h=s.getProjectionMatrix().get(),u=s.getViewVolumes().at(-1).getViewport();s.getViewpoint().getScreenScale(l.origin,u,t);const p=l.xAxis.normalize().multiply(t.x*o),d=l.yAxis.normalize().multiply(t.y*o),g=l.zAxis.normalize().multiply(t.x*o);i.set(...p,0,...d,0,...g,0,l[12],l[13],l[14],1),a&&(c().projectPoint(r().ZERO,i,h,u,e),e.x=Math.round(e.x),e.y=Math.round(e.y),c().unProjectPoint(e.x,e.y,e.z,i,h,u,e),e.z=0,i.translate(e)),n.assign(l).inverse().multLeft(i)}})()});const w=y,x=d().add("X3DLayoutContext",w),f=t.Fields;var _=e.n(f);const S=t.X3DFieldDefinition;var M=e.n(S);const O=t.FieldDefinitionArray;var b=e.n(O);const z=t.X3DNode;var m=e.n(z);const v=t.X3DChildNode;var F=e.n(v);const N=t.X3DConstants;var X=e.n(N);function T(t){F().call(this,t),this.addType(X().X3DLayoutNode)}Object.setPrototypeOf(T.prototype,F().prototype),Object.defineProperties(T,m().getStaticProperties("X3DLayoutNode","Layout",1));const B=T,P=d().add("X3DLayoutNode",B),L=t.Vector2;var U=e.n(L);const C=t.Vector4;var E=e.n(C);const D=t.Rotation4;var Y=e.n(D);const V=t.ObjectCache;const R=e.n(V)()(E());let I=0;const j=I++,A=I++,k=I++,G=I++,W=I++,H=I++,q=I++,Z=I++,K=I++,Q=I++;function J(t){P.call(this,t),this.addType(X().Layout)}Object.assign(Object.setPrototypeOf(J.prototype,P.prototype),{initialize(){P.prototype.initialize.call(this),this._align.addInterest("set_align__",this),this._offsetUnits.addInterest("set_offsetUnits__",this),this._offset.addInterest("set_offset__",this),this._sizeUnits.addInterest("set_sizeUnits__",this),this._size.addInterest("set_size__",this),this._scaleMode.addInterest("set_scaleMode__",this),this.set_align__(),this.set_offsetUnits__(),this.set_offset__(),this.set_sizeUnits__(),this.set_size__(),this.set_scaleMode__()},set_align__(){"LEFT"===this._align[0]?this.alignX=j:"RIGHT"===this._align[0]?this.alignX=k:this.alignX=A,"BOTTOM"===this._align[1]?this.alignY=G:"TOP"===this._align[1]?this.alignY=W:this.alignY=A},set_offsetUnits__(){"FRACTION"===this._offsetUnits[0]?this.offsetUnitX=q:"PIXEL"===this._offsetUnits[0]?this.offsetUnitX=Z:this.offsetUnitX=H,this._offsetUnits.length>1?"FRACTION"===this._offsetUnits[1]?this.offsetUnitY=q:"PIXEL"===this._offsetUnits[1]?this.offsetUnitY=Z:this.offsetUnitY=H:this.offsetUnitY=this.offsetUnitX},set_offset__(){this.offsetX=this._offset[0]??0,this.offsetY=this._offset[1]??this.offsetX},set_sizeUnits__(){"FRACTION"===this._sizeUnits[0]?this.sizeUnitX=q:"PIXEL"===this._sizeUnits[0]?this.sizeUnitX=Z:this.sizeUnitX=H,this._sizeUnits.length>1?"FRACTION"===this._sizeUnits[1]?this.sizeUnitY=q:"PIXEL"===this._sizeUnits[1]?this.sizeUnitY=Z:this.sizeUnitY=H:this.sizeUnitY=this.sizeUnitX},set_size__(){this.sizeX=this._size[0]??0,this.sizeY=this._size[1]??this.sizeX},set_scaleMode__(){"FRACTION"===this._scaleMode[0]?this.scaleModeX=q:"PIXEL"===this._scaleMode[0]?this.scaleModeX=Z:"STRETCH"===this._scaleMode[0]?this.scaleModeX=Q:this.scaleModeX=K,this._scaleMode.length>1?"FRACTION"===this._scaleMode[1]?this.scaleModeY=q:"PIXEL"===this._scaleMode[1]?this.scaleModeY=Z:"STRETCH"===this._scaleMode[1]?this.scaleModeY=Q:this.scaleModeY=K:this.scaleModeY=this.scaleModeX},getAlignX(){return this.alignX},getAlignY(){return this.alignY},getOffsetUnitX(t,e){return this.offsetUnitX===H?t[e]?.getOffsetUnitX(t,e-1)??q:this.offsetUnitX},getOffsetUnitY(t,e){return this.offsetUnitY===H?t[e]?.getOffsetUnitY(t,e-1)??q:this.offsetUnitY},getOffsetX(){return this.offsetX},getOffsetY(){return this.offsetY},getSizeUnitX(t,e){return this.sizeUnitX===H?t[e]?.getSizeUnitX(t,e-1)??q:this.sizeUnitX},getSizeUnitY(t,e){return this.sizeUnitY===H?t[e]?.getSizeUnitY(t,e-1)??q:this.sizeUnitY},getSizeX(){return this.sizeX},getSizeY(){return this.sizeY},getScaleModeX(t){return t?this.scaleModeX:this.scaleModeX===K?q:this.scaleModeX},getScaleModeY(t){return t?this.scaleModeY:this.scaleModeY===K?q:this.scaleModeY},push:(()=>{const t=new(E()),e=new(U()),i=new(U()),s=new(r()),n=new(r()),o=new(r()),a=new(r()),l=new(Y()),u=new(r()),c=new(h());return function(r,h){const p=h.getLayouts(),d=p.length-1,g=this.getBrowser().getRenderingProperty("ContentScale"),y=h.getNavigationInfo(),w=h.getViewpoint(),x=w.getNearDistance(y),f=h.getViewVolumes().at(-1).getViewport(),_=w.getViewportSize(f,x),S=R.pop(),M=h.getLayoutRectangles().at(-1)??t.set(0,0,..._),O=h.getModelViewMatrix();e.set(f[2],f[3]).divide(g),i.assign(_).divVec(e);const b=this.getSizeUnitX(p,d),z=this.getSizeUnitY(p,d);switch(b){case q:S.z=this.sizeX*M.z;break;case Z:S.z=this.sizeX*i.x}switch(z){case q:S.w=this.sizeY*M.w;break;case Z:S.w=this.sizeY*i.y}switch(s.set(0),this.getAlignX()){case j:s.x=-(M.z-S.z)/2;break;case A:b===Z&&1&e.x&&(s.x=-i.x/2);break;case k:s.x=(M.z-S.z)/2}switch(this.getAlignY()){case G:s.y=-(M.w-S.w)/2;break;case A:b===Z&&1&e.y&&(s.y=-i.y/2);break;case W:s.y=(M.w-S.w)/2}switch(n.set(0),this.getOffsetUnitX(p,d)){case q:n.x=this.offsetX*M.z;break;case Z:n.x=this.offsetX*_.x/e.x}switch(this.getOffsetUnitY(p,d)){case q:n.y=this.offsetY*M.w;break;case Z:n.y=this.offsetY*_.y/e.y}const m=this.getScaleModeX(p[d]),v=this.getScaleModeY(p[d]);switch(o.set(1),O.get().getTransform(a,l,u),m){case K:o.x=u.x;break;case q:o.x=S.z;break;case Q:break;case Z:o.x=_.x/e.x}switch(v){case K:o.y=u.y;break;case q:o.y=S.w;break;case Q:break;case Z:o.y=_.y/e.y}m===Q?v===Q?S.z>S.w?(o.x=S.z,o.y=o.x):(o.y=S.w,o.x=o.y):o.x=o.y:v===Q&&(o.y=o.x),s.add(n),S.x=s.x,S.y=s.y,c.setTransform(a,l).translate(s).scale(o),O.push(c),h.getLayouts().push(this),h.getLayoutRectangles().push(S)}})(),pop(t,e){const i=e.getModelViewMatrix();R.push(e.getLayoutRectangles().pop()),e.getLayouts().pop(),i.pop()}}),Object.defineProperties(J,{...m().getStaticProperties("Layout","Layout",1,"layout","3.2"),fieldDefinitions:{value:new(b())([new(M())(X().inputOutput,"metadata",new(_().SFNode)),new(M())(X().inputOutput,"align",new(_().MFString)("CENTER","CENTER")),new(M())(X().inputOutput,"offsetUnits",new(_().MFString)("WORLD","WORLD")),new(M())(X().inputOutput,"offset",new(_().MFFloat)(0,0)),new(M())(X().inputOutput,"sizeUnits",new(_().MFString)("WORLD","WORLD")),new(M())(X().inputOutput,"size",new(_().MFFloat)(1,1)),new(M())(X().inputOutput,"scaleMode",new(_().MFString)("NONE","NONE"))]),enumerable:!0}});const $=J,tt=d().add("Layout",$),et=t.X3DGroupingNode;var it=e.n(et);const st=t.X3DCast;var nt=e.n(st);function ot(t){it().call(this,t),this.addType(X().LayoutGroup),this.setCollisionObject(!1),this.matrix=new(h()),this.modelViewMatrix=new(h()),this.screenMatrix=new(h())}Object.assign(Object.setPrototypeOf(ot.prototype,it().prototype),{initialize(){it().prototype.initialize.call(this),this._viewport.addInterest("set_viewport__",this),this._layout.addInterest("set_layout__",this),this.set_viewport__(),this.set_layout__()},set_viewport__(){this.viewportNode=nt()(X().X3DViewportNode,this._viewport)},set_layout__(){this.layoutNode=nt()(X().X3DLayoutNode,this._layout)},set_collisionObjects__(){},getBBox(t,e){return this.isDefaultBBoxSize()?this.getSubBBox(t,e).multRight(this.getMatrix()):t.set(this._bboxSize.getValue(),this._bboxCenter.getValue())},getMatrix(){return this.layoutNode?this.matrix.assign(this.modelViewMatrix).inverse().multLeft(this.screenMatrix):this.matrix.set()},traverse(t,e){if(this.viewportNode?.push(e),this.layoutNode){const i=e.getModelViewMatrix();this.modelViewMatrix.assign(i.get()),this.layoutNode.push(t,e),this.screenMatrix.assign(i.get()),it().prototype.traverse.call(this,t,e),this.layoutNode.pop(t,e)}else it().prototype.traverse.call(this,t,e);this.viewportNode?.pop(e)}}),Object.defineProperties(ot,{...m().getStaticProperties("LayoutGroup","Layout",1,"children","3.2"),fieldDefinitions:{value:new(b())([new(M())(X().inputOutput,"metadata",new(_().SFNode)),new(M())(X().inputOutput,"layout",new(_().SFNode)),new(M())(X().inputOutput,"viewport",new(_().SFNode)),new(M())(X().inputOutput,"visible",new(_().SFBool)(!0)),new(M())(X().inputOutput,"bboxDisplay",new(_().SFBool)),new(M())(X().initializeOnly,"bboxSize",new(_().SFVec3f)(-1,-1,-1)),new(M())(X().initializeOnly,"bboxCenter",new(_().SFVec3f)),new(M())(X().inputOnly,"addChildren",new(_().MFNode)),new(M())(X().inputOnly,"removeChildren",new(_().MFNode)),new(M())(X().inputOutput,"children",new(_().MFNode))]),enumerable:!0}});const at=ot,rt=d().add("LayoutGroup",at),lt=t.X3DLayerNode;var ht=e.n(lt);const ut=t.OrthoViewpoint;var ct=e.n(ut);function pt(t){ht().call(this,t,new(ct())(t),new rt(t)),this.addType(X().LayoutLayer)}Object.assign(Object.setPrototypeOf(pt.prototype,ht().prototype),{initialize(){const t=this.getGroup();this._layout.addFieldInterest(t._layout),t._layout=this._layout,ht().prototype.initialize.call(this)}}),Object.defineProperties(pt,{...m().getStaticProperties("LayoutLayer","Layout",1,"layers","3.2"),fieldDefinitions:{value:new(b())([new(M())(X().inputOutput,"metadata",new(_().SFNode)),new(M())(X().inputOutput,"pickable",new(_().SFBool)(!0)),new(M())(X().inputOutput,"objectType",new(_().MFString)("ALL")),new(M())(X().inputOutput,"pointerEvents",new(_().SFBool)(!0)),new(M())(X().inputOutput,"visible",new(_().SFBool)(!0)),new(M())(X().inputOutput,"layout",new(_().SFNode)),new(M())(X().inputOutput,"viewport",new(_().SFNode)),new(M())(X().inputOnly,"addChildren",new(_().MFNode)),new(M())(X().inputOnly,"removeChildren",new(_().MFNode)),new(M())(X().inputOutput,"children",new(_().MFNode))]),enumerable:!0}});const dt=pt,gt=d().add("LayoutLayer",dt),yt=t.X3DFontStyleNode;var wt=e.n(yt);const xt=t.X3DTextGeometry;var ft=e.n(xt);const _t=t.TextAlignment;var St=e.n(_t);const Mt=t.PixelTexture;var Ot=e.n(Mt);const bt=t.Box3;var zt=e.n(bt);function mt(t,e){ft().call(this,t,e),t.setTransparent(!0),this.textureNode=new(Ot())(t.getExecutionContext()),this.context=document.createElement("canvas").getContext("2d",{willReadFrequently:!0}),this.matrix=new(h()),this.textureNode._textureProperties=e.getBrowser().getScreenTextureProperties(),this.textureNode.setup()}Object.assign(Object.setPrototypeOf(mt.prototype,ft().prototype),{getMatrix(){return this.matrix},getTextureNode(){return this.textureNode},configure:(()=>{const t=new(r()),e=new(r());return function(){ft().prototype.configure.call(this);const i=this.getFontStyle(),s=this.getText(),n=i.getContentScale();switch(s._textBounds.x=Math.ceil(s._textBounds.x)+1,s._textBounds.y=Math.ceil(s._textBounds.y)+1,this.getBBox().getExtents(t,e),t.x-=1,t.y-=1,i.getMajorAlignment()){case St().BEGIN:case St().FIRST:t.x=Math.floor(t.x),e.x=t.x+s._textBounds.x;break;case St().MIDDLE:t.x=Math.round(t.x),e.x=t.x+s._textBounds.x;break;case St().END:e.x=Math.ceil(e.x),t.x=e.x-s._textBounds.x}switch(i.getMinorAlignment()){case St().BEGIN:case St().FIRST:e.y=Math.ceil(e.y),t.y=e.y-s._textBounds.y;break;case St().MIDDLE:e.y=Math.round(e.y),t.y=e.y-s._textBounds.y;break;case St().END:t.y=Math.floor(t.y),e.y=t.y+s._textBounds.y}this.getBBox().setExtents(t,e),this.matrix.assign(h().ZERO),s._origin.x=t.x/n,s._origin.y=e.y/n,s._textBounds.x/=n,s._textBounds.y/=n;for(const t of s._lineBounds)t.x/=n,t.y/=n}})(),build:(()=>{const t=new(r()),e=new(r());return function(){const i=this.getFontStyle(),s=i.getFont();if(!s)return;const n=this.getText(),o=this.getGlyphs(),a=this.getMinorAlignment(),r=this.getTranslations(),l=this.getCharSpacings(),h=this.getScales(),u=i.getScale(),c=u/s.unitsPerEm,p=n.getTexCoords(),d=n.getNormals(),g=n.getVertices(),y=i.getContentScale(),w=this.context.canvas,x=this.context;n.getMultiTexCoords().push(p),this.getBBox().getExtents(t,e),p.push(0,0,0,1,1,0,0,1,1,1,0,1,0,0,0,1,1,1,0,1,0,1,0,1),d.push(0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1),g.push(t.x,t.y,0,1,e.x,t.y,0,1,e.x,e.y,0,1,t.x,t.y,0,1,e.x,e.y,0,1,t.x,e.y,0,1);const[f,_]=n._textBounds;if(w.width=f*y,w.height=_*y,x.fillStyle="rgba(255,255,255,0)",x.fillRect(0,0,w.width,w.height),x.fillStyle="rgba(255,255,255,1)",x.save(),x.translate(0,w.height),x.scale(1,-1),i._horizontal.getValue()){const i=o.length;for(let n=0;n<i;++n){const i=o[n],p=r[n],d=l[n],g=h[n],y=i.length;let w=0;for(let n=0;n<y;++n){const o=i[n],r=a.x+p.x+w*g+n*d-t.x,l=a.y+p.y-e.y;x.save(),x.translate(r,-l),x.scale(g,1),this.drawGlyph(x,s,o,u),x.restore();let h=0;n+1<i.length&&(h=s.getKerningValue(o,i[n+1])),w+=(o.advanceWidth+h)*c}}}else{const c=i._leftToRight.getValue(),p=i._topToBottom.getValue(),d=c?0:n._string.length-1,g=c?n._string.length:-1,y=c?1:-1;for(let i=d,n=0;i!==g;i+=y){const c=o[i],d=c.length,g=p?0:d-1,y=p?d:-1,w=p?1:-1,f=l[i],_=h[i];for(let i=g;i!==y;i+=w,++n){const o=r[n],l=p?i:d-i-1,h=a.x+o.x-t.x,g=a.y+o.y*_-l*f-e.y;x.save(),x.translate(h,-g),x.scale(1,_),this.drawGlyph(x,s,c[i],u),x.restore()}}}x.restore();const S=x.getImageData(0,0,w.width,w.height);S?this.textureNode.setTextureData(w.width,w.height,!0,!0,new Uint8Array(S.data.buffer)):this.textureNode.clear()}})(),drawGlyph(t,e,i,s){const n=i.getPath(0,0,s),o=n.commands;t.beginPath();for(const e of o)switch(e.type){case"M":t.moveTo(e.x,e.y);continue;case"Z":t.closePath();continue;case"L":t.lineTo(e.x,e.y);continue;case"Q":t.quadraticCurveTo(e.x1,e.y1,e.x,e.y);continue;case"C":t.bezierCurveTo(e.x1,e.y1,e.x2,e.y2,e.x,e.y);continue}n.fill&&t.fill(),n.stroke&&(t.lineWidth=n.strokeWidth,t.stroke())},getGlyphExtents(t,e,i,s,n){const o=t.unitsPerEm;s.set((e.xMin||0)/o,(e.yMin||0)/o,0),n.set((e.xMax||0)/o,(e.yMax||0)/o,0)},traverseBefore:(()=>{const t=new(zt()),e=new(h());return function(i,s,n){this.getBrowser().getScreenScaleMatrix(s,e,1,!0);const o=s.getModelViewMatrix();o.push(),o.multLeft(e),e.equals(this.matrix)||(this.matrix.assign(e),t.assign(this.getBBox()).multRight(this.matrix),this.getText().setBBox(t),n.set_bbox__())}})(),traverseAfter(t,e){e.getModelViewMatrix().pop()}});const vt=mt,Ft=d().add("ScreenText",vt);function Nt(t){wt().call(this,t),this.addType(X().ScreenFontStyle)}Object.assign(Object.setPrototypeOf(Nt.prototype,wt().prototype),{initialize(){wt().prototype.initialize.call(this),this.getBrowser().getRenderingProperties()._ContentScale.addInterest("addNodeEvent",this)},createTextGeometry(t){return new Ft(t,this)},getScale(){return this._pointSize.getValue()*this.getBrowser().getRenderingProperty("PixelsPerPoint")*this.getContentScale()},getContentScale(){return this.getBrowser().getRenderingProperty("ContentScale")}}),Object.defineProperties(Nt,{...m().getStaticProperties("ScreenFontStyle","Layout",2,"fontStyle","3.2"),fieldDefinitions:{value:new(b())([new(M())(X().inputOutput,"metadata",new(_().SFNode)),new(M())(X().inputOutput,"language",new(_().SFString)),new(M())(X().inputOutput,"family",new(_().MFString)("SERIF")),new(M())(X().inputOutput,"style",new(_().SFString)("PLAIN")),new(M())(X().inputOutput,"pointSize",new(_().SFFloat)(12)),new(M())(X().inputOutput,"spacing",new(_().SFFloat)(1)),new(M())(X().inputOutput,"horizontal",new(_().SFBool)(!0)),new(M())(X().inputOutput,"leftToRight",new(_().SFBool)(!0)),new(M())(X().inputOutput,"topToBottom",new(_().SFBool)(!0)),new(M())(X().inputOutput,"justify",new(_().MFString)("BEGIN"))]),enumerable:!0}});const Xt=Nt,Tt=d().add("ScreenFontStyle",Xt),Bt=t.TraverseType;var Pt=e.n(Bt);const Lt=t.X3DProtoDeclaration;var Ut=e.n(Lt);function Ct(t){it().call(this,t),this.addType(X().ScreenGroup),t.getOuterNode()instanceof Ut()?this.matrix=new(h()):this.matrix=new(h())(0)}Object.assign(Object.setPrototypeOf(Ct.prototype,it().prototype),{getBBox(t,e){return this.isDefaultBBoxSize()?this.getSubBBox(t,e).multRight(this.matrix):t.set(this._bboxSize.getValue(),this._bboxCenter.getValue())},getMatrix(){return this.matrix},traverse(t,e){switch(t){case Pt().CAMERA:case Pt().PICKING:case Pt().DEPTH:case Pt().SHADOW:break;default:{const t=this.getBrowser();t.getScreenScaleMatrix(e,this.matrix,t.getRenderingProperty("ContentScale"),!1);break}}const i=e.getModelViewMatrix();i.push(),i.multLeft(this.matrix),it().prototype.traverse.call(this,t,e),i.pop()}}),Object.defineProperties(Ct,{...m().getStaticProperties("ScreenGroup","Layout",2,"children","3.2"),fieldDefinitions:{value:new(b())([new(M())(X().inputOutput,"metadata",new(_().SFNode)),new(M())(X().inputOutput,"visible",new(_().SFBool)(!0)),new(M())(X().inputOutput,"bboxDisplay",new(_().SFBool)),new(M())(X().initializeOnly,"bboxSize",new(_().SFVec3f)(-1,-1,-1)),new(M())(X().initializeOnly,"bboxCenter",new(_().SFVec3f)),new(M())(X().inputOnly,"addChildren",new(_().MFNode)),new(M())(X().inputOnly,"removeChildren",new(_().MFNode)),new(M())(X().inputOutput,"children",new(_().MFNode))]),enumerable:!0}});const Et=Ct,Dt=d().add("ScreenGroup",Et);s().add({name:"Layout",concreteNodes:[tt,rt,gt,Tt,Dt],abstractNodes:[P],browserContext:x});d().add("LayoutComponent",void 0)})();
@@ -1,4 +1,4 @@
1
- /* X_ITE v16.2.0 */
1
+ /* X_ITE v16.3.0 */
2
2
  const __X_ITE_X3D__ = window [Symbol .for ("X_ITE.X3D")];
3
3
  /******/ (() => { // webpackBootstrap
4
4
  /******/ "use strict";
@@ -1,2 +1,2 @@
1
- /* X_ITE v16.2.0 */
1
+ /* X_ITE v16.3.0 */
2
2
  const t=window[Symbol.for("X_ITE.X3D")];(()=>{const e={n:t=>{const i=t&&t.__esModule?()=>t.default:()=>t;return e.d(i,{a:i}),i},d:(t,i)=>{for(var n in i)e.o(i,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:i[n]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e)},i=t.Components;var n=e.n(i);const o=t.Fields;var s=e.n(o);const r=t.X3DFieldDefinition;var l=e.n(r);const a=t.FieldDefinitionArray;var h=e.n(a);const u=t.X3DNode;var d=e.n(u);const c=t.X3DConstants;var g=e.n(c);const p=t.X3DCast;var f=e.n(p);const _=t.Namespace;var m=e.n(_);function w(t){d().call(this,t),this.addType(g().Contour2D),this.childNodes=[]}function y(t,e){const i=new Set(e);return t.filter(t=>!i.has(t))}Object.assign(Object.setPrototypeOf(w.prototype,d().prototype),{initialize(){d().prototype.initialize.call(this),this._addChildren.addInterest("set_addChildren__",this),this._removeChildren.addInterest("set_removeChildren__",this),this._children.addInterest("set_children__",this),this.set_children__()},set_addChildren__(){this._addChildren.setTainted(!0),this._addChildren.assign(y(this._addChildren,this._children));for(const t of this._addChildren)this._children.push(t);this._addChildren.length=0,this._addChildren.setTainted(!1)},set_removeChildren__(){this._removeChildren.setTainted(!0),this._children.assign(y(this._children,this._removeChildren)),this._removeChildren.length=0,this._removeChildren.setTainted(!1)},set_children__(){const t=this.childNodes;for(const e of t)e.removeInterest("addNodeEvent",this);t.length=0;for(const e of this._children){const i=f()(g().NurbsCurve2D,e)??f()(g().ContourPolyline2D,e);i&&t.push(i)}for(const e of t)e.addInterest("addNodeEvent",this)},addTrimmingContour(t,e,i){const n=[];for(const t of this.childNodes)t.tessellate(2,n);if(n.length){for(const i of n)i.subtract(t).divVec(e);i.push(n)}}}),Object.defineProperties(w,{...d().getStaticProperties("Contour2D","NURBS",4,"trimmingContour","3.0"),fieldDefinitions:{value:new(h())([new(l())(g().inputOutput,"metadata",new(s().SFNode)),new(l())(g().inputOnly,"addChildren",new(s().MFNode)),new(l())(g().inputOnly,"removeChildren",new(s().MFNode)),new(l())(g().inputOutput,"children",new(s().MFNode))]),enumerable:!0}});const b=w,v=m().add("Contour2D",b);function C(t){d().call(this,t),this.addType(g().X3DNurbsControlCurveNode)}Object.setPrototypeOf(C.prototype,d().prototype),Object.defineProperties(C,d().getStaticProperties("X3DNurbsControlCurveNode","NURBS",1));const O=C,N=m().add("X3DNurbsControlCurveNode",O),S=t.Vector3;var P=e.n(S);function D(t){N.call(this,t),this.addType(g().ContourPolyline2D),this.array=[]}Object.assign(Object.setPrototypeOf(D.prototype,N.prototype),{tessellate(t,e=this.array){const i=this._controlPoint.getValue(),n=2*this._controlPoint.length;switch(t){case 0:e.length=0;for(let t=0;t<n;t+=2)e.push(i[t],i[t+1]);break;case 1:e.length=0;for(let t=0;t<n;t+=2)e.push(i[t],0,i[t+1]);break;case 2:for(let t=0;t<n;t+=2)e.push(new(P())(i[t],i[t+1],0))}return e}}),Object.defineProperties(D,{...d().getStaticProperties("ContourPolyline2D","NURBS",3,"children","3.0"),fieldDefinitions:{value:new(h())([new(l())(g().inputOutput,"metadata",new(s().SFNode)),new(l())(g().inputOutput,"controlPoint",new(s().MFVec2d))]),enumerable:!0}});const T=D,F=m().add("ContourPolyline2D",T),V=t.X3DGeometryNode;var j=e.n(V);const x=t.Vector2;var R=e.n(x);const I=t.Vector4;var z=e.n(I);const A={getTessellation:(t,e)=>t>0?t:t<0?-t*e:2*e,getClosed2D(t,e,i,n){const o=n.length;return(!(i.length===o)||i[0]===i[o-1])&&!!n[0].equals(n[o-1])},getClosed:(()=>{const t=new(P()),e=new(P());return function(i,n,o,s){const r=s.getSize();return(!(o.length===r)||o[0]===o[r-1])&&!!s.get1Point(0,t).equals(s.get1Point(r-1,e))}})(),getUClosed:(()=>{const t=new(P()),e=new(P());return function(i,n,o,s,r,l){const a=r.length===l.getSize();for(let i=0;i<o;++i){const o=i*n,s=i*n+n-1;if(a&&r[o]!==r[s])return!1;if(!l.get1Point(o,t).equals(l.get1Point(s,e)))return!1}return!0}})(),getVClosed:(()=>{const t=new(P()),e=new(P());return function(i,n,o,s,r,l){const a=r.length===l.getSize();for(let i=0;i<n;++i){const s=i,h=(o-1)*n+i;if(a&&r[s]!==r[h])return!1;if(!l.get1Point(s,t).equals(l.get1Point(h,e)))return!1}return!0}})(),getKnots(t,e,i,n,o){const s=n+i,r=t??[];for(let t=0,e=o.length;t<e;++t)r[t]=o[t];r.length=o.length;let l=!0;if(r.length===s){l=!1;let t=0;for(let e=1;e<s;++e)r[e]===r[e-1]?++t:t=0,t>i-1&&(l=!0),r[e-1]>r[e]&&(l=!0)}if(l){if(e)for(let t=0;t<s;++t)r[t]=t;else{let t=0,e=1;for(;t<i;++t)r[t]=0;for(const n=s-i;t<n;++t,++e)r[t]=e;for(;t<s;++t)r[t]=e}r.length=s;const t=r.at(-1);for(let e=0;e<s;++e)r[e]/=t}if(e){const t=i-1;for(let e=1;e<t;++e)r.push(r.at(-1)+(r[e]-r[e-1]))}return r},getWeights(t,e,i){if(i.length!==e)return;const n=t??[];for(let t=0;t<e;++t)n[t]=i[t];return n.length=e,n},getUVWeights(t,e,i,n){const o=e*i;if(n.length!==o)return;const s=t??[];for(let t=0,o=0;t<e;++t)for(let t=0;t<i;++t,++o)s[o]=n[o];return s.length=o,s},getControlPoints2D(t,e,i,n,o){const s=t??[],r=o.getValue(),l=o.length,a=!!n,h=a?P():R();s.haveWeights!==a&&(s.haveWeights=a,s.length=0);for(let t=0;t<l;++t){const e=2*t;(s[t]??=new h(0,0,0)).set(r[e+0],r[e+1],a?n[t]:0)}if(s.length=l,e){const t=i-1;for(let e=1;e<t;++e)s.push(s[e])}return s},getControlPoints(t,e,i,n,o){const s=t??[],r=o.getSize(),l=!!n,a=l?z():P();s.haveWeights!==l&&(s.haveWeights=l,s.length=0);for(let t=0;t<r;++t){const e=o.get1Point(t,s[t]??=new a(0,0,0,0));l&&(e.w=n[t])}if(s.length=r,e){const t=i-1;for(let e=1;e<t;++e)s.push(s[e])}return s},getUVControlPoints(t,e,i,n,o,s,r,l,a){const h=t??[],u=!!l,d=u?z():P();h.haveWeights!==u&&(h.haveWeights=u,h.length=0);for(let t=0;t<s;++t){const e=h[t]??=[];for(let i=0;i<r;++i){const n=i*s+t;a.get1Point(n,e[i]??=new d(0,0,0,0)),u&&(e[i].w=l[n])}if(e.length=r,i){const t=o-1;for(let i=1;i<t;++i)e.push(e[i])}}if(h.length=s,e){const t=n-1;for(let e=1;e<t;++e)h.push(h[e])}return h},getTexControlPoints(t,e,i,n,o,s,r,l){const a=t??[];for(let t=0;t<s;++t){const e=a[t]??=[];for(let i=0;i<r;++i){const n=i*s+t;l.get1Point(n,e[i]??=new(z()))}if(e.length=r,i){const t=o-1;for(let i=1;i<t;++i)e.push(e[i])}}if(a.length=s,e){const t=n-1;for(let e=1;e<t;++e)a.push(a[e])}return a}},k=m().add("NURBS",A);function B(t){j().call(this,t),this.addType(g().X3DParametricGeometryNode)}Object.assign(Object.setPrototypeOf(B.prototype,j().prototype),{getKnots:(t,e,i,n,o)=>k.getKnots(t,e,i,n,o)}),Object.defineProperties(B,d().getStaticProperties("X3DParametricGeometryNode","NURBS",1));const E=B,M=m().add("X3DParametricGeometryNode",E),K=t.X3DLineGeometryNode;var U=e.n(K);const G=m().add("is-ndarray",function(t){if(!t)return!1;if(!t.dtype)return!1;return new RegExp("function View[0-9]+d(:?"+t.dtype+")+").test(String(t.constructor))}),Y=m().add("is-ndarray-like",function(t){return!!t&&(void 0!==t.data&&Array.isArray(t.shape)&&void 0!==t.offset&&void 0!==t.stride)}),W=m().add("is-array-like",function(t){return Array.isArray(t)||ArrayBuffer.isView(t)||void 0!==t.length});function X(t){if(t){if(G(t)||Y(t))return"generic"===t.dtype?X.GENERIC_NDARRAY:X.NDARRAY;if(W(t)){let e=t;for(;W(e[0]);)e=e[0];return"x"in e?X.ARRAY_OF_OBJECTS:X.ARRAY_OF_ARRAYS}throw new Error("Unhandled data type. Got type: "+typeof t)}}X.ARRAY_OF_OBJECTS="Obj",X.ARRAY_OF_ARRAYS="Arr",X.NDARRAY="Nd",X.GENERIC_NDARRAY="GenNd",X.PACKED="PackArr";const q=X,$=m().add("infer-type",q);function L(t){return t[0].toUpperCase()+t.slice(1)}const J=m().add("cache-key",function(t,e,i,n,o,s){const r=[];let l=!1;for(let e=0;e<t.splineDimension;++e){const i=W(t.knots)&&W(t.knots[e]);i&&(l=!0),r.push("Deg"+t.degree[e]+(i?"":"Uniform")+L(t.boundary[e]))}const a=[[l?"NU":"",t.weights?"RBS":"BS"].join("")+t.dimension+"D",r.join("_")];return n&&a.push(n+"Pts"),o&&a.push(o+"Wts"),s&&a.push(s+"Kts"),e&&a.push("debug"),i&&a.push("chk"),a.join("_")}),Z=function t(e,i){return function(i,n){void 0===i||Array.isArray(i)||(i=[i]);const o=[];for(let e=0;e<i.length;++e)o.push(t.sum(i[e]));if(n)for(let t=0;t<o.length;++t)void 0!==n[t]&&(o[t]="("+o[t]+" + "+n[t]+") % "+n[t]);return e+o.join("_")}};Z.sum=function(t){return 0===(t=(t=Array.isArray(t)?t:[t]).filter(t=>void 0!==t&&0!==t)).length&&t.push(0),t.join(" + ")};const H=Z,Q=m().add("variable",H),tt=[".x",".y",".z",".w"];function et(t){return function(e,i){void 0===e||Array.isArray(e)||(e=[e]);const n=[];for(let t=0;t<e.length;++t)n.push(Q.sum(e[t]));if(i)for(let t=0;t<n.length;++t)void 0!==i[t]&&(n[t]="("+n[t]+" + "+i[t]+") % "+i[t]);return t(n)}}function it(t,e){if(e)switch($(e)){case $.ARRAY_OF_OBJECTS:return et(e=>{const i=e.pop();return t+"["+e.join("][")+"]"+tt[i]});case $.ARRAY_OF_ARRAYS:return et(e=>t+"["+e.join("][")+"]");case $.GENERIC_NDARRAY:return et(e=>t+".get("+e.join(",")+")");case $.NDARRAY:return et(e=>{const i=[t+"Offset"];for(let n=0;n<e.length;++n)i.push(t+"Stride"+n+" * ("+e[n]+")");return t+"["+i.join(" + ")+"]"});case $.PACKED:default:return}}const nt=m().add("create-accessors",function(t){const e={};let i=it("x",t.points);return i&&(e.point=i),i=it("w",t.weights),i&&(e.weight=i),i=it("k",t.knots),i&&(e.knot=i),e}),ot=[],st=[],rt=m().add("numerical-derivative",function(t,e,i){if(1!==e)throw new Error("Numerical derivative not implemented for order n = "+e+".");const n=void 0===arguments[this.splineDimension+3]?1e-4:arguments[this.splineDimension+3];ot.length=this.splineDimension;for(let t=0;t<this.splineDimension;++t)ot[t+1]=arguments[t+3];const o=this.domain,s=o[i][0],r=o[i][1],l=ot[i+1];let a,h,u=(r-s)*n;if("closed"===this.boundary[i]){const t=r-s;a=s+(l-s-u+t)%t,h=s+(l-s+u+t)%t,u*=2}else a=Math.min(r,Math.max(s,l-u)),h=Math.min(r,Math.max(s,l+u)),u=h-a;ot[i+1]=a,ot[0]=st,this.evaluate.apply(null,ot),ot[i+1]=h,ot[0]=t,this.evaluate.apply(null,ot);for(let e=0;e<this.dimension;++e)t[e]=(t[e]-st[e])/u;return t}),lt=m().add("ndloop",function(t,e){let i=1,n=[];for(let e=0;e<t.length;++e)i*=Array.isArray(t[e])?t[e][1]-t[e][0]:t[e],n[e]=Array.isArray(t[e])?t[e][0]:0;for(let o=0;o<i;++o){e(n.slice());for(let e=t.length-1;e>=0;--e){if(n[e]!==(Array.isArray(t[e])?t[e][1]:t[e])-1){++n[e];break}n[e]=Array.isArray(t[e])?t[e][0]:0}}}),at=m().add("accessor-preamble",function(t,e,i,n){const o=[];switch($(n)){case $.NDARRAY:o.push(` var ${e} = ${i}.data;`),o.push(` var ${e}Offset = ${i}.offset;`);for(let t=0;t<n.dimension;++t)o.push(` var ${e}Stride${t} = ${i}.stride[${t}];`);break;case $.ARRAY_OF_OBJECTS:case $.ARRAY_OF_ARRAYS:o.push(` var ${e} = ${i};`)}return o.join("\n")}),ht=m().add("size-getter",function(t,e,i){if(t){if(Y(t))return e+".shape["+i+"]";{let t=e;for(let e=0;e<i;++e)t+="[0]";return t+".length"}}return"this.size["+i+"]"}),ut={},dt={},ct=m().add("evaluator",function(t,e,i,n,o,s,r){const l=e.splineDimension,a=e.points,h=e.degree,u=e.weights,d=void 0!==u,c=e.knots,g=e.dimension,p=e.boundary;if(null!=r){Array.isArray(r)||(r=[r]);let t=0;for(let e=0;e<l;++e)void 0===r[e]&&(r[e]=0),t+=r[e];if(d&&t>1)throw new Error("Analytical derivative not implemented for rational b-splines with order n = "+t+".")}s&&(t="Basis"+t),r&&(t="Der"+r.join("_")+"_"+t);const f=ut[t],_=n?"function"==typeof n?n:console.log:null;if(f)return n&&_(dt[t]),f.bind(e);const m=[],w="evaluate"+t;let y=i.point;s&&(y=function(t,e){const i=[];for(let n=0;n<t.length;++n){const o=[];let s=t[n];for(let t=0;t<s.length;++t)0!==s[t]&&o.push(s[t]);s=o.join(" + "),e[n]&&(s="("+s+" + "+e[n]+") % "+e[n]),i.push(s+" === "+S(n))}return"(("+i.join(" && ")+") ? 1 : 0)"});const b=i.weight,v=i.knot,C=Q("k"),O=Q("x"),N=Q("w"),S=Q("i"),P=Q("t"),D=n?"domain":"d",T=Q(n?"size":"s"),F=Q(n?"knotIndex":"j");let V=!0;for(let t=0;t<l;++t)W(c)&&W(c[t])&&(V=!1);function j(t){m.push(" "+(t||""))}function x(t){n&&j(t)}const R=s?[]:null,I=[];for(let t=0;t<l;++t)s&&R.push(S([t])),I.push(P([t]));m.push("function "+w+" ("+(s?"":"out, ")+I.join(", ")+(s?", "+R.join(", "):"")+") {"),j("var h, m, a, b;"),o&&(j("var "+D+" = this.domain;"),j("for (var i = 0; i < this.splineDimension; ++ i) {"),j(" a = arguments[i + 1];"),j(" if (a < "+D+"[i][0] || a > "+D+"[i][1] || a === undefined || isNaN(a)) {"),j(' throw new Error("Invalid Spline parameter in dimension "+i+". Valid domain is ["+'+D+'[i][0]+", "+'+D+'[i][1]+"]. but got t"+i+" = "+arguments[i + 1]+".");'),j(" }"),j("}"));for(let t=0;t<l;++t)j("var "+T(t)+" = "+ht(a,"this.points",t)+";");function z(t,e,i){return"("+t+") ? ("+e+") : ("+i+")"}m.push(at(e,"x","this.points",a)),d&&m.push(at(e,"w","this.weights",u)),V||m.push(at(e,"k","this.knots",c));const A=[];for(let t=0;t<l;++t)switch($(c)){case $.NDARRAY:A[t]=!0;break;case $.ARRAY_OF_ARRAYS:A[t]=W(c[t])}for(let t=0;t<l;++t)if(A[t]){x("\n // Bisect to locate the knot interval in dimension "+t+"\n"),j("var "+F(t)+" = 0;"),j("h = "+T(t)+";"),j("while(h > "+F(t)+" + 1) {"),j(" m = 0.5 * (h + "+F(t)+") | 0;"),j(" if ("+v([t,"m"])+" > "+P(t)+") h = m;"),j(" else "+F(t)+" = m;"),j("}"),x("\n // Fetch knots for dimension "+t+"\n");for(let e=1-h[t];e<=h[t];++e)"closed"===p[t]?j(e<0?"var "+C([t,e+h[t]-1])+" = "+z(F(t)+" < "+-e,v([t,0])+" + "+v([t,[T(t),F(t),e]])+" - "+v([t,[T(t)]]),v([t,[F(t),e]]))+";":e>0?"var "+C([t,e+h[t]-1])+" = "+z(F(t)+" + "+e+" > "+T(t),v([t,T(t)])+" + "+v([t,e+" + "+F(t)+" - "+T(t)])+" - "+v([t,0]),v([t,[F(t),e]]))+";":"var "+C([t,e+h[t]-1])+" = "+v([t,[F(t),e]])+";"):j("var "+C([t,e+h[t]-1])+" = "+v([t,[F(t),e]])+";")}else{x("\n // Directly compute knot interval for dimension "+t+"\n"),"closed"===p[t]?j(F(t)+" = ("+P(t)+" | 0) % "+T(t)+";"):(j(F(t)+" = ("+P(t)+" | 0);"),j("if ("+F(t)+" < "+h[t]+") "+F(t)+" = "+h[t]+";"),j("if ("+F(t)+" > "+T(t)+" - 1) "+F(t)+" = "+T(t)+" - 1;")),x("\n // Compute and clamp knots for dimension "+t+"\n");for(let e=1-h[t];e<=h[t];++e){j("var "+C([t,e+h[t]-1])+" = "+F(t)+" + "+e+";")}if("clamped"===p[t])for(let e=1-h[t];e<=h[t];++e){const i=C([t,e+h[t]-1]);e<0&&j("if ("+i+" < "+h[t]+") "+i+" = "+h[t]+";"),e>0&&j("if ("+i+" > "+T(t)+") "+i+" = "+T(t)+";")}"closed"===p[t]&&(x("\n // Wrap the B-Spline parameter for closed boundary"),j(P(t)+" %= "+T(t)+";"))}const k=[];for(let t=0;t<l;++t)k[t]=h[t]+1;d&&(x("\n // Fetch weights\n"),lt(k,function(t){const e=[],i=[];for(let n=0;n<l;++n)e[n]=[F(n),t[n]-h[n]],"closed"===p[n]&&t[n]-h[n]<0&&(i[n]=T(n));j("var "+N(t)+" = "+b(e,i)+";")})),n&&j(d?"\n // Fetch points and project into homogeneous (weighted) coordinates\n":"\n // Fetch points\n"),lt(k,function(t){const e=[],i=[];for(let n=0;n<l;++n)e[n]=[F(n),t[n]-h[n]],"closed"===p[n]&&t[n]-h[n]<0&&(i[n]=T(n));if(s)j(d?"var "+O(t)+" = "+y(e,i)+" * "+N(t)+";":"var "+O(t)+" = "+y(e,i)+";");else for(let n=0;n<g;++n){const o=t.concat(n);e[l]=n,j(d?"var "+O(o)+" = "+y(e,i)+" * "+N(t)+";":"var "+O(o)+" = "+y(e,i)+";")}}),x("\n"),x('// Perform De Boor"s algorithm');for(let t=k.length-1;t>=0;--t){k[t]=[h[t],h[t]+1];for(let e=0;e<h[t];++e){x("\n // Degree "+h[t]+" evaluation in dimension "+t+", step "+(e+1)+"\n");for(let i=h[t];i>e;--i){const n=r&&h[t]-e-r[t]<=0;n?(j("m = 1 / ("+C([t,i-e+h[t]-1])+" - "+C([t,i-1])+");"),d&&(j("a = ("+P(t)+" - "+C([t,i-1])+") * m;"),j("b = 1 - a;"))):(j("a = ("+P(t)+" - "+C([t,i-1])+") / ("+C([t,i-e+h[t]-1])+" - "+C([t,i-1])+");"),j("b = 1 - a;")),d&&lt(k,function(e){const o=e.slice(),s=e.slice();o[t]=i,s[t]=i-1,n&&d&&j("h = "+N(o)+";"),j(N(o)+" = b * "+N(s)+" + a * "+N(o)+";")}),lt(k,function(o){let r,a,h;const u=o.slice(),c=o.slice();if(u[t]=i,c[t]=i-1,n){const t=e+1;if(s)r=d?"h * "+N(c)+" / "+N(u)+" * ":"",a=O(u)+(d?" / h":""),h=O(c)+(d?" / "+N(c):""),j(O(u)+" = "+t+" * "+r+"("+a+" - "+h+") * m;");else{const e=u.slice(),i=c.slice();for(let n=0;n<g;++n)e[l]=i[l]=n,r=d?"h * "+N(c)+" / "+N(u)+" * ":"",a=O(e)+(d?" / h":""),h=O(i)+(d?" / "+N(c):""),j(O(e)+" = "+t+" * "+r+"("+a+" - "+h+") * m;")}}else if(s)j(O(u)+" = b * "+O(c)+" + a * "+O(u)+";");else for(let t=0;t<g;++t)u[l]=c[l]=t,j(O(u)+" = b * "+O(c)+" + a * "+O(u)+";")}),x("\n")}}}if(n&&j(d?"\n // Project back from homogeneous coordinates and return final output\n":"\n // Return final output\n"),s)j(d?"return "+O(h)+" / "+N(h)+";":"return "+O(h)+";");else for(let t=0;t<g;++t)j(d?"out["+t+"] = "+O(h.concat([t]))+" / "+N(h)+";":"out["+t+"] = "+O(h.concat([t]))+";");if(s||j("return out;"),m.push("}"),n){const e=m.join("\n");_(e),dt[t]=e}const B=new Function([m.join("\n"),"; return ",w].join(""))();return ut[t]=B,B.bind(e)}),gt={},pt=m().add("transform",function(t,e,i,n){const o=gt[t];if(o)return o.bind(e);const s=[],r="transform"+t;s.push("function "+r+"(m) {"),s.push("var i, w;"),s.push(at(e,"x","this.points",e.points));const l=Q(n?"size":"s");for(let t=0;t<e.splineDimension;++t)s.push("var "+l(t)+" = "+ht(e.points,"this.points",t)+";");const a=[];for(let t=0;t<e.splineDimension;++t){const e="i"+t;a.push(e),s.push("for ("+e+" = "+l(t)+"- 1; "+e+" >= 0; -- "+e+") {")}for(let t=0;t<e.dimension;++t)s.push("x"+t+" = "+i.point(a.concat([t])));const h=[];for(let t=0;t<e.dimension;++t)h.push("m["+((e.dimension+1)*(t+1)-1)+"] * x"+t);h.push("m["+((e.dimension+1)*(e.dimension+1)-1)+"]"),s.push("var w = ("+h.join(" + ")+") || 1.0;");for(let t=0;t<e.dimension;++t){const n=[],o=e.dimension;let r=0;for(;r<o;++r)n.push("m["+(r*(o+1)+t)+"] * x"+r);n.push("m["+(r*(o+1)+t)+"]");const l=i.point(a.concat([t])),h="("+n.join(" + ")+") / w";s.push(l+" = "+h+";")}for(let t=e.splineDimension-1;t>=0;--t)s.push("}");s.push("return this;"),s.push("}");const u=new Function([s.join("\n"),"; return ",r].join(""))();return n&&console.log(s.join("\n")),gt[t]=u,u.bind(e)}),ft={},_t=m().add("support",function(t,e,i,n,o){const s=ft[t];if(s)return s.bind(e);const r=e.degree,l=e.knots,a=e.splineDimension,h=e.boundary,u=[],d="support"+t,c=i.knot,g=Q("t"),p=n?"domain":"d",f=Q(n?"size":"s"),_=Q(n?"knotIndex":"i");let m=!0;for(let t=0;t<a;++t)W(l)&&W(l[t])&&(m=!1);function w(t){u.push(" "+(t||""))}const y=[];for(let t=0;t<a;++t)y.push(g([t]));u.push("function "+d+" (out, "+y.join(", ")+") {");let b=0;function v(t,e){w(void 0===e?"out["+b+++"] = "+t.join(" + ")+";":"out["+b+++"] = ("+t.join(" + ")+" + "+e+") % "+e+";")}w("var h, m;"),w("var c = 0;"),o&&(w("var "+p+" = this.domain;"),w("for (var i = 0; i < this.splineDimension; ++ i) {"),w(" a = arguments[i + 1];"),w(" if (a < "+p+"[i][0] || a > "+p+"[i][1] || a === undefined || isNaN(a)) {"),w(' throw new Error("Invalid Spline parameter in dimension "+i+". Valid domain is ["+'+p+'[i][0]+", "+'+p+'[i][1]+"]. but got t"+i+" = "+arguments[i + 1]+".");'),w(" }"),w("}"));for(let t=0;t<a;++t)w("var "+f(t)+" = "+ht(e.points,"this.points",t)+";");m||u.push(at(e,"k","this.knots",l));const C=[];for(let t=0;t<a;++t)switch($(l)){case $.NDARRAY:C[t]=!0;break;case $.ARRAY_OF_ARRAYS:C[t]=W(l[t])}for(let t=0;t<a;++t)C[t]?(w("var "+_(t)+" = 0;"),w("h = "+f(t)+";"),w("while(h > "+_(t)+" + 1) {"),w(" m = 0.5 * (h + "+_(t)+") | 0;"),w(" if ("+c([t,"m"])+" > "+g(t)+") h = m;"),w(" else "+_(t)+" = m;"),w("}")):"closed"===h[t]?w(_(t)+" = ("+g(t)+" | 0) % "+f(t)+";"):(w(_(t)+" = ("+g(t)+" | 0);"),w("if ("+_(t)+" < "+r[t]+") "+_(t)+" = "+r[t]+";"),w("if ("+_(t)+" > "+f(t)+" - 1) "+_(t)+" = "+f(t)+" - 1;"));const O=[];for(let t=0;t<a;++t)O[t]=r[t]+1;lt(O,function(t){const e=[],i=[];for(let n=0;n<a;++n)e[n]=[_(n),t[n]-r[n]],"closed"===h[n]&&t[n]-r[n]<0&&(i[n]=f(n));for(let t=0;t<a;++t)v(e[t],i[t])}),w("out.length = "+b+";"),w("return out;"),u.push("}"),n&&console.log(u.join("\n"));const N=new Function([u.join("\n"),"; return ",d].join(""))();return ft[t]=N,N.bind(e)}),mt=[],wt=new Map,yt=new Map;function bt(t,e,i,n,o,s,r){for(let l=0;l<i;++l){Ct(t+e*l,n,o,s,r)}}function vt(t,e,i,n,o,s,r){for(let i=0;i<e;++i){Ct(i+e*t,n,o,s,r)}}function Ct(t,e,i,n,o){let s="";for(let n=0;n<e;++n)s+=i[t*e+n],s+=";";n.has(s)?o.set(t,n.get(s)):n.set(s,t)}const Ot=function(t,e,i){const n=t.points??=[],o=t.faces??=[],s=i.haveWeights,r=e.dimension-s,l=i.resolution;switch(e.splineDimension){case 1:{const t=l[0],o=t+1,a=o*r,h=e.domain[0],u=h[1]-h[0],d=i.closed;for(let i=0;i<o;++i){const o=h[0]+u*(d?i%t:i)/t,l=i*r;if(e.evaluate(mt,o),s){const t=mt[r];for(let e=0;e<r;++e)n[l+e]=mt[e]/t}else for(let t=0;t<r;++t)n[l+t]=mt[t]}n.length=a;break}case 2:{const t=l[0],a=l[1],h=t+1,u=a+1,d=h*u*r,c=e.domain,g=c[0],p=c[1],f=g[1]-g[0],_=p[1]-p[0],m=i.closed[0],w=i.closed[1];for(let i=0;i<u;++i){const o=p[0]+_*i/a;for(let l=0;l<h;++l){const a=g[0]+f*l/t,u=(l+h*i)*r;if(e.evaluate(mt,a,o),s){const t=mt[r];for(let e=0;e<r;++e)n[u+e]=mt[e]/t}else for(let t=0;t<r;++t)n[u+t]=mt[t]}}n.length=d,bt(0,h,u,r,n,wt,yt),vt(0,h,u,r,n,wt,yt),m||bt(t,h,u,r,n,wt,yt),w||vt(a,h,u,r,n,wt,yt);let y=0;for(let e=0;e<a;++e){const i=w?(e+1)%a:e+1;for(let n=0;n<t;++n){const s=m?(n+1)%t:n+1;let r=n+h*e,l=s+h*e,a=s+h*i,u=n+h*i;r=yt.get(r)??r,l=yt.get(l)??l,a=yt.get(a)??a,u=yt.get(u)??u,o[y++]=r,o[y++]=l,o[y++]=a,o[y++]=r,o[y++]=a,o[y++]=u}}o.length=y,wt.clear(),yt.clear();break}default:throw new Error("Can only sample contours and surfaces.")}return t},Nt=m().add("sample",Ot),St={open:"open",closed:"closed",clamped:"clamped"};function Pt(t){return null==t}function Dt(t,e,i,n,o,s){!t||W(t)||G(t)?(s=s||{},this.weights=n,this.knots=i,this.degree=e,this.points=t,this.boundary=o,this.debug=s.debug,this.checkBounds=!!s.checkBounds,Object.defineProperty(this,"size",{value:s.size,writable:!0,configurable:!0})):(s=t,this.debug=t.debug,this.checkBounds=!!t.checkBounds,this.weights=t.weights,this.knots=t.knots,this.degree=t.degree,this.boundary=t.boundary,this.points=t.points,Object.defineProperty(this,"size",{value:s.size,writable:!0,configurable:!0}));const r=$(this.points),l=$(this.weights),a=$(this.knots);if(this.points)switch(r){case $.GENERIC_NDARRAY:case $.NDARRAY:Object.defineProperties(this,{splineDimension:{value:this.points.shape.length-1,writable:!1,configurable:!0},dimension:{value:this.points.shape[this.points.shape.length-1],writable:!1,configurable:!0},size:{get:function(){return this.points.shape.slice(0,this.points.shape.length-1)},set:function(){throw new Error("Cannot assign to This property is read-only property 'size'")},configurable:!0}});break;case $.ARRAY_OF_OBJECTS:case $.ARRAY_OF_ARRAYS:const t=this.size||[];let e=0,i=this.points;for(t.length=0;W(i[0]);i=i[0])++e,t.push(i.length);if(0===e)throw new Error("Expected an array of points");Object.defineProperties(this,{splineDimension:{value:e,writable:!1,configurable:!0},dimension:{value:i.length,writable:!1,configurable:!0},size:{get:function(){const t=[];t.length=0;for(let e=0,i=this.points;e<this.splineDimension;++e,i=i[0])t[e]=i.length;return t},set:function(){throw new Error('Cannot assign to This property is read-only property "size"')},configurable:!0}});break;case $.PACKED:default:throw new Error("Expected either a packed array, array of arrays, or ndarray of points")}else{if(void 0===this.size||null===this.size)throw new Error("Either points or a control hull size must be provided.");if(W(this.size)||Object.defineProperty(this,"size",{value:[this.size],writable:!0,configurable:!0}),0===this.size.length)throw new Error("`size` must be a number or an array of length at least one.");Object.defineProperties(this,{splineDimension:{value:this.size.length,writable:!1,configurable:!0},dimension:{value:0,writable:!1,configurable:!0}})}if(W(this.degree)){for(let t=0;t<this.splineDimension;++t)if(Pt(this.degree[t]))throw new Error("Missing degree in dimension "+(t+1))}else{const t=!Pt(this.degree),e=Pt(this.degree)?2:this.degree;this.degree=[];for(let i=0;i<this.splineDimension;++i)if(this.size[i]<=e){if(t)throw new Error("Expected at least "+(e+1)+" points for degree "+e+" spline in dimension "+(i+1)+" but got only "+this.size[i]);this.degree[i]=this.size[i]-1}else this.degree[i]=e}const h="string"!=typeof this.boundary?"open":this.boundary;if(!St[h])throw new Error("Boundary type must be one of "+Object.keys(St)+". Got "+h);this.boundary=W(this.boundary)?this.boundary:[],this.boundary.length=this.splineDimension;for(let t=0;t<this.splineDimension;++t)if(this.boundary[t]=Pt(this.boundary[t])?h:this.boundary[t],!St[h])throw new Error("Boundary type must be one of "+Object.keys(St)+". Got "+h+" for dimension "+(t+1));switch(a){case $.ARRAY_OF_ARRAYS:W(this.knots)&&this.knots.length>0&&!W(this.knots[0])&&(this.knots=[this.knots]);for(let t=0;t<this.splineDimension;++t){if(this.size[t]<=this.degree[t])throw new Error("Expected at least "+(this.degree[t]+1)+" points in dimension "+(t+1)+" but got "+this.size[t]+".");if(W(this.knots[t])){if("closed"!==this.boundary[t]&&this.knots[t].length!==this.degree[t]+this.size[t]+1)throw new Error("Expected "+(this.degree[t]+this.size[t]+1)+" knots in dimension "+(t+1)+" but got "+this.knots[t].length+".");if("closed"===this.boundary[t]&&this.knots[t].length!==this.size[t]+1){if(!(this.knots[t].length===this.size[t]+this.degree[t]+1))throw new Error("Expected "+(this.size[t]+1)+" knots for closed spline in dimension "+(t+1)+" but got "+this.knots[t].length+".")}}}case $.NDARRAY:}const u=J(this,this.debug,this.checkBounds,r,l,a);if(u!==this.__cacheKey){this.__cacheKey=u;const t=nt(this);this.evaluate=ct(this.__cacheKey,this,t,this.debug,this.checkBounds,!1),this.transform=pt(this.__cacheKey,this,t,this.debug),this.support=_t(this.__cacheKey,this,t,this.debug,this.checkBounds),this.evaluator=function(e,i){return ct(this.__cacheKey,this,t,this.debug,this.checkBounds,i,e)}}return this.numericalDerivative=rt.bind(this),this}function Tt(){const t=[];let e,i=this.points;i?Y(i)&&(e=i.shape):e=this.size;for(let n=0;n<this.splineDimension;++n){const o=e?e[n]:i.length,s=this.degree[n],r="closed"===this.boundary[n];if(this.knots&&this.knots[n]){const e=this.knots[n];t[n]=[e[r?0:s],e[o]]}else t[n]=[r?0:s,o];i&&(i=i[0])}return t}function Ft(t,e,i,n,o,s){const r=function(t,e,i,n,o,s){return l(t,e,i,n,o,s),r},l=Dt.bind(r);return Object.defineProperty(r,"domain",{get:Tt}),l(t,e,i,n,o,s),r}Ft.sample=Nt;const Vt=Ft,jt=m().add("nurbs",Vt);function xt(t){M.call(this,t),U().call(this,t),this.addType(g().NurbsCurve),this.knots=[],this.weights=[],this.controlPoints=[],this.mesh={},this.sampleOptions={resolution:[]}}Object.assign(Object.setPrototypeOf(xt.prototype,M.prototype),U().prototype,{initialize(){M.prototype.initialize.call(this),this._controlPoint.addInterest("set_controlPoint__",this),this.set_controlPoint__()},set_controlPoint__(){this.controlPointNode?.removeInterest("requestRebuild",this),this.controlPointNode=f()(g().X3DCoordinateNode,this._controlPoint),this.controlPointNode?.addInterest("requestRebuild",this)},getTessellation(t){return k.getTessellation(this._tessellation.getValue(),t)},getClosed(t,e,i,n){return!!this._closed.getValue()&&k.getClosed(t,e,i,n)},getWeights:(t,e,i)=>k.getWeights(t,e,i),getControlPoints:(t,e,i,n,o)=>k.getControlPoints(t,e,i,n,o),getSurface(){return this.surface},tessellate(){if(this._order.getValue()<2)return[];if(!this.controlPointNode)return[];if(this.controlPointNode.getSize()<this._order.getValue())return[];const t=this.getVertices(),e=t.length,i=[];if(e){for(let n=0;n<e;n+=8)i.push(t[n],t[n+1],t[n+2]);i.push(t[e-4],t[e-3],t[e-2])}return i},build(){if(this._order.getValue()<2)return;if(!this.controlPointNode)return;if(this.controlPointNode.getSize()<this._order.getValue())return;const t=this.getClosed(this._order.getValue(),this._knot,this._weight,this.controlPointNode),e=this.getWeights(this.weights,this.controlPointNode.getSize(),this._weight),i=this.getControlPoints(this.controlPoints,t,this._order.getValue(),e,this.controlPointNode),n=this.getKnots(this.knots,t,this._order.getValue(),this.controlPointNode.getSize(),this._knot),o=this._order.getValue()-1;this.surface=(this.surface??jt)({boundary:["open"],degree:[o],knots:[n],points:i,debug:!1}),this.sampleOptions.resolution[0]=this.getTessellation(this.controlPointNode.getSize()),this.sampleOptions.closed=t,this.sampleOptions.haveWeights=!!e;const s=jt.sample(this.mesh,this.surface,this.sampleOptions).points,r=s.length-3,l=this.getVertices();for(let t=0;t<r;t+=3)l.push(s[t+0],s[t+1],s[t+2],1,s[t+3],s[t+4],s[t+5],1)},dispose(){M.prototype.dispose.call(this)}}),Object.defineProperties(xt,{...d().getStaticProperties("NurbsCurve","NURBS",1,"geometry","3.0"),fieldDefinitions:{value:new(h())([new(l())(g().inputOutput,"metadata",new(s().SFNode)),new(l())(g().inputOutput,"tessellation",new(s().SFInt32)),new(l())(g().initializeOnly,"closed",new(s().SFBool)),new(l())(g().initializeOnly,"order",new(s().SFInt32)(3)),new(l())(g().initializeOnly,"knot",new(s().MFDouble)),new(l())(g().inputOutput,"weight",new(s().MFDouble)),new(l())(g().inputOutput,"controlPoint",new(s().SFNode))]),enumerable:!0}});const Rt=xt,It=m().add("NurbsCurve",Rt);function zt(t){N.call(this,t),this.addType(g().NurbsCurve2D),this.knots=[],this.weights=[],this.controlPoints=[],this.mesh={},this.sampleOptions={resolution:[]},this.array=[]}Object.assign(Object.setPrototypeOf(zt.prototype,N.prototype),{getTessellation(t){return k.getTessellation(this._tessellation.getValue(),t)},getClosed(t,e,i,n){return!!this._closed.getValue()&&k.getClosed2D(t,e,i,n)},getKnots:(t,e,i,n,o)=>k.getKnots(t,e,i,n,o),getWeights:(t,e,i)=>k.getWeights(t,e,i),getControlPoints:(t,e,i,n,o)=>k.getControlPoints2D(t,e,i,n,o),tessellate(t,e=this.array){if(this._order.getValue()<2)return e;if(this._controlPoint.length<this._order.getValue())return e;const i=this.getClosed(this._order.getValue(),this._knot,this._weight,this._controlPoint),n=this.getWeights(this.weights,this._controlPoint.length,this._weight),o=this.getControlPoints(this.controlPoints,i,this._order.getValue(),n,this._controlPoint),s=this.getKnots(this.knots,i,this._order.getValue(),this._controlPoint.length,this._knot),r=this._order.getValue()-1;this.surface=(this.surface??jt)({boundary:["open"],degree:[r],knots:[s],points:o,debug:!1}),this.sampleOptions.resolution[0]=this.getTessellation(this._controlPoint.length),this.sampleOptions.closed=i,this.sampleOptions.haveWeights=!!n;const l=jt.sample(this.mesh,this.surface,this.sampleOptions).points,a=l.length;switch(t){case 0:e.length=0;for(const t of l)e.push(t);break;case 1:e.length=0;for(let t=0;t<a;t+=2)e.push(l[t],0,l[t+1]);break;case 2:for(let t=0;t<a;t+=2)e.push(new(P())(l[t],l[t+1],0))}return e}}),Object.defineProperties(zt,{...d().getStaticProperties("NurbsCurve2D","NURBS",3,"children","3.0"),fieldDefinitions:{value:new(h())([new(l())(g().inputOutput,"metadata",new(s().SFNode)),new(l())(g().inputOutput,"tessellation",new(s().SFInt32)),new(l())(g().initializeOnly,"closed",new(s().SFBool)),new(l())(g().initializeOnly,"order",new(s().SFInt32)(3)),new(l())(g().initializeOnly,"knot",new(s().MFDouble)),new(l())(g().inputOutput,"weight",new(s().MFDouble)),new(l())(g().inputOutput,"controlPoint",new(s().MFVec2d))]),enumerable:!0}});const At=zt,kt=m().add("NurbsCurve2D",At),Bt=t.X3DChildNode;var Et=e.n(Bt);const Mt=t.Rotation4;var Kt=e.n(Mt);const Ut=t.Algorithm;var Gt=e.n(Ut);function Yt(t){Et().call(this,t),this.addType(g().NurbsOrientationInterpolator),this.geometry=new It(t)}Object.assign(Object.setPrototypeOf(Yt.prototype,Et().prototype),{initialize(){Et().prototype.initialize.call(this),this._set_fraction.addInterest("set_fraction__",this),this._order.addFieldInterest(this.geometry._order),this._knot.addFieldInterest(this.geometry._knot),this._weight.addFieldInterest(this.geometry._weight),this._controlPoint.addFieldInterest(this.geometry._controlPoint),this.geometry._tessellation=1,this.geometry._order=this._order,this.geometry._knot=this._knot,this.geometry._weight=this._weight,this.geometry._controlPoint=this._controlPoint,this.geometry._rebuild.addInterest("set_geometry__",this),this.geometry.setup(),this.set_geometry__()},set_geometry__(){const t=this.geometry.getSurface();t?(delete this.set_fraction__,this.derivative=t.evaluator(1)):this.set_fraction__=Function.prototype},set_fraction__:(()=>{const t=new(P()),e=new(Kt());return function(){const i=Gt().clamp(this._set_fraction.getValue(),0,1),n=this.geometry.getSurface().domain[0],o=Gt().project(i,0,1,...n);this.derivative(t,o),this._value_changed=e.setVectors(P().Z_AXIS,t)}})()}),Object.defineProperties(Yt,{...d().getStaticProperties("NurbsOrientationInterpolator","NURBS",1,"children","3.0"),fieldDefinitions:{value:new(h())([new(l())(g().inputOutput,"metadata",new(s().SFNode)),new(l())(g().inputOnly,"set_fraction",new(s().SFFloat)),new(l())(g().inputOutput,"order",new(s().SFInt32)(3)),new(l())(g().inputOutput,"knot",new(s().MFDouble)),new(l())(g().inputOutput,"weight",new(s().MFDouble)),new(l())(g().inputOutput,"controlPoint",new(s().SFNode)),new(l())(g().outputOnly,"value_changed",new(s().SFRotation))]),enumerable:!0}});const Wt=Yt,Xt=m().add("NurbsOrientationInterpolator",Wt),qt=t.Triangle3;var $t=e.n(qt);function Lt(t){M.call(this,t),this.addType(g().X3DNurbsSurfaceGeometryNode),this.tessellationScale=1,this.uKnots=[],this.vKnots=[],this.weights=[],this.controlPoints=[],this.mesh={},this.sampleOptions={resolution:[],closed:[]},this.textUKnots=[],this.textVKnots=[],this.textWeights=[],this.texControlPoints=[],this.texMesh={}}Object.assign(Object.setPrototypeOf(Lt.prototype,M.prototype),{initialize(){M.prototype.initialize.call(this),this._texCoord.addInterest("set_texCoord__",this),this._controlPoint.addInterest("set_controlPoint__",this),this.set_texCoord__(),this.set_controlPoint__()},set_texCoord__(){this.texCoordNode?.removeInterest("requestRebuild",this),this.nurbsTexCoordNode?.removeInterest("requestRebuild",this),this.texCoordNode=f()(g().X3DTextureCoordinateNode,this._texCoord),this.nurbsTexCoordNode=f()(g().NurbsTextureCoordinate,this._texCoord),this.texCoordNode?.addInterest("requestRebuild",this),this.nurbsTexCoordNode?.addInterest("requestRebuild",this)},set_controlPoint__(){this.controlPointNode?.removeInterest("requestRebuild",this),this.controlPointNode=f()(g().X3DCoordinateNode,this._controlPoint),this.controlPointNode?.addInterest("requestRebuild",this)},setTessellationScale(t){this.tessellationScale=t,this.requestRebuild()},getUTessellation(){return Math.floor(k.getTessellation(this._uTessellation.getValue(),this._uDimension.getValue())*this.tessellationScale)},getVTessellation(t){return Math.floor(k.getTessellation(this._vTessellation.getValue(),this._vDimension.getValue())*this.tessellationScale)},getUClosed(t,e,i,n,o,s){return!!this._uClosed.getValue()&&k.getUClosed(t,e,i,n,o,s)},getVClosed(t,e,i,n,o,s){return!!this._vClosed.getValue()&&k.getVClosed(t,e,i,n,o,s)},getUVWeights:(t,e,i,n)=>k.getUVWeights(t,e,i,n),getTexControlPoints:(t,e,i,n,o,s,r,l)=>k.getTexControlPoints(t,e,i,n,o,s,r,l),getUVControlPoints:(t,e,i,n,o,s,r,l,a)=>k.getUVControlPoints(t,e,i,n,o,s,r,l,a),getSurface(){return this.surface},trimSurface(){},build(){if(this._uOrder.getValue()<2)return;if(this._vOrder.getValue()<2)return;if(this._uDimension.getValue()<this._uOrder.getValue())return;if(this._vDimension.getValue()<this._vOrder.getValue())return;if(!this.controlPointNode)return;if(this.controlPointNode.getSize()<this._uDimension.getValue()*this._vDimension.getValue())return;const t=this.getUClosed(this._uOrder.getValue(),this._uDimension.getValue(),this._vDimension.getValue(),this._uKnot,this._weight,this.controlPointNode),e=this.getVClosed(this._vOrder.getValue(),this._uDimension.getValue(),this._vDimension.getValue(),this._vKnot,this._weight,this.controlPointNode),i=this.getUVWeights(this.weights,this._uDimension.getValue(),this._vDimension.getValue(),this._weight),n=this.getUVControlPoints(this.controlPoints,t,e,this._uOrder.getValue(),this._vOrder.getValue(),this._uDimension.getValue(),this._vDimension.getValue(),i,this.controlPointNode),o=this.getKnots(this.uKnots,t,this._uOrder.getValue(),this._uDimension.getValue(),this._uKnot),s=this.getKnots(this.vKnots,e,this._vOrder.getValue(),this._vDimension.getValue(),this._vKnot),r=this._uOrder.getValue()-1,l=this._vOrder.getValue()-1;this.surface=(this.surface??jt)({boundary:["open","open"],degree:[r,l],knots:[o,s],points:n,debug:!1});const a=this.sampleOptions;a.resolution[0]=this.getUTessellation(),a.resolution[1]=this.getVTessellation(),a.closed[0]=t,a.closed[1]=e,a.haveWeights=!!i;const h=jt.sample(this.mesh,this.surface,a),u=h.faces,d=h.points,c=this.getVertices();for(const t of u){const e=3*t;c.push(d[e],d[e+1],d[e+2],1)}this.buildNurbsTexCoords(t,e,this._uOrder.getValue(),this._vOrder.getValue(),o,s,this._uDimension.getValue(),this._vDimension.getValue()),this.generateNormals(u,d),this.trimSurface(o,s),this.setSolid(this._solid.getValue()),this.setCCW(!0)},buildNurbsTexCoords(t,e,i,n,o,s,r,l){const a=this.getMultiTexCoords();if(this.texCoordNode){this.texCoordNode.init(a);const h=this.texCoordNode.getTextureCoordinates?.(),u=a.length;for(let d=0;d<u;++d){const u=a[d],c=h?.[d]??this.texCoordNode,g=i-1,p=n-1,f=o,_=s,m=this.getTexControlPoints(this.texControlPoints,t,e,i,n,r,l,c);this.createNurbsTexCoords(g,p,f,_,m,u)}}else if(this.nurbsTexCoordNode?.isValid()){const t=this.nurbsTexCoordNode,e=t._uOrder.getValue()-1,i=t._vOrder.getValue()-1,n=this.getKnots(this.texUKnots,!1,t._uOrder.getValue(),t._uDimension.getValue(),t._uKnot),o=this.getKnots(this.texVKnots,!1,t._vOrder.getValue(),t._vDimension.getValue(),t._vKnot),s=this.getUVWeights(this.texWeights,t._uDimension.getValue(),t._vDimension.getValue(),t._weight),r=t.getControlPoints(s),l=this.getTexCoords();a.push(l),this.createNurbsTexCoords(e,i,n,o,r,l)}else{const t=this.getTexCoords();a.push(t),this.createDefaultNurbsTexCoords(t)}},createDefaultNurbsTexCoords:(()=>{const t=[0,0,5,5],e=[[[0,0,0,1],[0,1,0,1]],[[1,0,0,1],[1,1,0,1]]];return function(i){const n=t,o=t,s=e;return this.createNurbsTexCoords(1,1,n,o,s,i)}})(),createNurbsTexCoords(t,e,i,n,o,s){this.texSurface=(this.texSurface??jt)({boundary:["open","open"],degree:[t,e],knots:[i,n],points:o});const r=this.sampleOptions;r.closed[0]=!1,r.closed[1]=!1,r.haveWeights=!1;const l=jt.sample(this.texMesh,this.texSurface,r),a=l.faces,h=l.points;for(const t of a){const e=4*t;s.push(h[e],h[e+1],h[e+2],h[e+3])}return s},generateNormals(t,e){const i=this.createNormals(t,e),n=this.getNormals();for(const{x:t,y:e,z:o}of i)n.push(t,e,o)},createNormals(t,e){const i=new Map,n=this.createFaceNormals(t,e),o=t.length;for(let e=0;e<o;++e){const n=t[e];let o=i.get(n);o||i.set(n,o=[]),o.push(e)}return this.refineNormals(i,n,Gt().radians(85))},createFaceNormals:(()=>{const t=new(P()),e=new(P()),i=new(P());return function(n,o){const s=this.faceNormals??[],r=n.length;for(let l=0;l<r;l+=3){const r=3*n[l],a=3*n[l+1],h=3*n[l+2];t.set(o[r],o[r+1],o[r+2]),e.set(o[a],o[a+1],o[a+2]),i.set(o[h],o[h+1],o[h+2]);const u=$t().normal(t,e,i,s[l]??new(P()));s[l]=u,s[l+1]=u,s[l+2]=u}return s.length=r,s}})()}),Object.defineProperties(Lt,d().getStaticProperties("X3DNurbsSurfaceGeometryNode","NURBS",1));const Jt=Lt,Zt=m().add("X3DNurbsSurfaceGeometryNode",Jt);function Ht(t){Zt.call(this,t),this.addType(g().NurbsPatchSurface)}Object.setPrototypeOf(Ht.prototype,Zt.prototype),Object.defineProperties(Ht,{...d().getStaticProperties("NurbsPatchSurface","NURBS",1,"geometry","3.0"),fieldDefinitions:{value:new(h())([new(l())(g().inputOutput,"metadata",new(s().SFNode)),new(l())(g().inputOutput,"uTessellation",new(s().SFInt32)),new(l())(g().inputOutput,"vTessellation",new(s().SFInt32)),new(l())(g().initializeOnly,"solid",new(s().SFBool)(!0)),new(l())(g().initializeOnly,"uClosed",new(s().SFBool)),new(l())(g().initializeOnly,"vClosed",new(s().SFBool)),new(l())(g().initializeOnly,"uOrder",new(s().SFInt32)(3)),new(l())(g().initializeOnly,"vOrder",new(s().SFInt32)(3)),new(l())(g().initializeOnly,"uDimension",new(s().SFInt32)),new(l())(g().initializeOnly,"vDimension",new(s().SFInt32)),new(l())(g().initializeOnly,"uKnot",new(s().MFDouble)),new(l())(g().initializeOnly,"vKnot",new(s().MFDouble)),new(l())(g().inputOutput,"weight",new(s().MFDouble)),new(l())(g().inputOutput,"texCoord",new(s().SFNode)),new(l())(g().inputOutput,"controlPoint",new(s().SFNode))]),enumerable:!0}});const Qt=Ht,te=m().add("NurbsPatchSurface",Qt);function ee(t){Et().call(this,t),this.addType(g().NurbsPositionInterpolator),this.geometry=new It(t)}Object.assign(Object.setPrototypeOf(ee.prototype,Et().prototype),{initialize(){Et().prototype.initialize.call(this),this._set_fraction.addInterest("set_fraction__",this),this._order.addFieldInterest(this.geometry._order),this._knot.addFieldInterest(this.geometry._knot),this._weight.addFieldInterest(this.geometry._weight),this._controlPoint.addFieldInterest(this.geometry._controlPoint),this.geometry._tessellation=1,this.geometry._order=this._order,this.geometry._knot=this._knot,this.geometry._weight=this._weight,this.geometry._controlPoint=this._controlPoint,this.geometry._rebuild.addInterest("set_geometry__",this),this.geometry.setup(),this.set_geometry__()},set_geometry__(){this.geometry.getSurface()?delete this.set_fraction__:this.set_fraction__=Function.prototype},set_fraction__:(()=>{const t=new(P());return function(){const e=Gt().clamp(this._set_fraction.getValue(),0,1),i=this.geometry.getSurface(),n=i.domain[0],o=Gt().project(e,0,1,...n);i.evaluate(t,o),this._value_changed=t}})()}),Object.defineProperties(ee,{...d().getStaticProperties("NurbsPositionInterpolator","NURBS",1,"children","3.0"),fieldDefinitions:{value:new(h())([new(l())(g().inputOutput,"metadata",new(s().SFNode)),new(l())(g().inputOnly,"set_fraction",new(s().SFFloat)),new(l())(g().inputOutput,"order",new(s().SFInt32)(3)),new(l())(g().inputOutput,"knot",new(s().MFDouble)),new(l())(g().inputOutput,"weight",new(s().MFDouble)),new(l())(g().inputOutput,"controlPoint",new(s().SFNode)),new(l())(g().outputOnly,"value_changed",new(s().SFVec3f))]),enumerable:!0}});const ie=ee,ne=m().add("NurbsPositionInterpolator",ie),oe=t.X3DBoundedObject;var se=e.n(oe);function re(t){Et().call(this,t),se().call(this,t),this.addType(g().NurbsSet),this.geometryNodes=[]}function le(t,e){const i=new Set(e);return t.filter(t=>!i.has(t))}Object.assign(Object.setPrototypeOf(re.prototype,Et().prototype),se().prototype,{initialize(){Et().prototype.initialize.call(this),se().prototype.initialize.call(this),this._tessellationScale.addInterest("set_tessellationScale__",this),this._addGeometry.addInterest("set_addGeometry__",this),this._removeGeometry.addInterest("set_removeGeometry__",this),this._geometry.addInterest("set_geometry__",this),this.set_geometry__()},getBBox(t,e){if(this.isDefaultBBoxSize()){for(const e of this.geometryNodes)t.add(e.getBBox());return t}return t.set(this._bboxSize.getValue(),this._bboxCenter.getValue())},set_tessellationScale__(){const t=Math.max(0,this._tessellationScale.getValue());for(const e of this.geometryNodes)e.setTessellationScale(t)},set_addGeometry__(){this._addGeometry.setTainted(!0),this._addGeometry.assign(le(this._addGeometry,this._geometry));for(const t of this._addGeometry)this._geometry.push(t);this._addGeometry.length=0,this._addGeometry.setTainted(!1)},set_removeGeometry__(){this._removeGeometry.setTainted(!0),this._geometry.assign(le(this._geometry,this._removeGeometry)),this._removeGeometry.length=0,this._removeGeometry.setTainted(!1)},set_geometry__(){for(const t of this.geometryNodes)t.setTessellationScale(1);this.geometryNodes.length=0;for(const t of this._geometry){const e=f()(g().X3DNurbsSurfaceGeometryNode,t);e&&this.geometryNodes.push(e)}this.set_tessellationScale__()},dispose(){se().prototype.dispose.call(this),Et().prototype.dispose.call(this)}}),Object.defineProperties(re,{...d().getStaticProperties("NurbsSet","NURBS",2,"children","3.0"),fieldDefinitions:{value:new(h())([new(l())(g().inputOutput,"metadata",new(s().SFNode)),new(l())(g().inputOutput,"tessellationScale",new(s().SFFloat)(1)),new(l())(g().inputOutput,"visible",new(s().SFBool)(!0)),new(l())(g().inputOutput,"bboxDisplay",new(s().SFBool)),new(l())(g().initializeOnly,"bboxSize",new(s().SFVec3f)(-1,-1,-1)),new(l())(g().initializeOnly,"bboxCenter",new(s().SFVec3f)),new(l())(g().inputOnly,"addGeometry",new(s().MFNode)),new(l())(g().inputOnly,"removeGeometry",new(s().MFNode)),new(l())(g().inputOutput,"geometry",new(s().MFNode))]),enumerable:!0}});const ae=re,he=m().add("NurbsSet",ae);function ue(t){Et().call(this,t),this.addType(g().NurbsSurfaceInterpolator),this.geometry=new te(t)}Object.assign(Object.setPrototypeOf(ue.prototype,Et().prototype),{initialize(){Et().prototype.initialize.call(this),this._set_fraction.addInterest("set_fraction__",this),this._uOrder.addFieldInterest(this.geometry._uOrder),this._vOrder.addFieldInterest(this.geometry._vOrder),this._uDimension.addFieldInterest(this.geometry._uDimension),this._vDimension.addFieldInterest(this.geometry._vDimension),this._uKnot.addFieldInterest(this.geometry._uKnot),this._vKnot.addFieldInterest(this.geometry._vKnot),this._weight.addFieldInterest(this.geometry._weight),this._controlPoint.addFieldInterest(this.geometry._controlPoint),this.geometry._uTessellation=1,this.geometry._vTessellation=1,this.geometry._uOrder=this._uOrder,this.geometry._vOrder=this._vOrder,this.geometry._uDimension=this._uDimension,this.geometry._vDimension=this._vDimension,this.geometry._uKnot=this._uKnot,this.geometry._vKnot=this._vKnot,this.geometry._weight=this._weight,this.geometry._controlPoint=this._controlPoint,this.geometry._rebuild.addInterest("set_geometry__",this),this.geometry.setup(),this.set_geometry__()},set_geometry__(){const t=this.geometry.getSurface();t?(delete this.set_fraction__,this.uDerivative=t.evaluator([1,0]),this.vDerivative=t.evaluator([0,1])):this.set_fraction__=Function.prototype},set_fraction__:(()=>{const t=new(P()),e=new(P()),i=new(P());return function(){const n=this._set_fraction.getValue(),o=Gt().clamp(n.x,0,1),s=Gt().clamp(n.y,0,1),r=this.geometry.getSurface(),l=r.domain[0],a=r.domain[1],h=Gt().project(o,0,1,...l),u=Gt().project(s,0,1,...a);this.uDerivative(t,h,u),this.vDerivative(e,h,u),r.evaluate(i,h,u),this._normal_changed=t.cross(e),this._position_changed=i}})()}),Object.defineProperties(ue,{...d().getStaticProperties("NurbsSurfaceInterpolator","NURBS",1,"children","3.0"),fieldDefinitions:{value:new(h())([new(l())(g().inputOutput,"metadata",new(s().SFNode)),new(l())(g().inputOnly,"set_fraction",new(s().SFVec2f)),new(l())(g().initializeOnly,"uOrder",new(s().SFInt32)(3)),new(l())(g().initializeOnly,"vOrder",new(s().SFInt32)(3)),new(l())(g().initializeOnly,"uDimension",new(s().SFInt32)),new(l())(g().initializeOnly,"vDimension",new(s().SFInt32)),new(l())(g().initializeOnly,"uKnot",new(s().MFDouble)),new(l())(g().initializeOnly,"vKnot",new(s().MFDouble)),new(l())(g().inputOutput,"weight",new(s().MFDouble)),new(l())(g().inputOutput,"controlPoint",new(s().SFNode)),new(l())(g().outputOnly,"normal_changed",new(s().SFVec3f)),new(l())(g().outputOnly,"position_changed",new(s().SFVec3f))]),enumerable:!0}});const de=ue,ce=m().add("NurbsSurfaceInterpolator",de),ge=t.Extrusion;var pe=e.n(ge);function fe(t){M.call(this,t),this.addType(g().NurbsSweptSurface),this.extrusion=new(pe())(t)}Object.assign(Object.setPrototypeOf(fe.prototype,M.prototype),{initialize(){M.prototype.initialize.call(this),this._crossSectionCurve.addInterest("set_crossSectionCurve__",this),this._trajectoryCurve.addInterest("set_trajectoryCurve__",this);const t=this.extrusion;t._beginCap=!1,t._endCap=!1,t._solid=!0,t._ccw=!0,t._convex=!0,t._creaseAngle=Math.PI,t.setup(),t._crossSection.setTainted(!0),t._spine.setTainted(!0),this.set_crossSectionCurve__(),this.set_trajectoryCurve__()},getTrajectoryCurve(){return this.trajectoryCurveNode},set_crossSectionCurve__(){this.crossSectionCurveNode?.removeInterest("requestRebuild",this),this.crossSectionCurveNode=f()(g().X3DNurbsControlCurveNode,this._crossSectionCurve),this.crossSectionCurveNode?.addInterest("requestRebuild",this)},set_trajectoryCurve__(){this.trajectoryCurveNode?._rebuild.removeInterest("requestRebuild",this),this.trajectoryCurveNode=f()(g().NurbsCurve,this._trajectoryCurve),this.trajectoryCurveNode?._rebuild.addInterest("requestRebuild",this)},build(){if(!this.crossSectionCurveNode)return;if(!this.trajectoryCurveNode)return;const t=this.extrusion;if(t._crossSection=this.crossSectionCurveNode.tessellate(0),t._spine=this.trajectoryCurveNode.tessellate(0),t.rebuild(),this.getColors().assign(t.getColors()),this.getTexCoords().assign(t.getTexCoords()),this.getTangents().assign(t.getTangents()),this.getNormals().assign(t.getNormals()),this.getVertices().assign(t.getVertices()),this.getMultiTexCoords().push(this.getTexCoords()),!this._ccw.getValue()){const t=this.getNormals(),e=t.length;for(let i=0;i<e;++i)t[i]*=-1}this.setSolid(this._solid.getValue()),this.setCCW(this._ccw.getValue())}}),Object.defineProperties(fe,{...d().getStaticProperties("NurbsSweptSurface","NURBS",3,"geometry","3.0"),fieldDefinitions:{value:new(h())([new(l())(g().inputOutput,"metadata",new(s().SFNode)),new(l())(g().initializeOnly,"solid",new(s().SFBool)(!0)),new(l())(g().initializeOnly,"ccw",new(s().SFBool)(!0)),new(l())(g().inputOutput,"crossSectionCurve",new(s().SFNode)),new(l())(g().inputOutput,"trajectoryCurve",new(s().SFNode))]),enumerable:!0}});const _e=fe,me=m().add("NurbsSweptSurface",_e);function we(t){M.call(this,t),this.addType(g().NurbsSwungSurface),this.extrusion=new(pe())(t)}Object.assign(Object.setPrototypeOf(we.prototype,M.prototype),{initialize(){M.prototype.initialize.call(this),this._profileCurve.addInterest("set_profileCurve__",this),this._trajectoryCurve.addInterest("set_trajectoryCurve__",this);const t=this.extrusion;t._beginCap=!1,t._endCap=!1,t._solid=!0,t._ccw=!0,t._convex=!0,t._creaseAngle=Math.PI,t.setup(),t._crossSection.setTainted(!0),t._spine.setTainted(!0),this.set_profileCurve__(),this.set_trajectoryCurve__()},getTrajectoryCurve(){return this.trajectoryCurveNode},set_profileCurve__(){this.profileCurveNode?.removeInterest("requestRebuild",this),this.profileCurveNode=f()(g().X3DNurbsControlCurveNode,this._profileCurve),this.profileCurveNode?.addInterest("requestRebuild",this)},set_trajectoryCurve__(){this.trajectoryCurveNode?.removeInterest("requestRebuild",this),this.trajectoryCurveNode=f()(g().X3DNurbsControlCurveNode,this._trajectoryCurve),this.trajectoryCurveNode?.addInterest("requestRebuild",this)},build(){if(!this.profileCurveNode)return;if(!this.trajectoryCurveNode)return;const t=this.extrusion;if(t._crossSection=this.profileCurveNode.tessellate(0),t._spine=this.trajectoryCurveNode.tessellate(1),t.rebuild(),this.getColors().assign(t.getColors()),this.getTexCoords().assign(t.getTexCoords()),this.getTangents().assign(t.getTangents()),this.getNormals().assign(t.getNormals()),this.getVertices().assign(t.getVertices()),this.getMultiTexCoords().push(this.getTexCoords()),!this._ccw.getValue()){const t=this.getNormals(),e=t.length;for(let i=0;i<e;++i)t[i]*=-1}this.setSolid(this._solid.getValue()),this.setCCW(this._ccw.getValue())}}),Object.defineProperties(we,{...d().getStaticProperties("NurbsSwungSurface","NURBS",3,"geometry","3.0"),fieldDefinitions:{value:new(h())([new(l())(g().inputOutput,"metadata",new(s().SFNode)),new(l())(g().initializeOnly,"solid",new(s().SFBool)(!0)),new(l())(g().initializeOnly,"ccw",new(s().SFBool)(!0)),new(l())(g().inputOutput,"profileCurve",new(s().SFNode)),new(l())(g().inputOutput,"trajectoryCurve",new(s().SFNode))]),enumerable:!0}});const ye=we,be=m().add("NurbsSwungSurface",ye);function ve(t){d().call(this,t),this.addType(g().NurbsTextureCoordinate),this.array=[]}Object.assign(Object.setPrototypeOf(ve.prototype,d().prototype),{getControlPoints(t){const e=this._uDimension.getValue(),i=this._vDimension.getValue(),n=this._controlPoint.getValue(),o=this.array;for(let s=0;s<e;++s){const r=o[s]??=[];for(let o=0;o<i;++o){const i=o*e+s,l=r[o]??new(z()),a=2*i;r[o]=l.set(n[a],n[a+1],0,t?t[i]:1)}r.length=i}return o.length=e,o},isValid(){return!(this._uOrder.getValue()<2)&&(!(this._vOrder.getValue()<2)&&(!(this._uDimension.getValue()<this._uOrder.getValue())&&(!(this._vDimension.getValue()<this._vOrder.getValue())&&!(this._controlPoint.length<this._uDimension.getValue()*this._vDimension.getValue()))))}}),Object.defineProperties(ve,{...d().getStaticProperties("NurbsTextureCoordinate","NURBS",1,"texCoord","3.0"),fieldDefinitions:{value:new(h())([new(l())(g().inputOutput,"metadata",new(s().SFNode)),new(l())(g().initializeOnly,"uOrder",new(s().SFInt32)(3)),new(l())(g().initializeOnly,"vOrder",new(s().SFInt32)(3)),new(l())(g().initializeOnly,"uDimension",new(s().SFInt32)),new(l())(g().initializeOnly,"vDimension",new(s().SFInt32)),new(l())(g().initializeOnly,"uKnot",new(s().MFDouble)),new(l())(g().initializeOnly,"vKnot",new(s().MFDouble)),new(l())(g().inputOutput,"weight",new(s().MFDouble)),new(l())(g().inputOutput,"controlPoint",new(s().MFVec2f))]),enumerable:!0}});const Ce=ve,Oe=m().add("NurbsTextureCoordinate",Ce),Ne={area:({x:t,y:e},{x:i,y:n},{x:o,y:s})=>Math.abs(t*(n-s)+i*(s-e)+o*(e-n))/2,isPointInTriangle({x:t,y:e},{x:i,y:n},{x:o,y:s},{x:r,y:l}){const a=(s-l)*(i-r)+(r-o)*(n-l);if(0===a)return!1;const h=((s-l)*(t-r)+(r-o)*(e-l))/a;if(h<0||h>1)return!1;const u=((l-n)*(t-r)+(i-r)*(e-l))/a;if(u<0||u>1)return!1;const d=1-h-u;return!(d<0||d>1)},toBarycentric:(()=>{const t=new(R()),e=new(R()),i=new(R());return function(n,o,s,r,l={}){t.assign(s).subtract(o),e.assign(r).subtract(o),i.assign(n).subtract(o);const a=t.dot(t),h=t.dot(e),u=e.dot(e),d=i.dot(t),c=i.dot(e),g=a*u-h*h;return l.v=(u*d-h*c)/g,l.t=(a*c-h*d)/g,l.u=1-l.v-l.t,l}})()},Se=m().add("Triangle2",Ne),Pe=t.libtess;var De=e.n(Pe);function Te(t){Zt.call(this,t),this.addType(g().NurbsTrimmedSurface),this.trimmingContourNodes=[],this.trimmingContours=[]}function Fe(t,e){const i=new Set(e);return t.filter(t=>!i.has(t))}Object.assign(Object.setPrototypeOf(Te.prototype,Zt.prototype),{initialize(){Zt.prototype.initialize.call(this),this._addTrimmingContour.addInterest("set_addTrimmingContour__",this),this._removeTrimmingContour.addInterest("set_removeTrimmingContour__",this),this._trimmingContour.addInterest("set_trimmingContour__",this),this.set_trimmingContour__()},set_addTrimmingContour__(){this._addTrimmingContour.setTainted(!0),this._addTrimmingContour.assign(Fe(this._addTrimmingContour,this._trimmingContour),this._addTrimmingContour.length);for(const t of this._addTrimmingContour)this._trimmingContour.push(t);this._addTrimmingContour.length=0,this._addTrimmingContour.setTainted(!1)},set_removeTrimmingContour__(){this._removeTrimmingContour.setTainted(!0),this._trimmingContour.assign(Fe(this._trimmingContour,this._removeTrimmingContour)),this._removeTrimmingContour.length=0,this._removeTrimmingContour.setTainted(!1)},set_trimmingContour__(){const t=this.trimmingContourNodes;for(const e of t)e.removeInterest("requestRebuild",this);t.length=0;for(const e of this._trimmingContour){const i=f()(g().Contour2D,e);i&&t.push(i)}for(const e of t)e.addInterest("requestRebuild",this)},getTrimmingContours(t,e,i){for(const n of this.trimmingContourNodes)n.addTrimmingContour(t,e,i);return i},trimSurface:(()=>{const t=[new(P())(0,0,0),new(P())(1,0,0),new(P())(1,1,0),new(P())(0,1,0)];return function(e,i){const n=e.at(0),o=i.at(0),s=e.at(-1)-n,r=i.at(-1)-o,l=new(P())(n,o,0),a=new(P())(s,r,1),h=this.createDefaultNurbsTriangles([]),u=h.length,d=this.getTrimmingContours(l,a,[t]),c=this.triangulatePolygon(d,[],!1),g=c.length,p=[];if(1===d.length)return;for(let t=0;t<u;++t)h[t].index=t;for(let t=0;t<u;t+=3)p.push(h.slice(t,t+3));for(let t=0;t<g;t+=3)p.push(c.slice(t,t+3));const f=this.getMultiTexCoords(),_=this.getNormals(),m=this.getVertices(),w=this.triangulatePolygon(p,[],!0),y=w.length,b=f.length,v=f.map(()=>[]),C=[],O=[],N={};let S=0;for(let t=0;t<y;t+=3){const{[t]:e,[t+1]:i,[t+2]:n}=w;Se.area(e,i,n)<1e-6||(w[S++]=e,w[S++]=i,w[S++]=n)}w.length=S;t:for(let t=0;t<S;++t){const e=w[t];if(Object.hasOwn(e,"index")){const t=e.index,i=3*t,n=4*t;for(let t=0;t<b;++t){const e=f[t],i=v[t],{[n]:o,[n+1]:s,[n+2]:r,[n+3]:l}=e;i.push(o,s,r,l)}const{[i]:o,[i+1]:s,[i+2]:r}=_,{[n]:l,[n+1]:a,[n+2]:h}=m;C.push(o,s,r),O.push(l,a,h,1);continue t}for(let t=0;t<u;t+=3){const{[t]:i,[t+1]:n,[t+2]:o}=h,{u:s,v:r,t:l}=Se.toBarycentric(e,i,n,o,N);if(Math.abs(s-.5)>.50001)continue;if(Math.abs(r-.5)>.50001)continue;if(Math.abs(l-.5)>.50001)continue;const a=3*t,u=4*t;for(let t=0;t<b;++t){const e=f[t];v[t].push(s*e[u+0]+r*e[u+4]+l*e[u+8],s*e[u+1]+r*e[u+5]+l*e[u+9],s*e[u+2]+r*e[u+6]+l*e[u+10],s*e[u+3]+r*e[u+7]+l*e[u+11])}C.push(s*_[a+0]+r*_[a+3]+l*_[a+6],s*_[a+1]+r*_[a+4]+l*_[a+7],s*_[a+2]+r*_[a+5]+l*_[a+8]),O.push(s*m[u+0]+r*m[u+4]+l*m[u+8],s*m[u+1]+r*m[u+5]+l*m[u+9],s*m[u+2]+r*m[u+6]+l*m[u+10],1);continue t}const i=t%3;for(const t of v)t.length-=4*i;C.length-=3*i,O.length-=4*i,t+=2-i}for(let t=0;t<b;++t)f[t].assign(v[t]);_.assign(C),m.assign(O)}})(),createDefaultNurbsTriangles(t){const e=this.createDefaultNurbsTexCoords([]),i=e.length;for(let n=0;n<i;n+=4)t.push(new(P())(e[n],e[n+1],0));return t},triangulatePolygon:(()=>{function t(t,e,i){return new(P())(...t)}function e(t,[e,i,n,o],s){return n||e.x!==i.x||e.y!==i.y?new(P())(...t):e}const i=new(De().GluTesselator);return i.gluTessCallback(De().gluEnum.GLU_TESS_VERTEX_DATA,function(t,e){e.push(t)}),i.gluTessCallback(De().gluEnum.GLU_TESS_COMBINE,t),i.gluTessProperty(De().gluEnum.GLU_TESS_WINDING_RULE,De().windingRule.GLU_TESS_WINDING_ODD),i.gluTessNormal(0,0,1),function(n,o,s){i.gluTessCallback(De().gluEnum.GLU_TESS_COMBINE,s?e:t),i.gluTessBeginPolygon(o);for(const t of n){i.gluTessBeginContour();for(const e of t)i.gluTessVertex(e,e);i.gluTessEndContour()}return i.gluTessEndPolygon(),o}})()}),Object.defineProperties(Te,{...d().getStaticProperties("NurbsTrimmedSurface","NURBS",4,"geometry","3.0"),fieldDefinitions:{value:new(h())([new(l())(g().inputOutput,"metadata",new(s().SFNode)),new(l())(g().inputOutput,"uTessellation",new(s().SFInt32)),new(l())(g().inputOutput,"vTessellation",new(s().SFInt32)),new(l())(g().initializeOnly,"solid",new(s().SFBool)(!0)),new(l())(g().initializeOnly,"uClosed",new(s().SFBool)),new(l())(g().initializeOnly,"vClosed",new(s().SFBool)),new(l())(g().initializeOnly,"uOrder",new(s().SFInt32)(3)),new(l())(g().initializeOnly,"vOrder",new(s().SFInt32)(3)),new(l())(g().initializeOnly,"uDimension",new(s().SFInt32)),new(l())(g().initializeOnly,"vDimension",new(s().SFInt32)),new(l())(g().initializeOnly,"uKnot",new(s().MFDouble)),new(l())(g().initializeOnly,"vKnot",new(s().MFDouble)),new(l())(g().inputOutput,"weight",new(s().MFDouble)),new(l())(g().inputOutput,"texCoord",new(s().SFNode)),new(l())(g().inputOutput,"controlPoint",new(s().SFNode)),new(l())(g().inputOnly,"addTrimmingContour",new(s().MFNode)),new(l())(g().inputOnly,"removeTrimmingContour",new(s().MFNode)),new(l())(g().inputOutput,"trimmingContour",new(s().MFNode))]),enumerable:!0}});const Ve=Te,je=m().add("NurbsTrimmedSurface",Ve);n().add({name:"NURBS",concreteNodes:[v,F,It,kt,Xt,te,ne,he,ce,me,be,Oe,je],abstractNodes:[N,Zt,M]});m().add("NURBSComponent",void 0)})();
@@ -1,4 +1,4 @@
1
- /* X_ITE v16.2.0 */
1
+ /* X_ITE v16.3.0 */
2
2
  const __X_ITE_X3D__ = window [Symbol .for ("X_ITE.X3D")];
3
3
  /******/ (() => { // webpackBootstrap
4
4
  /******/ "use strict";
@@ -1,2 +1,2 @@
1
- /* X_ITE v16.2.0 */
1
+ /* X_ITE v16.3.0 */
2
2
  const e=window[Symbol.for("X_ITE.X3D")];(()=>{const t={n:e=>{const i=e&&e.__esModule?()=>e.default:()=>e;return t.d(i,{a:i}),i},d:(e,i)=>{for(var n in i)t.o(i,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:i[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)},i=e.Components;var n=t.n(i);const s=e.Fields;var o=t.n(s);const r=e.X3DFieldDefinition;var a=t.n(r);const c=e.FieldDefinitionArray;var l=t.n(c);const d=e.X3DNode;var u=t.n(d);const h=e.Namespace;var m=t.n(h);const _={forces:Symbol(),colors:Symbol(),texCoords:Symbol(),scales:Symbol()},p=m().add("ParticleSampler",_),f=e.GeometryType;var x=t.n(f);const g=e.X3DConstants;var y=t.n(g);const v=m().add("Line3.glsl","\n#if defined(X3D_BOUNDED_VOLUME)||defined(X3D_VOLUME_EMITTER)\nstruct Line3{vec3 point;vec3 direction;};bool intersects(const in Line3 line,const in vec3 a,const in vec3 b,const in vec3 c,out vec3 r){vec3 edge1=b-a;vec3 edge2=c-a;vec3 pvec=cross(line.direction,edge2);float det=dot(edge1,pvec);if(det==0.)return false;float inv_det=1./det;vec3 tvec=line.point-a;float u=dot(tvec,pvec)*inv_det;if(u<0.||u>1.)return false;vec3 qvec=cross(tvec,edge1);float v=dot(line.direction,qvec)*inv_det;if(v<0.||u+v>1.)return false;r=vec3(u,v,1.-u-v);return true;}\n#endif\n"),T=m().add("Plane3.glsl","\n#if defined(X3D_BOUNDED_VOLUME)||defined(X3D_VOLUME_EMITTER)\nstruct Plane3{vec3 normal;float distanceFromOrigin;};Plane3 plane3(const in vec3 point,const in vec3 normal){return Plane3(normal,dot(normal,point));}float plane_distance(const in Plane3 plane,const in vec3 point){return dot(point,plane.normal)-plane.distanceFromOrigin;}bool intersects(const in Plane3 plane,const in Line3 line,out vec3 point){float theta=dot(line.direction,plane.normal);if(theta==0.)return false;float t=(plane.distanceFromOrigin-dot(plane.normal,line.point))/theta;point=line.point+line.direction*t;return true;}void sort(inout vec4 points[ARRAY_SIZE],const in int count,const in Plane3 plane){const float shrink=1./1.3;int gap=count;bool exchanged=true;while(exchanged){gap=int(float(gap)*shrink);if(gap<=1){exchanged=false;gap=1;}for(int i=0,l=count-gap;i<l;++i){int j=gap+i;if(plane_distance(plane,points[i].xyz)>plane_distance(plane,points[j].xyz)){vec4 tmp1=points[i];points[i]=points[j];points[j]=tmp1;exchanged=true;}}}}int min_index(const in vec4 points[ARRAY_SIZE],const in int count,const in float value,const in Plane3 plane){int index=-1;float dist=1000000.;for(int i=0;i<count;++i){float d=plane_distance(plane,points[i].xyz);if(d>=value&&d<dist){dist=d;index=i;}}return index;}\n#endif\n"),E=m().add("Box3.glsl","\n#if defined(X3D_VOLUME_EMITTER)||defined(X3D_BOUNDED_VOLUME)\nbool intersects(const in vec3 min,const in vec3 max,const in Line3 line){vec3 intersection;if(intersects(plane3(max,vec3(0.,0.,1.)),line,intersection)){if(all(greaterThanEqual(vec4(intersection.xy,max.xy),vec4(min.xy,intersection.xy))))return true;}if(intersects(plane3(min,vec3(0.,0.,-1.)),line,intersection)){if(all(greaterThanEqual(vec4(intersection.xy,max.xy),vec4(min.xy,intersection.xy))))return true;}if(intersects(plane3(max,vec3(0.,1.,0.)),line,intersection)){if(all(greaterThanEqual(vec4(intersection.xz,max.xz),vec4(min.xz,intersection.xz))))return true;}if(intersects(plane3(min,vec3(0.,-1.,0.)),line,intersection)){if(all(greaterThanEqual(vec4(intersection.xz,max.xz),vec4(min.xz,intersection.xz))))return true;}if(intersects(plane3(max,vec3(1.,0.,0.)),line,intersection)){if(all(greaterThanEqual(vec4(intersection.yz,max.yz),vec4(min.yz,intersection.yz))))return true;}return false;}\n#endif\n"),I=m().add("BVH.glsl","\n#if defined(X3D_VOLUME_EMITTER)||defined(X3D_BOUNDED_VOLUME)\n#define BVH_NODE 0\n#define BVH_TRIANGLE 1\n#define BVH_STACK_SIZE 32\nint bvhNodeIndex=0;void setBVHIndex(const in int index){bvhNodeIndex=index;}int getBVHRoot(const in sampler2D volume,const in int hierarchyIndex,const in int rootIndex){return int(texelFetch(volume,rootIndex,0).x)+hierarchyIndex;}int getBVHType(const in sampler2D volume){return int(texelFetch(volume,bvhNodeIndex,0).x);}vec3 getBVHMin(const in sampler2D volume){return texelFetch(volume,bvhNodeIndex+1,0).xyz;}vec3 getBVHMax(const in sampler2D volume){return texelFetch(volume,bvhNodeIndex+2,0).xyz;}int getBVHLeft(const in sampler2D volume,const in int hierarchyIndex){return int(texelFetch(volume,bvhNodeIndex,0).y)+hierarchyIndex;}int getBVHRight(const in sampler2D volume,const in int hierarchyIndex){return int(texelFetch(volume,bvhNodeIndex,0).z)+hierarchyIndex;}int getBVHTriangle(const in sampler2D volume){return int(texelFetch(volume,bvhNodeIndex,0).y);}\n#if defined(X3D_VOLUME_EMITTER)\nint getIntersections(const in sampler2D volume,const in int verticesIndex,const in int hierarchyIndex,const in int rootIndex,const in Line3 line,out vec4 points[ARRAY_SIZE]){int current=getBVHRoot(volume,hierarchyIndex,rootIndex);int count=0;int stackIndex=-1;int stack[BVH_STACK_SIZE];while(stackIndex>=0||current>=0){if(current>=0){setBVHIndex(current);if(getBVHType(volume)==BVH_NODE){if(intersects(getBVHMin(volume),getBVHMax(volume),line)){stack[++stackIndex]=current;current=getBVHLeft(volume,hierarchyIndex);}else{current=-1;}}else{int t=getBVHTriangle(volume);int v=verticesIndex+t;vec3 r=vec3(0);vec3 a=texelFetch(volume,v,0).xyz;vec3 b=texelFetch(volume,v+1,0).xyz;vec3 c=texelFetch(volume,v+2,0).xyz;if(intersects(line,a,b,c,r))points[count++]=vec4(r.z*a+r.x*b+r.y*c,1.);current=-1;}}else{setBVHIndex(stack[stackIndex--]);current=getBVHRight(volume,hierarchyIndex);}}return count;}\n#endif\n#if defined(X3D_BOUNDED_VOLUME)\nint getIntersections(const in sampler2D volume,const in int verticesIndex,const in int normalsIndex,const in int hierarchyIndex,const in int rootIndex,const in Line3 line,out vec4 points[ARRAY_SIZE],out vec3 normals[ARRAY_SIZE]){int current=getBVHRoot(volume,hierarchyIndex,rootIndex);int count=0;int stackIndex=-1;int stack[BVH_STACK_SIZE];while(stackIndex>=0||current>=0){if(current>=0){setBVHIndex(current);if(getBVHType(volume)==BVH_NODE){if(intersects(getBVHMin(volume),getBVHMax(volume),line)){stack[++stackIndex]=current;current=getBVHLeft(volume,hierarchyIndex);}else{current=-1;}}else{int t=getBVHTriangle(volume);int v=verticesIndex+t;vec3 r=vec3(0);vec3 a=texelFetch(volume,v,0).xyz;vec3 b=texelFetch(volume,v+1,0).xyz;vec3 c=texelFetch(volume,v+2,0).xyz;if(intersects(line,a,b,c,r)){points[count]=vec4(r.z*a+r.x*b+r.y*c,1.);int n=normalsIndex+t;vec3 n0=texelFetch(volume,n,0).xyz;vec3 n1=texelFetch(volume,n+1,0).xyz;vec3 n2=texelFetch(volume,n+2,0).xyz;normals[count]=r.z*n0+r.x*n1+r.y*n2;++count;}current=-1;}}else{setBVHIndex(stack[stackIndex--]);current=getBVHRight(volume,hierarchyIndex);}}return count;}\n#endif\n#endif\n");function R(e){u().call(this,e),this.addType(y().X3DParticleEmitterNode),this.addChildObjects(y().outputOnly,"bbox_changed",new(o().SFTime)),this._speed.setUnit("speed"),this._mass.setUnit("mass"),this._surfaceArea.setUnit("area"),this.defines=[],this.samplers=[],this.uniforms=new Map,this.callbacks=[],this.functions=[],this.programs=new Map}Object.assign(Object.setPrototypeOf(R.prototype,u().prototype),{initialize(){u().prototype.initialize.call(this);const e=this.getBrowser().getContext();this.transformFeedback=e.createTransformFeedback(),this._on.addInterest("set_on__",this),this._speed.addInterest("set_speed__",this),this._variation.addInterest("set_variation__",this),this._mass.addInterest("set_mass__",this),this._surfaceArea.addInterest("set_surfaceArea__",this),this.addSampler("boundedVolume");for(const e in p)this.addSampler(e);this.addUniform("speed","uniform float speed;"),this.addUniform("variation","uniform float variation;"),this.addCallback(this.set_speed__),this.addCallback(this.set_variation__),this.addFunction(v),this.addFunction(T),this.addFunction(E),this.addFunction(I),this.set_on__(),this.set_mass__(),this.set_surfaceArea__()},isExplosive:()=>!1,getMass(){return this.mass},getSurfaceArea(){return this.surfaceArea},set_on__(){this.on=this._on.getValue()},set_speed__(){this.setUniform("uniform1f","speed",Math.max(this._speed.getValue(),0))},set_variation__(){this.setUniform("uniform1f","variation",Math.max(this._variation.getValue(),0))},set_mass__(){this.mass=Math.max(this._mass.getValue(),0)},set_surfaceArea__(){this.surfaceArea=Math.max(this._surfaceArea.getValue(),0)},getRandomValue:(e,t)=>Math.random()*(t-e)+e,getRandomNormal(e){const t=this.getRandomValue(-1,1)*Math.PI,i=this.getRandomValue(-1,1),n=Math.acos(i),s=Math.sin(n);return e.set(Math.sin(t)*s,Math.cos(t)*s,i)},animate(e,t){const i=this.getBrowser(),n=i.getContext(),s=this.getProgram(e),o=e.inputParticles;n.useProgram(s),n.uniform1i(s.randomSeed,4294967295*Math.random()),n.uniform1f(s.particleLifetime,e.particleLifetime),n.uniform1f(s.lifetimeVariation,e.lifetimeVariation),n.uniform1f(s.deltaTime,t),n.uniform2f(s.particleSize,e._particleSize.x,e._particleSize.y),e.boundedHierarchyRoot>-1&&(n.uniform1i(s.boundedVerticesIndex,e.boundedVerticesIndex),n.uniform1i(s.boundedNormalsIndex,e.boundedNormalsIndex),n.uniform1i(s.boundedHierarchyIndex,e.boundedHierarchyIndex),n.uniform1i(s.boundedHierarchyRoot,e.boundedHierarchyRoot),n.activeTexture(n.TEXTURE0+s.boundedVolumeTextureUnit),n.bindTexture(n.TEXTURE_2D,e.boundedTexture));for(const t of e.samplers)n.activeTexture(n.TEXTURE0+s[t]),n.bindTexture(n.TEXTURE_2D,e[t]);if(this.activateTextures(n,s),o.vertexArrayObject.enable(s)){const{particlesStride:t,particleOffsets:i}=e;for(const[e,r]of s.inputs)n.bindBuffer(n.ARRAY_BUFFER,o),n.enableVertexAttribArray(r),n.vertexAttribPointer(r,4,n.FLOAT,!1,t,i[e])}n.bindFramebuffer(n.FRAMEBUFFER,i.getDefaultFramebuffer()),n.bindBuffer(n.ARRAY_BUFFER,null),n.bindTransformFeedback(n.TRANSFORM_FEEDBACK,this.transformFeedback),n.bindBufferBase(n.TRANSFORM_FEEDBACK_BUFFER,0,e.outputParticles),n.enable(n.RASTERIZER_DISCARD),n.beginTransformFeedback(n.POINTS),n.drawArrays(n.POINTS,0,e.numParticles),n.endTransformFeedback(),n.disable(n.RASTERIZER_DISCARD),n.bindTransformFeedback(n.TRANSFORM_FEEDBACK,null)},addDefine(e){this.defines.push(e)},addSampler(e){this.samplers.push(e)},addUniform(e,t){this.uniforms.set(e,t)},setUniform(e,t,i,n,s){const o=this.getBrowser().getContext();for(const r of this.programs.values())o.useProgram(r),o[e](r[t],i,n,s)},addCallback(e){this.callbacks.push(e)},addFunction(e){this.functions.push(e)},getProgram(e){const{geometryType:t,createParticles:i,numColors:n,numTexCoords:s,texCoordCount:o,numScales:r,numForces:a,boundedHierarchyRoot:c}=e;let l="";return l+=t,l+=i&&this.on?1:0,l+=".",l+=n,l+=".",l+=s,l+=".",l+=o,l+=".",l+=r,l+=".",l+=a,l+=".",l+=c,this.programs.get(l)??this.createProgram(l,e)},createProgram(e,t){const i=this.getBrowser(),n=i.getContext(),s=this.defines.slice();s.push(`#define X3D_GEOMETRY_TYPE ${t.geometryType}`),s.push(""+(t.createParticles&&this.on?"#define X3D_CREATE_PARTICLES":"")),s.push(`#define X3D_NUM_COLORS ${t.numColors}`),s.push(`#define X3D_NUM_TEX_COORDS ${t.numTexCoords}`),s.push(`#define X3D_TEX_COORDS_COUNT ${t.texCoordCount}`),s.push(`#define X3D_NUM_SCALES ${t.numScales}`),s.push(`#define X3D_NUM_FORCES ${t.numForces}`),s.push(""+(t.boundedHierarchyRoot>-1?"#define X3D_BOUNDED_VOLUME":""));const o=`#version 300 es\nprecision highp float;precision highp int;precision highp sampler2D;\n${s.join("\n")}\nuniform int randomSeed;uniform float particleLifetime;uniform float lifetimeVariation;uniform float deltaTime;uniform vec2 particleSize;\n#if X3D_NUM_FORCES>0\nuniform sampler2D forces;\n#endif\n#if defined(X3D_BOUNDED_VOLUME)\nuniform int boundedVerticesIndex;uniform int boundedNormalsIndex;uniform int boundedHierarchyIndex;uniform int boundedHierarchyRoot;uniform sampler2D boundedVolume;\n#endif\n#if X3D_NUM_COLORS>0\nuniform sampler2D colors;\n#endif\n#if X3D_NUM_TEX_COORDS>0\nuniform sampler2D texCoords;\n#endif\n#if X3D_NUM_SCALES>0\nuniform sampler2D scales;\n#endif\n${Array.from(this.uniforms.values()).join("\n")}\nin vec4 input0;in vec4 input2;in vec4 input6;out vec4 output0;out vec4 output1;out vec4 output2;out vec4 output3;out vec4 output4;out vec4 output5;out vec4 output6;\n${Object.entries(x()).map(([e,t])=>`#define ${e} ${t}`).join("\n")}\nconst int ARRAY_SIZE=32;const float M_PI=3.141592653589793;uniform float NaN;vec4 texelFetch(const in sampler2D sampler,const in int index,const in int lod){int x=textureSize(sampler,lod).x;ivec2 p=ivec2(index % x,index/x);vec4 t=texelFetch(sampler,p,lod);return t;}vec4 Quaternion(const in vec3 fromVector,const in vec3 toVector){vec3 from=normalize(fromVector);vec3 to=normalize(toVector);float cos_angle=dot(from,to);vec3 cross_vec=cross(from,to);float cross_len=length(cross_vec);if(cross_len==0.){if(cos_angle>0.){return vec4(0.,0.,0.,1.);}else{vec3 t=cross(from,vec3(1.,0.,0.));if(dot(t,t)==0.)t=cross(from,vec3(0.,1.,0.));t=normalize(t);return vec4(t,0.);}}else{float s=sqrt(abs(1.-cos_angle)*.5);cross_vec=normalize(cross_vec);return vec4(cross_vec*s,sqrt(abs(1.+cos_angle)*.5));}}vec3 multVecQuat(const in vec3 v,const in vec4 q){return v+2.*cross(q.xyz,cross(q.xyz,v)+q.w*v);}mat3 Matrix3(const in vec4 quaternion){float x=quaternion.x;float y=quaternion.y;float z=quaternion.z;float w=quaternion.w;float A=y*y;float B=z*z;float C=x*y;float D=z*w;float E=z*x;float F=y*w;float G=x*x;float H=y*z;float I=x*w;return mat3(1.-2.*(A+B),2.*(C+D),2.*(E-F),2.*(C-D),1.-2.*(B+G),2.*(H+I),2.*(E+F),2.*(H-I),1.-2.*(A+G));}uint seed=1u;void srand(const in int value){seed=uint(value);}float random(){seed=seed*1103515245u+12345u;return float(seed)/4294967295.;}float getRandomValue(const in float min_,const in float max_){return min_+random()*(max_-min_);}float getRandomLifetime(){float v=particleLifetime*lifetimeVariation;float min_=max(0.,particleLifetime-v);float max_=particleLifetime+v;return getRandomValue(min_,max_);}float getRandomSpeed(){float v=speed*variation;float min_=max(0.,speed-v);float max_=speed+v;return getRandomValue(min_,max_);}vec3 getRandomNormal(){float theta=getRandomValue(-M_PI,M_PI);float cphi=getRandomValue(-1.,1.);float r=sqrt(1.-cphi*cphi);return vec3(sin(theta)*r,cos(theta)*r,cphi);}vec3 getRandomNormalWithAngle(const in float angle){float theta=getRandomValue(-M_PI,M_PI);float cphi=getRandomValue(cos(angle),1.);float r=sqrt(1.-cphi*cphi);return vec3(sin(theta)*r,cos(theta)*r,cphi);}vec3 getRandomNormalWithDirectionAndAngle(const in vec3 direction,const in float angle){vec4 rotation=Quaternion(vec3(0.,0.,1.),direction);vec3 normal=getRandomNormalWithAngle(angle);return multVecQuat(normal,rotation);}vec3 getRandomSurfaceNormal(const in vec3 direction){float theta=getRandomValue(-M_PI,M_PI);float cphi=pow(random(),1./3.);float r=sqrt(1.-cphi*cphi);vec3 normal=vec3(sin(theta)*r,cos(theta)*r,cphi);vec4 rotation=Quaternion(vec3(0.,0.,1.),direction);return multVecQuat(normal,rotation);}vec3 getRandomSphericalVelocity(){vec3 normal=getRandomNormal();float speed=getRandomSpeed();return normal*speed;}int upperBound(const in sampler2D sampler,in int count,const in float value){int first=0;int step=0;while(count>0){int index=first;step=count>>1;index+=step;if(value<texelFetch(sampler,index,0).x){count=step;}else{first=++index;count-=step+1;}}return first;}\n#if X3D_NUM_TEX_COORDS>0\nvoid interpolate(const in sampler2D sampler,const in int count,const in float fraction,out int index0){if(count==1||fraction<=texelFetch(sampler,0,0).x){index0=0;}else if(fraction>=texelFetch(sampler,count-1,0).x){index0=count-2;}else{int index=upperBound(sampler,count,fraction);if(index<count)index0=index-1;else index0=0;}}\n#endif\n#if X3D_NUM_COLORS>0||X3D_NUM_SCALES>0||defined(X3D_POLYLINE_EMITTER)||defined(X3D_SURFACE_EMITTER)||defined(X3D_VOLUME_EMITTER)\nvoid interpolate(const in sampler2D sampler,const in int count,const in float fraction,out int index0,out int index1,out float weight){if(count==1||fraction<=texelFetch(sampler,0,0).x){index0=0;index1=0;weight=0.;}else if(fraction>=texelFetch(sampler,count-1,0).x){index0=count-2;index1=count-1;weight=1.;}else{int index=upperBound(sampler,count,fraction);if(index<count){index1=index;index0=index-1;float key0=texelFetch(sampler,index0,0).x;float key1=texelFetch(sampler,index1,0).x;weight=clamp((fraction-key0)/(key1-key0),0.,1.);}else{index0=0;index1=0;weight=0.;}}}\n#endif\n#if defined(X3D_SURFACE_EMITTER)||defined(X3D_VOLUME_EMITTER)\nvec3 getRandomBarycentricCoord(){float u=random();float v=random();if(u+v>1.){u=1.-u;v=1.-v;}float t=1.-u-v;return vec3(t,u,v);}void getRandomPointOnSurface(const in sampler2D surface,const in int verticesIndex,const in int normalsIndex,out vec4 position,out vec3 normal){float lastAreaSoFar=texelFetch(surface,verticesIndex-1,0).x;float fraction=random()*lastAreaSoFar;int index0;int index1;int index2;float weight;interpolate(surface,verticesIndex,fraction,index0,index1,weight);index0*=3;index1=index0+1;index2=index0+2;vec4 vertex0=texelFetch(surface,verticesIndex+index0,0);vec4 vertex1=texelFetch(surface,verticesIndex+index1,0);vec4 vertex2=texelFetch(surface,verticesIndex+index2,0);vec3 normal0=texelFetch(surface,normalsIndex+index0,0).xyz;vec3 normal1=texelFetch(surface,normalsIndex+index1,0).xyz;vec3 normal2=texelFetch(surface,normalsIndex+index2,0).xyz;vec3 r=getRandomBarycentricCoord();position=r.z*vertex0+r.x*vertex1+r.y*vertex2;normal=normalize(r.z*normal0+r.x*normal1+r.y*normal2);}\n#endif\n${this.functions.join("\n")}\n#if X3D_NUM_TEX_COORDS>0\nint getTexCoordIndex0(const in float fraction){int index0=0;interpolate(texCoords,X3D_NUM_TEX_COORDS,fraction,index0);return X3D_NUM_TEX_COORDS+index0*X3D_TEX_COORDS_COUNT;}\n#else\n#define getTexCoordIndex0(fraction)(-1)\n#endif\n#if X3D_NUM_COLORS>0\nvec4 getColor(const in float fraction){int index0;int index1;float weight;interpolate(colors,X3D_NUM_COLORS,fraction,index0,index1,weight);vec4 color0=texelFetch(colors,X3D_NUM_COLORS+index0,0);vec4 color1=texelFetch(colors,X3D_NUM_COLORS+index1,0);return mix(color0,color1,weight);}\n#else\n#define getColor(fraction)(vec4(1))\n#endif\n#if X3D_NUM_SCALES>0\nvec3 getScale(const in float fraction){int index0;int index1;float weight;interpolate(scales,X3D_NUM_SCALES,fraction,index0,index1,weight);vec3 scale0=texelFetch(scales,X3D_NUM_SCALES+index0,0).xyz;vec3 scale1=texelFetch(scales,X3D_NUM_SCALES+index1,0).xyz;return mix(scale0,scale1,weight);}\n#else\n#define getScale(fraction)(vec3(1))\n#endif\n#if defined(X3D_BOUNDED_VOLUME)\nvoid bounce(const in float deltaTime,const in vec4 fromPosition,inout vec4 toPosition,inout vec3 velocity){Line3 line=Line3(fromPosition.xyz,normalize(velocity));vec4 points[ARRAY_SIZE];vec3 normals[ARRAY_SIZE];int numIntersections=getIntersections(boundedVolume,boundedVerticesIndex,boundedNormalsIndex,boundedHierarchyIndex,boundedHierarchyRoot,line,points,normals);if(numIntersections==0)return;Plane3 plane1=plane3(line.point,line.direction);int index=min_index(points,numIntersections,0.,plane1);if(index==-1)return;vec3 point=points[index].xyz;vec3 normal=normalize(normals[index]);Plane3 plane2=plane3(point,normal);if(sign(plane_distance(plane2,fromPosition.xyz))==sign(plane_distance(plane2,toPosition.xyz)))return;float damping=length(normals[index]);velocity=reflect(velocity,normal);toPosition=vec4(point+normalize(velocity)*.0001,1.);velocity*=damping;}\n#endif\nvoid main(){int life=int(input0[0]);float lifetime=input0[1];float elapsedTime=input0[2]+deltaTime;float fraction=elapsedTime/lifetime;srand((gl_VertexID+randomSeed)*randomSeed);if(elapsedTime>lifetime){lifetime=getRandomLifetime();elapsedTime=0.;fraction=0.;output0=vec4(max(life+1,1),lifetime,elapsedTime,getTexCoordIndex0(fraction));\n#if defined(X3D_CREATE_PARTICLES)\noutput1=getColor(fraction);output2=vec4(getRandomVelocity(),0.);output6=getRandomPosition();\n#else\noutput1=vec4(0);output2=vec4(0);output6=vec4(NaN);\n#endif\n}else{vec3 velocity=input2.xyz;vec4 position=input6;\n#if X3D_NUM_FORCES>0\nfor(int i=0;i<X3D_NUM_FORCES;++i){vec4 force=texelFetch(forces,i,0);float turbulence=force.w;vec3 normal=getRandomNormalWithDirectionAndAngle(force.xyz,turbulence);float speed=length(force.xyz);velocity+=normal*speed;}\n#endif\nposition.xyz+=velocity*deltaTime;\n#if defined(X3D_BOUNDED_VOLUME)\nbounce(deltaTime,input6,position,velocity);\n#endif\noutput0=vec4(life,lifetime,elapsedTime,getTexCoordIndex0(fraction));output1=getColor(fraction);output2=vec4(velocity,0.);output6=position;}vec3 scale=getScale(fraction);\n#if X3D_GEOMETRY_TYPE==POINT||X3D_GEOMETRY_TYPE==SPRITE||X3D_GEOMETRY_TYPE==GEOMETRY\noutput3=vec4(scale.x,0.,0.,0.);output4=vec4(0.,scale.y,0.,0.);output5=vec4(0.,0.,scale.z,0.);\n#elif X3D_GEOMETRY_TYPE==LINE\nmat3 m=Matrix3(Quaternion(vec3(0.,0.,1.),output2.xyz));\n#if X3D_NUM_SCALES>0\nm*=mat3(scale.x,0.,0.,0.,scale.y,0.,0.,0.,scale.z);\n#endif\noutput3=vec4(m[0],0.);output4=vec4(m[1],0.);output5=vec4(m[2],0.);\n#else\nvec2 s=particleSize*scale.xy;output3=vec4(s.x,0.,0.,0.);output4=vec4(0.,s.y,0.,0.);output5=vec4(0.,0.,scale.z,0.);\n#endif\n}`,r=n.createShader(n.VERTEX_SHADER);n.shaderSource(r,o),n.compileShader(r),n.getShaderParameter(r,n.COMPILE_STATUS)||console.error(n.getShaderInfoLog(r));const a=n.createShader(n.FRAGMENT_SHADER);n.shaderSource(a,"#version 300 es\nprecision highp float;void main(){}"),n.compileShader(a),n.getShaderParameter(a,n.COMPILE_STATUS)||console.error(n.getShaderInfoLog(a));const c=n.createProgram();n.attachShader(c,r),n.attachShader(c,a),n.transformFeedbackVaryings(c,Array.from({length:7},(e,t)=>"output"+t),n.INTERLEAVED_ATTRIBS),n.linkProgram(c),n.getProgramParameter(c,n.LINK_STATUS)||console.error(`Couldn't initialize particle shader: ${n.getProgramInfoLog(c)}`),this.programs.set(e,c),n.useProgram(c),c.inputs=[[0,n.getAttribLocation(c,"input0")],[2,n.getAttribLocation(c,"input2")],[6,n.getAttribLocation(c,"input6")]],c.randomSeed=n.getUniformLocation(c,"randomSeed"),c.particleLifetime=n.getUniformLocation(c,"particleLifetime"),c.lifetimeVariation=n.getUniformLocation(c,"lifetimeVariation"),c.deltaTime=n.getUniformLocation(c,"deltaTime"),c.particleSize=n.getUniformLocation(c,"particleSize"),c.boundedVerticesIndex=n.getUniformLocation(c,"boundedVerticesIndex"),c.boundedNormalsIndex=n.getUniformLocation(c,"boundedNormalsIndex"),c.boundedHierarchyIndex=n.getUniformLocation(c,"boundedHierarchyIndex"),c.boundedHierarchyRoot=n.getUniformLocation(c,"boundedHierarchyRoot"),c.boundedVolume=n.getUniformLocation(c,"boundedVolume");for(const e in p)c[e]=n.getUniformLocation(c,e);for(const e of this.uniforms.keys())c[e]=n.getUniformLocation(c,e);n.uniform1f(n.getUniformLocation(c,"NaN"),NaN);for(const e of this.samplers){const t=n.getUniformLocation(c,e);n.uniform1i(t,c[e+"TextureUnit"]=i.popTextureUnit())}for(const[e,t]of Object.entries(p))c[t]=c[e+"TextureUnit"];i.resetTextureUnits();for(const e of this.callbacks)e.call(this);return c},activateTextures(){},createTexture(){const e=this.getBrowser().getContext(),t=e.createTexture();return e.bindTexture(e.TEXTURE_2D,t),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texImage2D(e.TEXTURE_2D,0,e.RGBA32F,1,1,0,e.RGBA,e.FLOAT,new Float32Array(4)),t},popTextureUnit(e,t,i){const n=t[i];return void 0===n?t[i]=e.popTextureUnit():n}}),Object.defineProperties(R,u().getStaticProperties("X3DParticleEmitterNode","ParticleSystems",1));const b=R,w=m().add("X3DParticleEmitterNode",b),S=e.Vector3;var F=t.n(S);function O(e){w.call(this,e),this.addType(y().PointEmitter),this._position.setUnit("length")}Object.assign(Object.setPrototypeOf(O.prototype,w.prototype),{initialize(){w.prototype.initialize.call(this),this._position.addInterest("set_position__",this),this._direction.addInterest("set_direction__",this),this.addDefine("#define X3D_POINT_EMITTER"),this.addUniform("position","uniform vec3 position;"),this.addUniform("direction","uniform vec3 direction;"),this.addCallback(this.set_position__),this.addCallback(this.set_direction__),this.addFunction("vec3 getRandomVelocity ()\n {\n if (direction == vec3 (0.0))\n return getRandomSphericalVelocity ();\n\n else\n return direction * getRandomSpeed ();\n }"),this.addFunction("vec4 getRandomPosition ()\n {\n return vec4 (position, 1.0);\n }")},getBBox:(()=>{const e=new(F());return function(t,{particleLifetime:i,lifetimeVariation:n}){const s=i*(1+n)*(this._speed.getValue()*(1+this._variation.getValue()))*2;return t.set(e.set(s,s,s),this._position.getValue())}})(),set_position__(){const{x:e,y:t,z:i}=this._position.getValue();this.setUniform("uniform3f","position",e,t,i),this._bbox_changed.addEvent()},set_direction__:(()=>{const e=new(F());return function(){const{x:t,y:i,z:n}=e.assign(this._direction.getValue()).normalize();this.setUniform("uniform3f","direction",t,i,n)}})()}),Object.defineProperties(O,{...u().getStaticProperties("PointEmitter","ParticleSystems",1,"emitter","3.2"),fieldDefinitions:{value:new(l())([new(a())(y().inputOutput,"metadata",new(o().SFNode)),new(a())(y().inputOutput,"on",new(o().SFBool)(!0)),new(a())(y().inputOutput,"position",new(o().SFVec3f)),new(a())(y().inputOutput,"direction",new(o().SFVec3f)(0,1,0)),new(a())(y().inputOutput,"speed",new(o().SFFloat)),new(a())(y().inputOutput,"variation",new(o().SFFloat)(.25)),new(a())(y().inputOutput,"mass",new(o().SFFloat)),new(a())(y().inputOutput,"surfaceArea",new(o().SFFloat))]),enumerable:!0}});const A=O,N=m().add("PointEmitter",A),P=Symbol();function D(){}Object.assign(D.prototype,{getDefaultEmitter(){return this[P]??=(()=>{const e=new N(this.getPrivateScene());return e.setup(),e})()}});const C=D,V=m().add("X3DParticleSystemsContext",C);function B(e){u().call(this,e),this.addType(y().X3DParticlePhysicsModelNode)}Object.assign(Object.setPrototypeOf(B.prototype,u().prototype),{addForce(){}}),Object.defineProperties(B,u().getStaticProperties("X3DParticlePhysicsModelNode","ParticleSystems",1));const M=B,U=m().add("X3DParticlePhysicsModelNode",M),L=e.X3DCast;var z=t.n(L);function X(e){U.call(this,e),this.addType(y().BoundedPhysicsModel)}Object.assign(Object.setPrototypeOf(X.prototype,U.prototype),{initialize(){U.prototype.initialize.call(this),this._geometry.addInterest("set_geometry__",this),this.set_geometry__()},getBBox(){return this.geometryNode?.getBBox()},set_geometry__(){this.geometryNode?._rebuild.removeInterest("addNodeEvent",this),this.geometryNode=z()(y().X3DGeometryNode,this._geometry),this.geometryNode?._rebuild.addInterest("addNodeEvent",this)},addGeometry(e,t){if(!this.geometryNode)return;if(!this._enabled.getValue())return;const i=this._damping.getValue(),n=this.geometryNode.getNormals(),s=this.geometryNode.getVertices();for(const t of n)e.push(t*i);for(const e of s)t.push(e)}}),Object.defineProperties(X,{...u().getStaticProperties("BoundedPhysicsModel","ParticleSystems",2,"physics","3.2"),fieldDefinitions:{value:new(l())([new(a())(y().inputOutput,"metadata",new(o().SFNode)),new(a())(y().inputOutput,"enabled",new(o().SFBool)(!0)),new(a())(y().inputOutput,"damping",new(o().SFFloat)(1)),new(a())(y().inputOutput,"geometry",new(o().SFNode))]),enumerable:!0}});const k=X,j=m().add("BoundedPhysicsModel",k);function G(e){w.call(this,e),this.addType(y().ConeEmitter),this._position.setUnit("length"),this._angle.setUnit("angle")}Object.assign(Object.setPrototypeOf(G.prototype,w.prototype),{initialize(){w.prototype.initialize.call(this),this._position.addInterest("set_position__",this),this._direction.addInterest("set_direction__",this),this._angle.addInterest("set_angle__",this),this.addDefine("#define X3D_CONE_EMITTER"),this.addUniform("position","uniform vec3 position;"),this.addUniform("direction","uniform vec3 direction;"),this.addUniform("angle","uniform float angle;"),this.addCallback(this.set_position__),this.addCallback(this.set_direction__),this.addCallback(this.set_angle__),this.addFunction("vec3 getRandomVelocity ()\n {\n if (direction == vec3 (0.0))\n {\n return getRandomSphericalVelocity ();\n }\n else\n {\n vec3 normal = getRandomNormalWithDirectionAndAngle (direction, angle);\n float speed = getRandomSpeed ();\n\n return normal * speed;\n }\n }"),this.addFunction("vec4 getRandomPosition ()\n {\n return vec4 (position, 1.0);\n }")},getBBox:(()=>{const e=new(F());return function(t,{particleLifetime:i,lifetimeVariation:n}){const s=i*(1+n)*(this._speed.getValue()*(1+this._variation.getValue()))*2;return t.set(e.set(s,s,s),this._position.getValue())}})(),set_position__(){const{x:e,y:t,z:i}=this._position.getValue();this.setUniform("uniform3f","position",e,t,i),this._bbox_changed.addEvent()},set_direction__(){const{x:e,y:t,z:i}=this._direction.getValue();this.setUniform("uniform3f","direction",e,t,i)},set_angle__(){this.setUniform("uniform1f","angle",this._angle.getValue())}}),Object.defineProperties(G,{...u().getStaticProperties("ConeEmitter","ParticleSystems",1,"emitter","3.2"),fieldDefinitions:{value:new(l())([new(a())(y().inputOutput,"metadata",new(o().SFNode)),new(a())(y().inputOutput,"on",new(o().SFBool)(!0)),new(a())(y().inputOutput,"position",new(o().SFVec3f)),new(a())(y().inputOutput,"direction",new(o().SFVec3f)(0,1,0)),new(a())(y().inputOutput,"angle",new(o().SFFloat)(.785398)),new(a())(y().inputOutput,"speed",new(o().SFFloat)),new(a())(y().inputOutput,"variation",new(o().SFFloat)(.25)),new(a())(y().inputOutput,"mass",new(o().SFFloat)),new(a())(y().inputOutput,"surfaceArea",new(o().SFFloat))]),enumerable:!0}});const H=G,Y=m().add("ConeEmitter",H);function q(e){w.call(this,e),this.addType(y().ExplosionEmitter),this._position.setUnit("length")}Object.assign(Object.setPrototypeOf(q.prototype,w.prototype),{initialize(){w.prototype.initialize.call(this),this._position.addInterest("set_position__",this),this.addDefine("#define X3D_EXPLOSION_EMITTER"),this.addUniform("position","uniform vec3 position;"),this.addCallback(this.set_position__),this.addFunction("vec3 getRandomVelocity ()\n {\n return getRandomSphericalVelocity ();\n }"),this.addFunction("vec4 getRandomPosition ()\n {\n return vec4 (position, 1.0);\n }")},getBBox:(()=>{const e=new(F());return function(t,{particleLifetime:i,lifetimeVariation:n}){const s=i*(1+n)*(this._speed.getValue()*(1+this._variation.getValue()))*2;return t.set(e.set(s,s,s),this._position.getValue())}})(),isExplosive:()=>!0,set_position__(){const{x:e,y:t,z:i}=this._position.getValue();this.setUniform("uniform3f","position",e,t,i),this._bbox_changed.addEvent()}}),Object.defineProperties(q,{...u().getStaticProperties("ExplosionEmitter","ParticleSystems",1,"emitter","3.2"),fieldDefinitions:{value:new(l())([new(a())(y().inputOutput,"metadata",new(o().SFNode)),new(a())(y().inputOutput,"on",new(o().SFBool)(!0)),new(a())(y().inputOutput,"position",new(o().SFVec3f)),new(a())(y().inputOutput,"speed",new(o().SFFloat)),new(a())(y().inputOutput,"variation",new(o().SFFloat)(.25)),new(a())(y().inputOutput,"mass",new(o().SFFloat)),new(a())(y().inputOutput,"surfaceArea",new(o().SFFloat))]),enumerable:!0}});const W=q,K=m().add("ExplosionEmitter",W);function Z(e){U.call(this,e),this.addType(y().ForcePhysicsModel),this._force.setUnit("force")}Object.assign(Object.setPrototypeOf(Z.prototype,U.prototype),{addForce:(()=>{const e=new(F());return function(t,i,n,s){return!!this._enabled.getValue()&&(s.set(e.assign(this._force.getValue()).multiply(n),4*t),s[4*t+3]=0,!0)}})()}),Object.defineProperties(Z,{...u().getStaticProperties("ForcePhysicsModel","ParticleSystems",1,"physics","3.2"),fieldDefinitions:{value:new(l())([new(a())(y().inputOutput,"metadata",new(o().SFNode)),new(a())(y().inputOutput,"enabled",new(o().SFBool)(!0)),new(a())(y().inputOutput,"force",new(o().SFVec3f)(0,-9.8,0))]),enumerable:!0}});const Q=Z,$=m().add("ForcePhysicsModel",Q),J=e.X3DShapeNode;var ee=t.n(J);const te=e.GeometryContext;var ie=t.n(te);const ne=e.VertexArray;var se=t.n(ne);const oe=e.AlphaMode;var re=t.n(oe);const ae=e.LineSet;var ce=t.n(ae);const le=e.Coordinate;var de=t.n(le);const ue=e.Matrix4;var he=t.n(ue);const me=e.Matrix3;var _e=t.n(me);const pe=e.Plane3;var fe=t.n(pe);const xe=e.QuickSort;var ge=t.n(xe);const ye=new(F()),ve=new(F()),Te=new(F()),Ee={u:0,v:0,t:0},Ie=[F().Z_AXIS,F().NEGATIVE_Z_AXIS,F().Y_AXIS,F().NEGATIVE_Y_AXIS,F().X_AXIS];function Re(e,t){this.vertices=e.vertices,this.normals=e.normals,this.triangle=t,this.i4=12*t,this.i3=9*t}function be(e,t,i,n){this.min=new(F()),this.max=new(F()),this.planes=[],this.intersection=new(F());const s=e.vertices,o=this.min,r=this.max,a=i+n;let c,l=12*t[i];o.set(s[l],s[l+1],s[l+2]),r.assign(o);for(let e=i;e<a;++e)l=12*t[e],ye.set(s[l],s[l+1],s[l+2]),ve.set(s[l+4],s[l+5],s[l+6]),Te.set(s[l+8],s[l+9],s[l+10]),o.min(ye).min(ve).min(Te),r.max(ye).max(ve).max(Te);for(let e=0;e<5;++e)this.planes[e]=new(fe())(e%2?o:r,Ie[e]);n>2?(e.sorter.compare.axis=this.getLongestAxis(o,r),e.sorter.sort(i,a),c=n>>>1):c=1;const d=n-c;this.left=c>1?new be(e,t,i,c):new Re(e,t[i]),this.right=d>1?new be(e,t,i+c,d):new Re(e,t[i+c])}function we(e,t){const i=e.length/12;switch(this.vertices=e,this.normals=t,i){case 0:this.root=null;break;case 1:this.root=new Re(this,0);break;default:{const t=[];for(let e=0;e<i;++e)t.push(e);this.sorter=new(ge())(t,function(e,t){return function(i,n){return Math.min(e[i+t],e[i+4+t],e[i+8+t])<Math.min(e[n+t],e[n+4+t],e[n+8+t])}}(e,0)),this.root=new be(this,t,0,i);break}}}Object.assign(Re.prototype,{intersectsLine(e,t,i){const n=this.vertices,s=this.normals,o=this.i4,r=this.i3;if(ye.x=n[o],ye.y=n[o+1],ye.z=n[o+2],ve.x=n[o+4],ve.y=n[o+5],ve.z=n[o+6],Te.x=n[o+8],Te.y=n[o+9],Te.z=n[o+10],e.intersectsTriangle(ye,ve,Te,Ee)){const{u:e,v:a,t:c}=Ee,l=t.size++;l>=t.length&&t.push(new(F())),t[l].set(e*n[o]+a*n[o+4]+c*n[o+8],e*n[o+1]+a*n[o+5]+c*n[o+9],e*n[o+2]+a*n[o+6]+c*n[o+10]),i&&(l>=i.length&&i.push(new(F())),i[l].set(e*s[r]+a*s[r+3]+c*s[r+6],e*s[r+1]+a*s[r+4]+c*s[r+7],e*s[r+2]+a*s[r+5]+c*s[r+8]))}},toArray(e){const t=e.length/4;return e.push(1,3*this.triangle,0,0),t}}),Object.assign(be.prototype,{intersectsLine(e,t,i){this.intersectsBBox(e)&&(this.left.intersectsLine(e,t,i),this.right.intersectsLine(e,t,i))},intersectsBBox(e){const t=this.planes,i=this.min,n=this.max,s=i.x,o=n.x,r=i.y,a=n.y,c=i.z,l=n.z,d=this.intersection;return!!(t[0].intersectsLine(e,d)&&d.x>=s&&d.x<=o&&d.y>=r&&d.y<=a)||(!!(t[1].intersectsLine(e,d)&&d.x>=s&&d.x<=o&&d.y>=r&&d.y<=a)||(!!(t[2].intersectsLine(e,d)&&d.x>=s&&d.x<=o&&d.z>=c&&d.z<=l)||(!!(t[3].intersectsLine(e,d)&&d.x>=s&&d.x<=o&&d.z>=c&&d.z<=l)||!!(t[4].intersectsLine(e,d)&&d.y>=r&&d.y<=a&&d.z>=c&&d.z<=l))))},getLongestAxis(e,t){const i=t.x-e.x,n=t.y-e.y,s=t.z-e.z;return i<n?n<s?2:1:i<s?2:0},toArray(e){const t=this.left.toArray(e),i=this.right.toArray(e),n=this.min,s=this.max,o=e.length/4;return e.push(0,t,i,0,n.x,n.y,n.z,0,s.x,s.y,s.z,0),o}}),Object.assign(we.prototype,{intersectsLine(e,t,i){return t.size=0,this.root?(this.root.intersectsLine(e,t,i),t.size):0},toArray(e){if(this.root){const t=this.root.toArray(e);e.push(t,0,0,0)}return e}});const Se=we,Fe=m().add("BVH",Se),Oe=new Float32Array([0,0,0,1]),Ae=new Float32Array([0,0,0,1,1,0,0,1,1,1,0,1,0,0,0,1,1,1,0,1,0,1,0,1,0,0,1,-.5,-.5,0,1,.5,-.5,0,1,.5,.5,0,1,-.5,-.5,0,1,.5,.5,0,1,-.5,.5,0,1]);function Ne(e){ee().call(this,e),this.addType(y().ParticleSystem),this._particleSize.setUnit("length"),e.getSpecificationVersion()<=3.3&&(this.addAlias("colorRamp",this._color),this.addAlias("texCoordRamp",this._texCoord));const t=this.getBrowser();this.maxParticles=0,this.numParticles=0,this.spriteSize=new(F()),this.samplers=new Set,this.forcePhysicsModelNodes=[],this.forces=new Float32Array(4),this.boundedPhysicsModelNodes=[],this.boundedNormals=[],this.boundedVertices=[],this.colorRamp=new Float32Array,this.texCoordRamp=new Float32Array,this.scaleRamp=new Float32Array,this.geometryContext=new(ie())({textureCoordinateNode:t.getDefaultTextureCoordinate()}),this.creationTime=0,this.pauseTime=0,this.deltaTime=0,this.particlesStride=7*Float32Array.BYTES_PER_ELEMENT*4,this.particleOffsets=Array.from({length:7},(e,t)=>4*Float32Array.BYTES_PER_ELEMENT*t),this.particleOffset=this.particleOffsets[0],this.colorOffset=this.particleOffsets[1],this.velocityOffset=this.particleOffsets[2],this.matrixOffset=this.particleOffsets[3],this.texCoordOffset=0,this.instancesStride=this.particlesStride}Object.assign(Object.setPrototypeOf(Ne.prototype,ee().prototype),{initialize(){ee().prototype.initialize.call(this);const e=this.getBrowser(),t=e.getContext();this.getLive().addInterest("set_live__",this),this._enabled.addInterest("set_enabled__",this),this._geometryType.addInterest("set_geometryType__",this),this._geometryType.addInterest("set_texCoord__",this),this._maxParticles.addInterest("set_enabled__",this),this._particleLifetime.addInterest("set_particleLifetime__",this),this._particleLifetime.addInterest("set_bbox__",this),this._lifetimeVariation.addInterest("set_lifetimeVariation__",this),this._lifetimeVariation.addInterest("set_bbox__",this),this._particleSize.addInterest("set_particleSize__",this),this._emitter.addInterest("set_emitter__",this),this._emitter.addInterest("set_bbox__",this),this._physics.addInterest("set_physics__",this),this._colorKey.addInterest("set_color__",this),this._color.addInterest("set_colorRamp__",this),this._texCoordKey.addInterest("set_texCoord__",this),this._texCoord.addInterest("set_texCoordRamp__",this),this._scaleKey.addInterest("set_scale__",this),this._scale.addInterest("set_scaleRamp__",this),this._geometry.addInterest("updateVertexArrays",this),this.inputParticles=Object.assign(t.createBuffer(),{vertexArrayObject:new(se())(t),thickLinesVertexArrayObject:new(se())(t)}),this.outputParticles=Object.assign(t.createBuffer(),{vertexArrayObject:new(se())(t),thickLinesVertexArrayObject:new(se())(t)}),this.boundedTexture=this.createTexture();for(const e of Object.values(p))this[e]=this.createTexture();this.geometryBuffer=this.createBuffer(),this.texCoordBuffers=new Array(e.getMaxTexCoords()).fill(this.geometryBuffer),this.lineGeometryNode=new(ce())(this.getExecutionContext()),this.lineCoordinateNode=new(de())(this.getExecutionContext()),this.lineCoordinateNode._point=[0,0,-.5,0,0,.5],this.lineGeometryNode._vertexCount=[2],this.lineGeometryNode._coord=this.lineCoordinateNode,this.lineCoordinateNode.setup(),this.lineGeometryNode.setup(),this.set_emitter__(),this.set_enabled__(),this.set_geometryType__(),this.set_particleLifetime__(),this.set_lifetimeVariation__(),this.set_particleSize__(),this.set_physics__(),this.set_colorRamp__(),this.set_texCoordRamp__(),this.set_scaleRamp__(),this.set_bbox__()},getShapeKey(){return this.numTexCoords?2:1},getGeometryContext(){return this.geometryType===x().GEOMETRY?this.getGeometry():this.geometryContext},getGeometryType(){return this.geometryType},getNumInstances(){return this.numParticles},getInstances(){return this.outputParticles},set_bbox__(){const e=this.bbox;if(this.isDefaultBBoxSize())if(this.boundedPhysicsModelNodes.length){e.set();for(const t of this.boundedPhysicsModelNodes){const i=t.getBBox();i&&e.add(i)}}else this.emitterNode?.getBBox(e,this);else e.set(this._bboxSize.getValue(),this._bboxCenter.getValue());this.getBBoxSize().assign(e.size),this.getBBoxCenter().assign(e.center)},set_transparent__(){const e=this.appearanceNode.getAlphaMode();e===re().AUTO?(this.setTransparent(this.getAppearance().isTransparent()||this.colorRampNode?.isTransparent()||this.geometryType===x().GEOMETRY&&this.geometryNode?.isTransparent()),this.setAlphaMode(this.isTransparent()?re().BLEND:re().OPAQUE)):(this.setTransparent(e===re().BLEND),this.setAlphaMode(e))},set_live__(){this.getLive().getValue()?this._isActive.getValue()&&this._maxParticles.getValue()&&(this.getBrowser().sensorEvents().addInterest("animateParticles",this),this.pauseTime&&(this.creationTime+=Date.now()/1e3-this.pauseTime,this.pauseTime=0)):this._isActive.getValue()&&this._maxParticles.getValue()&&(this.getBrowser().sensorEvents().removeInterest("animateParticles",this),0===this.pauseTime&&(this.pauseTime=Date.now()/1e3))},set_enabled__(){this._enabled.getValue()&&this._maxParticles.getValue()?this._isActive.getValue()||(this.getLive().getValue()?(this.getBrowser().sensorEvents().addInterest("animateParticles",this),this.pauseTime=0):this.pauseTime=Date.now()/1e3,this._isActive=!0,delete this.traverse):this._isActive.getValue()&&(this.getLive().getValue()&&this.getBrowser().sensorEvents().removeInterest("animateParticles",this),this._isActive=!1,this.numParticles=0,this.traverse=Function.prototype),this.set_maxParticles__()},set_geometryType__(){const e=this.getBrowser().getContext();switch(this.geometryType=x().get(this._geometryType.getValue())??x().QUAD,this.geometryType){case x().POINT:this.geometryContext.geometryType=0,this.geometryContext.hasNormals=!1,this.texCoordCount=0,this.vertexCount=1,this.hasNormals=!1,this.verticesOffset=0,this.primitiveMode=e.POINTS,e.bindBuffer(e.ARRAY_BUFFER,this.geometryBuffer),e.bufferData(e.ARRAY_BUFFER,Oe,e.DYNAMIC_DRAW);break;case x().LINE:this.geometryContext.geometryType=1,this.geometryContext.hasNormals=!1,this.texCoordCount=0;break;case x().TRIANGLE:case x().QUAD:case x().SPRITE:this.geometryContext.geometryType=2,this.geometryContext.hasNormals=!0,this.texCoordCount=4,this.vertexCount=6,this.hasNormals=!0,this.texCoordsOffset=0,this.normalOffset=24*Float32Array.BYTES_PER_ELEMENT,this.verticesOffset=27*Float32Array.BYTES_PER_ELEMENT,this.primitiveMode=e.TRIANGLES,e.bindBuffer(e.ARRAY_BUFFER,this.geometryBuffer),e.bufferData(e.ARRAY_BUFFER,Ae,e.DYNAMIC_DRAW);break;case x().GEOMETRY:this.texCoordCount=0}this.geometryContext.updateGeometryKey(),this.updateVertexArrays(),this.set_objects__()},set_maxParticles__(){const e=this.numParticles,t=Math.max(0,this._maxParticles.getValue());this.maxParticles=t,this.numParticles=Math.min(e,t),this.emitterNode.isExplosive()||(this.creationTime=Date.now()/1e3),this.resizeBuffers(e),this.updateVertexArrays(),this.set_objects__()},set_particleLifetime__(){this.particleLifetime=Math.max(this._particleLifetime.getValue(),0)},set_lifetimeVariation__(){this.lifetimeVariation=Math.max(this._lifetimeVariation.getValue(),0)},set_particleSize__(){this.lineCoordinateNode._point[0].z=-this._particleSize.y/2,this.lineCoordinateNode._point[1].z=+this._particleSize.y/2,this.spriteSize.set(...this._particleSize)},set_emitter__(){this.emitterNode?._bbox_changed.removeInterest("set_bbox__",this),this.emitterNode=z()(y().X3DParticleEmitterNode,this._emitter)??this.getBrowser().getDefaultEmitter(),this.emitterNode._bbox_changed.addInterest("set_bbox__",this)},set_physics__(){const e=this.forcePhysicsModelNodes,t=this.boundedPhysicsModelNodes;for(const e of t)e.removeInterest("set_boundedPhysics__",this),e.removeInterest("set_bbox__",this);e.length=0,t.length=0;for(const i of this._physics)try{const n=i.getValue().getInnerNode(),s=n.getType();for(let i=s.length-1;i>=0;--i){switch(s[i]){case y().ForcePhysicsModel:case y().WindPhysicsModel:e.push(n);break;case y().BoundedPhysicsModel:t.push(n);break;default:continue}break}}catch{}for(const e of t)e.addInterest("set_boundedPhysics__",this),e.addInterest("set_bbox__",this);this.set_boundedPhysics__()},set_boundedPhysics__(){const e=this.getBrowser().getContext(),t=this.boundedPhysicsModelNodes,i=this.boundedNormals,n=this.boundedVertices;i.length=0,n.length=0;for(let e=0,s=t.length;e<s;++e)t[e].addGeometry(i,n);const s=new Fe(n,i).toArray([]),o=n.length/4,r=i.length/3,a=s.length/4,c=Math.ceil(Math.sqrt(o+r+a)),l=new Float32Array(c*c*4);this.boundedVerticesIndex=0,this.boundedNormalsIndex=o,this.boundedHierarchyIndex=this.boundedNormalsIndex+r,this.boundedHierarchyRoot=this.boundedHierarchyIndex+a-1,l.set(n);for(let e=4*this.boundedNormalsIndex,t=0,n=i.length;t<n;e+=4,t+=3)l[e+0]=i[t+0],l[e+1]=i[t+1],l[e+2]=i[t+2];l.set(s,4*this.boundedHierarchyIndex),c&&(e.bindTexture(e.TEXTURE_2D,this.boundedTexture),e.texImage2D(e.TEXTURE_2D,0,e.RGBA32F,c,c,0,e.RGBA,e.FLOAT,l))},set_colorRamp__(){this.colorRampNode?.removeInterest("set_color__",this),this.colorRampNode=z()(y().X3DColorNode,this._color),this.colorRampNode?.addInterest("set_color__",this),this.set_color__(),this.set_transparent__()},set_color__(){const e=this.getBrowser().getContext(),t=this._colorKey,i=t.length,n=Math.ceil(Math.sqrt(2*i));let s=this.colorRamp;n*n*4>s.length&&(s=this.colorRamp=new Float32Array(n*n*4));for(let e=0;e<i;++e)s[4*e]=t[e];this.colorRampNode?s.set(this.colorRampNode.addColors([],i).slice(0,4*i),4*i):s.fill(1,4*i),n&&(e.bindTexture(e.TEXTURE_2D,this[p.colors]),e.texImage2D(e.TEXTURE_2D,0,e.RGBA32F,n,n,0,e.RGBA,e.FLOAT,s)),this.numColors=i,this.geometryContext.colorMaterial=!(!i||!this.colorRampNode),i?this.samplers.add(p.colors):this.samplers.delete(p.colors),this.geometryContext.updateGeometryKey(),this.updateVertexArrays()},set_texCoordRamp__(){this.texCoordRampNode?.removeInterest("set_texCoord__",this),this.texCoordRampNode=z()(y().X3DTextureCoordinateNode,this._texCoord),this.texCoordRampNode?.addInterest("set_texCoord__",this),this.set_texCoord__()},set_texCoord__(){const e=this.getBrowser().getContext(),t=this._texCoordKey,i=t.length,n=Math.ceil(Math.sqrt(i+i*this.texCoordCount));let s=this.texCoordRamp;n*n*4>s.length?s=this.texCoordRamp=new Float32Array(n*n*4):s.fill(0);for(let e=0;e<i;++e)s[4*e]=t[e];this.texCoordRampNode&&s.set(this.texCoordRampNode.addPoints([]).slice(0,i*this.texCoordCount*4),4*i),n&&(e.bindTexture(e.TEXTURE_2D,this[p.texCoords]),e.texImage2D(e.TEXTURE_2D,0,e.RGBA32F,n,n,0,e.RGBA,e.FLOAT,s)),this.numTexCoords=this.texCoordRampNode?i:0,i?this.samplers.add(p.texCoords):this.samplers.delete(p.texCoords),this.updateVertexArrays()},set_scaleRamp__(){this.scaleRampNode?.removeInterest("set_scale__",this),this.scaleRampNode=z()(y().Coordinate,this._scale),this.scaleRampNode?.addInterest("set_scale__",this),this.set_scale__()},set_scale__(){const e=this.getBrowser().getContext(),t=this._scaleKey,i=t.length,n=Math.ceil(Math.sqrt(2*i));let s=this.scaleRamp;n*n*4>s.length?s=this.scaleRamp=new Float32Array(n*n*4):s.fill(0);for(let e=0;e<i;++e)s[4*e]=t[e];this.scaleRampNode?s.set(this.scaleRampNode.addPoints([],i).slice(0,4*i),4*i):s.fill(1,4*i),n&&(e.bindTexture(e.TEXTURE_2D,this[p.scales]),e.texImage2D(e.TEXTURE_2D,0,e.RGBA32F,n,n,0,e.RGBA,e.FLOAT,s)),this.numScales=i,i?this.samplers.add(p.scales):this.samplers.delete(p.scales),this.updateVertexArrays()},updateVertexArrays(){this.inputParticles.vertexArrayObject.update(),this.outputParticles.vertexArrayObject.update(),this.inputParticles.thickLinesVertexArrayObject.update(),this.outputParticles.thickLinesVertexArrayObject.update()},createTexture(){const e=this.getBrowser().getContext(),t=e.createTexture();return e.bindTexture(e.TEXTURE_2D,t),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texImage2D(e.TEXTURE_2D,0,e.RGBA32F,1,1,0,e.RGBA,e.FLOAT,new Float32Array(4)),t},createBuffer(){const e=this.getBrowser().getContext(),t=e.createBuffer();return e.bindBuffer(e.ARRAY_BUFFER,t),e.bufferData(e.ARRAY_BUFFER,new Uint32Array,e.DYNAMIC_DRAW),t},resizeBuffers(e){const t=this.getBrowser().getContext(),i=this.maxParticles,n=this.particlesStride,s=Object.assign(t.createBuffer(),this.outputParticles),o=new Uint8Array(i*n);t.bindBuffer(t.ARRAY_BUFFER,this.inputParticles),t.bufferData(t.ARRAY_BUFFER,o,t.DYNAMIC_DRAW),t.bindBuffer(t.COPY_READ_BUFFER,this.outputParticles),t.bindBuffer(t.ARRAY_BUFFER,s),t.bufferData(t.ARRAY_BUFFER,o,t.DYNAMIC_DRAW),t.copyBufferSubData(t.COPY_READ_BUFFER,t.ARRAY_BUFFER,0,0,Math.min(i*n,e*n)),t.deleteBuffer(this.outputParticles),this.outputParticles=s},animateParticles(){const e=this.getBrowser(),t=e.getContext(),i=this.emitterNode,n=1/Math.max(this.getBrowser().getCurrentFrameRate(),10);let s=this.deltaTime=(14*this.deltaTime+n)/15;if(i.isExplosive()){const e=Date.now()/1e3,t=this.particleLifetime+this.particleLifetime*this.lifetimeVariation;e-this.creationTime>t?(this.creationTime=e,this.numParticles=this.maxParticles,this.createParticles=this._createParticles.getValue(),s=Number.POSITIVE_INFINITY,this.set_objects__()):this.createParticles=!1}else if(this.createParticles=this._createParticles.getValue(),this.numParticles<this.maxParticles){const e=Date.now()/1e3,t=Math.max(0,Math.floor((e-this.creationTime)*this.maxParticles/this.particleLifetime));t&&(this.creationTime=e),this.numParticles=Math.min(this.maxParticles,this.numParticles+t),this.set_objects__()}if(i.getMass()){const e=this.forcePhysicsModelNodes;let n=e.length,o=this.forces,r=s/i.getMass();4*n>o.length&&(o=this.forces=new Float32Array(4*n));let a=0;for(let t=0;t<n;++t)a+=!e[t].addForce(t-a,i,r,o);this.numForces=n-=a,n?(t.bindTexture(t.TEXTURE_2D,this[p.forces]),t.texImage2D(t.TEXTURE_2D,0,t.RGBA32F,n,1,0,t.RGBA,t.FLOAT,o),this.samplers.add(p.forces)):this.samplers.delete(p.forces)}else this.numForces=0,this.samplers.delete(p.forces);const o=this.outputParticles;this.outputParticles=this.inputParticles,this.inputParticles=o,i.animate(this,s),e.addBrowserEvent()},updateSprite:(()=>{const e=new Float32Array(Ae),t=[new(F())(-.5,-.5,0),new(F())(.5,-.5,0),new(F())(.5,.5,0),new(F())(-.5,-.5,0),new(F())(.5,.5,0),new(F())(-.5,.5,0)],i=new(F());return function(n,s){for(let t=0;t<3;++t)e[24+t]=s[6+t];const o=this.spriteSize;for(let n=0;n<6;++n){const r=27+4*n;s.multVecMatrix(i.assign(t[n]).multVec(o)),e.set(i,r)}n.bindBuffer(n.ARRAY_BUFFER,this.geometryBuffer),n.bufferData(n.ARRAY_BUFFER,e,n.DYNAMIC_DRAW)}})(),displaySimple(e,t,i){switch(this.geometryType){case x().LINE:this.lineGeometryNode.displaySimpleInstanced(e,i,this);break;case x().GEOMETRY:this.getGeometry().displaySimpleInstanced(e,i,this);break;case x().SPRITE:this.updateSprite(e,this.getScreenAlignedRotation(t.modelViewMatrix));default:{const t=this.outputParticles;if(t.vertexArrayObject.enable(i.getProgram())){const n=this.particlesStride;i.enableParticleAttribute(e,t,n,this.particleOffset,1),i.enableInstanceMatrixAttribute(e,t,n,this.matrixOffset,1),i.enableVertexAttribute(e,this.geometryBuffer,0,this.verticesOffset)}e.drawArraysInstanced(this.primitiveMode,0,this.vertexCount,this.numParticles);break}}},display(e,t){switch(this.geometryType){case x().LINE:this.lineGeometryNode.displayInstanced(e,t,this);break;case x().GEOMETRY:this.getGeometry().displayInstanced(e,t,this);break;case x().SPRITE:this.updateSprite(e,this.getScreenAlignedRotation(t.modelViewMatrix));case x().QUAD:case x().TRIANGLE:{const i=he().prototype.determinant3.call(t.modelViewMatrix)>=0;e.frontFace(i?e.CCW:e.CW),e.enable(e.CULL_FACE)}default:{const i=t.viewport,n=this.getBrowser(),s=this.getAppearance(),o=s.getRenderModes(),r=s.getShader(this.geometryContext,t),a=n.getPrimitiveMode(this.primitiveMode),c=this.geometryType===x().POINT&&!t.transparent;c&&(e.enable(e.SAMPLE_ALPHA_TO_COVERAGE),e.colorMask(!0,!0,!0,!1)),e.viewport(...i),e.scissor(...i);for(const t of o)t.enable(e);if(r.enable(e),r.setUniforms(e,t,this.geometryContext),this.numTexCoords){const t=n.popTextureUnit();e.activeTexture(e.TEXTURE0+t),e.bindTexture(e.TEXTURE_2D,this[p.texCoords]),e.uniform1i(r.x3d_TexCoordRamp,t)}const l=this.outputParticles;if(l.vertexArrayObject.enable(r.getProgram())){const{particlesStride:t}=this;r.enableParticleAttribute(e,l,t,this.particleOffset,1),r.enableParticleVelocityAttribute(e,l,t,this.velocityOffset,1),r.enableInstanceMatrixAttribute(e,l,t,this.matrixOffset,1),this.geometryContext.colorMaterial&&r.enableColorAttribute(e,l,t,this.colorOffset,1),this.texCoordCount&&r.enableTexCoordAttribute(e,this.texCoordBuffers,0,this.texCoordOffset),this.hasNormals&&r.enableNormalAttribute(e,this.geometryBuffer,0,this.normalOffset,this.maxParticles),r.enableVertexAttribute(e,this.geometryBuffer,0,this.verticesOffset)}e.drawArraysInstanced(a,0,this.vertexCount,this.numParticles);for(const t of o)t.disable(e);n.resetTextureUnits(),c&&(e.disable(e.SAMPLE_ALPHA_TO_COVERAGE),e.colorMask(!0,!0,!0,!0));break}}},getScreenAlignedRotation:(()=>{const e=new(he()),t=new(F()),i=new(F()),n=new(F()),s=new(_e());return function(o){return e.assign(o).inverse(),e.multDirMatrix(t.assign(F().Y_AXIS)),e.multDirMatrix(n.assign(F().Z_AXIS)),t.cross(n),i.assign(n).cross(t),t.normalize(),i.normalize(),n.normalize(),s.set(...t,...i,...n),s}})()}),Object.defineProperties(Ne,{...u().getStaticProperties("ParticleSystem","ParticleSystems",2,"children","3.2"),fieldDefinitions:{value:new(l())([new(a())(y().inputOutput,"metadata",new(o().SFNode)),new(a())(y().inputOutput,"enabled",new(o().SFBool)(!0)),new(a())(y().initializeOnly,"geometryType",new(o().SFString)("QUAD")),new(a())(y().inputOutput,"createParticles",new(o().SFBool)(!0)),new(a())(y().inputOutput,"maxParticles",new(o().SFInt32)(200)),new(a())(y().inputOutput,"particleLifetime",new(o().SFTime)(5)),new(a())(y().inputOutput,"lifetimeVariation",new(o().SFFloat)(.25)),new(a())(y().inputOutput,"particleSize",new(o().SFVec2f)(.02,.02)),new(a())(y().initializeOnly,"emitter",new(o().SFNode)),new(a())(y().initializeOnly,"physics",new(o().MFNode)),new(a())(y().initializeOnly,"colorKey",new(o().MFFloat)),new(a())(y().initializeOnly,"color",new(o().SFNode)),new(a())(y().initializeOnly,"texCoordKey",new(o().MFFloat)),new(a())(y().initializeOnly,"texCoord",new(o().SFNode)),new(a())(y().initializeOnly,"scaleKey",new(o().MFFloat)),new(a())(y().initializeOnly,"scale",new(o().SFNode)),new(a())(y().outputOnly,"isActive",new(o().SFBool)),new(a())(y().inputOutput,"pointerEvents",new(o().SFBool)(!0)),new(a())(y().inputOutput,"castShadow",new(o().SFBool)(!0)),new(a())(y().inputOutput,"visible",new(o().SFBool)(!0)),new(a())(y().inputOutput,"bboxDisplay",new(o().SFBool)),new(a())(y().initializeOnly,"bboxSize",new(o().SFVec3f)(-1,-1,-1)),new(a())(y().initializeOnly,"bboxCenter",new(o().SFVec3f)),new(a())(y().inputOutput,"appearance",new(o().SFNode)),new(a())(y().inputOutput,"geometry",new(o().SFNode))]),enumerable:!0}});const Pe=Ne,De=m().add("ParticleSystem",Pe),Ce=e.IndexedLineSet;var Ve=t.n(Ce);function Be(e){w.call(this,e),this.addType(y().PolylineEmitter),this.verticesIndex=-1,this.polylinesNode=new(Ve())(e),this.polylinesArray=new Float32Array}Object.assign(Object.setPrototypeOf(Be.prototype,w.prototype),{initialize(){w.prototype.initialize.call(this),this.polylinesTexture=this.createTexture(),this._direction.addInterest("set_direction__",this),this._set_coordIndex.addFieldInterest(this._coordIndex),this._coordIndex.addFieldInterest(this.polylinesNode._coordIndex),this._coord.addFieldInterest(this.polylinesNode._coord),this.polylinesNode._coordIndex=this._coordIndex,this.polylinesNode._coord=this._coord,this.polylinesNode.setPrivate(!0),this.polylinesNode.setup(),this.polylinesNode._rebuild.addInterest("set_polylines__",this),this.addDefine("#define X3D_POLYLINE_EMITTER"),this.addSampler("polylines"),this.addUniform("direction","uniform vec3 direction;"),this.addUniform("verticesIndex","uniform int verticesIndex;"),this.addUniform("polylines","uniform sampler2D polylines;"),this.addCallback(this.set_direction__),this.addCallback(this.set_verticesIndex__),this.addFunction("vec3 getRandomVelocity ()\n {\n if (direction == vec3 (0.0))\n return getRandomSphericalVelocity ();\n\n else\n return direction * getRandomSpeed ();\n }"),this.addFunction("vec4 getRandomPosition ()\n {\n if (verticesIndex < 0)\n {\n return vec4 (NaN);\n }\n else\n {\n // Determine index0, index1 and weight.\n\n float lastLengthSoFar = texelFetch (polylines, verticesIndex - 1, 0) .x;\n float fraction = random () * lastLengthSoFar;\n\n int index0 = 0;\n int index1 = 0;\n float weight = 0.0;\n\n interpolate (polylines, verticesIndex, fraction, index0, index1, weight);\n\n // Interpolate and return position.\n\n index0 *= 2;\n index1 = index0 + 1;\n\n vec4 vertex0 = texelFetch (polylines, verticesIndex + index0, 0);\n vec4 vertex1 = texelFetch (polylines, verticesIndex + index1, 0);\n\n return mix (vertex0, vertex1, weight);\n }\n }"),this.set_polylines__()},getBBox:(()=>{const e=new(F());return function(t,{particleLifetime:i,lifetimeVariation:n}){const s=i*(1+n)*(this._speed.getValue()*(1+this._variation.getValue()))*2;return t.set(e.set(s,s,s),this.polylinesNode.getBBox().center).add(this.polylinesNode.getBBox())}})(),set_direction__:(()=>{const e=new(F());return function(){const{x:t,y:i,z:n}=e.assign(this._direction.getValue()).normalize();this.setUniform("uniform3f","direction",t,i,n)}})(),set_verticesIndex__(){this.setUniform("uniform1i","verticesIndex",this.verticesIndex)},set_polylines__:(()=>{const e=new(F()),t=new(F());return function(){const i=this.getBrowser().getContext(),n=this.polylinesNode.getVertices(),s=n.length/4,o=s/2+1,r=Math.ceil(Math.sqrt(o+s)),a=o;let c=this.polylinesArray;c.length<r*r*4&&(c=this.polylinesArray=new Float32Array(r*r*4));let l=0;for(let i=0,s=n.length;i<s;i+=8)e.set(n[i],n[i+1],n[i+2]),t.set(n[i+4],n[i+5],n[i+6]),c[i/2+4]=l+=t.subtract(e).norm();c.set(n,4*a),this.verticesIndex=s?a:-1,r&&(i.bindTexture(i.TEXTURE_2D,this.polylinesTexture),i.texImage2D(i.TEXTURE_2D,0,i.RGBA32F,r,r,0,i.RGBA,i.FLOAT,c)),this.set_verticesIndex__(),this._bbox_changed.addEvent()}})(),activateTextures(e,t){e.activeTexture(e.TEXTURE0+t.polylinesTextureUnit),e.bindTexture(e.TEXTURE_2D,this.polylinesTexture)}}),Object.defineProperties(Be,{...u().getStaticProperties("PolylineEmitter","ParticleSystems",1,"emitter","3.2"),fieldDefinitions:{value:new(l())([new(a())(y().inputOutput,"metadata",new(o().SFNode)),new(a())(y().inputOnly,"set_coordIndex",new(o().MFInt32)),new(a())(y().inputOutput,"on",new(o().SFBool)(!0)),new(a())(y().inputOutput,"direction",new(o().SFVec3f)(0,1,0)),new(a())(y().inputOutput,"speed",new(o().SFFloat)),new(a())(y().inputOutput,"variation",new(o().SFFloat)(.25)),new(a())(y().inputOutput,"mass",new(o().SFFloat)),new(a())(y().inputOutput,"surfaceArea",new(o().SFFloat)),new(a())(y().initializeOnly,"coordIndex",new(o().MFInt32)(-1)),new(a())(y().inputOutput,"coord",new(o().SFNode))]),enumerable:!0}});const Me=Be,Ue=m().add("PolylineEmitter",Me),Le=e.Triangle3;var ze=t.n(Le);function Xe(e){w.call(this,e),this.addType(y().SurfaceEmitter),this.verticesIndex=-1,this.normalsIndex=-1,this.surfaceArray=new Float32Array}Object.assign(Object.setPrototypeOf(Xe.prototype,w.prototype),{initialize(){w.prototype.initialize.call(this),this.surfaceTexture=this.createTexture(),this._surface.addInterest("set_surface__",this),this.addDefine("#define X3D_SURFACE_EMITTER"),this.addSampler("surface"),this.addUniform("solid","uniform bool solid;"),this.addUniform("verticesIndex","uniform int verticesIndex;"),this.addUniform("normalsIndex","uniform int normalsIndex;"),this.addUniform("surface","uniform sampler2D surface;"),this.addCallback(this.set_solid__),this.addCallback(this.set_verticesIndex__),this.addCallback(this.set_normalsIndex__),this.addFunction("vec4 position; vec3 getRandomVelocity ()\n {\n if (verticesIndex < 0)\n {\n return vec3 (0.0);\n }\n else\n {\n vec3 normal;\n\n getRandomPointOnSurface (surface, verticesIndex, normalsIndex, position, normal);\n\n if (solid == false && random () > 0.5)\n normal = -normal;\n\n return normal * getRandomSpeed ();\n }\n }"),this.addFunction("vec4 getRandomPosition ()\n {\n return verticesIndex < 0 ? vec4 (NaN) : position;\n }"),this.set_surface__()},getBBox:(()=>{const e=new(F());return function(t,{particleLifetime:i,lifetimeVariation:n}){if(!this.surfaceNode)return t.set();const s=i*(1+n)*(this._speed.getValue()*(1+this._variation.getValue()))*2;return t.set(e.set(s,s,s),this.surfaceNode.getBBox().center).add(this.surfaceNode.getBBox())}})(),set_surface__(){this.surfaceNode&&(this.surfaceNode._solid.removeInterest("set_solid__",this),this.surfaceNode._rebuild.removeInterest("set_geometry__",this)),this.surfaceNode=z()(y().X3DGeometryNode,this._surface),this.surfaceNode&&(this.surfaceNode._solid.addInterest("set_solid__",this),this.surfaceNode._rebuild.addInterest("set_geometry__",this)),this.set_solid__(),this.set_geometry__()},set_solid__(){this.setUniform("uniform1i","solid",this.surfaceNode?._solid.getValue()??!0)},set_verticesIndex__(){this.setUniform("uniform1i","verticesIndex",this.verticesIndex)},set_normalsIndex__(){this.setUniform("uniform1i","normalsIndex",this.normalsIndex)},set_geometry__:(()=>{const e=new(F()),t=new(F()),i=new(F());return function(){const n=this.getBrowser().getContext();if(this.surfaceNode){const s=this.surfaceNode.getVertices(),o=this.surfaceNode.getNormals(),r=s.length/4,a=r/3+1,c=Math.ceil(Math.sqrt(a+r+r)),l=a,d=l+r;let u=this.surfaceArray;u.length<c*c*4&&(u=this.surfaceArray=new Float32Array(c*c*4));let h=0;for(let n=0,o=s.length;n<o;n+=12)e.set(s[n],s[n+1],s[n+2]),t.set(s[n+4],s[n+5],s[n+6]),i.set(s[n+8],s[n+9],s[n+10]),u[n/3+4]=h+=ze().area(e,t,i);u.set(s,4*l);for(let e=4*d,t=0,i=o.length;t<i;e+=4,t+=3)u[e+0]=o[t+0],u[e+1]=o[t+1],u[e+2]=o[t+2];this.verticesIndex=r?l:-1,this.normalsIndex=r?d:-1,c&&(n.bindTexture(n.TEXTURE_2D,this.surfaceTexture),n.texImage2D(n.TEXTURE_2D,0,n.RGBA32F,c,c,0,n.RGBA,n.FLOAT,u))}else this.verticesIndex=-1,this.normalsIndex=-1;this.set_verticesIndex__(),this.set_normalsIndex__(),this._bbox_changed.addEvent()}})(),activateTextures(e,t){e.activeTexture(e.TEXTURE0+t.surfaceTextureUnit),e.bindTexture(e.TEXTURE_2D,this.surfaceTexture)}}),Object.defineProperties(Xe,{...u().getStaticProperties("SurfaceEmitter","ParticleSystems",2,"emitter","3.2"),fieldDefinitions:{value:new(l())([new(a())(y().inputOutput,"metadata",new(o().SFNode)),new(a())(y().inputOutput,"on",new(o().SFBool)(!0)),new(a())(y().inputOutput,"speed",new(o().SFFloat)),new(a())(y().inputOutput,"variation",new(o().SFFloat)(.25)),new(a())(y().inputOutput,"mass",new(o().SFFloat)),new(a())(y().inputOutput,"surfaceArea",new(o().SFFloat)),new(a())(y().initializeOnly,"surface",new(o().SFNode))]),enumerable:!0}});const ke=Xe,je=m().add("SurfaceEmitter",ke),Ge=e.IndexedFaceSet;var He=t.n(Ge);function Ye(e){w.call(this,e),this.addType(y().VolumeEmitter),this.verticesIndex=-1,this.normalsIndex=-1,this.hierarchyIndex=-1,this.hierarchyRoot=-1,this.volumeNode=new(He())(e),this.volumeArray=new Float32Array}Object.assign(Object.setPrototypeOf(Ye.prototype,w.prototype),{initialize(){w.prototype.initialize.call(this),this.volumeTexture=this.createTexture(),this._set_coordIndex.addFieldInterest(this._coordIndex),this._direction.addInterest("set_direction__",this),this._coordIndex.addFieldInterest(this.volumeNode._coordIndex),this._coord.addFieldInterest(this.volumeNode._coord),this.volumeNode._creaseAngle=Math.PI,this.volumeNode._convex=!1,this.volumeNode._coordIndex=this._coordIndex,this.volumeNode._coord=this._coord,this.volumeNode.setPrivate(!0),this.volumeNode.setup(),this.volumeNode._rebuild.addInterest("set_geometry__",this),this.addDefine("#define X3D_VOLUME_EMITTER"),this.addSampler("volume"),this.addUniform("direction","uniform vec3 direction;"),this.addUniform("verticesIndex","uniform int verticesIndex;"),this.addUniform("normalsIndex","uniform int normalsIndex;"),this.addUniform("hierarchyIndex","uniform int hierarchyIndex;"),this.addUniform("hierarchyRoot","uniform int hierarchyRoot;"),this.addUniform("volume","uniform sampler2D volume;"),this.addCallback(this.set_direction__),this.addCallback(this.set_verticesIndex__),this.addCallback(this.set_normalsIndex__),this.addCallback(this.set_hierarchyIndex__),this.addCallback(this.set_hierarchyRoot__),this.addFunction("vec3 getRandomVelocity ()\n {\n if (hierarchyRoot < 0)\n {\n return vec3 (0.0);\n }\n else\n {\n if (direction == vec3 (0.0))\n return getRandomSphericalVelocity ();\n\n else\n return direction * getRandomSpeed ();\n }\n }"),this.addFunction("vec4 getRandomPosition ()\n {\n if (hierarchyRoot < 0)\n {\n return vec4 (NaN);\n }\n else\n {\n vec4 point;\n vec3 normal;\n\n getRandomPointOnSurface (volume, verticesIndex, normalsIndex, point, normal);\n\n Line3 line = Line3 (point .xyz, getRandomSurfaceNormal (normal));\n\n vec4 points [ARRAY_SIZE];\n\n int numIntersections = getIntersections (volume, verticesIndex, hierarchyIndex, hierarchyRoot, line, points);\n\n numIntersections -= numIntersections % 2; // We need an even count of intersections.\n\n switch (numIntersections)\n {\n case 0:\n return vec4 (0.0);\n case 2:\n break;\n default:\n sort (points, numIntersections, plane3 (line .point, line .direction));\n break;\n }\n\n int index = int (fract (random ()) * float (numIntersections / 2)) * 2; // Select random intersection.\n\n return mix (points [index], points [index + 1], random ());\n }\n }"),this.set_geometry__()},getBBox:(()=>{const e=new(F());return function(t,{particleLifetime:i,lifetimeVariation:n}){const s=i*(1+n)*(this._speed.getValue()*(1+this._variation.getValue()))*2;return t.set(e.set(s,s,s),this.volumeNode.getBBox().center).add(this.volumeNode.getBBox())}})(),set_direction__:(()=>{const e=new(F());return function(){const{x:t,y:i,z:n}=e.assign(this._direction.getValue()).normalize();this.setUniform("uniform3f","direction",t,i,n)}})(),set_verticesIndex__(){this.setUniform("uniform1i","verticesIndex",this.verticesIndex)},set_normalsIndex__(){this.setUniform("uniform1i","normalsIndex",this.normalsIndex)},set_hierarchyIndex__(){this.setUniform("uniform1i","hierarchyIndex",this.hierarchyIndex)},set_hierarchyRoot__(){this.setUniform("uniform1i","hierarchyRoot",this.hierarchyRoot)},set_geometry__:(()=>{const e=new(F()),t=new(F()),i=new(F());return function(){const n=this.getBrowser().getContext(),s=this.volumeNode.getVertices(),o=this.volumeNode.getNormals(),r=new Fe(s,o).toArray([]),a=s.length/4,c=o.length/3,l=a/3+1,d=r.length/4,u=Math.ceil(Math.sqrt(l+a+a+d)),h=l,m=h+a,_=m+c;let p=this.volumeArray;p.length<u*u*4&&(p=this.volumeArray=new Float32Array(u*u*4));let f=0;for(let n=0,o=s.length;n<o;n+=12)e.set(s[n],s[n+1],s[n+2]),t.set(s[n+4],s[n+5],s[n+6]),i.set(s[n+8],s[n+9],s[n+10]),p[n/3+4]=f+=ze().area(e,t,i);p.set(s,4*h);for(let e=4*m,t=0,i=o.length;t<i;e+=4,t+=3)p[e+0]=o[t+0],p[e+1]=o[t+1],p[e+2]=o[t+2];p.set(r,4*_),this.verticesIndex=h,this.normalsIndex=m,this.hierarchyIndex=_,this.hierarchyRoot=_+d-1,u&&(n.bindTexture(n.TEXTURE_2D,this.volumeTexture),n.texImage2D(n.TEXTURE_2D,0,n.RGBA32F,u,u,0,n.RGBA,n.FLOAT,p)),this.set_verticesIndex__(),this.set_normalsIndex__(),this.set_hierarchyIndex__(),this.set_hierarchyRoot__(),this._bbox_changed.addEvent()}})(),activateTextures(e,t){e.activeTexture(e.TEXTURE0+t.volumeTextureUnit),e.bindTexture(e.TEXTURE_2D,this.volumeTexture)}}),Object.defineProperties(Ye,{...u().getStaticProperties("VolumeEmitter","ParticleSystems",2,"emitter","3.2"),fieldDefinitions:{value:new(l())([new(a())(y().inputOutput,"metadata",new(o().SFNode)),new(a())(y().inputOnly,"set_coordIndex",new(o().MFInt32)),new(a())(y().inputOutput,"on",new(o().SFBool)(!0)),new(a())(y().initializeOnly,"internal",new(o().SFBool)(!0)),new(a())(y().inputOutput,"direction",new(o().SFVec3f)(0,1,0)),new(a())(y().inputOutput,"speed",new(o().SFFloat)),new(a())(y().inputOutput,"variation",new(o().SFFloat)(.25)),new(a())(y().inputOutput,"mass",new(o().SFFloat)),new(a())(y().inputOutput,"surfaceArea",new(o().SFFloat)),new(a())(y().initializeOnly,"coordIndex",new(o().MFInt32)(-1)),new(a())(y().inputOutput,"coord",new(o().SFNode))]),enumerable:!0}});const qe=Ye,We=m().add("VolumeEmitter",qe),Ke=e.Algorithm;var Ze=t.n(Ke);function Qe(e){U.call(this,e),this.addType(y().WindPhysicsModel),this._speed.setUnit("speed"),e.getSpecificationVersion()<=3.3&&(this._direction=new(F()))}Object.assign(Object.setPrototypeOf(Qe.prototype,U.prototype),{getRandomSpeed(e){const t=Math.max(this._speed.getValue(),0),i=t*Math.max(this._gustiness.getValue(),0);return e.getRandomValue(Math.max(0,t-i),t+i)},addForce:(()=>{const e=new(F());return function(t,i,n,s){if(this._enabled.getValue()){const o=i.getSurfaceArea(),r=this.getRandomSpeed(i),a=10**(2*Math.log(r))*.64615;return this._direction.getValue().equals(F().ZERO)?i.getRandomNormal(e):e.assign(this._direction.getValue()).normalize(),s.set(e.multiply(o*a*n),4*t),s[4*t+3]=Math.PI*Ze().clamp(this._turbulence.getValue(),0,1),!0}return!1}})()}),Object.defineProperties(Qe,{...u().getStaticProperties("WindPhysicsModel","ParticleSystems",1,"physics","3.2"),fieldDefinitions:{value:new(l())([new(a())(y().inputOutput,"metadata",new(o().SFNode)),new(a())(y().inputOutput,"enabled",new(o().SFBool)(!0)),new(a())(y().inputOutput,"direction",new(o().SFVec3f)(1,0,0)),new(a())(y().inputOutput,"speed",new(o().SFFloat)(.1)),new(a())(y().inputOutput,"gustiness",new(o().SFFloat)(.1)),new(a())(y().inputOutput,"turbulence",new(o().SFFloat))]),enumerable:!0}});const $e=Qe,Je=m().add("WindPhysicsModel",$e);n().add({name:"ParticleSystems",concreteNodes:[j,Y,K,$,De,N,Ue,je,We,Je],abstractNodes:[w,U],browserContext:V});m().add("ParticleSystemsComponent",void 0)})();
@@ -1,4 +1,4 @@
1
- /* X_ITE v16.2.0 */
1
+ /* X_ITE v16.3.0 */
2
2
  const __X_ITE_X3D__ = window [Symbol .for ("X_ITE.X3D")];
3
3
  /******/ (() => { // webpackBootstrap
4
4
  /******/ "use strict";