x_ite 10.2.0 → 10.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -4
- package/dist/LICENSE.md +4 -0
- package/dist/assets/components/{Annotation.js → AnnotationComponent.js} +138 -260
- package/dist/assets/components/AnnotationComponent.min.js +2 -0
- package/dist/assets/components/{CADGeometry.js → CADGeometryComponent.js} +177 -299
- package/dist/assets/components/CADGeometryComponent.min.js +2 -0
- package/dist/assets/components/{CubeMapTexturing.js → CubeMapTexturingComponent.js} +204 -255
- package/dist/assets/components/CubeMapTexturingComponent.min.js +2 -0
- package/dist/assets/components/DISComponent.js +994 -0
- package/dist/assets/components/DISComponent.min.js +2 -0
- package/dist/assets/components/{EventUtilities.js → EventUtilitiesComponent.js} +121 -274
- package/dist/assets/components/EventUtilitiesComponent.min.js +2 -0
- package/dist/assets/components/{Geometry2D.js → Geometry2DComponent.js} +202 -356
- package/dist/assets/components/Geometry2DComponent.min.js +2 -0
- package/dist/assets/components/{Geospatial.js → GeospatialComponent.js} +449 -676
- package/dist/assets/components/GeospatialComponent.min.js +2 -0
- package/dist/assets/components/{HAnim.js → HAnimComponent.js} +277 -387
- package/dist/assets/components/HAnimComponent.min.js +2 -0
- package/dist/assets/components/{KeyDeviceSensor.js → KeyDeviceSensorComponent.js} +71 -114
- package/dist/assets/components/KeyDeviceSensorComponent.min.js +2 -0
- package/dist/assets/components/{Layout.js → LayoutComponent.js} +234 -339
- package/dist/assets/components/LayoutComponent.min.js +2 -0
- package/dist/assets/components/{NURBS.js → NURBSComponent.js} +349 -652
- package/dist/assets/components/NURBSComponent.min.js +2 -0
- package/dist/assets/components/{ParticleSystems.js → ParticleSystemsComponent.js} +345 -674
- package/dist/assets/components/ParticleSystemsComponent.min.js +2 -0
- package/dist/assets/components/{Picking.js → PickingComponent.js} +245 -472
- package/dist/assets/components/PickingComponent.min.js +2 -0
- package/dist/assets/components/{RigidBodyPhysics.js → RigidBodyPhysicsComponent.js} +496 -804
- package/dist/assets/components/RigidBodyPhysicsComponent.min.js +2 -0
- package/dist/assets/components/ScriptingComponent.js +899 -0
- package/dist/assets/components/ScriptingComponent.min.js +2 -0
- package/dist/assets/components/{Text.js → TextComponent.js} +200 -250
- package/dist/assets/components/TextComponent.min.js +2 -0
- package/dist/assets/components/{TextureProjection.js → TextureProjectionComponent.js} +144 -190
- package/dist/assets/components/TextureProjectionComponent.min.js +2 -0
- package/dist/assets/components/{Texturing3D.js → Texturing3DComponent.js} +225 -387
- package/dist/assets/components/Texturing3DComponent.min.js +2 -0
- package/dist/assets/components/{VolumeRendering.js → VolumeRenderingComponent.js} +316 -603
- package/dist/assets/components/VolumeRenderingComponent.min.js +2 -0
- package/dist/assets/components/{X_ITE.js → X_ITEComponent.js} +301 -599
- package/dist/assets/components/X_ITEComponent.min.js +2 -0
- package/dist/assets/images/XR.svg +74 -0
- package/dist/example.html +1 -1
- package/dist/x_ite.css +1 -1
- package/dist/x_ite.d.ts +68 -11
- package/dist/x_ite.js +2905 -5804
- package/dist/x_ite.min.js +2 -1
- package/dist/x_ite.min.mjs +2 -1
- package/dist/x_ite.mjs +2905 -5804
- package/dist/x_ite.zip +0 -0
- package/package.json +8 -6
- package/dist/assets/components/Annotation.min.js +0 -1
- package/dist/assets/components/CADGeometry.min.js +0 -1
- package/dist/assets/components/CubeMapTexturing.min.js +0 -1
- package/dist/assets/components/DIS.js +0 -1104
- package/dist/assets/components/DIS.min.js +0 -1
- package/dist/assets/components/EventUtilities.min.js +0 -1
- package/dist/assets/components/Geometry2D.min.js +0 -1
- package/dist/assets/components/Geospatial.min.js +0 -1
- package/dist/assets/components/HAnim.min.js +0 -1
- package/dist/assets/components/KeyDeviceSensor.min.js +0 -1
- package/dist/assets/components/Layout.min.js +0 -1
- package/dist/assets/components/NURBS.min.js +0 -1
- package/dist/assets/components/ParticleSystems.min.js +0 -1
- package/dist/assets/components/Picking.min.js +0 -1
- package/dist/assets/components/RigidBodyPhysics.min.js +0 -1
- package/dist/assets/components/Scripting.js +0 -927
- package/dist/assets/components/Scripting.min.js +0 -1
- package/dist/assets/components/Text.min.js +0 -1
- package/dist/assets/components/TextureProjection.min.js +0 -1
- package/dist/assets/components/Texturing3D.min.js +0 -1
- package/dist/assets/components/VolumeRendering.min.js +0 -1
- package/dist/assets/components/X_ITE.min.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
/* X_ITE v10.2.0 */(()=>{"use strict";var e={n:t=>{var 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:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)};const t=window[Symbol.for("X_ITE.X3D-10.2.0")].require("x_ite/Components");var i=e.n(t);const n=window[Symbol.for("X_ITE.X3D-10.2.0")].require("x_ite/Fields");var o=e.n(n);const s=window[Symbol.for("X_ITE.X3D-10.2.0")].require("x_ite/Base/X3DFieldDefinition");var r=e.n(s);const l=window[Symbol.for("X_ITE.X3D-10.2.0")].require("x_ite/Base/FieldDefinitionArray");var a=e.n(l);const u=window[Symbol.for("X_ITE.X3D-10.2.0")].require("x_ite/Components/Core/X3DNode");var h=e.n(u);const d=window[Symbol.for("X_ITE.X3D-10.2.0")].require("x_ite/Base/X3DConstants");var c=e.n(d);const p=window[Symbol.for("X_ITE.X3D-10.2.0")].require("x_ite/Base/X3DCast");var g=e.n(p);const m=window[Symbol.for("X_ITE.X3D-10.2.0")].require("x_ite/Namespace");var f=e.n(m);function _(e){h().call(this,e),this.addType(c().Contour2D),this.childNodes=[]}function b(e,t){const i=new Set(t);return e.filter((e=>!i.has(e)))}Object.assign(Object.setPrototypeOf(_.prototype,h().prototype),{initialize(){h().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(b(this._addChildren,this._children));for(const e of this._addChildren)this._children.push(e);this._addChildren.length=0,this._addChildren.setTainted(!1)},set_removeChildren__(){this._removeChildren.setTainted(!0),this._children.assign(b(this._children,this._removeChildren)),this._removeChildren.length=0,this._removeChildren.setTainted(!1)},set_children__(){const e=this.childNodes;e.length=0;for(const t of this._children){const i=g()(c().NurbsCurve2D,t);if(i)e.push(i);else{const i=g()(c().ContourPolyline2D,t);if(i){e.push(i);continue}}}},addTrimmingContour(e){for(const t of this.childNodes)e.push(t.tessellate(2))}}),Object.defineProperties(_,{typeName:{value:"Contour2D",enumerable:!0},componentInfo:{value:Object.freeze({name:"NURBS",level:4}),enumerable:!0},containerField:{value:"trimmingContour",enumerable:!0},specificationRange:{value:Object.freeze({from:"3.0",to:"Infinity"}),enumerable:!0},fieldDefinitions:{value:new(a())([new(r())(c().inputOutput,"metadata",new(o().SFNode)),new(r())(c().inputOnly,"addChildren",new(o().MFNode)),new(r())(c().inputOnly,"removeChildren",new(o().MFNode)),new(r())(c().inputOutput,"children",new(o().MFNode))]),enumerable:!0}});const v=_;f().add("Contour2D","x_ite/Components/NURBS/Contour2D",v);const w=v;function y(e){h().call(this,e),this.addType(c().X3DNurbsControlCurveNode)}Object.setPrototypeOf(y.prototype,h().prototype),Object.defineProperties(y,{typeName:{value:"X3DNurbsControlCurveNode",enumerable:!0},componentInfo:{value:Object.freeze({name:"NURBS",level:1}),enumerable:!0}});const N=y;f().add("X3DNurbsControlCurveNode","x_ite/Components/NURBS/X3DNurbsControlCurveNode",N);const C=N,O=window[Symbol.for("X_ITE.X3D-10.2.0")].require("standard/Math/Numbers/Vector3");var S=e.n(O);function P(e){C.call(this,e),this.addType(c().ContourPolyline2D),this.controlPoints=[]}Object.assign(Object.setPrototypeOf(P.prototype,C.prototype),{tessellate(e){switch(e){case 0:{const e=this._controlPoint.getValue(),t=this.controlPoints,i=this._controlPoint.length;for(let n=0;n<i;++n){const i=2*n;t[i+0]=e[i+0],t[i+1]=e[i+1]}return t.length=2*i,t}case 1:{const e=this._controlPoint.getValue(),t=this.controlPoints,i=this._controlPoint.length;for(let n=0;n<i;++n){const i=2*n,o=3*n;t[o+0]=e[i+0],t[o+1]=0,t[o+2]=e[i+1]}return t.length=3*i,t}case 3:{const e=this._controlPoint.getValue(),t=this.controlPoints,i=this._controlPoint.length;for(let n=0;n<i;++n){const i=2*n;t[n]=new(S())(e[i+0],e[i+1],0)}return t.length=i,t}}}}),Object.defineProperties(P,{typeName:{value:"ContourPolyline2D",enumerable:!0},componentInfo:{value:Object.freeze({name:"NURBS",level:3}),enumerable:!0},containerField:{value:"children",enumerable:!0},specificationRange:{value:Object.freeze({from:"3.0",to:"Infinity"}),enumerable:!0},fieldDefinitions:{value:new(a())([new(r())(c().inputOutput,"metadata",new(o().SFNode)),new(r())(c().inputOutput,"controlPoint",new(o().MFVec2d))]),enumerable:!0}});const D=P;f().add("ContourPolyline2D","x_ite/Components/NURBS/ContourPolyline2D",D);const I=D,F=window[Symbol.for("X_ITE.X3D-10.2.0")].require("x_ite/Components/Rendering/X3DGeometryNode");var R=e.n(F);const z=window[Symbol.for("X_ITE.X3D-10.2.0")].require("standard/Math/Numbers/Vector2");var V=e.n(z);const T=window[Symbol.for("X_ITE.X3D-10.2.0")].require("standard/Math/Numbers/Vector4");var j=e.n(T);const x={getTessellation:(e,t)=>e>0?e+1:e<0?-e*t+1:2*t+1,getClosed2D(e,t,i,n){const o=n.length;return(!(i.length===o)||i[0]===i[o-1])&&(!!n[0].equals(n[o-1])&&!!this.isPeriodic(e,o,t))},getClosed:(()=>{const e=new(S()),t=new(S());return function(i,n,o,s){const r=s.getSize();return(!(o.length===r)||o[0]===o[r-1])&&(!!s.get1Point(0,e).equals(s.get1Point(r-1,t))&&!!this.isPeriodic(i,r,n))}})(),getUClosed:(()=>{const e=new(S()),t=new(S());return function(i,n,o,s,r,l){const a=r.length===l.getSize();for(let i=0,s=o;i<s;++i){const o=i*n,s=i*n+n-1;if(a&&r[o]!==r[s])return!1;if(!l.get1Point(o,e).equals(l.get1Point(s,t)))return!1}return!!this.isPeriodic(i,n,s)}})(),getVClosed:(()=>{const e=new(S()),t=new(S());return function(i,n,o,s,r,l){const a=r.length===l.getSize();for(let i=0,s=n;i<s;++i){const s=i,u=(o-1)*n+i;if(a&&r[s]!==r[u])return!1;if(!l.get1Point(s,e).equals(l.get1Point(u,t)))return!1}return!!this.isPeriodic(i,o,s)}})(),isPeriodic(e,t,i){if(i.length===t+e){{let t=1;for(let n=1,o=e;n<o;++n)t+=i[n]===i[0];if(t===e)return!1}{let t=1;for(let n=i.length-e,o=i.length-1;n<o;++n)t+=i[n]===i[o];if(t===e)return!1}}return!0},getKnots(e,t,i,n,o){const s=e||[];for(let e=0,t=o.length;e<t;++e)s[e]=o[e];s.length=o.length;let r=!0;if(s.length===n+i){r=!1;let e=0;for(let t=1,n=s.length;t<n;++t)s[t]==s[t-1]?++e:e=0,e>i-1&&(r=!0),s[t-1]>s[t]&&(r=!0)}if(r)for(let e=0,t=n+i;e<t;++e)s[e]=e/(t-1);if(t)for(let e=1,t=i-1;e<t;++e)s.push(s.at(-1)+(s[e]-s[e-1]));return s},getWeights(e,t,i){if(i.length!==t)return;const n=e||[];for(let e=0;e<t;++e)n[e]=i[e];return n.length=t,n},getUVWeights(e,t,i,n){const o=t*i;if(n.length!==o)return;const s=e||[];for(let e=0,o=0;e<t;++e)for(let e=0;e<i;++e,++o)s[o]=n[o];return s.length=o,s},getControlPoints2D(e,t,i,n,o){const s=e||[],r=o.getValue(),l=o.length,a=!!n,u=a?S():V();s.haveWeights!==a&&(s.haveWeights=a,s.length=0);for(let e=0;e<l;++e){const t=2*e,i=s[e]||new u(0,0,0);s[e]=i.set(r[t+0],r[t+1],a?n[e]:0)}if(s.length=l,t)for(let e=1,t=i-1;e<t;++e)s.push(s[e]);return s},getControlPoints(e,t,i,n,o){const s=e||[],r=o.getSize(),l=!!n,a=l?j():S();s.haveWeights!==l&&(s.haveWeights=l,s.length=0);for(let e=0;e<r;++e){const t=s[e]=o.get1Point(e,s[e]||new a(0,0,0,0));l&&(t.w=n[e])}if(s.length=r,t)for(let e=1,t=i-1;e<t;++e)s.push(s[e]);return s},getUVControlPoints(e,t,i,n,o,s,r,l,a){const u=e||[],h=!!l,d=h?j():S();u.haveWeights!==h&&(u.haveWeights=h,u.length=0);for(let e=0;e<s;++e){let t=u[e];t||(t=u[e]=[]);for(let i=0;i<r;++i){const n=i*s+e;t[i]=a.get1Point(n,t[i]||new d(0,0,0,0)),h&&(t[i].w=l[n])}if(t.length=r,i)for(let e=1,i=o-1;e<i;++e)t.push(t[e])}if(u.length=s,t)for(let e=1,t=n-1;e<t;++e)u.push(u[e]);return u},getTexControlPoints(e,t,i,n,o,s,r,l){const a=e||[];for(let e=0;e<s;++e){let t=a[e];t||(t=a[e]=[]);for(let i=0;i<r;++i){const n=i*s+e;t[i]=l.get1Point(n,t[i]||new(j()))}if(t.length=r,i)for(let e=1,i=o-1;e<i;++e)t.push(t[e])}if(a.length=s,t)for(let e=1,t=n-1;e<t;++e)a.push(a[e]);return a}};f().add("NURBS","x_ite/Browser/NURBS/NURBS",x);const k=x;function A(e){R().call(this,e),this.addType(c().X3DParametricGeometryNode)}Object.assign(Object.setPrototypeOf(A.prototype,R().prototype),{getKnots:(e,t,i,n,o)=>k.getKnots(e,t,i,n,o)}),Object.defineProperties(A,{typeName:{value:"X3DParametricGeometryNode",enumerable:!0},componentInfo:{value:Object.freeze({name:"NURBS",level:1}),enumerable:!0}});const B=A;f().add("X3DParametricGeometryNode","x_ite/Components/NURBS/X3DParametricGeometryNode",B);const X=B,E=window[Symbol.for("X_ITE.X3D-10.2.0")].require("x_ite/Components/Rendering/X3DLineGeometryNode");var U=e.n(E);const q=function(e){return!!e&&(!!e.dtype&&new RegExp("function View[0-9]+d(:?"+e.dtype+")+").test(String(e.constructor)))};f().add("is-ndarray","lib/nurbs/src/utils/is-ndarray",q);const K=q,M=function(e){return!!e&&(void 0!==e.data&&Array.isArray(e.shape)&&void 0!==e.offset&&void 0!==e.stride)};f().add("is-ndarray-like","lib/nurbs/src/utils/is-ndarray-like",M);const G=M,W=function(e){return Array.isArray(e)||ArrayBuffer.isView(e)||void 0!==e.length};f().add("is-array-like","lib/nurbs/src/utils/is-array-like",W);const Y=W;function J(e){if(e){if(K(e)||G(e))return"generic"===e.dtype?J.GENERIC_NDARRAY:J.NDARRAY;if(Y(e)){for(var t=e;Y(t[0]);t=t[0]);return"x"in t?J.ARRAY_OF_OBJECTS:J.ARRAY_OF_ARRAYS}throw new Error("Unhandled data type. Got type: "+typeof e)}}J.ARRAY_OF_OBJECTS="Obj",J.ARRAY_OF_ARRAYS="Arr",J.NDARRAY="Nd",J.GENERIC_NDARRAY="GenNd",J.PACKED="PackArr";const L=J;f().add("infer-type","lib/nurbs/src/utils/infer-type",L);const Z=L;const H=function(e,t,i,n,o,s){var r,l,a=[],u=!1;for(r=0;r<e.splineDimension;r++){var h=Y(e.knots)&&Y(e.knots[r]);h&&(u=!0),a.push("Deg"+e.degree[r]+(h?"":"Uniform")+((l=e.boundary[r])[0].toUpperCase()+l.slice(1)))}var d=[[u?"NU":"",e.weights?"RBS":"BS"].join("")+e.dimension+"D",a.join("_")];return n&&d.push(n+"Pts"),o&&d.push(o+"Wts"),s&&d.push(s+"Kts"),t&&d.push("debug"),i&&d.push("chk"),d.join("_")};f().add("cache-key","lib/nurbs/src/utils/cache-key",H);const Q=H;var $=function e(t,i){return function(i,n){void 0===i||Array.isArray(i)||(i=[i]);for(var o=[],s=0;s<i.length;s++)o.push(e.sum(i[s]));if(n)for(i=0;i<o.length;i++)void 0!==n[i]&&(o[i]="("+o[i]+" + "+n[i]+") % "+n[i]);return t+o.join("_")}};$.sum=function(e){return 0===(e=(e=Array.isArray(e)?e:[e]).filter((e=>void 0!==e&&0!==e))).length&&e.push(0),e.join(" + ")};const ee=$;f().add("variable","lib/nurbs/src/utils/variable",ee);const te=ee;var ie=[".x",".y",".z",".w"];function ne(e){return function(t,i){void 0===t||Array.isArray(t)||(t=[t]);for(var n=[],o=0;o<t.length;o++)n.push(te.sum(t[o]));if(i)for(t=0;t<n.length;t++)void 0!==i[t]&&(n[t]="("+n[t]+" + "+i[t]+") % "+i[t]);return e(n)}}function oe(e,t){if(t)switch(Z(t)){case Z.ARRAY_OF_OBJECTS:return ne((t=>{var i=t.pop();return e+"["+t.join("][")+"]"+ie[i]}));case Z.ARRAY_OF_ARRAYS:return ne((t=>e+"["+t.join("][")+"]"));case Z.GENERIC_NDARRAY:return ne((t=>e+".get("+t.join(",")+")"));case Z.NDARRAY:return ne((t=>{for(var i=[e+"Offset"],n=0;n<t.length;n++)i.push(e+"Stride"+n+" * ("+t[n]+")");return e+"["+i.join(" + ")+"]"}));case Z.PACKED:default:return}}const se=function(e){var t,i={};return(t=oe("x",e.points))&&(i.point=t),(t=oe("w",e.weights))&&(i.weight=t),(t=oe("k",e.knots))&&(i.knot=t),i};f().add("create-accessors","lib/nurbs/src/utils/create-accessors",se);const re=se;var le=[],ae=[];const ue=function(e,t,i){if(1!==t)throw new Error("Numerical derivative not implemented for order n = "+t+".");var n,o=void 0===arguments[this.splineDimension+3]?1e-4:arguments[this.splineDimension+3];for(le.length=this.splineDimension,n=0;n<this.splineDimension;n++)le[n+1]=arguments[n+3];var s,r,l,a=this.domain,u=a[i][0],h=a[i][1],d=le[i+1],c=(h-u)*o;for("closed"===this.boundary[i]?(s=u+(d-u-c+(l=h-u))%l,r=u+(d-u+c+l)%l,c*=2):(s=Math.min(h,Math.max(u,d-c)),c=(r=Math.min(h,Math.max(u,d+c)))-s),le[i+1]=s,le[0]=ae,this.evaluate.apply(null,le),le[i+1]=r,le[0]=e,this.evaluate.apply(null,le),n=0;n<this.dimension;n++)e[n]=(e[n]-ae[n])/c;return e};f().add("numerical-derivative","lib/nurbs/src/numerical-derivative",ue);const he=ue,de=function(e,t){for(var i=1,n=0,o=[];n<e.length;n++)i*=Array.isArray(e[n])?e[n][1]-e[n][0]:e[n],o[n]=Array.isArray(e[n])?e[n][0]:0;for(var s=0;s<i;s++)for(t(o.slice()),n=e.length-1;n>=0;n--){if(o[n]!==(Array.isArray(e[n])?e[n][1]:e[n])-1){o[n]++;break}o[n]=Array.isArray(e[n])?e[n][0]:0}};f().add("ndloop","lib/nurbs/src/utils/ndloop",de);const ce=de,pe=function(e,t,i,n){var o=[];switch(Z(n)){case Z.NDARRAY:o.push(" var "+t+" = "+i+".data;"),o.push(" var "+t+"Offset = "+i+".offset;");for(var s=0;s<n.dimension;s++)o.push(" var "+t+"Stride"+s+" = "+i+".stride["+s+"];");break;case Z.ARRAY_OF_OBJECTS:case Z.ARRAY_OF_ARRAYS:o.push(" var "+t+" = "+i+";")}return o.join("\n")};f().add("accessor-preamble","lib/nurbs/src/utils/accessor-preamble",pe);const ge=pe,me=function(e,t,i){if(e){if(G(e))return t+".shape["+i+"]";for(var n=t,o=0;o<i;o++)n+="[0]";return n+".length"}return"this.size["+i+"]"};f().add("size-getter","lib/nurbs/src/utils/size-getter",me);const fe=me;var _e={},be={};const ve=function(e,t,i,n,o,s,r){var l,a,u,h,d,c,p=t.splineDimension,g=t.points,m=t.degree,f=t.weights,_=void 0!==f,b=t.knots,v=t.dimension,w=t.boundary;if(null!=r){Array.isArray(r)||(r=[r]);var y=0;for(l=0;l<p;l++)void 0===r[l]&&(r[l]=0),y+=r[l];if(_&&y>1)throw new Error("Analytical derivative not implemented for rational b-splines with order n = "+y+".")}s&&(e="Basis"+e),r&&(e="Der"+r.join("_")+"_"+e);var N=_e[e];if(n)var C="function"==typeof n?n:console.log;if(N)return n&&C(be[e]),N.bind(t);var O=[],S="evaluate"+e,P=i.point;s&&(P=function(e,t){for(var i=[],n=0;n<e.length;n++){for(var o=e[n],s=[],r=0;r<o.length;r++)0!==o[r]&&s.push(o[r]);o=s.join(" + "),t[n]&&(o="("+o+" + "+t[n]+") % "+t[n]),i.push(o+" === "+V(n))}return"(("+i.join(" && ")+") ? 1 : 0)"});var D=i.weight,I=i.knot,F=te("k"),R=te("x"),z=te("w"),V=te("i"),T=te("t"),j=n?"domain":"d",x=te(n?"size":"s"),k=te(n?"knotIndex":"j"),A=!0;for(d=0;d<p;d++)Y(b)&&Y(b[d])&&(A=!1);function B(e){O.push(" "+(e||""))}function X(e){n&&B(e)}if(s)var E=[];var U=[];for(l=0;l<p;l++)s&&E.push(V([l])),U.push(T([l]));for(O.push("function "+S+" ("+(s?"":"out, ")+U.join(", ")+(s?", "+E.join(", "):"")+") {"),B("var h, m, a, b;"),o&&(B("var "+j+" = this.domain;"),B("for (var i = 0; i < this.splineDimension; i++) {"),B(" a = arguments[i + 1];"),B(" if (a < "+j+"[i][0] || a > "+j+"[i][1] || a === undefined || isNaN(a)) {"),B(' throw new Error("Invalid Spline parameter in dimension "+i+". Valid domain is ["+'+j+'[i][0]+", "+'+j+'[i][1]+"]. but got t"+i+" = "+arguments[i + 1]+".");'),B(" }"),B("}")),d=0;d<p;d++)B("var "+x(d)+" = "+fe(g,"this.points",d)+";");function q(e,t,i){return"("+e+") ? ("+t+") : ("+i+")"}O.push(ge(t,"x","this.points",g)),_&&O.push(ge(t,"w","this.weights",f)),A||O.push(ge(t,"k","this.knots",b));var K=[];for(d=0;d<p;d++)switch(Z(b)){case Z.NDARRAY:K[d]=!0;break;case Z.ARRAY_OF_ARRAYS:K[d]=Y(b[d])}for(d=0;d<p;d++)if(K[d])for(X("\n // Bisect to locate the knot interval in dimension "+d+"\n"),B("var "+k(d)+" = 0;"),B("h = "+x(d)+";"),B("while(h > "+k(d)+" + 1) {"),B(" m = 0.5 * (h + "+k(d)+") | 0;"),B(" if ("+I([d,"m"])+" > "+T(d)+") h = m;"),B(" else "+k(d)+" = m;"),B("}"),X("\n // Fetch knots for dimension "+d+"\n"),l=1-m[d];l<=m[d];l++)"closed"===w[d]?B(l<0?"var "+F([d,l+m[d]-1])+" = "+q(k(d)+" < "+-l,I([d,0])+" + "+I([d,[x(d),k(d),l]])+" - "+I([d,[x(d)]]),I([d,[k(d),l]]))+";":l>0?"var "+F([d,l+m[d]-1])+" = "+q(k(d)+" + "+l+" > "+x(d),I([d,x(d)])+" + "+I([d,l+" + "+k(d)+" - "+x(d)])+" - "+I([d,0]),I([d,[k(d),l]]))+";":"var "+F([d,l+m[d]-1])+" = "+I([d,[k(d),l]])+";"):B("var "+F([d,l+m[d]-1])+" = "+I([d,[k(d),l]])+";");else{for(X("\n // Directly compute knot interval for dimension "+d+"\n"),"closed"===w[d]?B(k(d)+" = ("+T(d)+" | 0) % "+x(d)+";"):(B(k(d)+" = ("+T(d)+" | 0);"),B("if ("+k(d)+" < "+m[d]+") "+k(d)+" = "+m[d]+";"),B("if ("+k(d)+" > "+x(d)+" - 1) "+k(d)+" = "+x(d)+" - 1;")),X("\n // Compute and clamp knots for dimension "+d+"\n"),l=1-m[d];l<=m[d];l++)B("var "+(c=F([d,l+m[d]-1]))+" = "+k(d)+" + "+l+";");if("clamped"===w[d])for(l=1-m[d];l<=m[d];l++)c=F([d,l+m[d]-1]),l<0&&B("if ("+c+" < "+m[d]+") "+c+" = "+m[d]+";"),l>0&&B("if ("+c+" > "+x(d)+") "+c+" = "+x(d)+";");"closed"===w[d]&&(X("\n // Wrap the B-Spline parameter for closed boundary"),B(T(d)+" %= "+x(d)+";"))}for(d=0,u=[];d<p;d++)u[d]=m[d]+1;for(_&&(X("\n // Fetch weights\n"),ce(u,(function(e){for(var t=[],i=[],n=0;n<p;n++)t[n]=[k(n),e[n]-m[n]],"closed"===w[n]&&e[n]-m[n]<0&&(i[n]=x(n));B("var "+z(e)+" = "+D(t,i)+";")}))),n&&B(_?"\n // Fetch points and project into homogeneous (weighted) coordinates\n":"\n // Fetch points\n"),ce(u,(function(e){for(var t=[],i=[],n=0;n<p;n++)t[n]=[k(n),e[n]-m[n]],"closed"===w[n]&&e[n]-m[n]<0&&(i[n]=x(n));if(s)B(_?"var "+R(e)+" = "+P(t,i)+" * "+z(e)+";":"var "+R(e)+" = "+P(t,i)+";");else for(n=0;n<v;n++){var o=e.concat(n);t[p]=n,B(_?"var "+R(o)+" = "+P(t,i)+" * "+z(e)+";":"var "+R(o)+" = "+P(t,i)+";")}})),X("\n"),X('// Perform De Boor"s algorithm'),d=u.length-1;d>=0;d--)for(u[d]=[m[d],m[d]+1],l=0;l<m[d];l++)for(X("\n // Degree "+m[d]+" evaluation in dimension "+d+", step "+(l+1)+"\n"),a=m[d];a>l;a--){var M=r&&m[d]-l-r[d]<=0;M?(B("m = 1 / ("+F([d,a-l+m[d]-1])+" - "+F([d,a-1])+");"),_&&(B("a = ("+T(d)+" - "+F([d,a-1])+") * m;"),B("b = 1 - a;"))):(B("a = ("+T(d)+" - "+F([d,a-1])+") / ("+F([d,a-l+m[d]-1])+" - "+F([d,a-1])+");"),B("b = 1 - a;")),_&&ce(u,(function(e){var t=e.slice(),i=e.slice();t[d]=a,i[d]=a-1,M&&_&&B("h = "+z(t)+";"),B(z(t)+" = b * "+z(i)+" + a * "+z(t)+";")})),ce(u,(function(e){var t,i,n,o=e.slice(),r=e.slice();if(o[d]=a,r[d]=a-1,M){var u=l+1;if(s)t=_?"h * "+z(r)+" / "+z(o)+" * ":"",i=R(o)+(_?" / h":""),n=R(r)+(_?" / "+z(r):""),B(R(o)+" = "+u+" * "+t+"("+i+" - "+n+") * m;");else{var c=o.slice(),g=r.slice();for(h=0;h<v;h++)c[p]=g[p]=h,t=_?"h * "+z(r)+" / "+z(o)+" * ":"",i=R(c)+(_?" / h":""),n=R(g)+(_?" / "+z(r):""),B(R(c)+" = "+u+" * "+t+"("+i+" - "+n+") * m;")}}else if(s)B(R(o)+" = b * "+R(r)+" + a * "+R(o)+";");else for(h=0;h<v;h++)o[p]=r[p]=h,B(R(o)+" = b * "+R(r)+" + a * "+R(o)+";")})),X("\n")}if(n&&B(_?"\n // Project back from homogeneous coordinates and return final output\n":"\n // Return final output\n"),s)B(_?"return "+R(m)+" / "+z(m)+";":"return "+R(m)+";");else for(d=0;d<v;d++)B(_?"out["+d+"] = "+R(m.concat([d]))+" / "+z(m)+";":"out["+d+"] = "+R(m.concat([d]))+";");if(s||B("return out;"),O.push("}"),n){var G=O.join("\n");C(G),be[e]=G}var W=new Function([O.join("\n"),"; return ",S].join(""))();return _e[e]=W,W.bind(t)};f().add("evaluator","lib/nurbs/src/evaluator",ve);const we=ve;var ye={};const Ne=function(e,t,i,n){var o,s,r,l,a,u,h,d,c=ye[e];if(c)return c.bind(t);var p=[],g="transform"+e;p.push("function "+g+"(m) {"),p.push("var i, w;"),p.push(ge(t,"x","this.points",t.points));var m=te(n?"size":"s");for(o=0;o<t.splineDimension;o++)p.push("var "+m(o)+" = "+fe(t.points,"this.points",o)+";");for(l=[],o=0;o<t.splineDimension;o++)r="i"+o,l.push(r),p.push("for ("+r+" = "+m(o)+"- 1; "+r+" >= 0; "+r+"--) {");for(o=0;o<t.dimension;o++)p.push("x"+o+" = "+i.point(l.concat([o])));for(a=[],o=0;o<t.dimension;o++)a.push("m["+((t.dimension+1)*(o+1)-1)+"] * x"+o);for(a.push("m["+((t.dimension+1)*(t.dimension+1)-1)+"]"),p.push("var w = ("+a.join(" + ")+") || 1.0;"),o=0;o<t.dimension;o++){for(a=[],u=t.dimension,s=0;s<u;s++)a.push("m["+(s*(u+1)+o)+"] * x"+s);a.push("m["+(s*(u+1)+o)+"]"),d=i.point(l.concat([o])),h="("+a.join(" + ")+") / w",p.push(d+" = "+h+";")}for(o=t.splineDimension-1;o>=0;o--)p.push("}");p.push("return this;"),p.push("}");var f=new Function([p.join("\n"),"; return ",g].join(""))();return n&&console.log(p.join("\n")),ye[e]=f,f.bind(t)};f().add("transform","lib/nurbs/src/transform",Ne);const Ce=Ne;var Oe={};const Se=function(e,t,i,n,o){var s=Oe[e];if(s)return s.bind(t);var r,l,a,u=t.degree,h=t.knots,d=t.splineDimension,c=t.boundary,p=[],g="support"+e,m=i.knot,f=te("t"),_=n?"domain":"d",b=te(n?"size":"s"),v=te(n?"knotIndex":"i"),w=!0;for(a=0;a<d;a++)Y(h)&&Y(h[a])&&(w=!1);function y(e){p.push(" "+(e||""))}var N=[];for(r=0;r<d;r++)N.push(f([r]));p.push("function "+g+" (out, "+N.join(", ")+") {");var C=0;function O(e,t){y(void 0===t?"out["+C+++"] = "+e.join(" + ")+";":"out["+C+++"] = ("+e.join(" + ")+" + "+t+") % "+t+";")}for(y("var h, m;"),y("var c = 0;"),o&&(y("var "+_+" = this.domain;"),y("for (var i = 0; i < this.splineDimension; i++) {"),y(" a = arguments[i + 1];"),y(" if (a < "+_+"[i][0] || a > "+_+"[i][1] || a === undefined || isNaN(a)) {"),y(' throw new Error("Invalid Spline parameter in dimension "+i+". Valid domain is ["+'+_+'[i][0]+", "+'+_+'[i][1]+"]. but got t"+i+" = "+arguments[i + 1]+".");'),y(" }"),y("}")),a=0;a<d;a++)y("var "+b(a)+" = "+fe(t.points,"this.points",a)+";");w||p.push(ge(t,"k","this.knots",h));var S=[];for(a=0;a<d;a++)switch(Z(h)){case Z.NDARRAY:S[a]=!0;break;case Z.ARRAY_OF_ARRAYS:S[a]=Y(h[a])}for(a=0;a<d;a++)S[a]?(y("var "+v(a)+" = 0;"),y("h = "+b(a)+";"),y("while(h > "+v(a)+" + 1) {"),y(" m = 0.5 * (h + "+v(a)+") | 0;"),y(" if ("+m([a,"m"])+" > "+f(a)+") h = m;"),y(" else "+v(a)+" = m;"),y("}")):"closed"===c[a]?y(v(a)+" = ("+f(a)+" | 0) % "+b(a)+";"):(y(v(a)+" = ("+f(a)+" | 0);"),y("if ("+v(a)+" < "+u[a]+") "+v(a)+" = "+u[a]+";"),y("if ("+v(a)+" > "+b(a)+" - 1) "+v(a)+" = "+b(a)+" - 1;"));for(a=0,l=[];a<d;a++)l[a]=u[a]+1;ce(l,(function(e){for(var t=[],i=[],n=0;n<d;n++)t[n]=[v(n),e[n]-u[n]],"closed"===c[n]&&e[n]-u[n]<0&&(i[n]=b(n));for(n=0;n<d;n++)O(t[n],i[n])})),y("out.length = "+C+";"),y("return out;"),p.push("}"),n&&console.log(p.join("\n"));var P=new Function([p.join("\n"),"; return ",g].join(""))();return Oe[e]=P,P.bind(t)};f().add("support","lib/nurbs/src/support",Se);const Pe=Se;var De=[];const Ie=function(e,t,i){i=i||{};var n=(e=e||{}).points=e.points||[],o=e.faces=e.faces||[],s=i.haveWeights,r=t.dimension-s;if(Array.isArray(i.resolution))var l=i.resolution;else{var a=void 0===i.resolution?31:i.resolution;l=new Array(t.splineDimension).fill(a)}switch(t.splineDimension){case 1:for(var u=(f=(b=l[0])+!(w="closed"===t.boundary[0]))*r,h=(N=(_=i.domain||t.domain)[0])[1]-N[0],d=0;d<f;++d){var c=N[0]+h*d/b,p=d*r;if(t.evaluate(De,c),s)for(var g=De[r],m=0;m<r;++m)n[p+m]=De[m]/g;else for(m=0;m<r;++m)n[p+m]=De[m]}n.length=u;break;case 2:var f,_,b=l[0],v=l[1],w="closed"===t.boundary[0],y=v+!(D="closed"===t.boundary[1]),N=(u=(f=b+!w)*y*r,(_=i.domain||t.domain)[0]),C=_[1],O=(h=N[1]-N[0],C[1]-C[0]);for(d=0;d<f;++d){c=N[0]+h*d/b;for(var S=0;S<y;++S){var P=C[0]+O*S/v;p=(d+f*S)*r;if(t.evaluate(De,c,P),s)for(g=De[r],m=0;m<r;++m)n[p+m]=De[m]/g;else for(m=0;m<r;++m)n[p+m]=De[m]}}n.length=u;w=i.closed[0];var D=i.closed[1],I=0;for(d=0;d<b;++d){var F=d,R=d+1;w&&(R%=b);for(S=0;S<v;++S){var z=S,V=S+1;D&&(V%=v),o[I++]=F+f*z,o[I++]=R+f*z,o[I++]=R+f*V,o[I++]=F+f*z,o[I++]=R+f*V,o[I++]=F+f*V}}o.length=I;break;default:throw new Error("Can only sample contours and surfaces")}return e};f().add("sample","lib/nurbs/extras/sample",Ie);const Fe=Ie;var Re={open:"open",closed:"closed",clamped:"clamped"};function ze(e){return null==e}function Ve(e,t,i,n,o,s){var r,l;!e||Y(e)||K(e)?(s=s||{},this.weights=n,this.knots=i,this.degree=t,this.points=e,this.boundary=o,this.debug=s.debug,this.checkBounds=!!s.checkBounds,Object.defineProperty(this,"size",{value:s.size,writable:!0,configurable:!0})):(s=e,this.debug=e.debug,this.checkBounds=!!e.checkBounds,this.weights=e.weights,this.knots=e.knots,this.degree=e.degree,this.boundary=e.boundary,this.points=e.points,Object.defineProperty(this,"size",{value:s.size,writable:!0,configurable:!0}));var a=Z(this.points),u=Z(this.weights),h=Z(this.knots);if(this.points)switch(a){case Z.GENERIC_NDARRAY:case Z.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 read only property 'size'")},configurable:!0}});break;case Z.ARRAY_OF_OBJECTS:case Z.ARRAY_OF_ARRAYS:var d=0,c=this.size||[];c.length=0;for(var p=this.points;Y(p[0]);p=p[0])d++,c.push(p.length);if(0===d)throw new Error("Expected an array of points");Object.defineProperties(this,{splineDimension:{value:d,writable:!1,configurable:!0},dimension:{value:p.length,writable:!1,configurable:!0},size:{get:function(){var e=[];e.length=0;for(var t=0,i=this.points;t<this.splineDimension;t++,i=i[0])e[t]=i.length;return e},set:function(){throw new Error('Cannot assign to read only property "size"')},configurable:!0}});break;case Z.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(Y(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(Y(this.degree)){for(r=0;r<this.splineDimension;r++)if(ze(this.degree[r]))throw new Error("Missing degree in dimension "+(r+1))}else{var g=!ze(this.degree),m=ze(this.degree)?2:this.degree;for(this.degree=[],r=0;r<this.splineDimension;r++)if(this.size[r]<=m){if(g)throw new Error("Expected at least "+(m+1)+" points for degree "+m+" spline in dimension "+(r+1)+" but got only "+this.size[r]);this.degree[r]=this.size[r]-1}else this.degree[r]=m}if(l="string"!=typeof this.boundary?"open":this.boundary,!Re[l])throw new Error("Boundary type must be one of "+Object.keys(Re)+". Got "+l);for(this.boundary=Y(this.boundary)?this.boundary:[],this.boundary.length=this.splineDimension,r=0;r<this.splineDimension;r++)if(this.boundary[r]=ze(this.boundary[r])?l:this.boundary[r],!Re[l])throw new Error("Boundary type must be one of "+Object.keys(Re)+". Got "+l+" for dimension "+(r+1));switch(h){case Z.ARRAY_OF_ARRAYS:for(Y(this.knots)&&this.knots.length>0&&!Y(this.knots[0])&&(this.knots=[this.knots]),r=0;r<this.splineDimension;r++){if(this.size[r]<=this.degree[r])throw new Error("Expected at least "+(this.degree[r]+1)+" points in dimension "+(r+1)+" but got "+this.size[r]+".");if(Y(this.knots[r])){if("closed"!==this.boundary[r]&&this.knots[r].length!==this.degree[r]+this.size[r]+1)throw new Error("Expected "+(this.degree[r]+this.size[r]+1)+" knots in dimension "+(r+1)+" but got "+this.knots[r].length+".");if("closed"===this.boundary[r]&&this.knots[r].length!==this.size[r]+1&&!(this.knots[r].length===this.size[r]+this.degree[r]+1))throw new Error("Expected "+(this.size[r]+1)+" knots for closed spline in dimension "+(r+1)+" but got "+this.knots[r].length+".")}}case Z.NDARRAY:}var f=Q(this,this.debug,this.checkBounds,a,u,h);if(f!==this.__cacheKey){this.__cacheKey=f;var _=re(this);this.evaluate=we(this.__cacheKey,this,_,this.debug,this.checkBounds,!1),this.transform=Ce(this.__cacheKey,this,_,this.debug),this.support=Pe(this.__cacheKey,this,_,this.debug,this.checkBounds),this.evaluator=function(e,t){return we(this.__cacheKey,this,_,this.debug,this.checkBounds,t,e)}}return this.numericalDerivative=he.bind(this),this}function Te(){var e,t=[],i=this.points;i?G(i)&&(e=i.shape):e=this.size;for(var n=0;n<this.splineDimension;n++){var o=e?e[n]:i.length,s=this.degree[n],r="closed"===this.boundary[n];if(this.knots&&this.knots[n]){var l=this.knots[n];t[n]=[l[r?0:s],l[o]]}else t[n]=[r?0:s,o];i&&(i=i[0])}return t}function je(e,t,i,n,o,s){var r=function(e,t,i,n,o,s){return l(e,t,i,n,o,s),r},l=Ve.bind(r);return Object.defineProperty(r,"domain",{get:Te}),l(e,t,i,n,o,s),r}je.sample=Fe;const xe=je;f().add("nurbs","lib/nurbs/nurbs",xe);const ke=xe;function Ae(e){X.call(this,e),U().call(this,e),this.addType(c().NurbsCurve),this.knots=[],this.weights=[],this.controlPoints=[],this.mesh={},this.sampleOptions={resolution:[]}}Object.assign(Object.setPrototypeOf(Ae.prototype,X.prototype),U().prototype,{initialize(){X.prototype.initialize.call(this),this._controlPoint.addInterest("set_controlPoint__",this),this.set_controlPoint__()},set_controlPoint__(){this.controlPointNode&&this.controlPointNode.removeInterest("requestRebuild",this),this.controlPointNode=g()(c().X3DCoordinateNode,this._controlPoint),this.controlPointNode&&this.controlPointNode.addInterest("requestRebuild",this)},getTessellation(e){return k.getTessellation(this._tessellation.getValue(),e-this._order.getValue())},getClosed(e,t,i,n){return!!this._closed.getValue()&&k.getClosed(e,t,i,n)},getWeights:(e,t,i)=>k.getWeights(e,t,i),getControlPoints:(e,t,i,n,o)=>k.getControlPoints(e,t,i,n,o),tessellate(){if(this._order.getValue()<2)return[];if(!this.controlPointNode)return[];if(this.controlPointNode.getSize()<this._order.getValue())return[];const e=this.getVertices(),t=[];if(e.length){const i=e.length;for(let n=0;n<i;n+=8)t.push(e[n],e[n+1],e[n+2]);t.push(e[i-4],e[i-3],e[i-2])}return t},build(){if(this._order.getValue()<2)return;if(!this.controlPointNode)return;if(this.controlPointNode.getSize()<this._order.getValue())return;const e=this.getClosed(this._order.getValue(),this._knot,this._weight,this.controlPointNode),t=this.getWeights(this.weights,this.controlPointNode.getSize(),this._weight),i=this.getControlPoints(this.controlPoints,e,this._order.getValue(),t,this.controlPointNode),n=this.getKnots(this.knots,e,this._order.getValue(),this.controlPointNode.getSize(),this._knot),o=(n.at(-1),n[0],this._order.getValue()-1),s=this.surface=(this.surface||ke)({boundary:["open"],degree:[o],knots:[n],points:i,debug:!1});this.sampleOptions.resolution[0]=this.getTessellation(n.length),this.sampleOptions.haveWeights=!!t;const r=ke.sample(this.mesh,s,this.sampleOptions).points,l=this.getVertices();for(let e=3,t=r.length;e<t;e+=3){const t=e-3;l.push(r[t],r[t+1],r[t+2],1),l.push(r[e],r[e+1],r[e+2],1)}},dispose(){X.prototype.dispose.call(this)}}),Object.defineProperties(Ae,{typeName:{value:"NurbsCurve",enumerable:!0},componentInfo:{value:Object.freeze({name:"NURBS",level:1}),enumerable:!0},containerField:{value:"geometry",enumerable:!0},specificationRange:{value:Object.freeze({from:"3.0",to:"Infinity"}),enumerable:!0},fieldDefinitions:{value:new(a())([new(r())(c().inputOutput,"metadata",new(o().SFNode)),new(r())(c().inputOutput,"tessellation",new(o().SFInt32)),new(r())(c().initializeOnly,"closed",new(o().SFBool)),new(r())(c().initializeOnly,"order",new(o().SFInt32)(3)),new(r())(c().initializeOnly,"knot",new(o().MFDouble)),new(r())(c().inputOutput,"weight",new(o().MFDouble)),new(r())(c().inputOutput,"controlPoint",new(o().SFNode))]),enumerable:!0}});const Be=Ae;f().add("NurbsCurve","x_ite/Components/NURBS/NurbsCurve",Be);const Xe=Be;function Ee(e){C.call(this,e),this.addType(c().NurbsCurve2D),this.knots=[],this.weights=[],this.controlPoints=[],this.mesh={},this.sampleOptions={resolution:[]},this.array=[]}Object.assign(Object.setPrototypeOf(Ee.prototype,C.prototype),{getTessellation(e){return k.getTessellation(this._tessellation.getValue(),e-this._order.getValue())},getClosed(e,t,i,n){return!!this._closed.getValue()&&k.getClosed2D(e,t,i,n)},getKnots:(e,t,i,n,o)=>k.getKnots(e,t,i,n,o),getWeights:(e,t,i)=>k.getWeights(e,t,i),getControlPoints:(e,t,i,n,o)=>k.getControlPoints2D(e,t,i,n,o),tessellate(e){const t=this.array;if(t.length=0,this._order.getValue()<2)return t;if(this._controlPoint.length<this._order.getValue())return t;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=(s.at(-1),s[0],this._order.getValue()-1),l=this.surface=(this.surface||ke)({boundary:["open"],degree:[r],knots:[s],points:o,debug:!1});this.sampleOptions.resolution[0]=this.getTessellation(s.length),this.sampleOptions.haveWeights=!!n;const a=ke.sample(this.mesh,l,this.sampleOptions).points;switch(e){case 0:for(let e=0,i=a.length;e<i;e+=2)t.push(a[e],a[e+1]);break;case 1:for(let e=0,i=a.length;e<i;e+=2)t.push(a[e],0,a[e+1]);break;case 2:for(let e=0,i=a.length;e<i;e+=2)t.push(new(S())(a[e],a[e+1],0))}return t}}),Object.defineProperties(Ee,{typeName:{value:"NurbsCurve2D",enumerable:!0},componentInfo:{value:Object.freeze({name:"NURBS",level:3}),enumerable:!0},containerField:{value:"children",enumerable:!0},specificationRange:{value:Object.freeze({from:"3.0",to:"Infinity"}),enumerable:!0},fieldDefinitions:{value:new(a())([new(r())(c().inputOutput,"metadata",new(o().SFNode)),new(r())(c().inputOutput,"tessellation",new(o().SFInt32)),new(r())(c().initializeOnly,"closed",new(o().SFBool)),new(r())(c().initializeOnly,"order",new(o().SFInt32)(3)),new(r())(c().initializeOnly,"knot",new(o().MFDouble)),new(r())(c().inputOutput,"weight",new(o().MFDouble)),new(r())(c().inputOutput,"controlPoint",new(o().MFVec2d))]),enumerable:!0}});const Ue=Ee;f().add("NurbsCurve2D","x_ite/Components/NURBS/NurbsCurve2D",Ue);const qe=Ue,Ke=window[Symbol.for("X_ITE.X3D-10.2.0")].require("x_ite/Components/Core/X3DChildNode");var Me=e.n(Ke);const Ge=window[Symbol.for("X_ITE.X3D-10.2.0")].require("x_ite/Components/Interpolation/OrientationInterpolator");var We=e.n(Ge);const Ye=window[Symbol.for("X_ITE.X3D-10.2.0")].require("standard/Math/Numbers/Rotation4");var Je=e.n(Ye);function Le(e){Me().call(this,e),this.addType(c().NurbsOrientationInterpolator),this.addChildObjects(c().inputOutput,"rebuild",new(o().SFTime)),this.interpolator=new(We())(e),this.knots=[],this.weights=[],this.controlPoints=[],this.mesh={},this.sampleOptions={resolution:[128]}}Object.assign(Object.setPrototypeOf(Le.prototype,Me().prototype),{initialize(){Me().prototype.initialize.call(this),this._order.addInterest("requestRebuild",this),this._knot.addInterest("requestRebuild",this),this._weight.addInterest("requestRebuild",this),this._controlPoint.addInterest("set_controlPoint__",this),this._rebuild.addInterest("build",this),this._set_fraction.addFieldInterest(this.interpolator._set_fraction),this.interpolator._value_changed.addFieldInterest(this._value_changed),this.interpolator.setup(),this.set_controlPoint__()},set_controlPoint__(){this.controlPointNode&&this.controlPointNode.removeInterest("requestRebuild",this),this.controlPointNode=g()(c().X3DCoordinateNode,this._controlPoint),this.controlPointNode&&this.controlPointNode.addInterest("requestRebuild",this),this.requestRebuild()},getClosed:(e,t,i,n)=>!1,getKnots:(e,t,i,n,o)=>k.getKnots(e,t,i,n,o),getWeights:(e,t,i)=>k.getWeights(e,t,i),getControlPoints:(e,t,i,n,o)=>k.getControlPoints(e,t,i,n,o),requestRebuild(){this._rebuild.addEvent()},build(){if(this._order.getValue()<2)return;if(!this.controlPointNode)return;if(this.controlPointNode.getSize()<this._order.getValue())return;const e=this.getClosed(this._order.getValue(),this._knot,this._weight,this.controlPointNode),t=this.getWeights(this.weights,this.controlPointNode.getSize(),this._weight),i=this.getControlPoints(this.controlPoints,e,this._order.getValue(),t,this.controlPointNode),n=this.getKnots(this.knots,e,this._order.getValue(),this.controlPointNode.getSize(),this._knot),o=n.at(-1)-n[0],s=this._order.getValue()-1,r=this.surface=(this.surface||ke)({boundary:["open"],degree:[s],knots:[n],points:i,debug:!1});this.sampleOptions.haveWeights=!!t;const l=ke.sample(this.mesh,r,this.sampleOptions).points,a=this.interpolator;a._key.length=0,a._keyValue.length=0;for(let t=0,i=l.length-3;t<i;t+=3){const s=new(S())(l[t+3]-l[t+0],l[t+4]-l[t+1],l[t+5]-l[t+2]);a._key.push(n[0]+t/(i-3+3*e)*o),a._keyValue.push(new(Je())(S().zAxis,s))}e&&(a._key.push(n[0]+o),a._keyValue.push(a._keyValue[0]))}}),Object.defineProperties(Le,{typeName:{value:"NurbsOrientationInterpolator",enumerable:!0},componentInfo:{value:Object.freeze({name:"NURBS",level:1}),enumerable:!0},containerField:{value:"children",enumerable:!0},specificationRange:{value:Object.freeze({from:"3.0",to:"Infinity"}),enumerable:!0},fieldDefinitions:{value:new(a())([new(r())(c().inputOutput,"metadata",new(o().SFNode)),new(r())(c().inputOnly,"set_fraction",new(o().SFFloat)),new(r())(c().inputOutput,"order",new(o().SFInt32)(3)),new(r())(c().inputOutput,"knot",new(o().MFDouble)),new(r())(c().inputOutput,"weight",new(o().MFDouble)),new(r())(c().inputOutput,"controlPoint",new(o().SFNode)),new(r())(c().outputOnly,"value_changed",new(o().SFRotation))]),enumerable:!0}});const Ze=Le;f().add("NurbsOrientationInterpolator","x_ite/Components/NURBS/NurbsOrientationInterpolator",Ze);const He=Ze,Qe=window[Symbol.for("X_ITE.X3D-10.2.0")].require("standard/Math/Algorithm");var $e=e.n(Qe);const et=window[Symbol.for("X_ITE.X3D-10.2.0")].require("standard/Math/Geometry/Triangle3");var tt=e.n(et);function it(e){X.call(this,e),this.addType(c().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(it.prototype,X.prototype),{initialize(){X.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=g()(c().X3DTextureCoordinateNode,this._texCoord),this.nurbsTexCoordNode=g()(c().NurbsTextureCoordinate,this._texCoord),this.texCoordNode?.addInterest("requestRebuild",this),this.nurbsTexCoordNode?.addInterest("requestRebuild",this)},set_controlPoint__(){this.controlPointNode&&this.controlPointNode.removeInterest("requestRebuild",this),this.controlPointNode=g()(c().X3DCoordinateNode,this._controlPoint),this.controlPointNode&&this.controlPointNode.addInterest("requestRebuild",this)},setTessellationScale(e){this.tessellationScale=e,this.requestRebuild()},getUTessellation(e){return Math.floor(k.getTessellation(this._uTessellation.getValue(),e-this._uOrder.getValue())*this.tessellationScale)},getVTessellation(e){return Math.floor(k.getTessellation(this._vTessellation.getValue(),e-this._vOrder.getValue())*this.tessellationScale)},getUClosed(e,t,i,n,o,s){return!!this._uClosed.getValue()&&k.getUClosed(e,t,i,n,o,s)},getVClosed(e,t,i,n,o,s){return!!this._vClosed.getValue()&&k.getVClosed(e,t,i,n,o,s)},getUVWeights:(e,t,i,n)=>k.getUVWeights(e,t,i,n),getTexControlPoints:(e,t,i,n,o,s,r,l)=>k.getTexControlPoints(e,t,i,n,o,s,r,l),getUVControlPoints:(e,t,i,n,o,s,r,l,a)=>k.getUVControlPoints(e,t,i,n,o,s,r,l,a),getTrimmingContours(){},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 e=this.getUClosed(this._uOrder.getValue(),this._uDimension.getValue(),this._vDimension.getValue(),this._uKnot,this._weight,this.controlPointNode),t=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,e,t,this._uOrder.getValue(),this._vOrder.getValue(),this._uDimension.getValue(),this._vDimension.getValue(),i,this.controlPointNode),o=this.getKnots(this.uKnots,e,this._uOrder.getValue(),this._uDimension.getValue(),this._uKnot),s=this.getKnots(this.vKnots,t,this._vOrder.getValue(),this._vDimension.getValue(),this._vKnot),r=(o.at(-1),o[0],s.at(-1),s[0],this._uOrder.getValue()-1),l=this._vOrder.getValue()-1,a=this.surface=(this.surface||ke)({boundary:["open","open"],degree:[r,l],knots:[o,s],points:n,debug:!1}),u=this.sampleOptions;u.resolution[0]=this.getUTessellation(o.length),u.resolution[1]=this.getVTessellation(s.length),u.closed[0]=e,u.closed[1]=t,u.domain=void 0,u.haveWeights=!!i,u.trimmingContours=this.getTrimmingContours();const h=ke.sample(this.mesh,a,u),d=h.faces,c=h.points,p=this.getVertices();for(let e=0,t=d.length;e<t;++e){const t=3*d[e];p.push(c[t],c[t+1],c[t+2],1)}this.buildNurbsTexCoords(e,t,this._uOrder.getValue(),this._vOrder.getValue(),o,s,this._uDimension.getValue(),this._vDimension.getValue(),a.domain),this.generateNormals(d,c),this.setSolid(this._solid.getValue()),this.setCCW(!0)},buildNurbsTexCoords:(()=>{const e=[],t=[],i=[[[0,0,0,1],[0,1,0,1]],[[1,0,0,1],[1,1,0,1]]];function n(e,t){return e[0]=e[1]=t[0],e[2]=e[3]=t.at(-1),e}return function(o,s,r,l,a,u,h,d,c){const p=this.sampleOptions;if(this.texCoordNode&&this.texCoordNode.getSize()===h*d)var g=r-1,m=l-1,f=a,_=u,b=this.getTexControlPoints(this.texControlPoints,o,s,r,l,h,d,this.texCoordNode);else if(this.nurbsTexCoordNode&&this.nurbsTexCoordNode.isValid()){var v=this.nurbsTexCoordNode,w=(g=v._uOrder.getValue()-1,m=v._vOrder.getValue()-1,f=this.getKnots(this.texUKnots,!1,v._uOrder.getValue(),v._uDimension.getValue(),v._uKnot),_=this.getKnots(this.texVKnots,!1,v._vOrder.getValue(),v._vDimension.getValue(),v._vKnot),this.getUVWeights(this.texWeights,v._uDimension.getValue(),v._vDimension.getValue(),v._weight));b=v.getControlPoints(w)}else{g=1,m=1,f=n(e,a),_=n(t,u),b=i;p.domain=c}const y=this.texSurface=(this.texSurface||ke)({boundary:["open","open"],degree:[g,m],knots:[f,_],points:b});p.closed[0]=!1,p.closed[1]=!1,p.haveWeights=!1;const N=ke.sample(this.texMesh,y,p),C=N.faces,O=N.points,S=this.getTexCoords();for(let e=0,t=C.length;e<t;++e){const t=4*C[e];S.push(O[t],O[t+1],O[t+2],O[t+3])}this.getMultiTexCoords().push(this.getTexCoords())}})(),generateNormals(e,t){const i=this.createNormals(e,t),n=this.getNormals();for(const e of i)n.push(e.x,e.y,e.z)},createNormals(e,t){const i=new Map,n=this.createFaceNormals(e,t),o=e.length;for(let t=0;t<o;++t){const n=e[t];let o=i.get(n);o||i.set(n,o=[]),o.push(t)}return this.refineNormals(i,n,$e().radians(85))},createFaceNormals:(()=>{const e=new(S()),t=new(S()),i=new(S());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],u=3*n[l+2];e.set(o[r],o[r+1],o[r+2]),t.set(o[a],o[a+1],o[a+2]),i.set(o[u],o[u+1],o[u+2]);const h=tt().normal(e,t,i,s[l]||new(S()));s[l]=h,s[l+1]=h,s[l+2]=h}return s.length=r,s}})()}),Object.defineProperties(it,{typeName:{value:"X3DNurbsSurfaceGeometryNode",enumerable:!0},componentInfo:{value:Object.freeze({name:"NURBS",level:1}),enumerable:!0}});const nt=it;f().add("X3DNurbsSurfaceGeometryNode","x_ite/Components/NURBS/X3DNurbsSurfaceGeometryNode",nt);const ot=nt;function st(e){ot.call(this,e),this.addType(c().NurbsPatchSurface)}Object.setPrototypeOf(st.prototype,ot.prototype),Object.defineProperties(st,{typeName:{value:"NurbsPatchSurface",enumerable:!0},componentInfo:{value:Object.freeze({name:"NURBS",level:1}),enumerable:!0},containerField:{value:"geometry",enumerable:!0},specificationRange:{value:Object.freeze({from:"3.0",to:"Infinity"}),enumerable:!0},fieldDefinitions:{value:new(a())([new(r())(c().inputOutput,"metadata",new(o().SFNode)),new(r())(c().inputOutput,"uTessellation",new(o().SFInt32)),new(r())(c().inputOutput,"vTessellation",new(o().SFInt32)),new(r())(c().initializeOnly,"solid",new(o().SFBool)(!0)),new(r())(c().initializeOnly,"uClosed",new(o().SFBool)),new(r())(c().initializeOnly,"vClosed",new(o().SFBool)),new(r())(c().initializeOnly,"uOrder",new(o().SFInt32)(3)),new(r())(c().initializeOnly,"vOrder",new(o().SFInt32)(3)),new(r())(c().initializeOnly,"uDimension",new(o().SFInt32)),new(r())(c().initializeOnly,"vDimension",new(o().SFInt32)),new(r())(c().initializeOnly,"uKnot",new(o().MFDouble)),new(r())(c().initializeOnly,"vKnot",new(o().MFDouble)),new(r())(c().inputOutput,"weight",new(o().MFDouble)),new(r())(c().inputOutput,"texCoord",new(o().SFNode)),new(r())(c().inputOutput,"controlPoint",new(o().SFNode))]),enumerable:!0}});const rt=st;f().add("NurbsPatchSurface","x_ite/Components/NURBS/NurbsPatchSurface",rt);const lt=rt,at=window[Symbol.for("X_ITE.X3D-10.2.0")].require("x_ite/Components/Interpolation/PositionInterpolator");var ut=e.n(at);function ht(e){Me().call(this,e),this.addType(c().NurbsPositionInterpolator),this.addChildObjects(c().inputOutput,"rebuild",new(o().SFTime)),this.interpolator=new(ut())(e),this.knots=[],this.weights=[],this.controlPoints=[],this.mesh={},this.sampleOptions={resolution:[128]}}Object.assign(Object.setPrototypeOf(ht.prototype,Me().prototype),{initialize(){Me().prototype.initialize.call(this),this._order.addInterest("requestRebuild",this),this._knot.addInterest("requestRebuild",this),this._weight.addInterest("requestRebuild",this),this._controlPoint.addInterest("set_controlPoint__",this),this._rebuild.addInterest("build",this),this._set_fraction.addFieldInterest(this.interpolator._set_fraction),this.interpolator._value_changed.addFieldInterest(this._value_changed),this.interpolator.setup(),this.set_controlPoint__()},set_controlPoint__(){this.controlPointNode&&this.controlPointNode.removeInterest("requestRebuild",this),this.controlPointNode=g()(c().X3DCoordinateNode,this._controlPoint),this.controlPointNode&&this.controlPointNode.addInterest("requestRebuild",this),this.requestRebuild()},getClosed:(e,t,i,n)=>!1,getKnots:(e,t,i,n,o)=>k.getKnots(e,t,i,n,o),getWeights:(e,t,i)=>k.getWeights(e,t,i),getControlPoints:(e,t,i,n,o)=>k.getControlPoints(e,t,i,n,o),requestRebuild(){this._rebuild.addEvent()},build(){if(this._order.getValue()<2)return;if(!this.controlPointNode)return;if(this.controlPointNode.getSize()<this._order.getValue())return;const e=this.getClosed(this._order.getValue(),this._knot,this._weight,this.controlPointNode),t=this.getWeights(this.weights,this.controlPointNode.getSize(),this._weight),i=this.getControlPoints(this.controlPoints,e,this._order.getValue(),t,this.controlPointNode),n=this.getKnots(this.knots,e,this._order.getValue(),this.controlPointNode.getSize(),this._knot),s=n.at(-1)-n[0],r=this._order.getValue()-1,l=this.surface=(this.surface||ke)({boundary:["open"],degree:[r],knots:[n],points:i,debug:!1});this.sampleOptions.haveWeights=!!t;const a=ke.sample(this.mesh,l,this.sampleOptions).points,u=this.interpolator;u._key.length=0,u._keyValue.length=0;for(let e=0,t=a.length;e<t;e+=3)u._key.push(n[0]+e/(t-3)*s),u._keyValue.push(new(o().SFVec3f)(a[e],a[e+1],a[e+2]))}}),Object.defineProperties(ht,{typeName:{value:"NurbsPositionInterpolator",enumerable:!0},componentInfo:{value:Object.freeze({name:"NURBS",level:1}),enumerable:!0},containerField:{value:"children",enumerable:!0},specificationRange:{value:Object.freeze({from:"3.0",to:"Infinity"}),enumerable:!0},fieldDefinitions:{value:new(a())([new(r())(c().inputOutput,"metadata",new(o().SFNode)),new(r())(c().inputOnly,"set_fraction",new(o().SFFloat)),new(r())(c().inputOutput,"order",new(o().SFInt32)(3)),new(r())(c().inputOutput,"knot",new(o().MFDouble)),new(r())(c().inputOutput,"weight",new(o().MFDouble)),new(r())(c().inputOutput,"controlPoint",new(o().SFNode)),new(r())(c().outputOnly,"value_changed",new(o().SFVec3f))]),enumerable:!0}});const dt=ht;f().add("NurbsPositionInterpolator","x_ite/Components/NURBS/NurbsPositionInterpolator",dt);const ct=dt,pt=window[Symbol.for("X_ITE.X3D-10.2.0")].require("x_ite/Components/Grouping/X3DBoundedObject");var gt=e.n(pt);function mt(e){Me().call(this,e),gt().call(this,e),this.addType(c().NurbsSet),this.geometryNodes=[]}function ft(e,t){const i=new Set(t);return e.filter((e=>!i.has(e)))}Object.assign(Object.setPrototypeOf(mt.prototype,Me().prototype),gt().prototype,{initialize(){Me().prototype.initialize.call(this),gt().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(e,t){for(const t of this.geometryNodes)e.add(t.getBBox());return e},set_tessellationScale__(){const e=Math.max(0,this._tessellationScale.getValue());for(const t of this.geometryNodes)t.setTessellationScale(e)},set_addGeometry__(){this._addGeometry.setTainted(!0),this._addGeometry.assign(ft(this._addGeometry,this._geometry));for(const e of this._addGeometry)this._geometry.push(e);this._addGeometry.length=0,this._addGeometry.setTainted(!1)},set_removeGeometry__(){this._removeGeometry.setTainted(!0),this._geometry.assign(ft(this._geometry,this._removeGeometry)),this._removeGeometry.length=0,this._removeGeometry.setTainted(!1)},set_geometry__(){for(const e of this.geometryNodes)e.setTessellationScale(1);this.geometryNodes.length=0;for(const e of this._geometry){const t=g()(c().X3DNurbsSurfaceGeometryNode,e);t&&this.geometryNodes.push(t)}this.set_tessellationScale__()},dispose(){gt().prototype.dispose.call(this),Me().prototype.dispose.call(this)}}),Object.defineProperties(mt,{typeName:{value:"NurbsSet",enumerable:!0},componentInfo:{value:Object.freeze({name:"NURBS",level:2}),enumerable:!0},containerField:{value:"children",enumerable:!0},specificationRange:{value:Object.freeze({from:"3.0",to:"Infinity"}),enumerable:!0},fieldDefinitions:{value:new(a())([new(r())(c().inputOutput,"metadata",new(o().SFNode)),new(r())(c().inputOutput,"tessellationScale",new(o().SFFloat)(1)),new(r())(c().inputOutput,"visible",new(o().SFBool)(!0)),new(r())(c().inputOutput,"bboxDisplay",new(o().SFBool)),new(r())(c().initializeOnly,"bboxSize",new(o().SFVec3f)(-1,-1,-1)),new(r())(c().initializeOnly,"bboxCenter",new(o().SFVec3f)),new(r())(c().inputOnly,"addGeometry",new(o().MFNode)),new(r())(c().inputOnly,"removeGeometry",new(o().MFNode)),new(r())(c().inputOutput,"geometry",new(o().MFNode))]),enumerable:!0}});const _t=mt;f().add("NurbsSet","x_ite/Components/NURBS/NurbsSet",_t);const bt=_t,vt=window[Symbol.for("X_ITE.X3D-10.2.0")].require("standard/Math/Geometry/Line3");var wt=e.n(vt);const yt={isPointInTriangle(e,t,i,n){const o=(t.y-i.y)*(e.x-i.x)+(i.x-t.x)*(e.y-i.y);if(0==o)return!1;const s=((t.y-i.y)*(n.x-i.x)+(i.x-t.x)*(n.y-i.y))/o;if(s<0||s>1)return!1;const r=((i.y-e.y)*(n.x-i.x)+(e.x-i.x)*(n.y-i.y))/o;if(r<0||r>1)return!1;const l=1-s-r;return!(l<0||l>1)}};f().add("Triangle2","standard/Math/Geometry/Triangle2",yt);const Nt=yt;function Ct(e){Me().call(this,e),this.addType(c().NurbsSurfaceInterpolator),this.geometry=new lt(e)}Object.assign(Object.setPrototypeOf(Ct.prototype,Me().prototype),{initialize(){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=128,this.geometry._vTessellation=128,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.setup()},set_fraction__:(()=>{const e=new(S()),t=new(S()),i=new(S()),n=new(S()),o=new(wt())(S().Zero,S().zAxis),s={};return function(){const r=this._set_fraction.getValue(),l=this.geometry.getTexCoords(),a=this.geometry.getNormals(),u=this.geometry.getVertices();for(let h=0,d=0,c=l.length;h<c;h+=12,d+=9)if(e.set(l[h+0],l[h+1],0),t.set(l[h+4],l[h+5],0),i.set(l[h+7],l[h+9],0),Nt.isPointInTriangle(e,t,i,r)&&(o.set(n.set(r.x,r.y,0),S().zAxis),o.intersectsTriangle(e,t,i,s))){const e=s.u,t=s.v,i=s.t,n=new(S())(i*a[d+0]+e*a[d+3]+t*a[d+6],i*a[d+1]+e*a[d+4]+t*a[d+7],i*a[d+2]+e*a[d+5]+t*a[d+8]),o=new(S())(i*u[h+0]+e*u[h+4]+t*u[h+8],i*u[h+1]+e*u[h+5]+t*u[h+9],i*u[h+2]+e*u[h+6]+t*u[h+10]);this._normal_changed=n,this._position_changed=o}}})()}),Object.defineProperties(Ct,{typeName:{value:"NurbsSurfaceInterpolator",enumerable:!0},componentInfo:{value:Object.freeze({name:"NURBS",level:1}),enumerable:!0},containerField:{value:"children",enumerable:!0},specificationRange:{value:Object.freeze({from:"3.0",to:"Infinity"}),enumerable:!0},fieldDefinitions:{value:new(a())([new(r())(c().inputOutput,"metadata",new(o().SFNode)),new(r())(c().inputOnly,"set_fraction",new(o().SFVec2f)),new(r())(c().initializeOnly,"uOrder",new(o().SFInt32)(3)),new(r())(c().initializeOnly,"vOrder",new(o().SFInt32)(3)),new(r())(c().initializeOnly,"uDimension",new(o().SFInt32)),new(r())(c().initializeOnly,"vDimension",new(o().SFInt32)),new(r())(c().initializeOnly,"uKnot",new(o().MFDouble)),new(r())(c().initializeOnly,"vKnot",new(o().MFDouble)),new(r())(c().inputOutput,"weight",new(o().MFDouble)),new(r())(c().inputOutput,"controlPoint",new(o().SFNode)),new(r())(c().outputOnly,"normal_changed",new(o().SFVec3f)),new(r())(c().outputOnly,"position_changed",new(o().SFVec3f))]),enumerable:!0}});const Ot=Ct;f().add("NurbsSurfaceInterpolator","x_ite/Components/NURBS/NurbsSurfaceInterpolator",Ot);const St=Ot,Pt=window[Symbol.for("X_ITE.X3D-10.2.0")].require("x_ite/Components/Geometry3D/Extrusion");var Dt=e.n(Pt);function It(e){X.call(this,e),this.addType(c().NurbsSweptSurface),this.extrusion=new(Dt())(e)}Object.assign(Object.setPrototypeOf(It.prototype,X.prototype),{initialize(){X.prototype.initialize.call(this),this._crossSectionCurve.addInterest("set_crossSectionCurve__",this),this._trajectoryCurve.addInterest("set_trajectoryCurve__",this);const e=this.extrusion;e._beginCap=!1,e._endCap=!1,e._solid=!0,e._ccw=!0,e._convex=!0,e._creaseAngle=Math.PI,e.setup(),e._crossSection.setTainted(!0),e._spine.setTainted(!0),this.set_crossSectionCurve__(),this.set_trajectoryCurve__()},set_crossSectionCurve__(){this.crossSectionCurveNode&&this.crossSectionCurveNode.removeInterest("requestRebuild",this),this.crossSectionCurveNode=g()(c().X3DNurbsControlCurveNode,this._crossSectionCurve),this.crossSectionCurveNode&&this.crossSectionCurveNode.addInterest("requestRebuild",this)},set_trajectoryCurve__(){this.trajectoryCurveNode?._rebuild.removeInterest("requestRebuild",this),this.trajectoryCurveNode=g()(c().NurbsCurve,this._trajectoryCurve),this.trajectoryCurveNode?._rebuild.addInterest("requestRebuild",this)},build(){if(!this.crossSectionCurveNode)return;if(!this.trajectoryCurveNode)return;const e=this.extrusion;if(e._crossSection=this.crossSectionCurveNode.tessellate(0),e._spine=this.trajectoryCurveNode.tessellate(0),e.rebuild(),this.getColors().assign(e.getColors()),this.getTexCoords().assign(e.getTexCoords()),this.getNormals().assign(e.getNormals()),this.getVertices().assign(e.getVertices()),this.getMultiTexCoords().push(this.getTexCoords()),!this._ccw.getValue()){const e=this.getNormals();for(let t=0,i=e.length;t<i;++t)e[t]=-e[t]}this.setSolid(this._solid.getValue()),this.setCCW(this._ccw.getValue())}}),Object.defineProperties(It,{typeName:{value:"NurbsSweptSurface",enumerable:!0},componentInfo:{value:Object.freeze({name:"NURBS",level:3}),enumerable:!0},containerField:{value:"geometry",enumerable:!0},specificationRange:{value:Object.freeze({from:"3.0",to:"Infinity"}),enumerable:!0},fieldDefinitions:{value:new(a())([new(r())(c().inputOutput,"metadata",new(o().SFNode)),new(r())(c().initializeOnly,"solid",new(o().SFBool)(!0)),new(r())(c().initializeOnly,"ccw",new(o().SFBool)(!0)),new(r())(c().inputOutput,"crossSectionCurve",new(o().SFNode)),new(r())(c().inputOutput,"trajectoryCurve",new(o().SFNode))]),enumerable:!0}});const Ft=It;f().add("NurbsSweptSurface","x_ite/Components/NURBS/NurbsSweptSurface",Ft);const Rt=Ft;function zt(e){X.call(this,e),this.addType(c().NurbsSwungSurface),this.extrusion=new(Dt())(e)}Object.assign(Object.setPrototypeOf(zt.prototype,X.prototype),{initialize(){X.prototype.initialize.call(this),this._profileCurve.addInterest("set_profileCurve__",this),this._trajectoryCurve.addInterest("set_trajectoryCurve__",this);const e=this.extrusion;e._beginCap=!1,e._endCap=!1,e._solid=!0,e._ccw=!0,e._convex=!0,e._creaseAngle=Math.PI,e.setup(),e._crossSection.setTainted(!0),e._spine.setTainted(!0),this.set_profileCurve__(),this.set_trajectoryCurve__()},set_profileCurve__(){this.profileCurveNode&&this.profileCurveNode.removeInterest("requestRebuild",this),this.profileCurveNode=g()(c().X3DNurbsControlCurveNode,this._profileCurve),this.profileCurveNode&&this.profileCurveNode.addInterest("requestRebuild",this)},set_trajectoryCurve__(){this.trajectoryCurveNode&&this.trajectoryCurveNode.removeInterest("requestRebuild",this),this.trajectoryCurveNode=g()(c().X3DNurbsControlCurveNode,this._trajectoryCurve),this.trajectoryCurveNode&&this.trajectoryCurveNode.addInterest("requestRebuild",this)},build(){if(!this.profileCurveNode)return;if(!this.trajectoryCurveNode)return;const e=this.extrusion;if(e._crossSection=this.profileCurveNode.tessellate(0),e._spine=this.trajectoryCurveNode.tessellate(1),e.rebuild(),this.getColors().assign(e.getColors()),this.getTexCoords().assign(e.getTexCoords()),this.getNormals().assign(e.getNormals()),this.getVertices().assign(e.getVertices()),this.getMultiTexCoords().push(this.getTexCoords()),!this._ccw.getValue()){const e=this.getNormals();for(let t=0,i=e.length;t<i;++t)e[t]=-e[t]}this.setSolid(this._solid.getValue()),this.setCCW(this._ccw.getValue())}}),Object.defineProperties(zt,{typeName:{value:"NurbsSwungSurface",enumerable:!0},componentInfo:{value:Object.freeze({name:"NURBS",level:3}),enumerable:!0},containerField:{value:"geometry",enumerable:!0},specificationRange:{value:Object.freeze({from:"3.0",to:"Infinity"}),enumerable:!0},fieldDefinitions:{value:new(a())([new(r())(c().inputOutput,"metadata",new(o().SFNode)),new(r())(c().initializeOnly,"solid",new(o().SFBool)(!0)),new(r())(c().initializeOnly,"ccw",new(o().SFBool)(!0)),new(r())(c().inputOutput,"profileCurve",new(o().SFNode)),new(r())(c().inputOutput,"trajectoryCurve",new(o().SFNode))]),enumerable:!0}});const Vt=zt;f().add("NurbsSwungSurface","x_ite/Components/NURBS/NurbsSwungSurface",Vt);const Tt=Vt;function jt(e){h().call(this,e),this.addType(c().NurbsTextureCoordinate),this.controlPoints=[]}Object.assign(Object.setPrototypeOf(jt.prototype,h().prototype),{initialize(){h().prototype.initialize.call(this)},getControlPoints(e){const t=this._controlPoint.getValue(),i=this.controlPoints;for(let n=0,o=this._uDimension.getValue();n<o;++n){let s=i[n];s||(s=i[n]=[]);for(let i=0,r=this._vDimension.getValue();i<r;++i){const r=i*o+n,l=s[i]||new(j()),a=2*r;s[i]=l.set(t[a],t[a+1],0,e?e[r]:1)}}return i},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(jt,{typeName:{value:"NurbsTextureCoordinate",enumerable:!0},componentInfo:{value:Object.freeze({name:"NURBS",level:1}),enumerable:!0},containerField:{value:"texCoord",enumerable:!0},specificationRange:{value:Object.freeze({from:"3.0",to:"Infinity"}),enumerable:!0},fieldDefinitions:{value:new(a())([new(r())(c().inputOutput,"metadata",new(o().SFNode)),new(r())(c().initializeOnly,"uOrder",new(o().SFInt32)(3)),new(r())(c().initializeOnly,"vOrder",new(o().SFInt32)(3)),new(r())(c().initializeOnly,"uDimension",new(o().SFInt32)),new(r())(c().initializeOnly,"vDimension",new(o().SFInt32)),new(r())(c().initializeOnly,"uKnot",new(o().MFDouble)),new(r())(c().initializeOnly,"vKnot",new(o().MFDouble)),new(r())(c().inputOutput,"weight",new(o().MFDouble)),new(r())(c().inputOutput,"controlPoint",new(o().MFVec2f))]),enumerable:!0}});const xt=jt;f().add("NurbsTextureCoordinate","x_ite/Components/NURBS/NurbsTextureCoordinate",xt);const kt=xt;function At(e){ot.call(this,e),this.addType(c().NurbsTrimmedSurface),this.trimmingContourNodes=[]}function Bt(e,t){const i=new Set(t);return e.filter((e=>!i.has(e)))}Object.assign(Object.setPrototypeOf(At.prototype,ot.prototype),{initialize(){ot.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(Bt(this._addTrimmingContour,this._trimmingContour),this._addTrimmingContour.length);for(const e of this._addTrimmingContour)this._trimmingContour.push(e);this._addTrimmingContour.length=0,this._addTrimmingContour.setTainted(!1)},set_removeTrimmingContour__(){this._removeTrimmingContour.setTainted(!0),this._trimmingContour.assign(Bt(this._trimmingContour,this._removeTrimmingContour)),this._removeTrimmingContour.length=0,this._removeTrimmingContour.setTainted(!1)},set_trimmingContour__(){const e=this.trimmingContourNodes;e.length=0;for(const t of this._trimmingContour){const i=g()(c().Contour2D,t);i&&e.push(i)}},getTrimmingContours(){const e=this.trimmingContourNodes,t=[];for(const i of e)i.addTrimmingContour(t);return t}}),Object.defineProperties(At,{typeName:{value:"NurbsTrimmedSurface",enumerable:!0},componentInfo:{value:Object.freeze({name:"NURBS",level:4}),enumerable:!0},containerField:{value:"geometry",enumerable:!0},specificationRange:{value:Object.freeze({from:"3.0",to:"Infinity"}),enumerable:!0},fieldDefinitions:{value:new(a())([new(r())(c().inputOutput,"metadata",new(o().SFNode)),new(r())(c().inputOutput,"uTessellation",new(o().SFInt32)),new(r())(c().inputOutput,"vTessellation",new(o().SFInt32)),new(r())(c().initializeOnly,"solid",new(o().SFBool)(!0)),new(r())(c().initializeOnly,"uClosed",new(o().SFBool)),new(r())(c().initializeOnly,"vClosed",new(o().SFBool)),new(r())(c().initializeOnly,"uOrder",new(o().SFInt32)(3)),new(r())(c().initializeOnly,"vOrder",new(o().SFInt32)(3)),new(r())(c().initializeOnly,"uDimension",new(o().SFInt32)),new(r())(c().initializeOnly,"vDimension",new(o().SFInt32)),new(r())(c().initializeOnly,"uKnot",new(o().MFDouble)),new(r())(c().initializeOnly,"vKnot",new(o().MFDouble)),new(r())(c().inputOutput,"weight",new(o().MFDouble)),new(r())(c().inputOutput,"texCoord",new(o().SFNode)),new(r())(c().inputOutput,"controlPoint",new(o().SFNode)),new(r())(c().inputOnly,"addTrimmingContour",new(o().MFNode)),new(r())(c().inputOnly,"removeTrimmingContour",new(o().MFNode)),new(r())(c().inputOutput,"trimmingContour",new(o().MFNode))]),enumerable:!0}});const Xt=At;f().add("NurbsTrimmedSurface","x_ite/Components/NURBS/NurbsTrimmedSurface",Xt);const Et=Xt;i().add({name:"NURBS",concreteNodes:[w,I,Xe,qe,He,lt,ct,bt,St,Rt,Tt,kt,Et],abstractNodes:[C,ot,X]});const Ut=void 0;f().add("NURBS","assets/components/NURBS",Ut)})();
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
/* X_ITE v10.2.0 */(()=>{"use strict";var e={823:e=>{e.exports=window[Symbol.for("X_ITE.X3D-10.2.0")].require("lib/jquery")}},t={};function i(n){var o=t[n];if(void 0!==o)return o.exports;var r=t[n]={exports:{}};return e[n](r,r.exports,i),r.exports}i.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return i.d(t,{a:t}),t},i.d=(e,t)=>{for(var n in t)i.o(t,n)&&!i.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);const n=window[Symbol.for("X_ITE.X3D-10.2.0")].require("x_ite/Components");var o=i.n(n);const r=window[Symbol.for("X_ITE.X3D-10.2.0")].require("x_ite/Fields");var s=i.n(r);const a=window[Symbol.for("X_ITE.X3D-10.2.0")].require("x_ite/Base/X3DFieldDefinition");var c=i.n(a);const l=window[Symbol.for("X_ITE.X3D-10.2.0")].require("x_ite/Base/FieldDefinitionArray");var d=i.n(l);const u=window[Symbol.for("X_ITE.X3D-10.2.0")].require("x_ite/Components/Core/X3DNode");var h=i.n(u);const m=window[Symbol.for("X_ITE.X3D-10.2.0")].require("x_ite/Browser/ParticleSystems/GeometryTypes");var f=i.n(m);const p=window[Symbol.for("X_ITE.X3D-10.2.0")].require("x_ite/Base/X3DConstants");var _=i.n(p);const x=window[Symbol.for("X_ITE.X3D-10.2.0")].require("x_ite/Namespace");var g=i.n(x);const v="\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.0)return false;float inv_det=1.0/det;vec3 tvec=line.point-a;float u=dot(tvec,pvec)*inv_det;if(u<0.0||u>1.0)return false;vec3 qvec=cross(tvec,edge1);float v=dot(line.direction,qvec)*inv_det;if(v<0.0||u+v>1.0)return false;r=vec3(u,v,1.0-u-v);return true;}\n#endif\n";g().add("Line3.glsl","x_ite/Browser/ParticleSystems/Line3.glsl",v);const y=v,b="\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.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.0/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.0;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";g().add("Plane3.glsl","x_ite/Browser/ParticleSystems/Plane3.glsl",b);const T=b,I="\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,0.0,1.0)),line,intersection)){if(all(greaterThanEqual(vec4(intersection.xy,max.xy),vec4(min.xy,intersection.xy))))return true;}if(intersects(plane3(min,vec3(0.0,0.0,-1.0)),line,intersection)){if(all(greaterThanEqual(vec4(intersection.xy,max.xy),vec4(min.xy,intersection.xy))))return true;}if(intersects(plane3(max,vec3(0.0,1.0,0.0)),line,intersection)){if(all(greaterThanEqual(vec4(intersection.xz,max.xz),vec4(min.xz,intersection.xz))))return true;}if(intersects(plane3(min,vec3(0.0,-1.0,0.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.0,0.0)),line,intersection)){if(all(greaterThanEqual(vec4(intersection.yz,max.yz),vec4(min.yz,intersection.yz))))return true;}return false;}\n#endif\n";g().add("Box3.glsl","x_ite/Browser/ParticleSystems/Box3.glsl",I);const w=I,E="\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.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.0);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.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.0);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";g().add("BVH.glsl","x_ite/Browser/ParticleSystems/BVH.glsl",E);const R=E;function S(e){h().call(this,e),this.addType(_().X3DParticleEmitterNode),this.addChildObjects(_().outputOnly,"bbox_changed",new(s().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(S.prototype,h().prototype),{initialize(){h().prototype.initialize.call(this);const e=this.getBrowser().getContext();e.getVersion()<2||(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("forces"),this.addSampler("boundedVolume"),this.addSampler("colorRamp"),this.addSampler("texCoordRamp"),this.addUniform("speed","uniform float speed;"),this.addUniform("variation","uniform float variation;"),this.addCallback(this.set_speed__),this.addCallback(this.set_variation__),this.addFunction(y),this.addFunction(T),this.addFunction(w),this.addFunction(R),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),o=Math.sin(n);return e.set(Math.sin(t)*o,Math.cos(t)*o,i)},animate(e,t){const i=this.getBrowser().getContext(),n=this.getProgram(e),o=e.inputParticles;if(i.useProgram(n),i.uniform1i(n.randomSeed,4294967295*Math.random()),i.uniform1f(n.particleLifetime,e.particleLifetime),i.uniform1f(n.lifetimeVariation,e.lifetimeVariation),i.uniform1f(n.deltaTime,t),i.uniform2f(n.particleSize,e._particleSize.x,e._particleSize.y),e.numForces&&(i.activeTexture(i.TEXTURE0+n.forcesTextureUnit),i.bindTexture(i.TEXTURE_2D,e.forcesTexture)),e.boundedHierarchyRoot>-1&&(i.uniform1i(n.boundedVerticesIndex,e.boundedVerticesIndex),i.uniform1i(n.boundedNormalsIndex,e.boundedNormalsIndex),i.uniform1i(n.boundedHierarchyIndex,e.boundedHierarchyIndex),i.uniform1i(n.boundedHierarchyRoot,e.boundedHierarchyRoot),i.activeTexture(i.TEXTURE0+n.boundedVolumeTextureUnit),i.bindTexture(i.TEXTURE_2D,e.boundedTexture)),e.numColors&&(i.activeTexture(i.TEXTURE0+n.colorRampTextureUnit),i.bindTexture(i.TEXTURE_2D,e.colorRampTexture)),e.numTexCoords&&(i.uniform1i(n.texCoordCount,e.texCoordCount),i.activeTexture(i.TEXTURE0+n.texCoordRampTextureUnit),i.bindTexture(i.TEXTURE_2D,e.texCoordRampTexture)),this.activateTextures(i,n),o.vertexArrayObject.enable(n)){const{particlesStride:t,particleOffsets:r}=e;for(const[e,s]of n.inputs)i.bindBuffer(i.ARRAY_BUFFER,o),i.enableVertexAttribArray(s),i.vertexAttribPointer(s,4,i.FLOAT,!1,t,r[e])}i.bindFramebuffer(i.FRAMEBUFFER,null),i.bindBuffer(i.ARRAY_BUFFER,null),i.bindTransformFeedback(i.TRANSFORM_FEEDBACK,this.transformFeedback),i.bindBufferBase(i.TRANSFORM_FEEDBACK_BUFFER,0,e.outputParticles),i.enable(i.RASTERIZER_DISCARD),i.beginTransformFeedback(i.POINTS),i.drawArrays(i.POINTS,0,e.numParticles),i.endTransformFeedback(),i.disable(i.RASTERIZER_DISCARD),i.bindTransformFeedback(i.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,o){const r=this.getBrowser().getContext();for(const s of this.programs.values())r.useProgram(s),r[e](s[t],i,n,o)},addCallback(e){this.callbacks.push(e)},addFunction(e){this.functions.push(e)},getProgram(e){const{geometryType:t,createParticles:i,numColors:n,numTexCoords:o,numForces:r,boundedHierarchyRoot:s}=e;let a="";return a+=t,a+=i&&this.on?1:0,a+=".",a+=n,a+=".",a+=o,a+=".",a+=r,a+=".",a+=s,this.programs.get(a)??this.createProgram(a,e)},createProgram(e,t){const i=this.getBrowser(),n=i.getContext(),o=this.defines.slice();o.push(`#define X3D_GEOMETRY_TYPE ${t.geometryType}`),o.push(""+(t.createParticles&&this.on?"#define X3D_CREATE_PARTICLES":"")),o.push(`#define X3D_NUM_COLORS ${t.numColors}`),o.push(`#define X3D_NUM_TEX_COORDS ${t.numTexCoords}`),o.push(`#define X3D_NUM_FORCES ${t.numForces}`),o.push(""+(t.boundedHierarchyRoot>-1?"#define X3D_BOUNDED_VOLUME":""));const r=`#version 300 es\nprecision highp float;precision highp int;precision highp sampler2D;\n${o.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 colorRamp;\n#endif\n#if X3D_NUM_TEX_COORDS>0\nuniform int texCoordCount;uniform sampler2D texCoordRamp;\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(f()).map((([e,t])=>`#define ${e} ${t}`)).join("\n")}\nconst int ARRAY_SIZE=32;const float M_PI=3.14159265359;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;}vec3 save_normalize(const in vec3 vector){float l=length(vector);if(l==0.0)return vec3(0.0);return vector/l;}vec4 Quaternion(const in vec3 fromVector,const in vec3 toVector){vec3 from=save_normalize(fromVector);vec3 to=save_normalize(toVector);float cos_angle=dot(from,to);vec3 cross_vec=cross(from,to);float cross_len=length(cross_vec);if(cross_len==0.0){if(cos_angle>0.0){return vec4(0.0,0.0,0.0,1.0);}else{vec3 t=cross(from,vec3(1.0,0.0,0.0));if(dot(t,t)==0.0)t=cross(from,vec3(0.0,1.0,0.0));t=save_normalize(t);return vec4(t,0.0);}}else{float s=sqrt(abs(1.0-cos_angle)*0.5);cross_vec=save_normalize(cross_vec);return vec4(cross_vec*s,sqrt(abs(1.0+cos_angle)*0.5));}}vec3 multVecQuat(const in vec3 v,const in vec4 q){float a=q.w*q.w-q.x*q.x-q.y*q.y-q.z*q.z;float b=2.0*(v.x*q.x+v.y*q.y+v.z*q.z);float c=2.0*q.w;vec3 r=a*v.xyz+b*q.xyz+c*(q.yzx*v.zxy-q.zxy*v.yzx);return r;}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.0-2.0*(A+B),2.0*(C+D),2.0*(E-F),2.0*(C-D),1.0-2.0*(B+G),2.0*(H+I),2.0*(E+F),2.0*(H-I),1.0-2.0*(A+G));}uint seed=1u;void srand(const in int value){seed=uint(value);}float random(){seed=seed*1103515245u+12345u;return float(seed)/4294967295.0;}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.0,particleLifetime-v);float max_=particleLifetime+v;return getRandomValue(min_,max_);}float getRandomSpeed(){float v=speed*variation;float min_=max(0.0,speed-v);float max_=speed+v;return getRandomValue(min_,max_);}vec3 getRandomNormal(){float theta=getRandomValue(-M_PI,M_PI);float cphi=getRandomValue(-1.0,1.0);float r=sqrt(1.0-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.0);float r=sqrt(1.0-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,0.0,1.0),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.0/3.0);float r=sqrt(1.0-cphi*cphi);vec3 normal=vec3(sin(theta)*r,cos(theta)*r,cphi);vec4 rotation=Quaternion(vec3(0.0,0.0,1.0),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_COLORS>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.0;}else if(fraction>=texelFetch(sampler,count-1,0).x){index0=count-2;index1=count-1;weight=1.0;}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.0,1.0);}else{index0=0;index1=0;weight=0.0;}}}\n#endif\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 defined(X3D_SURFACE_EMITTER)||defined(X3D_VOLUME_EMITTER)\nvec3 getRandomBarycentricCoord(){float u=random();float v=random();if(u+v>1.0){u=1.0-u;v=1.0-v;}float t=1.0-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=save_normalize(r.z*normal0+r.x*normal1+r.y*normal2);}\n#endif\n${this.functions.join("\n")}\n#if X3D_NUM_COLORS>0\nvec4 getColor(const in float lifetime,const in float elapsedTime){float fraction=elapsedTime/lifetime;int index0;int index1;float weight;interpolate(colorRamp,X3D_NUM_COLORS,fraction,index0,index1,weight);vec4 color0=texelFetch(colorRamp,X3D_NUM_COLORS+index0,0);vec4 color1=texelFetch(colorRamp,X3D_NUM_COLORS+index1,0);return mix(color0,color1,weight);}\n#else\n#define getColor(lifetime,elapsedTime)(vec4(1.0))\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,save_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.0,plane1);if(index==-1)return;vec3 point=points[index].xyz;vec3 normal=save_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+save_normalize(velocity)*0.0001,1.0);velocity*=damping;}\n#endif\n#if X3D_NUM_TEX_COORDS>0\nint getTexCoordIndex0(const in float lifetime,const in float elapsedTime){float fraction=elapsedTime/lifetime;int index0=0;interpolate(texCoordRamp,X3D_NUM_TEX_COORDS,fraction,index0);return X3D_NUM_TEX_COORDS+index0*texCoordCount;}\n#else\n#define getTexCoordIndex0(lifetime,elapsedTime)(-1)\n#endif\nvoid main(){int life=int(input0[0]);float lifetime=input0[1];float elapsedTime=input0[2]+deltaTime;srand((gl_VertexID+randomSeed)*randomSeed);if(elapsedTime>lifetime){lifetime=getRandomLifetime();elapsedTime=0.0;output0=vec4(max(life+1,1),lifetime,elapsedTime,getTexCoordIndex0(lifetime,elapsedTime));\n#if defined(X3D_CREATE_PARTICLES)\noutput1=getColor(lifetime,elapsedTime);output2=vec4(getRandomVelocity(),0.0);output6=getRandomPosition();\n#else\noutput1=vec4(0.0);output2=vec4(0.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(lifetime,elapsedTime));output1=getColor(lifetime,elapsedTime);output2=vec4(velocity,0.0);output6=position;}\n#if X3D_GEOMETRY_TYPE==POINT||X3D_GEOMETRY_TYPE==SPRITE||X3D_GEOMETRY_TYPE==GEOMETRY\noutput3=vec4(1.0,0.0,0.0,0.0);output4=vec4(0.0,1.0,0.0,0.0);output5=vec4(0.0,0.0,1.0,0.0);\n#elif X3D_GEOMETRY_TYPE==LINE\nmat3 m=Matrix3(Quaternion(vec3(0.0,0.0,1.0),output2.xyz));output3=vec4(m[0],0.0);output4=vec4(m[1],0.0);output5=vec4(m[2],0.0);\n#else\noutput3=vec4(particleSize.x,0.0,0.0,0.0);output4=vec4(0.0,particleSize.y,0.0,0.0);output5=vec4(0.0,0.0,1.0,0.0);\n#endif\n}`,s=n.createShader(n.VERTEX_SHADER);n.shaderSource(s,r),n.compileShader(s),n.getShaderParameter(s,n.COMPILE_STATUS)||console.error(n.getShaderInfoLog(s));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,s),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.forces=n.getUniformLocation(c,"forces"),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"),c.colorRamp=n.getUniformLocation(c,"colorRamp"),c.texCoordCount=n.getUniformLocation(c,"texCoordCount"),c.texCoordRamp=n.getUniformLocation(c,"texCoordRamp");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.getTexture2DUnit())}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},getTexture2DUnit(e,t,i){const n=t[i];return void 0===n?t[i]=e.getTexture2DUnit():n}}),Object.defineProperties(S,{typeName:{value:"X3DParticleEmitterNode",enumerable:!0},componentInfo:{value:Object.freeze({name:"ParticleSystems",level:1}),enumerable:!0}});const F=S;g().add("X3DParticleEmitterNode","x_ite/Components/ParticleSystems/X3DParticleEmitterNode",F);const O=F,P=window[Symbol.for("X_ITE.X3D-10.2.0")].require("standard/Math/Numbers/Vector3");var A=i.n(P);function N(e){O.call(this,e),this.addType(_().PointEmitter),this._position.setUnit("length")}Object.assign(Object.setPrototypeOf(N.prototype,O.prototype),{initialize(){O.prototype.initialize.call(this),this.getBrowser().getContext().getVersion()<2||(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:function(){const e=new(A());return function(t,{particleLifetime:i,lifetimeVariation:n}){const o=i*(1+n)*(this._speed.getValue()*(1+this._variation.getValue()))*2;return t.set(e.set(o,o,o),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(A());return function(){const{x:t,y:i,z:n}=e.assign(this._direction.getValue()).normalize();this.setUniform("uniform3f","direction",t,i,n)}})()}),Object.defineProperties(N,{typeName:{value:"PointEmitter",enumerable:!0},componentInfo:{value:Object.freeze({name:"ParticleSystems",level:1}),enumerable:!0},containerField:{value:"emitter",enumerable:!0},specificationRange:{value:Object.freeze({from:"3.2",to:"Infinity"}),enumerable:!0},fieldDefinitions:{value:new(d())([new(c())(_().inputOutput,"metadata",new(s().SFNode)),new(c())(_().inputOutput,"on",new(s().SFBool)(!0)),new(c())(_().inputOutput,"position",new(s().SFVec3f)),new(c())(_().inputOutput,"direction",new(s().SFVec3f)(0,1,0)),new(c())(_().inputOutput,"speed",new(s().SFFloat)),new(c())(_().inputOutput,"variation",new(s().SFFloat)(.25)),new(c())(_().inputOutput,"mass",new(s().SFFloat)),new(c())(_().inputOutput,"surfaceArea",new(s().SFFloat))]),enumerable:!0}});const D=N;g().add("PointEmitter","x_ite/Components/ParticleSystems/PointEmitter",D);const C=D,V=Symbol();function B(){}Object.assign(B.prototype,{getDefaultEmitter(){return this[V]=new C(this.getPrivateScene()),this[V].setPrivate(!0),this[V].setup(),this.getDefaultEmitter=function(){return this[V]},Object.defineProperty(this,"getDefaultEmitter",{enumerable:!1}),this[V]}});const M=B;g().add("X3DParticleSystemsContext","x_ite/Browser/ParticleSystems/X3DParticleSystemsContext",M);const U=M;function z(e){h().call(this,e),this.addType(_().X3DParticlePhysicsModelNode)}Object.assign(Object.setPrototypeOf(z.prototype,h().prototype),{addForce(){}}),Object.defineProperties(z,{typeName:{value:"X3DParticlePhysicsModelNode",enumerable:!0},componentInfo:{value:Object.freeze({name:"ParticleSystems",level:1}),enumerable:!0}});const X=z;g().add("X3DParticlePhysicsModelNode","x_ite/Components/ParticleSystems/X3DParticlePhysicsModelNode",X);const L=X,j=window[Symbol.for("X_ITE.X3D-10.2.0")].require("x_ite/Base/X3DCast");var k=i.n(j);function q(e){L.call(this,e),this.addType(_().BoundedPhysicsModel)}Object.assign(Object.setPrototypeOf(q.prototype,L.prototype),{initialize(){L.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=k()(_().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().getValue(),o=this.geometryNode.getVertices().getValue();for(const t of n)e.push(t*i);for(const e of o)t.push(e)}}),Object.defineProperties(q,{typeName:{value:"BoundedPhysicsModel",enumerable:!0},componentInfo:{value:Object.freeze({name:"ParticleSystems",level:2}),enumerable:!0},containerField:{value:"physics",enumerable:!0},specificationRange:{value:Object.freeze({from:"3.2",to:"Infinity"}),enumerable:!0},fieldDefinitions:{value:new(d())([new(c())(_().inputOutput,"metadata",new(s().SFNode)),new(c())(_().inputOutput,"enabled",new(s().SFBool)(!0)),new(c())(_().inputOutput,"damping",new(s().SFFloat)(1)),new(c())(_().inputOutput,"geometry",new(s().SFNode))]),enumerable:!0}});const G=q;g().add("BoundedPhysicsModel","x_ite/Components/ParticleSystems/BoundedPhysicsModel",G);const H=G;function Y(e){O.call(this,e),this.addType(_().ConeEmitter),this._position.setUnit("length"),this._angle.setUnit("angle")}Object.assign(Object.setPrototypeOf(Y.prototype,O.prototype),{initialize(){O.prototype.initialize.call(this),this.getBrowser().getContext().getVersion()<2||(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:function(){const e=new(A());return function(t,{particleLifetime:i,lifetimeVariation:n}){const o=i*(1+n)*(this._speed.getValue()*(1+this._variation.getValue()))*2;return t.set(e.set(o,o,o),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(Y,{typeName:{value:"ConeEmitter",enumerable:!0},componentInfo:{value:Object.freeze({name:"ParticleSystems",level:1}),enumerable:!0},containerField:{value:"emitter",enumerable:!0},specificationRange:{value:Object.freeze({from:"3.2",to:"Infinity"}),enumerable:!0},fieldDefinitions:{value:new(d())([new(c())(_().inputOutput,"metadata",new(s().SFNode)),new(c())(_().inputOutput,"on",new(s().SFBool)(!0)),new(c())(_().inputOutput,"position",new(s().SFVec3f)),new(c())(_().inputOutput,"direction",new(s().SFVec3f)(0,1,0)),new(c())(_().inputOutput,"angle",new(s().SFFloat)(.785398)),new(c())(_().inputOutput,"speed",new(s().SFFloat)),new(c())(_().inputOutput,"variation",new(s().SFFloat)(.25)),new(c())(_().inputOutput,"mass",new(s().SFFloat)),new(c())(_().inputOutput,"surfaceArea",new(s().SFFloat))]),enumerable:!0}});const W=Y;g().add("ConeEmitter","x_ite/Components/ParticleSystems/ConeEmitter",W);const K=W;function Z(e){O.call(this,e),this.addType(_().ExplosionEmitter),this._position.setUnit("length")}Object.assign(Object.setPrototypeOf(Z.prototype,O.prototype),{initialize(){O.prototype.initialize.call(this),this.getBrowser().getContext().getVersion()<2||(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:function(){const e=new(A());return function(t,{particleLifetime:i,lifetimeVariation:n}){const o=i*(1+n)*(this._speed.getValue()*(1+this._variation.getValue()))*2;return t.set(e.set(o,o,o),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(Z,{typeName:{value:"ExplosionEmitter",enumerable:!0},componentInfo:{value:Object.freeze({name:"ParticleSystems",level:1}),enumerable:!0},containerField:{value:"emitter",enumerable:!0},specificationRange:{value:Object.freeze({from:"3.2",to:"Infinity"}),enumerable:!0},fieldDefinitions:{value:new(d())([new(c())(_().inputOutput,"metadata",new(s().SFNode)),new(c())(_().inputOutput,"on",new(s().SFBool)(!0)),new(c())(_().inputOutput,"position",new(s().SFVec3f)),new(c())(_().inputOutput,"speed",new(s().SFFloat)),new(c())(_().inputOutput,"variation",new(s().SFFloat)(.25)),new(c())(_().inputOutput,"mass",new(s().SFFloat)),new(c())(_().inputOutput,"surfaceArea",new(s().SFFloat))]),enumerable:!0}});const Q=Z;g().add("ExplosionEmitter","x_ite/Components/ParticleSystems/ExplosionEmitter",Q);const $=Q;function J(e){L.call(this,e),this.addType(_().ForcePhysicsModel),this._force.setUnit("force")}Object.assign(Object.setPrototypeOf(J.prototype,L.prototype),{addForce:(()=>{const e=new(A());return function(t,i,n,o){return!!this._enabled.getValue()&&(o.set(e.assign(this._force.getValue()).multiply(n),4*t),o[4*t+3]=0,!0)}})()}),Object.defineProperties(J,{typeName:{value:"ForcePhysicsModel",enumerable:!0},componentInfo:{value:Object.freeze({name:"ParticleSystems",level:1}),enumerable:!0},containerField:{value:"physics",enumerable:!0},specificationRange:{value:Object.freeze({from:"3.2",to:"Infinity"}),enumerable:!0},fieldDefinitions:{value:new(d())([new(c())(_().inputOutput,"metadata",new(s().SFNode)),new(c())(_().inputOutput,"enabled",new(s().SFBool)(!0)),new(c())(_().inputOutput,"force",new(s().SFVec3f)(0,-9.8,0))]),enumerable:!0}});const ee=J;g().add("ForcePhysicsModel","x_ite/Components/ParticleSystems/ForcePhysicsModel",ee);const te=ee,ie=window[Symbol.for("X_ITE.X3D-10.2.0")].require("x_ite/Components/Shape/X3DShapeNode");var ne=i.n(ie);const oe=window[Symbol.for("X_ITE.X3D-10.2.0")].require("x_ite/Browser/Rendering/GeometryContext");var re=i.n(oe);const se=window[Symbol.for("X_ITE.X3D-10.2.0")].require("x_ite/Rendering/VertexArray");var ae=i.n(se);const ce=window[Symbol.for("X_ITE.X3D-10.2.0")].require("x_ite/Rendering/TraverseType");var le=i.n(ce);const de=window[Symbol.for("X_ITE.X3D-10.2.0")].require("x_ite/Browser/Shape/AlphaMode");var ue=i.n(de);const he=window[Symbol.for("X_ITE.X3D-10.2.0")].require("x_ite/Components/Rendering/LineSet");var me=i.n(he);const fe=window[Symbol.for("X_ITE.X3D-10.2.0")].require("x_ite/Components/Rendering/Coordinate");var pe=i.n(fe);const _e=window[Symbol.for("X_ITE.X3D-10.2.0")].require("standard/Math/Numbers/Matrix4");var xe=i.n(_e);const ge=window[Symbol.for("X_ITE.X3D-10.2.0")].require("standard/Math/Numbers/Matrix3");var ve=i.n(ge);const ye=window[Symbol.for("X_ITE.X3D-10.2.0")].require("standard/Math/Geometry/Plane3");var be=i.n(ye);function Te(e,t){this.array=e,t&&(this.compare=t)}Object.assign(Te.prototype,{compare:(e,t)=>e<t,sort(e,t){t-e>1&&this.quicksort(e,t-1)},quicksort(e,t){let i=e,n=t;const{array:o,compare:r}=this,s=o[e+t>>>1];for(;;){for(;r(o[i],s);)++i;for(;r(s,o[n]);)--n;if(!(i<n)){i===n&&(++i,--n);break}{const e=o[i];o[i]=o[n],o[n]=e,i++,n--}}e<n&&this.quicksort(e,n),i<t&&this.quicksort(i,t)}});const Ie=Te;g().add("QuickSort","standard/Math/Algorithms/QuickSort",Ie);const we=Ie,Ee=new(A()),Re=new(A()),Se=new(A()),Fe={u:0,v:0,t:0},Oe=[new(A())(0,0,1),new(A())(0,0,-1),new(A())(0,1,0),new(A())(0,-1,0),new(A())(1,0,0)];function Pe(e,t){this.vertices=e.vertices,this.normals=e.normals,this.triangle=t,this.i4=12*t,this.i3=9*t}function Ae(e,t,i,n){this.min=new(A()),this.max=new(A()),this.planes=[],this.intersection=new(A());const o=e.vertices,r=this.min,s=this.max,a=i+n;let c=12*t[i];r.set(o[c],o[c+1],o[c+2]),s.assign(r);for(let e=i;e<a;++e)c=12*t[e],Ee.set(o[c],o[c+1],o[c+2]),Re.set(o[c+4],o[c+5],o[c+6]),Se.set(o[c+8],o[c+9],o[c+10]),r.min(Ee,Re,Se),s.max(Ee,Re,Se);for(let e=0;e<5;++e)this.planes[e]=new(be())(e%2?r:s,Oe[e]);if(n>2){e.sorter.compare.axis=this.getLongestAxis(r,s),e.sorter.sort(i,a);var l=n>>>1}else l=1;const d=n-l;this.left=l>1?new Ae(e,t,i,l):new Pe(e,t[i]),this.right=d>1?new Ae(e,t,i+l,d):new Pe(e,t[i+l])}function Ne(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 Pe(this,0);break;default:{const t=[];for(let e=0;e<i;++e)t.push(e);this.sorter=new we(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 Ae(this,t,0,i);break}}}Object.assign(Pe.prototype,{intersectsLine(e,t,i){const n=this.vertices,o=this.normals,r=this.i4,s=this.i3;if(Ee.x=n[r],Ee.y=n[r+1],Ee.z=n[r+2],Re.x=n[r+4],Re.y=n[r+5],Re.z=n[r+6],Se.x=n[r+8],Se.y=n[r+9],Se.z=n[r+10],e.intersectsTriangle(Ee,Re,Se,Fe)){const e=Fe.u,a=Fe.v,c=1-e-a,l=t.size++;l>=t.length&&t.push(new(A())),t[l].set(c*n[r]+e*n[r+4]+a*n[r+8],c*n[r+1]+e*n[r+5]+a*n[r+9],c*n[r+2]+e*n[r+6]+a*n[r+10]),i&&(l>=i.length&&i.push(new(A())),i[l].set(c*o[s]+e*o[s+3]+a*o[s+6],c*o[s+1]+e*o[s+4]+a*o[s+7],c*o[s+2]+e*o[s+5]+a*o[s+8]))}},toArray(e){const t=e.length/4;return e.push(1,3*this.triangle,0,0),t}}),Object.assign(Ae.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,o=i.x,r=n.x,s=i.y,a=n.y,c=i.z,l=n.z,d=this.intersection;return!!(t[0].intersectsLine(e,d)&&d.x>=o&&d.x<=r&&d.y>=s&&d.y<=a)||(!!(t[1].intersectsLine(e,d)&&d.x>=o&&d.x<=r&&d.y>=s&&d.y<=a)||(!!(t[2].intersectsLine(e,d)&&d.x>=o&&d.x<=r&&d.z>=c&&d.z<=l)||(!!(t[3].intersectsLine(e,d)&&d.x>=o&&d.x<=r&&d.z>=c&&d.z<=l)||!!(t[4].intersectsLine(e,d)&&d.y>=s&&d.y<=a&&d.z>=c&&d.z<=l))))},getLongestAxis(e,t){const i=t.x-e.x,n=t.y-e.y,o=t.z-e.z;return i<n?n<o?2:1:i<o?2:0},toArray(e){const t=this.left.toArray(e),i=this.right.toArray(e),n=this.min,o=this.max,r=e.length/4;return e.push(0,t,i,0,n.x,n.y,n.z,0,o.x,o.y,o.z,0),r}}),Object.assign(Ne.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 De=Ne;g().add("BVH","standard/Math/Utility/BVH",De);const Ce=De;var Ve=i(823);const Be=new Float32Array([0,0,0,1]),Me=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 Ue(e){ne().call(this,e),this.addType(_().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.forcePhysicsModelNodes=[],this.forces=new Float32Array(4),this.boundedPhysicsModelNodes=[],this.boundedNormals=[],this.boundedVertices=[],this.colorRamp=new Float32Array,this.texCoordRamp=new Float32Array,this.geometryContext=new(re())({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(Ue.prototype,ne().prototype),{initialize(){ne().prototype.initialize.call(this);const e=this.getBrowser(),t=e.getContext();e.getContext().getVersion()<2||(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.inputParticles=Object.assign(t.createBuffer(),{vertexArrayObject:new(ae())(t),thickLinesVertexArrayObject:new(ae())(t),lineTrianglesBuffer:t.createBuffer(),numLines:0}),this.outputParticles=Object.assign(t.createBuffer(),{vertexArrayObject:new(ae())(t),thickLinesVertexArrayObject:new(ae())(t),lineTrianglesBuffer:t.createBuffer(),numLines:0}),this.forcesTexture=this.createTexture(),this.boundedTexture=this.createTexture(),this.colorRampTexture=this.createTexture(),this.texCoordRampTexture=this.createTexture(),this.geometryBuffer=this.createBuffer(),this.texCoordBuffers=new Array(e.getMaxTexCoords()).fill(this.geometryBuffer),this.lineGeometryNode=new(me())(this.getExecutionContext()),this.lineCoordinateNode=new(pe())(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_bbox__())},getShapeKey(){return this.numTexCoords?2:1},getGeometryContext(){return this.geometryType===f().GEOMETRY?this.getGeometry():this.geometryContext},getGeometryType(){return this.geometryType},getNumInstances(){return this.numParticles},getInstances(){return this.outputParticles},set_bbox__(){if(this._bboxSize.getValue().equals(this.getDefaultBBoxSize()))if(this.boundedPhysicsModelNodes.length){this.bbox.set();for(const e of this.boundedPhysicsModelNodes){const t=e.getBBox();t&&this.bbox.add(t)}}else this.emitterNode?.getBBox(this.bbox,this);else this.bbox.set(this._bboxSize.getValue(),this._bboxCenter.getValue());this.bboxSize.assign(this.bbox.size),this.bboxCenter.assign(this.bbox.center)},set_transparent__(){const e=this.appearanceNode.getAlphaMode();if(e===ue().AUTO){if(this.geometryType===f().POINT)this.setTransparent(!0);else this.setTransparent(this.getAppearance().isTransparent()||this.colorRampNode?.isTransparent()||this.geometryType===f().GEOMETRY&&this.geometryNode?.isTransparent());this.setAlphaMode(this.isTransparent()?ue().BLEND:ue().OPAQUE)}else this.setTransparent(e===ue().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=Ve.enum(f(),this._geometryType.getValue(),f().QUAD),this.geometryType){case f().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,Be,e.DYNAMIC_DRAW);break;case f().LINE:this.geometryContext.geometryType=1,this.geometryContext.hasNormals=!1,this.texCoordCount=0;break;case f().TRIANGLE:case f().QUAD:case f().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,Me,e.DYNAMIC_DRAW);break;case f().GEOMETRY:this.texCoordCount=0}this.geometryContext.updateGeometryKey(),this.updateVertexArrays(),this.set_transparent__()},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()},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},set_emitter__(){this.emitterNode?._bbox_changed.removeInterest("set_bbox__",this),this.emitterNode=k()(_().X3DParticleEmitterNode,this._emitter)??this.getBrowser().getDefaultEmitter(),this.emitterNode._bbox_changed.addInterest("set_bbox__",this)},set_physics__(){const e=this._physics.getValue(),t=this.forcePhysicsModelNodes,i=this.boundedPhysicsModelNodes;for(const e of i)e.removeInterest("set_boundedPhysics__",this),e.removeInterest("set_bbox__",this);t.length=0,i.length=0;for(let n=0,o=e.length;n<o;++n)try{const o=e[n].getValue().getInnerNode(),r=o.getType();for(let e=r.length-1;e>=0;--e){switch(r[e]){case _().ForcePhysicsModel:case _().WindPhysicsModel:t.push(o);break;case _().BoundedPhysicsModel:i.push(o);break;default:continue}break}}catch{}for(const e of i)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,o=t.length;e<o;++e)t[e].addGeometry(i,n);const o=new Ce(n,i).toArray([]),r=n.length/4,s=i.length/3,a=o.length/4,c=Math.ceil(Math.sqrt(r+s+a)),l=new Float32Array(c*c*4);this.boundedVerticesIndex=0,this.boundedNormalsIndex=r,this.boundedHierarchyIndex=this.boundedNormalsIndex+s,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(o,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&&this.colorRampNode.removeInterest("set_color__",this),this.colorRampNode=k()(_().X3DColorNode,this._color),this.colorRampNode&&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 o=this.colorRamp;n*n*4>o.length&&(o=this.colorRamp=new Float32Array(n*n*4));for(let e=0;e<i;++e)o[4*e]=t[e];this.colorRampNode?o.set(this.colorRampNode.addColors([],i).slice(0,4*i),4*i):o.fill(1,4*i),n&&(e.bindTexture(e.TEXTURE_2D,this.colorRampTexture),e.texImage2D(e.TEXTURE_2D,0,e.RGBA32F,n,n,0,e.RGBA,e.FLOAT,o)),this.numColors=i,this.geometryContext.colorMaterial=!(!i||!this.colorRampNode),this.geometryContext.updateGeometryKey(),this.updateVertexArrays()},set_texCoordRamp__(){this.texCoordRampNode&&this.texCoordRampNode.removeInterest("set_texCoord__",this),this.texCoordRampNode=k()(_().X3DTextureCoordinateNode,this._texCoord),this.texCoordRampNode&&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 o=this.texCoordRamp;n*n*4>o.length?o=this.texCoordRamp=new Float32Array(n*n*4):o.fill(0);for(let e=0;e<i;++e)o[4*e]=t[e];this.texCoordRampNode&&o.set(this.texCoordRampNode.addPoints([]).slice(0,i*this.texCoordCount*4),4*i),n&&(e.bindTexture(e.TEXTURE_2D,this.texCoordRampTexture),e.texImage2D(e.TEXTURE_2D,0,e.RGBA32F,n,n,0,e.RGBA,e.FLOAT,o)),this.numTexCoords=this.texCoordRampNode?i:0,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,o=Object.assign(t.createBuffer(),this.outputParticles),r=new Uint8Array(i*n);t.bindBuffer(t.ARRAY_BUFFER,this.inputParticles),t.bufferData(t.ARRAY_BUFFER,r,t.DYNAMIC_DRAW),t.bindBuffer(t.COPY_READ_BUFFER,this.outputParticles),t.bindBuffer(t.ARRAY_BUFFER,o),t.bufferData(t.ARRAY_BUFFER,r,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=o},animateParticles(){const e=this.getBrowser(),t=e.getContext(),i=this.emitterNode,n=1/Math.max(10,this.getBrowser().getCurrentFrameRate());let o=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(),o=Number.POSITIVE_INFINITY):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)}if(i.getMass()){const e=this.forcePhysicsModelNodes;let n=e.length,r=this.forces,s=o/i.getMass();4*n>r.length&&(r=this.forces=new Float32Array(4*n));let a=0;for(let t=0;t<n;++t)a+=!e[t].addForce(t-a,i,s,r);this.numForces=n-=a,n&&(t.bindTexture(t.TEXTURE_2D,this.forcesTexture),t.texImage2D(t.TEXTURE_2D,0,t.RGBA32F,n,1,0,t.RGBA,t.FLOAT,r))}else this.numForces=0;const r=this.outputParticles;this.outputParticles=this.inputParticles,this.inputParticles=r,i.animate(this,o),e.addBrowserEvent()},updateSprite:(()=>{const e=new Float32Array(Me),t=[new(A())(-.5,-.5,0),new(A())(.5,-.5,0),new(A())(.5,.5,0),new(A())(-.5,-.5,0),new(A())(.5,.5,0),new(A())(-.5,.5,0)],i=new(A()),n=new(A());return function(o,r){for(let t=0;t<3;++t)e[24+t]=r[6+t];n.set(this._particleSize.x,this._particleSize.y,1);for(let o=0;o<6;++o){const s=27+4*o;r.multVecMatrix(i.assign(t[o]).multVec(n)),e[s+0]=i.x,e[s+1]=i.y,e[s+2]=i.z}o.bindBuffer(o.ARRAY_BUFFER,this.geometryBuffer),o.bufferData(o.ARRAY_BUFFER,e,o.DYNAMIC_DRAW)}})(),intersectsBox(e,t){},traverse(e,t){if(this.numParticles){switch(e){case le().POINTER:this._pointerEvents.getValue()&&t.addPointingShape(this);break;case le().PICKING:case le().COLLISION:break;case le().SHADOW:this._castShadow.getValue()&&t.addShadowShape(this);break;case le().DISPLAY:t.addDisplayShape(this)&&this.getAppearance().traverse(e,t)}this.geometryType===f().GEOMETRY&&this.getGeometry()?.traverse(e,t)}},displaySimple(e,t,i){switch(this.geometryType){case f().LINE:this.lineGeometryNode.displaySimpleInstanced(e,i,this);break;case f().GEOMETRY:this.getGeometry()?.displaySimpleInstanced(e,i,this);break;case f().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 f().LINE:this.lineGeometryNode.displayInstanced(e,t,this);break;case f().GEOMETRY:this.getGeometry()?.displayInstanced(e,t,this);break;case f().SPRITE:this.updateSprite(e,this.getScreenAlignedRotation(t.modelViewMatrix));case f().QUAD:case f().TRIANGLE:{const i=xe().prototype.determinant3.call(t.modelViewMatrix)>0;e.frontFace(i?e.CCW:e.CW),e.enable(e.CULL_FACE)}default:{const i=this.getBrowser(),n=this.getAppearance(),o=n.getRenderModes(),r=n.getShader(this.geometryContext,t),s=i.getPrimitiveMode(this.primitiveMode);for(const t of o)t.enable(e);if(r.enable(e),r.setUniforms(e,this.geometryContext,t),this.numTexCoords){const t=i.getTexture2DUnit();e.activeTexture(e.TEXTURE0+t),e.bindTexture(e.TEXTURE_2D,this.texCoordRampTexture),e.uniform1i(r.x3d_TexCoordRamp,t)}const a=this.outputParticles;if(a.vertexArrayObject.enable(r.getProgram())){const{particlesStride:t}=this;r.enableParticleAttribute(e,a,t,this.particleOffset,1),r.enableParticleVelocityAttribute(e,a,t,this.velocityOffset,1),r.enableInstanceMatrixAttribute(e,a,t,this.matrixOffset,1),this.geometryContext.colorMaterial&&(r.enableColorAttribute(e,a,t,this.colorOffset),r.colorAttributeDivisor(e,1)),this.texCoordCount&&r.enableTexCoordAttribute(e,this.texCoordBuffers,0,this.texCoordOffset),this.hasNormals&&(r.enableNormalAttribute(e,this.geometryBuffer,0,this.normalOffset),r.normalAttributeDivisor(e,this.maxParticles)),r.enableVertexAttribute(e,this.geometryBuffer,0,this.verticesOffset)}e.drawArraysInstanced(s,0,this.vertexCount,this.numParticles);for(const t of o)t.disable(e);break}}},getScreenAlignedRotation:(()=>{const e=new(xe()),t=new(A()),i=new(A()),n=new(A()),o=new(ve())(9);return function(r){e.assign(r).inverse(),e.multDirMatrix(t.assign(A().zAxis)),e.multDirMatrix(i.assign(A().yAxis));const s=i.cross(t);n.assign(t).cross(s);const a=t;return s.normalize(),n.normalize(),a.normalize(),o.set(s.x,s.y,s.z,n.x,n.y,n.z,a.x,a.y,a.z),o}})()}),Object.defineProperties(Ue,{typeName:{value:"ParticleSystem",enumerable:!0},componentInfo:{value:Object.freeze({name:"ParticleSystems",level:2}),enumerable:!0},containerField:{value:"children",enumerable:!0},specificationRange:{value:Object.freeze({from:"3.2",to:"Infinity"}),enumerable:!0},fieldDefinitions:{value:new(d())([new(c())(_().inputOutput,"metadata",new(s().SFNode)),new(c())(_().inputOutput,"enabled",new(s().SFBool)(!0)),new(c())(_().inputOutput,"createParticles",new(s().SFBool)(!0)),new(c())(_().initializeOnly,"geometryType",new(s().SFString)("QUAD")),new(c())(_().inputOutput,"maxParticles",new(s().SFInt32)(200)),new(c())(_().inputOutput,"particleLifetime",new(s().SFFloat)(5)),new(c())(_().inputOutput,"lifetimeVariation",new(s().SFFloat)(.25)),new(c())(_().inputOutput,"particleSize",new(s().SFVec2f)(.02,.02)),new(c())(_().initializeOnly,"emitter",new(s().SFNode)),new(c())(_().initializeOnly,"physics",new(s().MFNode)),new(c())(_().initializeOnly,"colorKey",new(s().MFFloat)),new(c())(_().initializeOnly,"color",new(s().SFNode)),new(c())(_().initializeOnly,"texCoordKey",new(s().MFFloat)),new(c())(_().initializeOnly,"texCoord",new(s().SFNode)),new(c())(_().outputOnly,"isActive",new(s().SFBool)),new(c())(_().inputOutput,"pointerEvents",new(s().SFBool)(!0)),new(c())(_().inputOutput,"castShadow",new(s().SFBool)(!0)),new(c())(_().inputOutput,"visible",new(s().SFBool)(!0)),new(c())(_().inputOutput,"bboxDisplay",new(s().SFBool)),new(c())(_().initializeOnly,"bboxSize",new(s().SFVec3f)(-1,-1,-1)),new(c())(_().initializeOnly,"bboxCenter",new(s().SFVec3f)),new(c())(_().inputOutput,"appearance",new(s().SFNode)),new(c())(_().inputOutput,"geometry",new(s().SFNode))]),enumerable:!0}});const ze=Ue;g().add("ParticleSystem","x_ite/Components/ParticleSystems/ParticleSystem",ze);const Xe=ze,Le=window[Symbol.for("X_ITE.X3D-10.2.0")].require("x_ite/Components/Rendering/IndexedLineSet");var je=i.n(Le);function ke(e){O.call(this,e),this.addType(_().PolylineEmitter),this.verticesIndex=-1,this.polylinesNode=new(je())(e),this.polylinesArray=new Float32Array}Object.assign(Object.setPrototypeOf(ke.prototype,O.prototype),{initialize(){O.prototype.initialize.call(this);this.getBrowser().getContext().getVersion()<2||(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:function(){const e=new(A());return function(t,{particleLifetime:i,lifetimeVariation:n}){const o=i*(1+n)*(this._speed.getValue()*(1+this._variation.getValue()))*2;return t.set(e.set(o,o,o),this.polylinesNode.getBBox().center).add(this.polylinesNode.getBBox())}}(),set_direction__:(()=>{const e=new(A());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(A()),t=new(A());return function(){const i=this.getBrowser().getContext(),n=this.polylinesNode.getVertices().getValue(),o=n.length/4,r=o/2+1,s=Math.ceil(Math.sqrt(r+o)),a=r;let c=this.polylinesArray;c.length<s*s*4&&(c=this.polylinesArray=new Float32Array(s*s*4));let l=0;for(let i=0,o=n.length;i<o;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).magnitude();c.set(n,4*a),this.verticesIndex=o?a:-1,s&&(i.bindTexture(i.TEXTURE_2D,this.polylinesTexture),i.texImage2D(i.TEXTURE_2D,0,i.RGBA32F,s,s,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(ke,{typeName:{value:"PolylineEmitter",enumerable:!0},componentInfo:{value:Object.freeze({name:"ParticleSystems",level:1}),enumerable:!0},containerField:{value:"emitter",enumerable:!0},specificationRange:{value:Object.freeze({from:"3.2",to:"Infinity"}),enumerable:!0},fieldDefinitions:{value:new(d())([new(c())(_().inputOutput,"metadata",new(s().SFNode)),new(c())(_().inputOnly,"set_coordIndex",new(s().MFInt32)),new(c())(_().inputOutput,"on",new(s().SFBool)(!0)),new(c())(_().inputOutput,"direction",new(s().SFVec3f)(0,1,0)),new(c())(_().inputOutput,"speed",new(s().SFFloat)),new(c())(_().inputOutput,"variation",new(s().SFFloat)(.25)),new(c())(_().inputOutput,"mass",new(s().SFFloat)),new(c())(_().inputOutput,"surfaceArea",new(s().SFFloat)),new(c())(_().initializeOnly,"coordIndex",new(s().MFInt32)(-1)),new(c())(_().inputOutput,"coord",new(s().SFNode))]),enumerable:!0}});const qe=ke;g().add("PolylineEmitter","x_ite/Components/ParticleSystems/PolylineEmitter",qe);const Ge=qe,He=window[Symbol.for("X_ITE.X3D-10.2.0")].require("standard/Math/Geometry/Triangle3");var Ye=i.n(He);function We(e){O.call(this,e),this.addType(_().SurfaceEmitter),this.verticesIndex=-1,this.normalsIndex=-1,this.surfaceNode=null,this.surfaceArray=new Float32Array}Object.assign(Object.setPrototypeOf(We.prototype,O.prototype),{initialize(){O.prototype.initialize.call(this);this.getBrowser().getContext().getVersion()<2||(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:function(){const e=new(A());return function(t,{particleLifetime:i,lifetimeVariation:n}){if(!this.surfaceNode)return t.set();const o=i*(1+n)*(this._speed.getValue()*(1+this._variation.getValue()))*2;return t.set(e.set(o,o,o),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=k()(_().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(A()),t=new(A()),i=new(A());return function(){const n=this.getBrowser().getContext();if(this.surfaceNode){const o=this.surfaceNode.getVertices().getValue(),r=this.surfaceNode.getNormals().getValue(),s=o.length/4,a=s/3+1,c=Math.ceil(Math.sqrt(a+s+s)),l=a,d=l+s;let u=this.surfaceArray;u.length<c*c*4&&(u=this.surfaceArray=new Float32Array(c*c*4));let h=0;for(let n=0,r=o.length;n<r;n+=12)e.set(o[n],o[n+1],o[n+2]),t.set(o[n+4],o[n+5],o[n+6]),i.set(o[n+8],o[n+9],o[n+10]),u[n/3+4]=h+=Ye().area(e,t,i);u.set(o,4*l);for(let e=4*d,t=0,i=r.length;t<i;e+=4,t+=3)u[e+0]=r[t+0],u[e+1]=r[t+1],u[e+2]=r[t+2];this.verticesIndex=s?l:-1,this.normalsIndex=s?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(We,{typeName:{value:"SurfaceEmitter",enumerable:!0},componentInfo:{value:Object.freeze({name:"ParticleSystems",level:2}),enumerable:!0},containerField:{value:"emitter",enumerable:!0},specificationRange:{value:Object.freeze({from:"3.2",to:"Infinity"}),enumerable:!0},fieldDefinitions:{value:new(d())([new(c())(_().inputOutput,"metadata",new(s().SFNode)),new(c())(_().inputOutput,"on",new(s().SFBool)(!0)),new(c())(_().inputOutput,"speed",new(s().SFFloat)),new(c())(_().inputOutput,"variation",new(s().SFFloat)(.25)),new(c())(_().inputOutput,"mass",new(s().SFFloat)),new(c())(_().inputOutput,"surfaceArea",new(s().SFFloat)),new(c())(_().initializeOnly,"surface",new(s().SFNode))]),enumerable:!0}});const Ke=We;g().add("SurfaceEmitter","x_ite/Components/ParticleSystems/SurfaceEmitter",Ke);const Ze=Ke,Qe=window[Symbol.for("X_ITE.X3D-10.2.0")].require("x_ite/Components/Geometry3D/IndexedFaceSet");var $e=i.n(Qe);function Je(e){O.call(this,e),this.addType(_().VolumeEmitter),this.verticesIndex=-1,this.normalsIndex=-1,this.hierarchyIndex=-1,this.hierarchyRoot=-1,this.volumeNode=new($e())(e),this.volumeArray=new Float32Array}Object.assign(Object.setPrototypeOf(Je.prototype,O.prototype),{initialize(){O.prototype.initialize.call(this);this.getBrowser().getContext().getVersion()<2||(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:function(){const e=new(A());return function(t,{particleLifetime:i,lifetimeVariation:n}){const o=i*(1+n)*(this._speed.getValue()*(1+this._variation.getValue()))*2;return t.set(e.set(o,o,o),this.volumeNode.getBBox().center).add(this.volumeNode.getBBox())}}(),set_direction__:(()=>{const e=new(A());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(A()),t=new(A()),i=new(A());return function(){const n=this.getBrowser().getContext(),o=this.volumeNode.getVertices().getValue(),r=this.volumeNode.getNormals().getValue(),s=new Ce(o,r).toArray([]),a=o.length/4,c=r.length/3,l=a/3+1,d=s.length/4,u=Math.ceil(Math.sqrt(l+a+a+d)),h=l,m=h+a,f=m+c;let p=this.volumeArray;p.length<u*u*4&&(p=this.volumeArray=new Float32Array(u*u*4));let _=0;for(let n=0,r=o.length;n<r;n+=12)e.set(o[n],o[n+1],o[n+2]),t.set(o[n+4],o[n+5],o[n+6]),i.set(o[n+8],o[n+9],o[n+10]),p[n/3+4]=_+=Ye().area(e,t,i);p.set(o,4*h);for(let e=4*m,t=0,i=r.length;t<i;e+=4,t+=3)p[e+0]=r[t+0],p[e+1]=r[t+1],p[e+2]=r[t+2];p.set(s,4*f),this.verticesIndex=h,this.normalsIndex=m,this.hierarchyIndex=f,this.hierarchyRoot=f+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(Je,{typeName:{value:"VolumeEmitter",enumerable:!0},componentInfo:{value:Object.freeze({name:"ParticleSystems",level:2}),enumerable:!0},containerField:{value:"emitter",enumerable:!0},specificationRange:{value:Object.freeze({from:"3.2",to:"Infinity"}),enumerable:!0},fieldDefinitions:{value:new(d())([new(c())(_().inputOutput,"metadata",new(s().SFNode)),new(c())(_().inputOnly,"set_coordIndex",new(s().MFInt32)),new(c())(_().inputOutput,"on",new(s().SFBool)(!0)),new(c())(_().initializeOnly,"internal",new(s().SFBool)(!0)),new(c())(_().inputOutput,"direction",new(s().SFVec3f)(0,1,0)),new(c())(_().inputOutput,"speed",new(s().SFFloat)),new(c())(_().inputOutput,"variation",new(s().SFFloat)(.25)),new(c())(_().inputOutput,"mass",new(s().SFFloat)),new(c())(_().inputOutput,"surfaceArea",new(s().SFFloat)),new(c())(_().initializeOnly,"coordIndex",new(s().MFInt32)(-1)),new(c())(_().inputOutput,"coord",new(s().SFNode))]),enumerable:!0}});const et=Je;g().add("VolumeEmitter","x_ite/Components/ParticleSystems/VolumeEmitter",et);const tt=et,it=window[Symbol.for("X_ITE.X3D-10.2.0")].require("standard/Math/Algorithm");var nt=i.n(it);function ot(e){L.call(this,e),this.addType(_().WindPhysicsModel),this._speed.setUnit("speed"),e.getSpecificationVersion()<=3.3&&(this._direction=new(A()))}Object.assign(Object.setPrototypeOf(ot.prototype,L.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(A());return function(t,i,n,o){if(this._enabled.getValue()){const r=i.getSurfaceArea(),s=this.getRandomSpeed(i),a=10**(2*Math.log(s))*.64615;return this._direction.getValue().equals(A().Zero)?i.getRandomNormal(e):e.assign(this._direction.getValue()).normalize(),o.set(e.multiply(r*a*n),4*t),o[4*t+3]=Math.PI*nt().clamp(this._turbulence.getValue(),0,1),!0}return!1}})()}),Object.defineProperties(ot,{typeName:{value:"WindPhysicsModel",enumerable:!0},componentInfo:{value:Object.freeze({name:"ParticleSystems",level:1}),enumerable:!0},containerField:{value:"physics",enumerable:!0},specificationRange:{value:Object.freeze({from:"3.2",to:"Infinity"}),enumerable:!0},fieldDefinitions:{value:new(d())([new(c())(_().inputOutput,"metadata",new(s().SFNode)),new(c())(_().inputOutput,"enabled",new(s().SFBool)(!0)),new(c())(_().inputOutput,"direction",new(s().SFVec3f)(1,0,0)),new(c())(_().inputOutput,"speed",new(s().SFFloat)(.1)),new(c())(_().inputOutput,"gustiness",new(s().SFFloat)(.1)),new(c())(_().inputOutput,"turbulence",new(s().SFFloat))]),enumerable:!0}});const rt=ot;g().add("WindPhysicsModel","x_ite/Components/ParticleSystems/WindPhysicsModel",rt);const st=rt;o().add({name:"ParticleSystems",concreteNodes:[H,K,$,te,Xe,C,Ge,Ze,tt,st],abstractNodes:[O,L],browserContext:U});const at=void 0;g().add("ParticleSystems","assets/components/ParticleSystems",at)})();
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
/* X_ITE v10.2.0 */(()=>{"use strict";var e={n:t=>{var 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:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)};const t=window[Symbol.for("X_ITE.X3D-10.2.0")].require("x_ite/Components");var i=e.n(t);const n=window[Symbol.for("X_ITE.X3D-10.2.0")].require("x_ite/Fields");var s=e.n(n);const o=window[Symbol.for("X_ITE.X3D-10.2.0")].require("x_ite/Base/X3DFieldDefinition");var r=e.n(o);const c=window[Symbol.for("X_ITE.X3D-10.2.0")].require("x_ite/Base/FieldDefinitionArray");var a=e.n(c);const l=window[Symbol.for("X_ITE.X3D-10.2.0")].require("x_ite/Components/Core/X3DSensorNode");var p=e.n(l);const h=window[Symbol.for("X_ITE.X3D-10.2.0")].require("x_ite/Rendering/TraverseType");var d=e.n(h);const g=window[Symbol.for("X_ITE.X3D-10.2.0")].require("x_ite/Base/X3DConstants");var u=e.n(g);const m=window[Symbol.for("X_ITE.X3D-10.2.0")].require("x_ite/Namespace");var y=e.n(m);let _=0;const w={MATCH_ANY:_++,MATCH_EVERY:_++,MATCH_ONLY_ONE:_++};y().add("MatchCriterion","x_ite/Browser/Picking/MatchCriterion",w);const k=w;let S=0;const f={BOUNDS:S++,GEOMETRY:S++};y().add("IntersectionType","x_ite/Browser/Picking/IntersectionType",f);const b=f;let O=0;const T={ANY:O++,CLOSEST:O++,ALL:O++,ALL_SORTED:O++};y().add("SortOrder","x_ite/Browser/Picking/SortOrder",T);const N=T,C=window[Symbol.for("X_ITE.X3D-10.2.0")].require("standard/Math/Numbers/Matrix4");var P=e.n(C);function v(e,t){this.array=e,t&&(this.compare=t)}Object.assign(v.prototype,{compare:(e,t)=>e<t,sort(e,t){t-e>1&&this.quicksort(e,t-1)},quicksort(e,t){let i=e,n=t;const{array:s,compare:o}=this,r=s[e+t>>>1];for(;;){for(;o(s[i],r);)++i;for(;o(r,s[n]);)--n;if(!(i<n)){i===n&&(++i,--n);break}{const e=s[i];s[i]=s[n],s[n]=e,i++,n--}}e<n&&this.quicksort(e,n),i<t&&this.quicksort(i,t)}});const G=v;y().add("QuickSort","standard/Math/Algorithms/QuickSort",G);const M=G,x=window[Symbol.for("X_ITE.X3D-10.2.0")].require("standard/Utility/ObjectCache");var B,j,F,I=e.n(x)()(P());function A(e,t){return e.distance<t.distance}function D(e){p().call(this,e),this.addType(u().X3DPickSensorNode),this.objectType=new Set,this.intersectionType=b.BOUNDS,this.sortOrder=N.CLOSEST,this.pickTargetNodes=new Set,this.modelMatrices=[],this.targets=[],this.targets.size=0,this.pickedTargets=[],this.pickedTargetsSorter=new M(this.pickedTargets,A),this.pickedGeometries=new(s().MFNode)}Object.assign(Object.setPrototypeOf(D.prototype,p().prototype),{initialize(){this.getLive().addInterest("set_live__",this),this._enabled.addInterest("set_live__",this),this._objectType.addInterest("set_objectType__",this),this._matchCriterion.addInterest("set_matchCriterion__",this),this._intersectionType.addInterest("set_intersectionType__",this),this._sortOrder.addInterest("set_sortOrder__",this),this._pickTarget.addInterest("set_pickTarget__",this),this.set_objectType__(),this.set_matchCriterion__(),this.set_intersectionType__(),this.set_sortOrder__(),this.set_pickTarget__()},getObjectType(){return this.objectType},getMatchCriterion(){return this.matchCriterion},getIntersectionType(){return this.intersectionType},getSortOrder(){return this.sortOrder},getModelMatrices(){return this.modelMatrices},getTargets(){return this.targets},getPickShape:(()=>{const e=new WeakMap;return function(t){const i=e.get(t);if(void 0!==i)return i;const n=this.getBrowser(),s=n.getPrivateScene().createNode("Shape",!1),o=n.getPrivateScene().createNode("CollidableShape",!1);return s.setPrivate(!0),o.setPrivate(!0),o.setConvex(!0),s._geometry=t,o._shape=s,s.setup(),o.setup(),e.set(t,o),o}})(),getPickedGeometries:function(){var e=this.targets,t=e.size,i=this.pickedTargets,n=this.pickedGeometries;i.length=0;for(var s=0;s<t;++s){var o=e[s];o.intersected&&i.push(o)}if(0===i.length)return n.length=0,n;switch(this.sortOrder){case N.ANY:i.length=1,n[0]=this.getPickedGeometry(i[0]),n.length=1;break;case N.CLOSEST:this.pickedTargetsSorter.sort(0,i.length),i.length=1,n[0]=this.getPickedGeometry(i[0]),n.length=1;break;case N.ALL:s=0;for(var r=i.length;s<r;++s)n[s]=this.getPickedGeometry(i[s]);n.length=r;break;case N.ALL_SORTED:for(this.pickedTargetsSorter.sort(0,i.length),s=0,r=i.length;s<r;++s)n[s]=this.getPickedGeometry(i[s]);n.length=r}return n},getPickedGeometry(e){var t=this.getExecutionContext(),i=e.geometryNode;if(i.getExecutionContext()===t)return i;if((o=i.getExecutionContext()).getType().includes(u().X3DPrototypeInstance)&&o.getExecutionContext()===t)return o;for(var n=e.pickingHierarchy,s=n.length-1;s>=0;--s){var o,r=n[s];if(r.getExecutionContext()===t)return r;if((o=r.getExecutionContext()).getType().includes(u().X3DPrototypeInstance)&&o.getExecutionContext()===t)return o}return null},getPickedTargets(){return this.pickedTargets},set_live__(){this.getLive().getValue()&&this._enabled.getValue()&&!this.objectType.has("NONE")?(this.getBrowser().addPickSensor(this),this.setPickableObject(!0)):(this.getBrowser().removePickSensor(this),this.setPickableObject(!1))},set_objectType__(){this.objectType.clear();for(var e=0,t=this._objectType.length;e<t;++e)this.objectType.add(this._objectType[e]);this.set_live__()},set_matchCriterion__:(F=new Map([["MATCH_ANY",k.MATCH_ANY],["MATCH_EVERY",k.MATCH_EVERY],["MATCH_ONLY_ONE",k.MATCH_ONLY_ONE]]),function(){this.matchCriterion=F.get(this._matchCriterion.getValue()),void 0===this.matchCriterion&&(this.matchCriterion=MatchCriterionType.MATCH_ANY)}),set_intersectionType__:(j=new Map([["BOUNDS",b.BOUNDS],["GEOMETRY",b.GEOMETRY]]),function(){this.intersectionType=j.get(this._intersectionType.getValue()),void 0===this.intersectionType&&(this.intersectionType=b.BOUNDS)}),set_sortOrder__:(B=new Map([["ANY",N.ANY],["CLOSEST",N.CLOSEST],["ALL",N.ALL],["ALL_SORTED",N.ALL_SORTED]]),function(){this.sortOrder=B.get(this._sortOrder.getValue()),void 0===this.sortOrder&&(this.sortOrder=N.CLOSEST)}),set_pickTarget__(){this.pickTargetNodes.clear();for(var e=0,t=this._pickTarget.length;e<t;++e)try{for(var i=this._pickTarget[e].getValue().getInnerNode(),n=i.getType(),s=n.length-1;s>=0;--s)switch(n[s]){case u().Inline:case u().Shape:case u().X3DGroupingNode:this.pickTargetNodes.add(i);break;default:continue}}catch{}},traverse(e,t){e===d().PICKING&&this.isPickableObject()&&this.modelMatrices.push(I.pop().assign(t.getModelViewMatrix().get()))},collect(e,t,i){var n=this.pickTargetNodes;if(i.some((e=>n.has(e)))){var s=this.targets;if(s.size<s.length)var o=s[s.size];else{o={modelMatrix:new(P()),pickingHierarchy:[],pickedPoint:[],intersections:[]};s.push(o)}++s.size,o.intersected=!1,o.geometryNode=e,o.pickedPoint.length=0,o.intersections.length=0,o.modelMatrix.assign(t);for(var r=o.pickingHierarchy,c=0,a=i.length;c<a;++c)r[c]=i[c];r.length=a}},process(){for(var e=this.modelMatrices,t=0,i=e.length;t<i;++t)I.push(e[t]);this.modelMatrices.length=0,this.targets.size=0}}),Object.defineProperties(D,{typeName:{value:"X3DPickSensorNode",enumerable:!0},componentInfo:{value:Object.freeze({name:"Picking",level:1}),enumerable:!0}});const E=D;y().add("X3DPickSensorNode","x_ite/Components/Picking/X3DPickSensorNode",E);const z=E,L=window[Symbol.for("X_ITE.X3D-10.2.0")].require("standard/Math/Numbers/Vector3");var V=e.n(L);const X=window[Symbol.for("X_ITE.X3D-10.2.0")].require("standard/Math/Geometry/Box3");var R=e.n(X);const q=window[Symbol.for("X_ITE.X3D-10.2.0")].require("standard/Math/Geometry/Line3");var Y=e.n(q);function H(e){z.call(this,e),this.addType(u().LinePickSensor),this.pickingGeometryNode=null}Object.assign(Object.setPrototypeOf(H.prototype,z.prototype),{initialize(){z.prototype.initialize.call(this),this._pickingGeometry.addInterest("set_pickingGeometry__",this),this.set_pickingGeometry__()},set_pickingGeometry__(){this.pickingGeometryNode=null;try{const e=this._pickingGeometry.getValue().getInnerNode(),t=e.getType();for(let i=t.length-1;i>=0;--i)switch(t[i]){case u().IndexedLineSet:case u().LineSet:this.pickingGeometryNode=e;break;default:continue}}catch{}},process:(()=>{const e=new(R()),t=new(R()),i=new(V()),n=new(V()),o=new(P()),r=new(V()),c=new(V()),a=new(Y())(V().Zero,V().zAxis),l=new(V()),p=new(V()),h=[],d=[],g=new(V()),u=new(s().MFVec3f),m=new(s().MFVec3f),y=new(s().MFVec3f);return function(){if(this.pickingGeometryNode){const s=this.getModelMatrices(),_=this.getTargets();switch(this.getIntersectionType()){case b.BOUNDS:{for(let o=0,r=s.length;o<r;++o){const r=s[o];e.assign(this.pickingGeometryNode.getBBox()).multRight(r);for(let s=0,o=_.size;s<o;++s){const o=_[s];t.assign(o.geometryNode.getBBox()).multRight(o.modelMatrix),e.intersectsBox(t)&&(i.assign(e.center),n.assign(t.center),o.intersected=!0,o.distance=i.distance(n))}}const o=this.getPickedGeometries(),r=!!o.length;o.assign(o.filter((e=>e))),r!==this._isActive.getValue()&&(this._isActive=r),this._pickedGeometry.equals(o)||(this._pickedGeometry=o);break}case b.GEOMETRY:{for(let g=0,u=s.length;g<u;++g){const u=s[g];e.assign(this.pickingGeometryNode.getBBox()).multRight(u);for(let s=0,g=_.size;s<g;++s){const g=_[s],m=g.geometryNode,y=this.pickingGeometryNode.getVertices();t.assign(m.getBBox()).multRight(g.modelMatrix),o.assign(g.modelMatrix).inverse().multLeft(u);for(let e=0,t=y.length;e<t;e+=8)if(o.multVecMatrix(r.set(y[e+0],y[e+1],y[e+2])),o.multVecMatrix(c.set(y[e+4],y[e+5],y[e+6])),a.setPoints(r,c),d.length=0,m.intersectsLine(a,g.modelMatrix,h,d))for(let e=0,t=d.length;e<t;++e){const t=d[e];l.assign(t.point).subtract(r),p.assign(t.point).subtract(c);l.add(p).magnitude()<=r.distance(c)&&g.intersections.push(t)}g.intersections.length&&(i.assign(e.center),n.assign(t.center),g.intersected=!0,g.distance=i.distance(n))}}const w=this.getPickedGeometries(),k=!!w.length;w.assign(w.filter((e=>e))),k!==this._isActive.getValue()&&(this._isActive=k),this._pickedGeometry.equals(w)||(this._pickedGeometry=w);const S=this.getPickedTargets();u.length=0,m.length=0,y.length=0;for(let e=0,t=S.length;e<t;++e){const t=S[e].intersections;for(let e=0,i=t.length;e<i;++e){const i=t[e],n=i.texCoord;g.set(n.x,n.y,n.z),u.push(g),m.push(i.normal),y.push(i.point)}}this._pickedTextureCoordinate.equals(u)||(this._pickedTextureCoordinate=u),this._pickedNormal.equals(m)||(this._pickedNormal=m),this._pickedPoint.equals(y)||(this._pickedPoint=y);break}}}z.prototype.process.call(this)}})()}),Object.defineProperties(H,{typeName:{value:"LinePickSensor",enumerable:!0},componentInfo:{value:Object.freeze({name:"Picking",level:1}),enumerable:!0},containerField:{value:"children",enumerable:!0},specificationRange:{value:Object.freeze({from:"3.2",to:"Infinity"}),enumerable:!0},fieldDefinitions:{value:new(a())([new(r())(u().inputOutput,"metadata",new(s().SFNode)),new(r())(u().inputOutput,"description",new(s().SFString)),new(r())(u().inputOutput,"enabled",new(s().SFBool)(!0)),new(r())(u().inputOutput,"objectType",new(s().MFString)("ALL")),new(r())(u().inputOutput,"matchCriterion",new(s().SFString)("MATCH_ANY")),new(r())(u().initializeOnly,"intersectionType",new(s().SFString)("BOUNDS")),new(r())(u().initializeOnly,"sortOrder",new(s().SFString)("CLOSEST")),new(r())(u().outputOnly,"isActive",new(s().SFBool)),new(r())(u().outputOnly,"pickedTextureCoordinate",new(s().MFVec3f)),new(r())(u().outputOnly,"pickedNormal",new(s().MFVec3f)),new(r())(u().outputOnly,"pickedPoint",new(s().MFVec3f)),new(r())(u().inputOutput,"pickingGeometry",new(s().SFNode)),new(r())(u().inputOutput,"pickTarget",new(s().MFNode)),new(r())(u().outputOnly,"pickedGeometry",new(s().MFNode))]),enumerable:!0}});const U=H;y().add("LinePickSensor","x_ite/Components/Picking/LinePickSensor",U);const W=U,K=window[Symbol.for("X_ITE.X3D-10.2.0")].require("x_ite/Components/Grouping/X3DGroupingNode");var Q=e.n(K);function Z(e){this.addType(u().X3DPickableObject),this.objectType=new Set}Object.assign(Z.prototype,{initialize(){this._objectType.addInterest("set_objectType__",this),this.set_objectType__()},getObjectType(){return this.objectType},set_objectType__(){this.objectType.clear();for(var e=0,t=this._objectType.length;e<t;++e)this.objectType.add(this._objectType[e])},dispose(){}}),Object.defineProperties(Z,{typeName:{value:"X3DPickableObject",enumerable:!0},componentInfo:{value:Object.freeze({name:"Picking",level:1}),enumerable:!0}});const J=Z;y().add("X3DPickableObject","x_ite/Components/Picking/X3DPickableObject",J);const $=J;function ee(e){Q().call(this,e),$.call(this,e),this.addType(u().PickableGroup),this.pickSensorNodes=new Set}Object.assign(Object.setPrototypeOf(ee.prototype,Q().prototype),$.prototype,{initialize(){Q().prototype.initialize.call(this),$.prototype.initialize.call(this),this._pickable.addInterest("set_pickable__",this),this.set_pickable__()},set_pickableObjects__(){this.set_pickable__()},set_pickable__(){this.setPickableObject(this._pickable.getValue()||this.getTransformSensors().size)},traverse(e,t){if(e===d().PICKING){if(this._pickable.getValue()){if(this.getObjectType().has("NONE"))return;const i=this.getBrowser(),n=i.getPickable();if(this.getObjectType().has("ALL"))n.push(!0),Q().prototype.traverse.call(this,e,t),n.pop();else{const s=this.pickSensorNodes,o=i.getPickSensors();for(const e of o.at(-1)){if(!e.getObjectType().has("ALL")){let t=0;for(const i of this.getObjectType())if(e.getObjectType().has(i)){++t;break}switch(e.getMatchCriterion()){case k.MATCH_ANY:if(0===t)continue;break;case k.MATCH_EVERY:if(t!==pickSensor.getObjectType().size)continue;break;case k.MATCH_ONLY_ONE:if(1!==t)continue}}s.add(e)}n.push(!0),o.push(s),Q().prototype.traverse.call(this,e,t),o.pop(),n.pop(),s.clear()}}}else Q().prototype.traverse.call(this,e,t)},dispose(){$.prototype.dispose.call(this),Q().prototype.dispose.call(this)}}),Object.defineProperties(ee,{typeName:{value:"PickableGroup",enumerable:!0},componentInfo:{value:Object.freeze({name:"Picking",level:1}),enumerable:!0},containerField:{value:"children",enumerable:!0},specificationRange:{value:Object.freeze({from:"3.2",to:"Infinity"}),enumerable:!0},fieldDefinitions:{value:new(a())([new(r())(u().inputOutput,"metadata",new(s().SFNode)),new(r())(u().inputOutput,"description",new(s().SFString)),new(r())(u().inputOutput,"pickable",new(s().SFBool)(!0)),new(r())(u().inputOutput,"objectType",new(s().MFString)("ALL")),new(r())(u().inputOutput,"visible",new(s().SFBool)(!0)),new(r())(u().inputOutput,"bboxDisplay",new(s().SFBool)),new(r())(u().initializeOnly,"bboxSize",new(s().SFVec3f)(-1,-1,-1)),new(r())(u().initializeOnly,"bboxCenter",new(s().SFVec3f)),new(r())(u().inputOnly,"addChildren",new(s().MFNode)),new(r())(u().inputOnly,"removeChildren",new(s().MFNode)),new(r())(u().inputOutput,"children",new(s().MFNode))]),enumerable:!0}});const te=ee;y().add("PickableGroup","x_ite/Components/Picking/PickableGroup",te);const ie=te,ne=window[Symbol.for("X_ITE.X3D-10.2.0")].require("x_ite/Base/X3DCast");var se=e.n(ne);const oe=window[Symbol.for("X_ITE.X3D-10.2.0")].require("standard/Math/Numbers/Rotation4");var re=e.n(oe);const ce=window[Symbol.for("X_ITE.X3D-10.2.0")].require("lib/ammojs/AmmoClass");var ae=e.n(ce);function le(){this.broadphase=new(ae().btDbvtBroadphase),this.collisionConfiguration=new(ae().btDefaultCollisionConfiguration),this.dispatcher=new(ae().btCollisionDispatcher)(this.collisionConfiguration),this.collisionWorld=new(ae().btCollisionWorld)(this.dispatcher,this.broadphase,this.collisionConfiguration),this.compoundShape1=new(ae().btCompoundShape),this.motionState1=new(ae().btDefaultMotionState),this.constructionInfo1=new(ae().btRigidBodyConstructionInfo)(0,this.motionState1,this.compoundShape1),this.rigidBody1=new(ae().btRigidBody)(this.constructionInfo1),this.compoundShape2=new(ae().btCompoundShape),this.motionState2=new(ae().btDefaultMotionState),this.constructionInfo2=new(ae().btRigidBodyConstructionInfo)(0,this.motionState2,this.compoundShape2),this.rigidBody2=new(ae().btRigidBody)(this.constructionInfo2),this.collisionWorld.addCollisionObject(this.rigidBody1),this.collisionWorld.addCollisionObject(this.rigidBody2)}Object.assign(le.prototype,{constuctor:le,setChildShape1(e,t){this.setChildShape(this.compoundShape1,e,t)},setChildShape2(e,t){this.setChildShape(this.compoundShape2,e,t)},setChildShape1Components(e,t,i){this.setChildShapeComponents(this.compoundShape1,e,t,i)},setChildShape2Components(e,t,i){this.setChildShapeComponents(this.compoundShape2,e,t,i)},setChildShape:(()=>{const e=new(V()),t=new(re()),i=new(V())(1,1,1),n=new(ae().btVector3)(0,0,0);return function(s,o,r){s.getNumChildShapes()&&s.removeChildShapeByIndex(0),r.getNumChildShapes()&&(o.get(e,t,i),n.setValue(i.x,i.y,i.z),r.setLocalScaling(n),s.addChildShape(this.getTransform(e,t),r))}})(),setChildShapeComponents(e,t,i,n){e.getNumChildShapes()&&e.removeChildShapeByIndex(0),n.getNumChildShapes()&&(n.setLocalScaling(i),e.addChildShape(t,n))},contactTest(){this.collisionWorld.performDiscreteCollisionDetection();const e=this.dispatcher.getNumManifolds();for(let t=0;t<e;++t){const e=this.dispatcher.getManifoldByIndexInternal(t),i=e.getNumContacts();for(let t=0;t<i;++t){if(e.getContactPoint(t).getDistance()<=0)return!0}}return!1},getTransform:(()=>{const e=new(ae().btTransform),t=new(ae().btVector3)(0,0,0),i=new(P());return function(n,s,o){const r=o||e;return i.set(n,s),t.setValue(i[12],i[13],i[14]),r.getBasis().setValue(i[0],i[4],i[8],i[1],i[5],i[9],i[2],i[6],i[10]),r.setOrigin(t),r}})()});const pe=le;y().add("VolumePicker","x_ite/Browser/Picking/VolumePicker",pe);const he=pe;function de(e){z.call(this,e),this.addType(u().PointPickSensor),this.pickingGeometryNode=null,this.picker=new he,this.compoundShapes=[]}Object.assign(Object.setPrototypeOf(de.prototype,z.prototype),{initialize(){z.prototype.initialize.call(this),this._pickingGeometry.addInterest("set_pickingGeometry__",this),this.set_pickingGeometry__()},set_pickingGeometry__(){this.pickingGeometryNode?._rebuild.removeInterest("set_geometry__",this),this.pickingGeometryNode=se()(u().PointSet,this._pickingGeometry),this.pickingGeometryNode?._rebuild.addInterest("set_geometry__",this),this.set_geometry__()},set_geometry__:(()=>{const e=new(ae().btVector3)(1,1,1),t=new(ae().btVector3),i=new(ae().btTransform);return function(){const n=this.compoundShapes;if(this.pickingGeometryNode){const s=this.pickingGeometryNode.getCoord();if(s){const o=s.getSize();for(let r=0;r<o;++r)if(r<n.length){const o=n[r],c=s.get1Point(r,o.point);t.setValue(c.x,c.y,c.z),i.setOrigin(t),o.setLocalScaling(e),o.updateChildTransform(0,i)}else{const e=new(ae().btCompoundShape),o=new(ae().btSphereShape)(0),c=s.get1Point(r,new(V()));e.point=c,t.setValue(c.x,c.y,c.z),i.setOrigin(t),e.addChildShape(i,o),n.push(e)}n.length=o}else n.length=0}else n.length=0}})(),process:(()=>{const e=new(R()),t=new(R()),i=new(V()),n=new(V()),o=new(ae().btTransform),r=new(ae().btVector3),c=new(V()),a=new(re()),l=new(V())(1,1,1),p=new(s().MFVec3f);return function(){if(this.pickingGeometryNode){const s=this.getModelMatrices(),h=this.getTargets();switch(this.getIntersectionType()){case b.BOUNDS:{for(let o=0,r=s.length;o<r;++o){const r=s[o];e.assign(this.pickingGeometryNode.getBBox()).multRight(r);for(let s=0,o=h.size;s<o;++s){const o=h[s];t.assign(o.geometryNode.getBBox()).multRight(o.modelMatrix),e.intersectsBox(t)&&(i.assign(e.center),n.assign(t.center),o.intersected=!0,o.distance=i.distance(n))}}const o=this.getPickedGeometries(),r=!!o.length;o.assign(o.filter((e=>e))),r!==this._isActive.getValue()&&(this._isActive=r),this._pickedGeometry.equals(o)||(this._pickedGeometry=o);break}case b.GEOMETRY:{const d=this.picker,g=this.compoundShapes;for(let p=0,u=s.length;p<u;++p){const u=s[p];e.assign(this.pickingGeometryNode.getBBox()).multRight(u),u.get(c,a,l),d.getTransform(c,a,o),r.setValue(l.x,l.y,l.z);for(let s=0,c=g.length;s<c;++s){const c=g[s];d.setChildShape1Components(o,r,c);for(let s=0,o=h.size;s<o;++s){const o=h[s],r=this.getPickShape(o.geometryNode);t.assign(o.geometryNode.getBBox()).multRight(o.modelMatrix),d.setChildShape2(o.modelMatrix,r.getCompoundShape()),d.contactTest()&&(i.assign(e.center),n.assign(t.center),o.intersected=!0,o.distance=i.distance(n),o.pickedPoint.push(c.point))}}}const u=this.getPickedGeometries(),m=!!u.length;u.assign(u.filter((e=>e))),m!==this._isActive.getValue()&&(this._isActive=m),this._pickedGeometry.equals(u)||(this._pickedGeometry=u);const y=this.getPickedTargets();p.length=0;for(let e=0,t=y.length;e<t;++e){const t=y[e].pickedPoint;for(let e=0,i=t.length;e<i;++e)p.push(t[e])}this._pickedPoint.equals(p)||(this._pickedPoint=p);break}}}z.prototype.process.call(this)}})()}),Object.defineProperties(de,{typeName:{value:"PointPickSensor",enumerable:!0},componentInfo:{value:Object.freeze({name:"Picking",level:1}),enumerable:!0},containerField:{value:"children",enumerable:!0},specificationRange:{value:Object.freeze({from:"3.2",to:"Infinity"}),enumerable:!0},fieldDefinitions:{value:new(a())([new(r())(u().inputOutput,"metadata",new(s().SFNode)),new(r())(u().inputOutput,"description",new(s().SFString)),new(r())(u().inputOutput,"enabled",new(s().SFBool)(!0)),new(r())(u().inputOutput,"objectType",new(s().MFString)("ALL")),new(r())(u().inputOutput,"matchCriterion",new(s().SFString)("MATCH_ANY")),new(r())(u().initializeOnly,"intersectionType",new(s().SFString)("BOUNDS")),new(r())(u().initializeOnly,"sortOrder",new(s().SFString)("CLOSEST")),new(r())(u().outputOnly,"isActive",new(s().SFBool)),new(r())(u().outputOnly,"pickedPoint",new(s().MFVec3f)),new(r())(u().inputOutput,"pickingGeometry",new(s().SFNode)),new(r())(u().inputOutput,"pickTarget",new(s().MFNode)),new(r())(u().outputOnly,"pickedGeometry",new(s().MFNode))]),enumerable:!0}});const ge=de;y().add("PointPickSensor","x_ite/Components/Picking/PointPickSensor",ge);const ue=ge;function me(e){z.call(this,e),this.addType(u().PrimitivePickSensor),this.pickingGeometryNode=null,this.picker=new he}Object.assign(Object.setPrototypeOf(me.prototype,z.prototype),{initialize(){z.prototype.initialize.call(this),this._pickingGeometry.addInterest("set_pickingGeometry__",this),this.set_pickingGeometry__()},set_pickingGeometry__(){this.pickingGeometryNode=null;try{const e=this._pickingGeometry.getValue().getInnerNode(),t=e.getType();for(let i=t.length-1;i>=0;--i)switch(t[i]){case u().Box:case u().Cone:case u().Cylinder:case u().Sphere:this.pickingGeometryNode=e;break;default:continue}}catch{}},process:(()=>{const e=new(R()),t=new(R()),i=new(V()),n=new(V());return function(){if(this.pickingGeometryNode){const s=this.getModelMatrices(),o=this.getTargets();switch(this.getIntersectionType()){case b.BOUNDS:{for(let r=0,c=s.length;r<c;++r){const c=s[r];e.assign(this.pickingGeometryNode.getBBox()).multRight(c);for(let s=0,r=o.size;s<r;++s){const r=o[s];t.assign(r.geometryNode.getBBox()).multRight(r.modelMatrix),e.intersectsBox(t)&&(i.assign(e.center),n.assign(t.center),r.intersected=!0,r.distance=i.distance(n))}}const r=this.getPickedGeometries(),c=!!r.length;r.assign(r.filter((e=>e))),c!==this._isActive.getValue()&&(this._isActive=c),this._pickedGeometry.equals(r)||(this._pickedGeometry=r);break}case b.GEOMETRY:{const r=this.picker;for(let c=0,a=s.length;c<a;++c){const a=s[c],l=this.getPickShape(this.pickingGeometryNode);e.assign(this.pickingGeometryNode.getBBox()).multRight(a),r.setChildShape1(a,l.getCompoundShape());for(let s=0,c=o.size;s<c;++s){const c=o[s],a=this.getPickShape(c.geometryNode);t.assign(c.geometryNode.getBBox()).multRight(c.modelMatrix),r.setChildShape2(c.modelMatrix,a.getCompoundShape()),r.contactTest()&&(i.assign(e.center),n.assign(t.center),c.intersected=!0,c.distance=i.distance(n))}}const c=this.getPickedGeometries(),a=!!c.length;c.assign(c.filter((e=>e))),a!==this._isActive.getValue()&&(this._isActive=a),this._pickedGeometry.equals(c)||(this._pickedGeometry=c);break}}}z.prototype.process.call(this)}})()}),Object.defineProperties(me,{typeName:{value:"PrimitivePickSensor",enumerable:!0},componentInfo:{value:Object.freeze({name:"Picking",level:2}),enumerable:!0},containerField:{value:"children",enumerable:!0},specificationRange:{value:Object.freeze({from:"3.2",to:"Infinity"}),enumerable:!0},fieldDefinitions:{value:new(a())([new(r())(u().inputOutput,"metadata",new(s().SFNode)),new(r())(u().inputOutput,"description",new(s().SFString)),new(r())(u().inputOutput,"enabled",new(s().SFBool)(!0)),new(r())(u().inputOutput,"objectType",new(s().MFString)("ALL")),new(r())(u().inputOutput,"matchCriterion",new(s().SFString)("MATCH_ANY")),new(r())(u().initializeOnly,"intersectionType",new(s().SFString)("BOUNDS")),new(r())(u().initializeOnly,"sortOrder",new(s().SFString)("CLOSEST")),new(r())(u().outputOnly,"isActive",new(s().SFBool)),new(r())(u().inputOutput,"pickingGeometry",new(s().SFNode)),new(r())(u().inputOutput,"pickTarget",new(s().MFNode)),new(r())(u().outputOnly,"pickedGeometry",new(s().MFNode))]),enumerable:!0}});const ye=me;y().add("PrimitivePickSensor","x_ite/Components/Picking/PrimitivePickSensor",ye);const _e=ye;function we(e){z.call(this,e),this.addType(u().VolumePickSensor),this.pickingGeometryNode=null,this.picker=new he}Object.assign(Object.setPrototypeOf(we.prototype,z.prototype),{initialize(){z.prototype.initialize.call(this),this._pickingGeometry.addInterest("set_pickingGeometry__",this),this.set_pickingGeometry__()},set_pickingGeometry__(){this.pickingGeometryNode=se()(u().X3DGeometryNode,this._pickingGeometry)},process:(()=>{const e=new(R()),t=new(R()),i=new(V()),n=new(V());return function(){if(this.pickingGeometryNode){const s=this.getModelMatrices(),o=this.getTargets();switch(this.getIntersectionType()){case b.BOUNDS:{for(let r=0,c=s.length;r<c;++r){const c=s[r];e.assign(this.pickingGeometryNode.getBBox()).multRight(c);for(let s=0,r=o.size;s<r;++s){const r=o[s];t.assign(r.geometryNode.getBBox()).multRight(r.modelMatrix),e.intersectsBox(t)&&(i.assign(e.center),n.assign(t.center),r.intersected=!0,r.distance=i.distance(n))}}const r=this.getPickedGeometries(),c=!!r.length;r.assign(r.filter((e=>e))),c!==this._isActive.getValue()&&(this._isActive=c),this._pickedGeometry.equals(r)||(this._pickedGeometry=r);break}case b.GEOMETRY:{const r=this.picker;for(let c=0,a=s.length;c<a;++c){const a=s[c],l=this.getPickShape(this.pickingGeometryNode);e.assign(this.pickingGeometryNode.getBBox()).multRight(a),r.setChildShape1(a,l.getCompoundShape());for(let s=0,c=o.size;s<c;++s){const c=o[s],a=this.getPickShape(c.geometryNode);t.assign(c.geometryNode.getBBox()).multRight(c.modelMatrix),r.setChildShape2(c.modelMatrix,a.getCompoundShape()),r.contactTest()&&(i.assign(e.center),n.assign(t.center),c.intersected=!0,c.distance=i.distance(n))}}const c=this.getPickedGeometries(),a=!!c.length;c.assign(c.filter((e=>e))),a!==this._isActive.getValue()&&(this._isActive=a),this._pickedGeometry.equals(c)||(this._pickedGeometry=c);break}}}z.prototype.process.call(this)}})()}),Object.defineProperties(we,{typeName:{value:"VolumePickSensor",enumerable:!0},componentInfo:{value:Object.freeze({name:"Picking",level:3}),enumerable:!0},containerField:{value:"children",enumerable:!0},specificationRange:{value:Object.freeze({from:"3.2",to:"Infinity"}),enumerable:!0},fieldDefinitions:{value:new(a())([new(r())(u().inputOutput,"metadata",new(s().SFNode)),new(r())(u().inputOutput,"description",new(s().SFString)),new(r())(u().inputOutput,"enabled",new(s().SFBool)(!0)),new(r())(u().inputOutput,"objectType",new(s().MFString)("ALL")),new(r())(u().inputOutput,"matchCriterion",new(s().SFString)("MATCH_ANY")),new(r())(u().initializeOnly,"intersectionType",new(s().SFString)("BOUNDS")),new(r())(u().initializeOnly,"sortOrder",new(s().SFString)("CLOSEST")),new(r())(u().outputOnly,"isActive",new(s().SFBool)),new(r())(u().inputOutput,"pickingGeometry",new(s().SFNode)),new(r())(u().inputOutput,"pickTarget",new(s().MFNode)),new(r())(u().outputOnly,"pickedGeometry",new(s().MFNode))]),enumerable:!0}});const ke=we;y().add("VolumePickSensor","x_ite/Components/Picking/VolumePickSensor",ke);const Se=ke;i().add({name:"Picking",concreteNodes:[W,ie,ue,_e,Se],abstractNodes:[z,$]});const fe=void 0;y().add("Picking","assets/components/Picking",fe)})();
|