x_ite 5.0.0 → 5.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. package/dist/assets/components/annotation.js +2 -2
  2. package/dist/assets/components/annotation.min.js +1 -1
  3. package/dist/assets/components/cad-geometry.js +2 -2
  4. package/dist/assets/components/cad-geometry.min.js +1 -1
  5. package/dist/assets/components/cube-map-texturing.js +2 -2
  6. package/dist/assets/components/cube-map-texturing.min.js +1 -1
  7. package/dist/assets/components/dis.js +2 -2
  8. package/dist/assets/components/dis.min.js +1 -1
  9. package/dist/assets/components/event-utilities.js +2 -2
  10. package/dist/assets/components/event-utilities.min.js +1 -1
  11. package/dist/assets/components/geometry2d.js +2 -2
  12. package/dist/assets/components/geometry2d.min.js +1 -1
  13. package/dist/assets/components/geospatial.js +2 -2
  14. package/dist/assets/components/geospatial.min.js +1 -1
  15. package/dist/assets/components/h-anim.js +2 -2
  16. package/dist/assets/components/h-anim.min.js +1 -1
  17. package/dist/assets/components/key-device-sensor.js +2 -2
  18. package/dist/assets/components/key-device-sensor.min.js +1 -1
  19. package/dist/assets/components/layout.js +2 -2
  20. package/dist/assets/components/layout.min.js +1 -1
  21. package/dist/assets/components/nurbs.js +2 -2
  22. package/dist/assets/components/nurbs.min.js +1 -1
  23. package/dist/assets/components/particle-systems.js +2 -2
  24. package/dist/assets/components/particle-systems.min.js +1 -1
  25. package/dist/assets/components/picking.js +2 -2
  26. package/dist/assets/components/picking.min.js +1 -1
  27. package/dist/assets/components/projective-texture-mapping.js +2 -2
  28. package/dist/assets/components/projective-texture-mapping.min.js +1 -1
  29. package/dist/assets/components/rigid-body-physics.js +2 -2
  30. package/dist/assets/components/rigid-body-physics.min.js +1 -1
  31. package/dist/assets/components/scripting.js +2 -2
  32. package/dist/assets/components/scripting.min.js +1 -1
  33. package/dist/assets/components/texturing-3d.js +2 -2
  34. package/dist/assets/components/texturing-3d.min.js +1 -1
  35. package/dist/assets/components/volume-rendering.js +2 -2
  36. package/dist/assets/components/volume-rendering.min.js +1 -1
  37. package/dist/assets/components/x_ite.js +2 -2
  38. package/dist/assets/components/x_ite.min.js +1 -1
  39. package/dist/assets/shaders/webgl1/Phong.fs +3 -3
  40. package/dist/assets/shaders/webgl2/Phong.fs +3 -3
  41. package/dist/example.html +2 -2
  42. package/dist/x_ite.css +2 -2
  43. package/dist/x_ite.js +14 -45
  44. package/dist/x_ite.min.js +4 -4
  45. package/dist/x_ite.zip +0 -0
  46. package/docs/_config.yml +1 -1
  47. package/docs/index.md +2 -2
  48. package/package.json +3 -3
  49. package/src/assets/shaders/webgl1/Phong.fs +3 -3
  50. package/src/assets/shaders/webgl2/Phong.fs +3 -3
  51. package/src/x_ite/Base/X3DBaseNode.js +8 -2
  52. package/src/x_ite/Browser/NURBS/NURBS.js +51 -51
  53. package/src/x_ite/Browser/VERSION.js +1 -1
  54. package/src/x_ite/Components/Grouping/X3DGroupingNode.js +17 -16
  55. package/src/x_ite/Components/NURBS/Contour2D.js +53 -14
  56. package/src/x_ite/Components/NURBS/ContourPolyline2D.js +15 -12
  57. package/src/x_ite/Components/NURBS/NurbsCurve2D.js +9 -9
  58. package/src/x_ite/Components/NURBS/NurbsOrientationInterpolator.js +9 -9
  59. package/src/x_ite/Components/NURBS/NurbsPositionInterpolator.js +6 -6
  60. package/src/x_ite/Components/NURBS/NurbsSet.js +31 -27
  61. package/src/x_ite/Components/NURBS/NurbsSurfaceInterpolator.js +10 -10
  62. package/src/x_ite/Components/NURBS/NurbsSweptSurface.js +5 -5
  63. package/src/x_ite/Components/NURBS/NurbsSwungSurface.js +4 -4
  64. package/src/x_ite/Components/NURBS/NurbsTextureCoordinate.js +6 -6
  65. package/src/x_ite/Components/NURBS/NurbsTrimmedSurface.js +46 -7
  66. package/src/x_ite/Components/NURBS/X3DNurbsSurfaceGeometryNode.js +30 -32
  67. package/src/x_ite/Components/Shape/Material.js +0 -20
  68. package/src/x_ite/Components/Shape/PhysicalMaterial.js +0 -12
  69. package/src/x_ite/Components/Shape/X3DOneSidedMaterialNode.js +0 -8
@@ -1 +1 @@
1
- !function(){const e=window[Symbol.for("X_ITE.X3D-5.0.0")].define,t=window[Symbol.for("X_ITE.X3D-5.0.0")].require;e("x_ite/Components/ParticleSystems/X3DParticleEmitterNode",["x_ite/Components/Core/X3DNode","x_ite/Base/X3DConstants","standard/Math/Numbers/Vector3","standard/Math/Numbers/Rotation4","standard/Math/Geometry/Line3","standard/Math/Geometry/Plane3","standard/Math/Algorithm","standard/Math/Algorithms/QuickSort"],(function(e,t,i,s,r,n,o,a){"use strict";var l=new i(0,0,0),h=new i(0,0,0),d=new r(i.Zero,i.zAxis),c=new n(i.Zero,i.zAxis);function u(e,t){return c.getDistanceToPoint(e)<c.getDistanceToPoint(t)}function m(e,t){return e<c.getDistanceToPoint(t)}function f(i){e.call(this,i),this.addType(t.X3DParticleEmitterNode),this._speed.setUnit("speed"),this._mass.setUnit("mass"),this._surfaceArea.setUnit("area"),this.rotations=[],this.intersections=[],this.intersectionNormals=[],this.sorter=new a(this.intersections,u)}return f.prototype=Object.assign(Object.create(e.prototype),{constructor:f,initialize:function(){e.prototype.initialize.call(this),this._speed.addInterest("set_speed__",this),this._variation.addInterest("set_variation__",this),this._mass.addInterest("set_mass__",this),this.set_speed__(),this.set_variation__(),this.set_mass__()},set_speed__:function(){this.speed=this._speed.getValue()},set_variation__:function(){this.variation=this._variation.getValue()},set_mass__:function(){this.mass=this._mass.getValue()},isExplosive:function(){return!1},getMass:function(){return this.mass},getRandomLifetime:function(e,t){var i=e*t,s=Math.max(0,e-i),r=e+i;return Math.random()*(r-s)+s},getRandomSpeed:function(){var e=this.speed,t=e*this.variation,i=Math.max(0,e-t),s=e+t;return Math.random()*(s-i)+i},getSphericalRandomVelocity:function(e){return this.getRandomNormal(e).multiply(this.getRandomSpeed())},getRandomValue:function(e,t){return Math.random()*(t-e)+e},getRandomNormal:function(e){var t=this.getRandomValue(-1,1)*Math.PI,i=this.getRandomValue(-1,1),s=Math.acos(i),r=Math.sin(s);return e.set(Math.sin(t)*r,Math.cos(t)*r,i)},getRandomNormalWithAngle:function(e,t){var i=(2*Math.random()-1)*Math.PI,s=this.getRandomValue(Math.cos(e),1),r=Math.acos(s),n=Math.sin(r);return t.set(Math.sin(i)*n,Math.cos(i)*n,s)},getRandomNormalWithDirectionAndAngle:function(e,t,s){return rotation.setFromToVec(i.zAxis,e),rotation.multVecRot(this.getRandomNormalWithAngle(t,s))},getRandomSurfaceNormal:function(e){var t=this.getRandomValue(-1,1)*Math.PI,i=Math.pow(Math.random(),1/3),s=Math.acos(i),r=Math.sin(s);return e.set(Math.sin(t)*r,Math.cos(t)*r,i)},animate:function(e,t){for(var r=e.particles,n=e.numParticles,o=e.createParticles,a=e.particleLifetime,d=e.lifetimeVariation,c=e.speeds,u=e.velocities,m=e.turbulences,f=this.rotations,p=e.numForces,_=e.boundedVertices.length,y=e.boundedVolume,g=f.length;g<p;++g)f[g]=new s(0,0,1,0);for(g=0;g<p;++g)f[g].setFromToVec(i.zAxis,u[g]);for(g=0;g<n;++g){var x=r[g],A=x.elapsedTime+t;if(A>x.lifetime)x.lifetime=this.getRandomLifetime(a,d),x.elapsedTime=0,o?(++x.life,this.getRandomPosition(x.position),this.getRandomVelocity(x.velocity)):x.position.set(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY);else{for(var F=x.position,w=x.velocity,R=0;R<p;++R)w.add(f[R].multVecRot(this.getRandomNormalWithAngle(m[R],l)).multiply(c[R]));_?(h.x=F.x,h.y=F.y,h.z=F.z,F.x+=w.x*t,F.y+=w.y*t,F.z+=w.z*t,this.bounce(y,h,F,w)):(F.x+=w.x*t,F.y+=w.y*t,F.z+=w.z*t),x.elapsedTime=A}}e.geometryContext.colorMaterial&&this.getColors(r,e.colorKeys,e.colorRamp,n)},bounce:function(e,t,i,s){l.assign(s).normalize(),d.set(t,l);var r=this.intersections,n=this.intersectionNormals,a=e.intersectsLine(d,r,n);if(a){for(var h=0;h<a;++h)r[h].index=h;c.set(t,l),this.sorter.sort(0,a);var u=o.upperBound(r,0,a,0,m);if(u<a){var f=r[u],p=n[f.index];if(c.set(f,p),c.getDistanceToPoint(t)*c.getDistanceToPoint(i)<0){var _=2*p.dot(s);s.x-=p.x*_,s.y-=p.y*_,s.z-=p.z*_,l.assign(s).normalize();var y=f.distance(t);i.x=f.x+l.x*y,i.y=f.y+l.y*y,i.z=f.z+l.z*y}}}},getColors:function(e,t,i,s){for(var r=t.length,n=0,a=0,l=0,h=0;h<s;++h){var d=e[h],c=d.elapsedTime/d.lifetime,u=d.color;if(1==r||c<=t[0])n=0,a=0,l=0;else if(c>=t[r-1])n=r-2,a=r-1,l=1;else{var m=o.upperBound(t,0,r,c,o.less);if(m<r){a=m;var f=t[n=m-1],p=t[a];l=o.clamp((c-f)/(p-f),0,1)}else n=0,a=0,l=0}var _=i[n],y=i[a];u.x=_.x+l*(y.x-_.x),u.y=_.y+l*(y.y-_.y),u.z=_.z+l*(y.z-_.z),u.w=_.w+l*(y.w-_.w)}}}),f})),e("x_ite/Components/ParticleSystems/PointEmitter",["x_ite/Fields","x_ite/Base/X3DFieldDefinition","x_ite/Base/FieldDefinitionArray","x_ite/Components/ParticleSystems/X3DParticleEmitterNode","x_ite/Base/X3DConstants","standard/Math/Numbers/Vector3"],(function(e,t,i,s,r,n){"use strict";function o(e){s.call(this,e),this.addType(r.PointEmitter),this._position.setUnit("length"),this._speed.setUnit("speed"),this._mass.setUnit("mass"),this._surfaceArea.setUnit("area"),this.direction=new n(0,0,0)}return o.prototype=Object.assign(Object.create(s.prototype),{constructor:o,[Symbol.for("X_ITE.X3DBaseNode.fieldDefinitions")]:new i([new t(r.inputOutput,"metadata",new e.SFNode),new t(r.inputOutput,"position",new e.SFVec3f),new t(r.inputOutput,"direction",new e.SFVec3f(0,1,0)),new t(r.inputOutput,"speed",new e.SFFloat),new t(r.inputOutput,"variation",new e.SFFloat(.25)),new t(r.initializeOnly,"mass",new e.SFFloat),new t(r.initializeOnly,"surfaceArea",new e.SFFloat)]),getTypeName:function(){return"PointEmitter"},getComponentName:function(){return"ParticleSystems"},getContainerField:function(){return"emitter"},initialize:function(){s.prototype.initialize.call(this),this._position.addInterest("set_position__",this),this._direction.addInterest("set_direction__",this),this.set_position__(),this.set_direction__()},set_position__:function(){this.position=this._position.getValue()},set_direction__:function(){this.direction.assign(this._direction.getValue()).normalize(),this.direction.equals(n.Zero)?this.getRandomVelocity=this.getSphericalRandomVelocity:delete this.getRandomVelocity},getRandomPosition:function(e){return e.assign(this.position)},getRandomVelocity:function(e){var t=this.direction,i=this.getRandomSpeed();return e.x=t.x*i,e.y=t.y*i,e.z=t.z*i,e}}),o})),e("x_ite/Browser/ParticleSystems/X3DParticleSystemsContext",["x_ite/Components/ParticleSystems/PointEmitter"],(function(e){"use strict";const t=Symbol();function i(){}return i.prototype={getDefaultEmitter:function(){return this[t]=new e(this.getPrivateScene()),this[t].setup(),this.getDefaultEmitter=function(){return this[t]},Object.defineProperty(this,"getDefaultEmitter",{enumerable:!1}),v,this[t]}},i})),e("x_ite/Components/ParticleSystems/X3DParticlePhysicsModelNode",["x_ite/Components/Core/X3DNode","x_ite/Base/X3DConstants"],(function(e,t){"use strict";function i(i){e.call(this,i),this.addType(t.X3DParticlePhysicsModelNode)}return i.prototype=Object.assign(Object.create(e.prototype),{constructor:i,addForce:function(){}}),i})),e("x_ite/Components/ParticleSystems/BoundedPhysicsModel",["x_ite/Fields","x_ite/Base/X3DFieldDefinition","x_ite/Base/FieldDefinitionArray","x_ite/Components/ParticleSystems/X3DParticlePhysicsModelNode","x_ite/Base/X3DConstants","x_ite/Base/X3DCast"],(function(e,t,i,s,r,n){"use strict";function o(e){s.call(this,e),this.addType(r.BoundedPhysicsModel)}return o.prototype=Object.assign(Object.create(s.prototype),{constructor:o,[Symbol.for("X_ITE.X3DBaseNode.fieldDefinitions")]:new i([new t(r.inputOutput,"metadata",new e.SFNode),new t(r.inputOutput,"enabled",new e.SFBool(!0)),new t(r.inputOutput,"geometry",new e.SFNode)]),getTypeName:function(){return"BoundedPhysicsModel"},getComponentName:function(){return"ParticleSystems"},getContainerField:function(){return"physics"},initialize:function(){s.prototype.initialize.call(this),this._geometry.addInterest("set_geometry__",this),this.set_geometry__()},set_geometry__:function(){this.geometryNode&&this.geometryNode._rebuild.removeInterest("addNodeEvent",this),this.geometryNode=n(r.X3DGeometryNode,this._geometry),this.geometryNode&&this.geometryNode._rebuild.addInterest("addNodeEvent",this)},addGeometry:function(e,t){if(this.geometryNode){for(var i=this.geometryNode.getNormals().getValue(),s=this.geometryNode.getVertices().getValue(),r=0,n=i.length;r<n;++r)e.push(i[r]);for(r=0,n=s.length;r<n;++r)t.push(s[r])}}}),o})),e("x_ite/Components/ParticleSystems/ConeEmitter",["x_ite/Fields","x_ite/Base/X3DFieldDefinition","x_ite/Base/FieldDefinitionArray","x_ite/Components/ParticleSystems/X3DParticleEmitterNode","x_ite/Base/X3DConstants","standard/Math/Numbers/Vector3","standard/Math/Numbers/Rotation4"],(function(e,t,i,s,r,n,o){"use strict";function a(e){s.call(this,e),this.addType(r.ConeEmitter),this._position.setUnit("length"),this._angle.setUnit("angle"),this._speed.setUnit("speed"),this._mass.setUnit("mass"),this._surfaceArea.setUnit("area"),this.rotation=new o(0,0,1,0)}return a.prototype=Object.assign(Object.create(s.prototype),{constructor:a,[Symbol.for("X_ITE.X3DBaseNode.fieldDefinitions")]:new i([new t(r.inputOutput,"metadata",new e.SFNode),new t(r.inputOutput,"position",new e.SFVec3f),new t(r.inputOutput,"direction",new e.SFVec3f(0,1,0)),new t(r.inputOutput,"angle",new e.SFFloat(.7854)),new t(r.inputOutput,"speed",new e.SFFloat),new t(r.inputOutput,"variation",new e.SFFloat(.25)),new t(r.initializeOnly,"mass",new e.SFFloat),new t(r.initializeOnly,"surfaceArea",new e.SFFloat)]),getTypeName:function(){return"ConeEmitter"},getComponentName:function(){return"ParticleSystems"},getContainerField:function(){return"emitter"},initialize:function(){s.prototype.initialize.call(this),this._position.addInterest("set_position__",this),this._direction.addInterest("set_direction__",this),this._angle.addInterest("set_angle__",this),this.set_position__(),this.set_direction__(),this.set_angle__()},set_position__:function(){this.position=this._position.getValue()},set_direction__:function(){var e=this._direction.getValue();this.rotation.setFromToVec(n.zAxis,e),e.equals(n.Zero)?this.getRandomVelocity=this.getSphericalRandomVelocity:delete this.getRandomVelocity},set_angle__:function(){this.angle=this._angle.getValue()},getRandomPosition:function(e){return e.assign(this.position)},getRandomVelocity:function(e){return this.rotation.multVecRot(this.getRandomNormalWithAngle(this.angle,e).multiply(this.getRandomSpeed()))}}),a})),e("x_ite/Components/ParticleSystems/ExplosionEmitter",["x_ite/Fields","x_ite/Base/X3DFieldDefinition","x_ite/Base/FieldDefinitionArray","x_ite/Components/ParticleSystems/X3DParticleEmitterNode","x_ite/Base/X3DConstants"],(function(e,t,i,s,r){"use strict";function n(e){s.call(this,e),this.addType(r.ExplosionEmitter),this._position.setUnit("length"),this._speed.setUnit("speed"),this._mass.setUnit("mass"),this._surfaceArea.setUnit("area"),this.getRandomVelocity=this.getSphericalRandomVelocity}return n.prototype=Object.assign(Object.create(s.prototype),{constructor:n,[Symbol.for("X_ITE.X3DBaseNode.fieldDefinitions")]:new i([new t(r.inputOutput,"metadata",new e.SFNode),new t(r.inputOutput,"position",new e.SFVec3f),new t(r.inputOutput,"speed",new e.SFFloat),new t(r.inputOutput,"variation",new e.SFFloat(.25)),new t(r.initializeOnly,"mass",new e.SFFloat),new t(r.initializeOnly,"surfaceArea",new e.SFFloat)]),getTypeName:function(){return"ExplosionEmitter"},getComponentName:function(){return"ParticleSystems"},getContainerField:function(){return"emitter"},initialize:function(){s.prototype.initialize.call(this),this._position.addInterest("set_position__",this),this.set_position__()},set_position__:function(){this.position=this._position.getValue()},isExplosive:function(){return!0},getRandomPosition:function(e){return e.assign(this.position)}}),n})),e("x_ite/Components/ParticleSystems/ForcePhysicsModel",["x_ite/Fields","x_ite/Base/X3DFieldDefinition","x_ite/Base/FieldDefinitionArray","x_ite/Components/ParticleSystems/X3DParticlePhysicsModelNode","x_ite/Base/X3DConstants"],(function(e,t,i,s,r){"use strict";function n(e){s.call(this,e),this.addType(r.ForcePhysicsModel),this._force.setUnit("force")}return n.prototype=Object.assign(Object.create(s.prototype),{constructor:n,[Symbol.for("X_ITE.X3DBaseNode.fieldDefinitions")]:new i([new t(r.inputOutput,"metadata",new e.SFNode),new t(r.inputOutput,"enabled",new e.SFBool(!0)),new t(r.inputOutput,"force",new e.SFVec3f(0,-9.8,0))]),getTypeName:function(){return"ForcePhysicsModel"},getComponentName:function(){return"ParticleSystems"},getContainerField:function(){return"physics"},addForce:function(e,t,i,s){this._enabled.getValue()&&(i[e].assign(this._force.getValue()),s[e]=0)}}),n})),e("standard/Math/Utility/BVH",["standard/Math/Numbers/Vector3","standard/Math/Geometry/Plane3","standard/Math/Algorithms/QuickSort"],(function(e,t,i){"use strict";const s=new e(0,0,0),r=new e(0,0,0),n=new e(0,0,0),o={u:0,v:0,t:0},a=[new e(0,0,1),new e(0,0,-1),new e(0,1,0),new e(0,-1,0),new e(1,0,0)];function l(e,t){this.vertices=e.vertices,this.normals=e.normals,this.i4=12*t,this.i3=9*t}function h(i,o,d,c){this.min=new e(0,0,0),this.max=new e(0,0,0),this.planes=[],this.intersection=new e(0,0,0);const u=i.vertices,m=this.min,f=this.max,p=d+c;let _=12*o[d];m.set(u[_],u[_+1],u[_+2]),f.assign(m);for(let e=d;e<p;++e)_=12*o[e],s.set(u[_],u[_+1],u[_+2]),r.set(u[_+4],u[_+5],u[_+6]),n.set(u[_+8],u[_+9],u[_+10]),m.min(s,r,n),f.max(s,r,n);for(let e=0;e<5;++e)this.planes[e]=new t(e%2?m:f,a[e]);if(c>2){i.sorter.compare.axis=this.getLongestAxis(m,f),i.sorter.sort(d,p);var y=c>>>1}else y=1;const g=c-y;this.left=y>1?new h(i,o,d,y):new l(i,o[d]),this.right=g>1?new h(i,o,d+y,g):new l(i,o[d+y])}function d(e,t){this.vertices=e,this.normals=t;const s=e.length/12;switch(s){case 0:this.root=null;break;case 1:this.root=new l(this,0);break;default:{const t=[];for(let e=0;e<s;++e)t.push(e);this.sorter=new i(t,function(e,t){function i(e,s){const r=i.vertices;return t=i.axis,Math.min(r[e+t],r[e+4+t],r[e+8+t])<Math.min(r[s+t],r[s+4+t],r[s+8+t])}return i.vertices=e,i.axis=t,i}(e,0)),this.root=new h(this,t,0,s);break}}}return l.prototype={intersectsLine:function(t,i,a){const l=this.vertices,h=this.normals,d=this.i4,c=this.i3;if(s.x=l[d],s.y=l[d+1],s.z=l[d+2],r.x=l[d+4],r.y=l[d+5],r.z=l[d+6],n.x=l[d+8],n.y=l[d+9],n.z=l[d+10],t.intersectsTriangle(s,r,n,o)){const t=o.u,s=o.v,r=1-t-s,n=i.size++;n>=i.length&&i.push(new e(0,0,0)),i[n].set(r*l[d]+t*l[d+4]+s*l[d+8],r*l[d+1]+t*l[d+5]+s*l[d+9],r*l[d+2]+t*l[d+6]+s*l[d+10]),a&&(n>=a.length&&a.push(new e(0,0,0)),a[n].set(r*h[c]+t*h[c+3]+s*h[c+6],r*h[c+1]+t*h[c+4]+s*h[c+7],r*h[c+2]+t*h[c+5]+s*h[c+8]))}}},h.prototype={intersectsLine:function(e,t,i){this.intersectsBBox(e)&&(this.left.intersectsLine(e,t,i),this.right.intersectsLine(e,t,i))},intersectsBBox:function(e){const t=this.planes,i=this.min,s=this.max,r=i.x,n=s.x,o=i.y,a=s.y,l=i.z,h=s.z,d=this.intersection;return!!(t[0].intersectsLine(e,d)&&d.x>=r&&d.x<=n&&d.y>=o&&d.y<=a)||(!!(t[1].intersectsLine(e,d)&&d.x>=r&&d.x<=n&&d.y>=o&&d.y<=a)||(!!(t[2].intersectsLine(e,d)&&d.x>=r&&d.x<=n&&d.z>=l&&d.z<=h)||(!!(t[3].intersectsLine(e,d)&&d.x>=r&&d.x<=n&&d.z>=l&&d.z<=h)||!!(t[4].intersectsLine(e,d)&&d.y>=o&&d.y<=a&&d.z>=l&&d.z<=h))))},getLongestAxis:function(e,t){const i=t.x-e.x,s=t.y-e.y,r=t.z-e.z;return i<s?s<r?2:1:i<r?2:0}},d.prototype={constructor:d,intersectsLine:function(e,t,i){return t.size=0,this.root?(this.root.intersectsLine(e,t,i),t.size):0}},d})),e("x_ite/Components/ParticleSystems/ParticleSystem",["x_ite/Fields","x_ite/Base/X3DFieldDefinition","x_ite/Base/FieldDefinitionArray","x_ite/Components/Shape/X3DShapeNode","x_ite/Rendering/TraverseType","x_ite/Base/X3DConstants","x_ite/Base/X3DCast","x_ite/Browser/Shape/AlphaMode","standard/Math/Numbers/Vector3","standard/Math/Numbers/Vector4","standard/Math/Numbers/Matrix4","standard/Math/Numbers/Matrix3","standard/Math/Algorithms/QuickSort","standard/Math/Algorithm","standard/Math/Utility/BVH"],(function(e,t,i,s,r,n,o,a,l,h,d,c,u,m,f){"use strict";var p=0;const _=p++,y=p++,g=p++,x=p++,A=p++,F=p++,w={POINT:_,LINE:y,TRIANGLE:g,QUAD:x,GEOMETRY:A,SPRITE:F},R=new d,b=new l(0,0,0),P=new l(0,0,0),S=new l(0,0,0),v=new l(0,0,0),B=new l(0,0,0),C=new l(0,0,0),N=new l(0,0,0),T=new l(0,0,0),D=new l(0,0,0),V=new l(0,0,0);function I(e,t){return e.distance<t.distance}function M(e){s.call(this,e),this.addType(n.ParticleSystem),this._particleSize.setUnit("length"),this.createParticles=!0,this.particles=[],this.velocities=[],this.speeds=[],this.turbulences=[],this.geometryType=_,this.maxParticles=0,this.numParticles=0,this.particleLifetime=0,this.lifetimeVariation=0,this.emitterNode=null,this.forcePhysicsModelNodes=[],this.boundedPhysicsModelNodes=[],this.boundedNormals=[],this.boundedVertices=[],this.boundedVolume=null,this.creationTime=0,this.pauseTime=0,this.deltaTime=0,this.numForces=0,this.colorKeys=[],this.colorRamppNode=null,this.colorRamp=[],this.texCoordKeys=[],this.texCoordRampNode=null,this.texCoordRamp=[],this.texCoordAnim=!1,this.vertexCount=0,this.shaderNode=null,this.rotation=new c,this.particleSorter=new u(this.particles,I),this.sortParticles=!1,this.geometryContext={}}return M.prototype=Object.assign(Object.create(s.prototype),{constructor:M,[Symbol.for("X_ITE.X3DBaseNode.fieldDefinitions")]:new i([new t(n.inputOutput,"metadata",new e.SFNode),new t(n.inputOutput,"enabled",new e.SFBool(!0)),new t(n.inputOutput,"createParticles",new e.SFBool(!0)),new t(n.initializeOnly,"geometryType",new e.SFString("QUAD")),new t(n.inputOutput,"maxParticles",new e.SFInt32(200)),new t(n.inputOutput,"particleLifetime",new e.SFFloat(5)),new t(n.inputOutput,"lifetimeVariation",new e.SFFloat(.25)),new t(n.inputOutput,"particleSize",new e.SFVec2f(.02,.02)),new t(n.initializeOnly,"emitter",new e.SFNode),new t(n.initializeOnly,"physics",new e.MFNode),new t(n.initializeOnly,"colorKey",new e.MFFloat),new t(n.initializeOnly,"colorRamp",new e.SFNode),new t(n.initializeOnly,"texCoordKey",new e.MFFloat),new t(n.initializeOnly,"texCoordRamp",new e.SFNode),new t(n.outputOnly,"isActive",new e.SFBool),new t(n.inputOutput,"visible",new e.SFBool(!0)),new t(n.inputOutput,"castShadow",new e.SFBool(!0)),new t(n.inputOutput,"bboxDisplay",new e.SFBool),new t(n.initializeOnly,"bboxSize",new e.SFVec3f(-1,-1,-1)),new t(n.initializeOnly,"bboxCenter",new e.SFVec3f),new t(n.inputOutput,"appearance",new e.SFNode),new t(n.inputOutput,"geometry",new e.SFNode)]),getTypeName:function(){return"ParticleSystem"},getComponentName:function(){return"ParticleSystems"},getContainerField:function(){return"children"},initialize:function(){s.prototype.initialize.call(this);const e=this.getBrowser(),t=e.getContext();this.isLive().addInterest("set_live__",this),e.getBrowserOptions()._Shading.addInterest("set_shader__",this),this._enabled.addInterest("set_enabled__",this),this._createParticles.addInterest("set_createParticles__",this),this._geometryType.addInterest("set_geometryType__",this),this._maxParticles.addInterest("set_enabled__",this),this._particleLifetime.addInterest("set_particleLifetime__",this),this._lifetimeVariation.addInterest("set_lifetimeVariation__",this),this._emitter.addInterest("set_emitter__",this),this._physics.addInterest("set_physics__",this),this._colorKey.addInterest("set_color__",this),this._colorRamp.addInterest("set_colorRamp__",this),this._texCoordKey.addInterest("set_texCoord__",this),this._texCoordRamp.addInterest("set_texCoordRamp__",this),this.idBuffer=t.createBuffer(),this.positionBuffer=t.createBuffer(),this.elapsedTimeBuffer=t.createBuffer(),this.lifeBuffer=t.createBuffer(),this.colorBuffer=t.createBuffer(),this.texCoordBuffers=[t.createBuffer()],this.normalBuffer=t.createBuffer(),this.vertexBuffer=t.createBuffer();for(var i=1,r=this.getBrowser().getMaxTextures();i<r;++i)this.texCoordBuffers.push(this.texCoordBuffers[0]);this.idArray=new Float32Array,this.positionArray=new Float32Array,this.elapsedTimeArray=new Float32Array,this.lifeArray=new Float32Array,this.colorArray=new Float32Array,this.texCoordArray=new Float32Array,this.normalArray=new Float32Array,this.vertexArray=new Float32Array,this.primitiveMode=t.TRIANGLES,this.geometryContext.fogCoords=!1,this.geometryContext.textureCoordinateNode=e.getDefaultTextureCoordinate(),this.geometryContext.textureCoordinateMapping=new Map,this.set_emitter__(),this.set_enabled__(),this.set_createParticles__(),this.set_particleLifetime__(),this.set_lifetimeVariation__(),this.set_physics__(),this.set_colorRamp__(),this.set_texCoordRamp__()},set_bbox__:function(){this._bboxSize.getValue().equals(this.getDefaultBBoxSize())?this.bbox.set():this.bbox.set(this._bboxSize.getValue(),this._bboxCenter.getValue()),this.bboxSize.assign(this.bbox.size),this.bboxCenter.assign(this.bbox.center)},set_transparent__:function(){if(this.getAppearance().getAlphaMode()===a.AUTO)if(this.geometryType===_)this.setTransparent(!0);else this.setTransparent(this.getAppearance().getTransparent()||this.colorRampNode&&this.colorRampNode.getTransparent()||this.geometryType===A&&this.geometryNode&&this.geometryNode.getTransparent());else this.setTransparent(this.getAppearance().getTransparent())},set_live__:function(){this.isLive().getValue()?this._isActive.getValue()&&this._maxParticles.getValue()&&(this.getBrowser().sensorEvents().addInterest("animateParticles",this),this.pauseTime&&(this.creationTime+=performance.now()/1e3-this.pauseTime,this.pauseTime=0)):this._isActive.getValue()&&this._maxParticles.getValue()&&(this.getBrowser().sensorEvents().removeInterest("animateParticles",this),0===this.pauseTime&&(this.pauseTime=performance.now()/1e3))},set_enabled__:function(){this._enabled.getValue()&&this._maxParticles.getValue()?this._isActive.getValue()||(this.isLive().getValue()?(this.getBrowser().sensorEvents().addInterest("animateParticles",this),this.pauseTime=0):this.pauseTime=performance.now()/1e3,this._isActive=!0):this._isActive.getValue()&&(this.isLive().getValue()&&this.getBrowser().sensorEvents().removeInterest("animateParticles",this),this._isActive=!1,this.numParticles=0),this.set_maxParticles__()},set_createParticles__:function(){this.createParticles=this._createParticles.getValue()},set_geometryType__:function(){var e=this.getBrowser().getContext(),t=this.maxParticles;switch(this.geometryType=w[this._geometryType.getValue()],this.geometryType||(this.geometryType=_),this.geometryType){case _:this.idArray=new Float32Array(t),this.positionArray=new Float32Array(3*t),this.elapsedTimeArray=new Float32Array(t),this.lifeArray=new Float32Array(t),this.colorArray=new Float32Array(4*t),this.texCoordArray=new Float32Array,this.normalArray=new Float32Array,this.vertexArray=new Float32Array(4*t);for(var i=0,s=(r=this.idArray).length;i<s;++i)r[i]=i;this.colorArray.fill(1),this.vertexArray.fill(1),this.testWireframe=!1,this.primitiveMode=e.POINTS,this.texCoordCount=0,this.vertexCount=1,this.geometryContext.geometryType=0;break;case y:this.idArray=new Float32Array(2*t),this.positionArray=new Float32Array(6*t),this.elapsedTimeArray=new Float32Array(2*t),this.lifeArray=new Float32Array(2*t),this.colorArray=new Float32Array(8*t),this.texCoordArray=new Float32Array,this.normalArray=new Float32Array,this.vertexArray=new Float32Array(8*t);for(i=0,s=(r=this.idArray).length;i<s;++i)r[i]=Math.floor(i/2);this.colorArray.fill(1),this.vertexArray.fill(1),this.testWireframe=!1,this.primitiveMode=e.LINES,this.texCoordCount=2,this.vertexCount=2,this.geometryContext.geometryType=1;break;case g:case x:case F:this.idArray=new Float32Array(6*t),this.positionArray=new Float32Array(18*t),this.elapsedTimeArray=new Float32Array(6*t),this.lifeArray=new Float32Array(6*t),this.colorArray=new Float32Array(24*t),this.texCoordArray=new Float32Array(24*t),this.normalArray=new Float32Array(18*t),this.vertexArray=new Float32Array(24*t);var r;for(i=0,s=(r=this.idArray).length;i<s;++i)r[i]=Math.floor(i/6);this.colorArray.fill(1),this.vertexArray.fill(1);for(var n=this.texCoordArray,o=this.normalArray,a=(i=0,18*t);i<a;i+=3)o[i]=0,o[i+1]=0,o[i+2]=1;e.bindBuffer(e.ARRAY_BUFFER,this.normalBuffer),e.bufferData(e.ARRAY_BUFFER,this.normalArray,e.STATIC_DRAW);for(i=0;i<t;++i){var l=24*i;n[l]=n[l+12]=0,n[l+1]=n[l+13]=0,n[l+2]=n[l+14]=0,n[l+3]=n[l+15]=1,n[l+4]=1,n[l+5]=0,n[l+6]=0,n[l+7]=1,n[l+8]=n[l+16]=1,n[l+9]=n[l+17]=1,n[l+10]=n[l+18]=0,n[l+11]=n[l+19]=1,n[l+20]=0,n[l+21]=1,n[l+22]=0,n[l+23]=1}e.bindBuffer(e.ARRAY_BUFFER,this.texCoordBuffers[0]),e.bufferData(e.ARRAY_BUFFER,this.texCoordArray,e.STATIC_DRAW),this.testWireframe=!0,this.primitiveMode=e.TRIANGLES,this.texCoordCount=4,this.vertexCount=6,this.geometryContext.geometryType=2;break;case A:this.texCoordCount=0,this.vertexCount=0}e.bindBuffer(e.ARRAY_BUFFER,this.idBuffer),e.bufferData(e.ARRAY_BUFFER,this.idArray,e.STATIC_DRAW),this.set_shader__(),this.set_transparent__()},set_shader__:function(){switch(this.geometryType){case _:this.shaderNode=this.getBrowser().getPointShader();break;case y:this.shaderNode=this.getBrowser().getLineShader();break;case g:case x:case F:case A:this.shaderNode=null}},set_maxParticles__:function(){for(var e=this.particles,t=Math.max(0,this._maxParticles.getValue()),i=this.numParticles,s=Math.min(e.length,t);i<s;++i)e[i].life=1,e[i].lifetime=-1;for(i=e.length,s=t;i<s;++i)e[i]={id:i,life:1,lifetime:-1,elapsedTime:0,position:new l(0,0,0),velocity:new l(0,0,0),color:new h(1,1,1,1),distance:0};this.maxParticles=t,this.numParticles=Math.min(this.numParticles,t),this.emitterNode.isExplosive()||(this.creationTime=performance.now()/1e3),this.set_geometryType__()},set_particleLifetime__:function(){this.particleLifetime=this._particleLifetime.getValue()},set_lifetimeVariation__:function(){this.lifetimeVariation=this._lifetimeVariation.getValue()},set_emitter__:function(){this.emitterNode=o(n.X3DParticleEmitterNode,this._emitter),this.emitterNode||(this.emitterNode=this.getBrowser().getDefaultEmitter()),this.createParticles=this._createParticles.getValue()},set_physics__:function(){for(var e=this._physics.getValue(),t=this.forcePhysicsModelNodes,i=this.boundedPhysicsModelNodes,s=0,r=i.length;s<r;++s)i[s].removeInterest("set_boundedPhysics__",this);t.length=0,i.length=0;for(s=0,r=e.length;s<r;++s)try{for(var o=e[s].getValue().getInnerNode(),a=o.getType(),l=a.length-1;l>=0;--l){switch(a[l]){case n.ForcePhysicsModel:case n.WindPhysicsModel:t.push(o);break;case n.BoundedPhysicsModel:o.addInterest("set_boundedPhysics__",this),i.push(o);break;default:continue}break}}catch(e){}this.set_boundedPhysics__()},set_boundedPhysics__:function(){var e=this.boundedPhysicsModelNodes,t=this.boundedNormals,i=this.boundedVertices;t.length=0,i.length=0;for(var s=0,r=e.length;s<r;++s)e[s].addGeometry(t,i);this.boundedVolume=new f(i,t)},set_colorRamp__:function(){this.colorRampNode&&this.colorRampNode.removeInterest("set_color__",this),this.colorRampNode=o(n.X3DColorNode,this._colorRamp),this.colorRampNode&&this.colorRampNode.addInterest("set_color__",this),this.set_color__(),this.set_transparent__()},set_color__:function(){for(var e=this._colorKey,t=this.colorKeys,i=this.colorRamp,s=0,r=e.length;s<r;++s)t[s]=e[s];t.length=r,this.colorRampNode&&this.colorRampNode.getVectors(this.colorRamp);for(s=i.length,r=e.length;s<r;++s)i[s]=new h(1,1,1,1);i.length=r,this.geometryContext.colorMaterial=!(!t.length||!this.colorRampNode)},set_texCoordRamp__:function(){this.texCoordRampNode&&this.texCoordRampNode.removeInterest("set_texCoord__",this),this.texCoordRampNode=o(n.X3DTextureCoordinateNode,this._texCoordRamp),this.texCoordRampNode&&this.texCoordRampNode.addInterest("set_texCoord__",this),this.set_texCoord__()},set_texCoord__:function(){for(var e=this._texCoordKey,t=this.texCoordKeys,i=this.texCoordRamp,s=0,r=e.length;s<r;++s)t[s]=e[s];t.length=r,this.texCoordRampNode&&this.texCoordRampNode.getTexCoord(i);for(s=i.length,r=e.length*this.texCoordCount;s<r;++s)i[s]=new h(0,0,0,0);i.length=r,this.texCoordAnim=!(!t.length||!this.texCoordRampNode)},intersectsBox:function(e,t){},animateParticles:function(){var e=this.emitterNode,t=1/Math.max(10,this.getBrowser().getCurrentFrameRate()),i=this.deltaTime=(14*this.deltaTime+t)/15;if(e.isExplosive()){var s=performance.now()/1e3,r=this.particleLifetime+this.particleLifetime*this.lifetimeVariation;0===this.numParticles||s-this.creationTime>r?(this.creationTime=s,this.numParticles=this.maxParticles,this.createParticles=this._createParticles.getValue(),i=Number.POSITIVE_INFINITY):this.createParticles=!1}else if(this.numParticles<this.maxParticles){s=performance.now()/1e3;var n=Math.max(0,Math.floor((s-this.creationTime)*this.maxParticles/this.particleLifetime));n&&(this.creationTime=s),this.numParticles=Math.floor(Math.min(this.maxParticles,this.numParticles+n))}if(e.getMass()){for(var o=this.forcePhysicsModelNodes,a=this.velocities,h=this.speeds,d=this.turbulences,c=this.deltaTime/e.getMass(),u=a.length,m=o.length;u<m;++u)a[u]=new l(0,0,0);for(u=0,m=o.length;u<m;++u)o[u].addForce(u,e,a,d);for(u=0,m=a.length;u<m;++u)a[u].multiply(c),h[u]=a[u].abs();this.numForces=m}else this.numForces=0;e.animate(this,i),this.updateGeometry(null),this.getBrowser().addBrowserEvent()},updateGeometry:function(e){switch(this.geometryType){case _:e||this.updatePoint();break;case y:e||this.updateLine();break;case g:case x:case F:this.updateQuad(e)}},updatePoint:function(){var e=this.getBrowser().getContext(),t=this.particles,i=this.numParticles,s=this.positionArray,r=this.elapsedTimeArray,n=this.lifeArray,o=this.colorArray,a=this.vertexArray;if(this.geometryContext.colorMaterial){for(var l=0;l<i;++l){var h=t[l].color;o[m=4*l]=h.x,o[m+1]=h.y,o[m+2]=h.z,o[m+3]=h.w}e.bindBuffer(e.ARRAY_BUFFER,this.colorBuffer),e.bufferData(e.ARRAY_BUFFER,this.colorArray,e.STATIC_DRAW)}for(l=0;l<i;++l){var d=t[l].position,c=t[l].elapsedTime/t[l].lifetime,u=3*l,m=4*l;s[u]=d.x,s[u+1]=d.y,s[u+2]=d.z,r[l]=c,n[l]=t[l].life,a[m]=d.x,a[m+1]=d.y,a[m+2]=d.z}e.bindBuffer(e.ARRAY_BUFFER,this.positionBuffer),e.bufferData(e.ARRAY_BUFFER,this.positionArray,e.STATIC_DRAW),e.bindBuffer(e.ARRAY_BUFFER,this.elapsedTimeBuffer),e.bufferData(e.ARRAY_BUFFER,this.elapsedTimeArray,e.STATIC_DRAW),e.bindBuffer(e.ARRAY_BUFFER,this.lifeBuffer),e.bufferData(e.ARRAY_BUFFER,this.lifeArray,e.STATIC_DRAW),e.bindBuffer(e.ARRAY_BUFFER,this.vertexBuffer),e.bufferData(e.ARRAY_BUFFER,this.vertexArray,e.STATIC_DRAW)},updateLine:function(){var e=this.getBrowser().getContext(),t=this.particles,i=this.numParticles,s=this.positionArray,r=this.elapsedTimeArray,n=this.lifeArray,o=this.colorArray,a=this.vertexArray,l=this._particleSize.y/2;if(this.geometryContext.colorMaterial){for(var h=0;h<i;++h){var d=t[h].color;o[A=8*h]=d.x,o[A+1]=d.y,o[A+2]=d.z,o[A+3]=d.w,o[A+4]=d.x,o[A+5]=d.y,o[A+6]=d.z,o[A+7]=d.w}e.bindBuffer(e.ARRAY_BUFFER,this.colorBuffer),e.bufferData(e.ARRAY_BUFFER,this.colorArray,e.STATIC_DRAW)}for(h=0;h<i;++h){var c=t[h],u=c.position,m=t[h].elapsedTime/t[h].lifetime,f=t[h].life,p=u.x,_=u.y,y=u.z,g=2*h,x=6*h,A=8*h;s[x]=p,s[x+1]=_,s[x+2]=y,s[x+3]=p,s[x+4]=_,s[x+5]=y,r[g]=m,r[g+1]=m,n[g]=f,n[g+1]=f,v.assign(c.velocity).normalize().multiply(l),a[A]=p-v.x,a[A+1]=_-v.y,a[A+2]=y-v.z,a[A+4]=p+v.x,a[A+5]=_+v.y,a[A+6]=y+v.z}e.bindBuffer(e.ARRAY_BUFFER,this.positionBuffer),e.bufferData(e.ARRAY_BUFFER,this.positionArray,e.STATIC_DRAW),e.bindBuffer(e.ARRAY_BUFFER,this.elapsedTimeBuffer),e.bufferData(e.ARRAY_BUFFER,this.elapsedTimeArray,e.STATIC_DRAW),e.bindBuffer(e.ARRAY_BUFFER,this.lifeBuffer),e.bufferData(e.ARRAY_BUFFER,this.lifeArray,e.STATIC_DRAW),e.bindBuffer(e.ARRAY_BUFFER,this.vertexBuffer),e.bufferData(e.ARRAY_BUFFER,this.vertexArray,e.STATIC_DRAW)},updateQuad:function(e){try{var t=this.getBrowser().getContext(),i=this.particles,s=this.maxParticles,r=this.numParticles,n=this.positionArray,o=this.elapsedTimeArray,a=this.lifeArray,l=this.colorArray,h=this.texCoordArray,d=this.normalArray,c=this.vertexArray,u=this._particleSize.x/2,f=this._particleSize.y/2;if(!e){if(this.geometryContext.colorMaterial){for(var p=0;p<s;++p){var _=i[p].color;l[G=24*p]=l[G+4]=l[G+8]=l[G+12]=l[G+16]=l[G+20]=_.x,l[G+1]=l[G+5]=l[G+9]=l[G+13]=l[G+17]=l[G+21]=_.y,l[G+2]=l[G+6]=l[G+10]=l[G+14]=l[G+18]=l[G+22]=_.z,l[G+3]=l[G+7]=l[G+11]=l[G+15]=l[G+19]=l[G+23]=_.w}t.bindBuffer(t.ARRAY_BUFFER,this.colorBuffer),t.bufferData(t.ARRAY_BUFFER,this.colorArray,t.STATIC_DRAW)}if(this.texCoordAnim&&this.texCoordArray.length){var y=this.texCoordKeys,g=this.texCoordRamp,x=y.length,A=0;for(p=0;p<s;++p){var w=i[p],R=w.elapsedTime/w.lifetime;if(1==x||R<=y[0])A=0;else if(R>=y.at(-1))A=x-2;else{var b=m.upperBound(y,0,x,R,m.less);A=b<x?b-1:0}var P=g[A*=this.texCoordCount],D=g[A+1],V=g[A+2],I=g[A+3];h[G=24*p]=h[G+12]=P.x,h[G+1]=h[G+13]=P.y,h[G+2]=h[G+14]=P.z,h[G+3]=h[G+15]=P.w,h[G+4]=D.x,h[G+5]=D.y,h[G+6]=D.z,h[G+7]=D.w,h[G+8]=h[G+16]=V.x,h[G+9]=h[G+17]=V.y,h[G+10]=h[G+18]=V.z,h[G+11]=h[G+19]=V.w,h[G+20]=I.x,h[G+21]=I.y,h[G+22]=I.z,h[G+23]=I.w}t.bindBuffer(t.ARRAY_BUFFER,this.texCoordBuffers[0]),t.bufferData(t.ARRAY_BUFFER,this.texCoordArray,t.STATIC_DRAW)}}if(this.geometryType===F){if(e){var M=this.getScreenAlignedRotation(e);v.set(M[0],M[1],M[2]).cross(S.set(M[3],M[4],M[5])).normalize();var z=v.x,E=v.y,O=v.z;for(p=0,x=18*s;p<x;p+=3)d[p]=z,d[p+1]=E,d[p+2]=O;t.bindBuffer(t.ARRAY_BUFFER,this.normalBuffer),t.bufferData(t.ARRAY_BUFFER,this.normalArray,t.STATIC_DRAW),B.set(-u,-f,0),C.set(u,-f,0),N.set(u,f,0),T.set(-u,f,0),M.multVecMatrix(B),M.multVecMatrix(C),M.multVecMatrix(N),M.multVecMatrix(T);for(p=0;p<r;++p){var U=i[p].position,X=i[p].elapsedTime/i[p].lifetime,Y=U.x,L=U.y,W=U.z,j=6*p,G=24*p;n[k=18*p]=n[k+3]=n[k+6]=n[k+9]=n[k+12]=n[k+15]=Y,n[k+1]=n[k+4]=n[k+7]=n[k+10]=n[k+13]=n[k+16]=L,n[k+2]=n[k+5]=n[k+8]=n[k+11]=n[k+14]=n[k+17]=W,o[j]=o[j+1]=o[j+2]=o[j+3]=o[j+4]=o[j+5]=X,a[j]=a[j+1]=a[j+2]=a[j+3]=a[j+4]=a[j+5]=i[p].life,c[G]=c[G+12]=Y+B.x,c[G+1]=c[G+13]=L+B.y,c[G+2]=c[G+14]=W+B.z,c[G+4]=Y+C.x,c[G+5]=L+C.y,c[G+6]=W+C.z,c[G+8]=c[G+16]=Y+N.x,c[G+9]=c[G+17]=L+N.y,c[G+10]=c[G+18]=W+N.z,c[G+20]=Y+T.x,c[G+21]=L+T.y,c[G+22]=W+T.z}t.bindBuffer(t.ARRAY_BUFFER,this.positionBuffer),t.bufferData(t.ARRAY_BUFFER,this.positionArray,t.STATIC_DRAW),t.bindBuffer(t.ARRAY_BUFFER,this.elapsedTimeBuffer),t.bufferData(t.ARRAY_BUFFER,this.elapsedTimeArray,t.STATIC_DRAW),t.bindBuffer(t.ARRAY_BUFFER,this.lifeBuffer),t.bufferData(t.ARRAY_BUFFER,this.lifeArray,t.STATIC_DRAW),t.bindBuffer(t.ARRAY_BUFFER,this.vertexBuffer),t.bufferData(t.ARRAY_BUFFER,this.vertexArray,t.STATIC_DRAW)}}else if(!e){for(p=0;p<r;++p){var k;U=i[p].position,X=i[p].elapsedTime/i[p].lifetime,Y=U.x,L=U.y,W=U.z,j=6*p,G=24*p;n[k=18*p]=n[k+3]=n[k+6]=n[k+9]=n[k+12]=n[k+15]=Y,n[k+1]=n[k+4]=n[k+7]=n[k+10]=n[k+13]=n[k+16]=L,n[k+2]=n[k+5]=n[k+8]=n[k+11]=n[k+14]=n[k+17]=W,o[j]=o[j+1]=o[j+2]=o[j+3]=o[j+4]=o[j+5]=X,a[j]=a[j+1]=a[j+2]=a[j+3]=a[j+4]=a[j+5]=i[p].life,c[G]=c[G+12]=Y-u,c[G+1]=c[G+13]=L-f,c[G+2]=c[G+14]=W,c[G+4]=Y+u,c[G+5]=L-f,c[G+6]=W,c[G+8]=c[G+16]=Y+u,c[G+9]=c[G+17]=L+f,c[G+10]=c[G+18]=W,c[G+20]=Y-u,c[G+21]=L+f,c[G+22]=W}t.bindBuffer(t.ARRAY_BUFFER,this.positionBuffer),t.bufferData(t.ARRAY_BUFFER,this.positionArray,t.STATIC_DRAW),t.bindBuffer(t.ARRAY_BUFFER,this.elapsedTimeBuffer),t.bufferData(t.ARRAY_BUFFER,this.elapsedTimeArray,t.STATIC_DRAW),t.bindBuffer(t.ARRAY_BUFFER,this.lifeBuffer),t.bufferData(t.ARRAY_BUFFER,this.lifeArray,t.STATIC_DRAW),t.bindBuffer(t.ARRAY_BUFFER,this.vertexBuffer),t.bufferData(t.ARRAY_BUFFER,this.vertexArray,t.STATIC_DRAW)}}catch(e){console.error(e)}},traverse:function(e,t){if(this._isActive.getValue()){switch(e){case r.POINTER:case r.PICKING:case r.COLLISION:break;case r.SHADOW:this._castShadow.getValue()&&t.addDepthShape(this);break;case r.DISPLAY:t.addDisplayShape(this)&&this.getAppearance().traverse(e,t)}this.geometryType===A&&this.getGeometry()&&this.getGeometry().traverse(e,t)}},depth:function(e,t,i){if(this.updateGeometry(t.modelViewMatrix),this.geometryType===A){var s=this.getGeometry();s&&s.displayParticlesDepth(e,t,i,this.particles,this.numParticles)}else{if(this.numParticles<=0)return;i.getValid()&&(i.enableFloatAttrib(e,"x3d_ParticleId",this.idBuffer,1),i.enableFloatAttrib(e,"x3d_ParticlePosition",this.positionBuffer,3),i.enableFloatAttrib(e,"x3d_ParticleElapsedTime",this.elapsedTimeBuffer,1),i.enableFloatAttrib(e,"x3d_ParticleLife",this.lifeBuffer,1),i.enableVertexAttribute(e,this.vertexBuffer),e.drawArrays(this.primitiveMode,0,this.numParticles*this.vertexCount),i.disableFloatAttrib(e,"x3d_ParticleId"),i.disableFloatAttrib(e,"x3d_ParticlePosition"),i.disableFloatAttrib(e,"x3d_ParticleElapsedTime"),i.disableFloatAttrib(e,"x3d_ParticleLife"))}},display:function(e,t){try{if(this.numParticles<=0)return;if(this.updateGeometry(t.modelViewMatrix),this.geometryType===A){const i=this.getGeometry();i&&i.displayParticles(e,t,this.particles,this.numParticles)}else{const r=this.getAppearance(),n=r.shaderNode||this.shaderNode||r.materialNode.getShader(t.browser,t.shadow);if(n.getValid()){t.geometryContext=this.geometryContext;const o=r.blendModeNode;if(o&&o.enable(e),n.enable(e),n.setLocalUniforms(e,t),n.enableFloatAttrib(e,"x3d_ParticleId",this.idBuffer,1),n.enableFloatAttrib(e,"x3d_ParticlePosition",this.positionBuffer,3),n.enableFloatAttrib(e,"x3d_ParticleElapsedTime",this.elapsedTimeBuffer,1),n.enableFloatAttrib(e,"x3d_ParticleLife",this.lifeBuffer,1),this.geometryContext.colorMaterial&&n.enableColorAttribute(e,this.colorBuffer),this.texCoordArray.length&&n.enableTexCoordAttribute(e,this.texCoordBuffers),this.normalArray.length&&n.enableNormalAttribute(e,this.normalBuffer),n.enableVertexAttribute(e,this.vertexBuffer),n.wireframe&&this.testWireframe)for(var i=0,s=this.numParticles*this.vertexCount;i<s;i+=3)e.drawArrays(n.primitiveMode,i,3);else{const i=d.prototype.determinant3.call(t.modelViewMatrix)>0;e.frontFace(i?e.CCW:e.CW),e.enable(e.CULL_FACE),e.cullFace(e.BACK),e.drawArrays(this.primitiveMode,0,this.numParticles*this.vertexCount)}n.disableFloatAttrib(e,"x3d_ParticleId"),n.disableFloatAttrib(e,"x3d_ParticlePosition"),n.disableFloatAttrib(e,"x3d_ParticleElapsedTime"),n.disableFloatAttrib(e,"x3d_ParticleLife"),n.disableColorAttribute(e),n.disableTexCoordAttribute(e),n.disableNormalAttribute(e),o&&o.disable(e),t.geometryContext=null}}}catch(e){console.error(e)}},getScreenAlignedRotation:function(e){R.assign(e).inverse(),R.multDirMatrix(b.assign(l.zAxis)),R.multDirMatrix(P.assign(l.yAxis)),D.assign(P).cross(b),V.assign(b).cross(D);var t=b;return D.normalize(),V.normalize(),t.normalize(),this.rotation.set(D.x,D.y,D.z,V.x,V.y,V.z,t.x,t.y,t.z)}}),M})),e("x_ite/Components/ParticleSystems/PolylineEmitter",["x_ite/Fields","x_ite/Base/X3DFieldDefinition","x_ite/Base/FieldDefinitionArray","x_ite/Components/ParticleSystems/X3DParticleEmitterNode","x_ite/Components/Rendering/IndexedLineSet","x_ite/Base/X3DConstants","standard/Math/Numbers/Vector3","standard/Math/Algorithm"],(function(e,t,i,s,r,n,o,a){"use strict";function l(e){s.call(this,e),this.addType(n.PolylineEmitter),this._speed.setUnit("speed"),this._mass.setUnit("mass"),this._surfaceArea.setUnit("area"),this.direction=new o(0,0,0),this.polylineNode=new r(e),this.polylines=[],this.lengthSoFarArray=[0]}var h,d;function c(e){return e.set(0,0,0)}return l.prototype=Object.assign(Object.create(s.prototype),{constructor:l,[Symbol.for("X_ITE.X3DBaseNode.fieldDefinitions")]:new i([new t(n.inputOutput,"metadata",new e.SFNode),new t(n.inputOutput,"direction",new e.SFVec3f(0,1,0)),new t(n.inputOutput,"speed",new e.SFFloat),new t(n.inputOutput,"variation",new e.SFFloat(.25)),new t(n.initializeOnly,"mass",new e.SFFloat),new t(n.initializeOnly,"surfaceArea",new e.SFFloat),new t(n.inputOutput,"coordIndex",new e.MFInt32(-1)),new t(n.inputOutput,"coord",new e.SFNode)]),getTypeName:function(){return"PolylineEmitter"},getComponentName:function(){return"ParticleSystems"},getContainerField:function(){return"emitter"},initialize:function(){s.prototype.initialize.call(this),this._direction.addInterest("set_direction__",this),this._coordIndex.addFieldInterest(this.polylineNode._coordIndex),this._coord.addFieldInterest(this.polylineNode._coord),this.polylineNode._coordIndex=this._coordIndex,this.polylineNode._coord=this._coord,this.polylineNode._rebuild.addInterest("set_polyline",this),this.polylineNode.setPrivate(!0),this.polylineNode.setup(),this.set_direction__(),this.set_polyline()},set_direction__:function(){this.direction.assign(this._direction.getValue()).normalize(),this.direction.equals(o.Zero)?this.getRandomVelocity=this.getSphericalRandomVelocity:delete this.getRandomVelocity},set_polyline:(h=new o(0,0,0),d=new o(0,0,0),function(){var e=this.vertices=this.polylineNode.getVertices().getValue();if(e.length){delete this.getRandomPosition;var t=0,i=this.lengthSoFarArray;i.length=1;for(var s=0,r=e.length;s<r;s+=8)h.set(e[s],e[s+1],e[s+2]),d.set(e[s+4],e[s+5],e[s+6]),t+=d.subtract(h).abs(),i.push(t)}else this.getRandomPosition=c}),getRandomPosition:function(e){var t=this.lengthSoFarArray,i=t.length,s=Math.random()*t.at(-1),r=0,n=0,o=0;if(1==i||s<=t[0])r=0,o=0;else if(s>=t.at(-1))r=i-2,o=1;else{var l=a.upperBound(t,0,i,s,a.less);if(l<i){n=l;var h=t[r=l-1],d=t[n];o=a.clamp((s-h)/(d-h),0,1)}else r=0,o=0}n=(r*=8)+4;var c=this.vertices,u=c[r],m=c[r+1],f=c[r+2],p=c[n],_=c[n+1],y=c[n+2];return e.x=u+o*(p-u),e.y=m+o*(_-m),e.z=f+o*(y-f),e},getRandomVelocity:function(e){var t=this.direction,i=this.getRandomSpeed();return e.x=t.x*i,e.y=t.y*i,e.z=t.z*i,e}}),l})),e("x_ite/Components/ParticleSystems/SurfaceEmitter",["x_ite/Fields","x_ite/Base/X3DFieldDefinition","x_ite/Base/FieldDefinitionArray","x_ite/Components/ParticleSystems/X3DParticleEmitterNode","x_ite/Base/X3DConstants","x_ite/Base/X3DCast","standard/Math/Geometry/Triangle3","standard/Math/Numbers/Vector3","standard/Math/Algorithm"],(function(e,t,i,s,r,n,o,a,l){"use strict";function h(e){s.call(this,e),this.addType(r.SurfaceEmitter),this._speed.setUnit("speed"),this._mass.setUnit("mass"),this._surfaceArea.setUnit("area"),this.surfaceNode=null,this.areaSoFarArray=[0],this.direction=new a(0,0,0)}var d,c,u;function m(e){return e.set(0,0,0)}return h.prototype=Object.assign(Object.create(s.prototype),{constructor:h,[Symbol.for("X_ITE.X3DBaseNode.fieldDefinitions")]:new i([new t(r.inputOutput,"metadata",new e.SFNode),new t(r.inputOutput,"speed",new e.SFFloat),new t(r.inputOutput,"variation",new e.SFFloat(.25)),new t(r.initializeOnly,"mass",new e.SFFloat),new t(r.initializeOnly,"surfaceArea",new e.SFFloat),new t(r.initializeOnly,"surface",new e.SFNode)]),getTypeName:function(){return"SurfaceEmitter"},getComponentName:function(){return"ParticleSystems"},getContainerField:function(){return"emitter"},initialize:function(){s.prototype.initialize.call(this),this._surface.addInterest("set_surface__",this),this.set_surface__()},set_surface__:function(){this.surfaceNode&&this.surfaceNode._rebuild.removeInterest("set_geometry__",this),this.surfaceNode=n(r.X3DGeometryNode,this._surface),this.surfaceNode&&this.surfaceNode._rebuild.addInterest("set_geometry__",this),this.set_geometry__()},set_geometry__:(d=new a(0,0,0),c=new a(0,0,0),u=new a(0,0,0),function(){if(this.surfaceNode){delete this.getRandomPosition,delete this.getRandomVelocity;var e=0,t=this.areaSoFarArray,i=this.surfaceNode.getVertices().getValue();this.normals=this.surfaceNode.getNormals().getValue(),this.vertices=i,t.length=1;for(var s=0,r=i.length;s<r;s+=12)d.set(i[s],i[s+1],i[s+2]),c.set(i[s+4],i[s+5],i[s+6]),u.set(i[s+8],i[s+9],i[s+10]),e+=o.area(d,c,u),t.push(e)}else this.getRandomPosition=m,this.getRandomVelocity=this.getSphericalRandomVelocity}),getRandomPosition:function(e){var t=this.areaSoFarArray,i=t.length,s=Math.random()*t.at(-1),r=0;if(1==i||s<=t[0])r=0;else if(s>=t.at(-1))r=i-2;else{var n=l.upperBound(t,0,i,s,l.less);r=n<i?n-1:0}var o=Math.random(),a=Math.random();o+a>1&&(o=1-o,a=1-a);var h=1-o-a,d=12*r,c=this.vertices;e.x=o*c[d]+a*c[d+4]+h*c[d+8],e.y=o*c[d+1]+a*c[d+5]+h*c[d+9],e.z=o*c[d+2]+a*c[d+6]+h*c[d+10];d=9*r;var u=this.normals,m=this.direction;return m.x=o*u[d]+a*u[d+3]+h*u[d+6],m.y=o*u[d+1]+a*u[d+4]+h*u[d+7],m.z=o*u[d+2]+a*u[d+5]+h*u[d+8],e},getRandomVelocity:function(e){var t=this.getRandomSpeed(),i=this.direction;return e.x=i.x*t,e.y=i.y*t,e.z=i.z*t,e}}),h})),e("x_ite/Components/ParticleSystems/VolumeEmitter",["x_ite/Fields","x_ite/Base/X3DFieldDefinition","x_ite/Base/FieldDefinitionArray","x_ite/Components/ParticleSystems/X3DParticleEmitterNode","x_ite/Components/Geometry3D/IndexedFaceSet","x_ite/Base/X3DConstants","standard/Math/Numbers/Vector3","standard/Math/Numbers/Rotation4","standard/Math/Geometry/Line3","standard/Math/Geometry/Plane3","standard/Math/Geometry/Triangle3","standard/Math/Algorithm","standard/Math/Utility/BVH","standard/Math/Algorithms/QuickSort"],(function(e,t,i,s,r,n,o,a,l,h,d,c,u,m){"use strict";function f(e){s.call(this,e),this.addType(n.VolumeEmitter),this._speed.setUnit("speed"),this._mass.setUnit("mass"),this._surfaceArea.setUnit("area"),this.direction=new o(0,0,0),this.volumeNode=new r(e),this.areaSoFarArray=[0]}var p,_,y;return f.prototype=Object.assign(Object.create(s.prototype),{constructor:f,[Symbol.for("X_ITE.X3DBaseNode.fieldDefinitions")]:new i([new t(n.inputOutput,"metadata",new e.SFNode),new t(n.initializeOnly,"internal",new e.SFBool(!0)),new t(n.inputOutput,"direction",new e.SFVec3f(0,1,0)),new t(n.inputOutput,"speed",new e.SFFloat),new t(n.inputOutput,"variation",new e.SFFloat(.25)),new t(n.initializeOnly,"mass",new e.SFFloat),new t(n.initializeOnly,"surfaceArea",new e.SFFloat),new t(n.inputOutput,"coordIndex",new e.MFInt32(-1)),new t(n.inputOutput,"coord",new e.SFNode)]),getTypeName:function(){return"VolumeEmitter"},getComponentName:function(){return"ParticleSystems"},getContainerField:function(){return"emitter"},initialize:function(){s.prototype.initialize.call(this),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._rebuild.addInterest("set_geometry__",this),this.volumeNode.setPrivate(!0),this.volumeNode.setup(),this.set_direction__(),this.set_geometry__()},set_direction__:function(){this.direction.assign(this._direction.getValue()).normalize(),this.direction.equals(o.Zero)?this.getRandomVelocity=this.getSphericalRandomVelocity:delete this.getRandomVelocity},set_geometry__:(p=new o(0,0,0),_=new o(0,0,0),y=new o(0,0,0),function(){var e=0,t=this.areaSoFarArray,i=this.volumeNode.getNormals().getValue(),s=this.volumeNode.getVertices().getValue();this.normals=i,this.vertices=s,t.length=1;for(var r=0,n=s.length;r<n;r+=12)p.set(s[r],s[r+1],s[r+2]),_.set(s[r+4],s[r+5],s[r+6]),y.set(s[r+8],s[r+9],s[r+10]),e+=d.area(p,_,y),t.push(e);this.bvh=new u(s,i)}),getRandomPosition:function(){var e=new o(0,0,0),t=new o(0,0,0),i=new a(0,0,1,0),s=new l(o.Zero,o.zAxis),r=new h(o.Zero,o.zAxis),n=[],d=new m(n,(function(e,t){return r.getDistanceToPoint(e)<r.getDistanceToPoint(t)}));return function(a){var l=this.areaSoFarArray,h=l.length,u=Math.random()*l.at(-1),m=0;if(1==h||u<=l[0])m=0;else if(u>=l.at(-1))m=h-2;else{m=(F=c.upperBound(l,0,h,u,c.less))<h?F-1:0}var f=Math.random(),p=Math.random();f+p>1&&(f=1-f,p=1-p);var _=1-f-p,y=12*m,g=this.vertices;e.x=f*g[y]+p*g[y+4]+_*g[y+8],e.y=f*g[y+1]+p*g[y+5]+_*g[y+9],e.z=f*g[y+2]+p*g[y+6]+_*g[y+10];y=9*m;var x=this.normals;t.x=f*x[y]+p*x[y+3]+_*x[y+6],t.y=f*x[y+1]+p*x[y+4]+_*x[y+7],t.z=f*x[y+2]+p*x[y+5]+_*x[y+8],i.setFromToVec(o.zAxis,t),i.multVecRot(this.getRandomSurfaceNormal(t)),s.set(e,t),r.set(e,t);var A=this.bvh.intersectsLine(s,n);if(A-=A%2){d.sort(0,A);var F=2*Math.round(this.getRandomValue(0,A/2-1)),w=n[F],R=n[F+1];_=Math.random();return a.x=w.x+(R.x-w.x)*_,a.y=w.y+(R.y-w.y)*_,a.z=w.z+(R.z-w.z)*_,a}return a.set(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY)}}(),getRandomVelocity:function(e){var t=this.direction,i=this.getRandomSpeed();return e.x=t.x*i,e.y=t.y*i,e.z=t.z*i,e}}),f})),e("x_ite/Components/ParticleSystems/WindPhysicsModel",["x_ite/Fields","x_ite/Base/X3DFieldDefinition","x_ite/Base/FieldDefinitionArray","x_ite/Components/ParticleSystems/X3DParticlePhysicsModelNode","x_ite/Base/X3DConstants","standard/Math/Numbers/Vector3","standard/Math/Algorithm"],(function(e,t,i,s,r,n,o){"use strict";function a(e){s.call(this,e),this.addType(r.WindPhysicsModel),this._speed.setUnit("speed")}var l;return a.prototype=Object.assign(Object.create(s.prototype),{constructor:a,[Symbol.for("X_ITE.X3DBaseNode.fieldDefinitions")]:new i([new t(r.inputOutput,"metadata",new e.SFNode),new t(r.inputOutput,"enabled",new e.SFBool(!0)),new t(r.inputOutput,"direction",new e.SFVec3f),new t(r.inputOutput,"speed",new e.SFFloat(.1)),new t(r.inputOutput,"gustiness",new e.SFFloat(.1)),new t(r.inputOutput,"turbulence",new e.SFFloat)]),getTypeName:function(){return"WindPhysicsModel"},getComponentName:function(){return"ParticleSystems"},getContainerField:function(){return"physics"},getRandomSpeed:function(e){var t=Math.max(0,this._speed.getValue()),i=t*Math.max(0,this._gustiness.getValue());return e.getRandomValue(Math.max(0,t-i),t+i)},addForce:(l=new n(0,0,0),function(e,t,i,s){var r=t._surfaceArea.getValue();if(this._enabled.getValue()){var a=this.getRandomSpeed(t),h=.64615*Math.pow(10,2*Math.log(a));this._direction.getValue().equals(n.Zero)?t.getRandomNormal(l):l.assign(this._direction.getValue()).normalize(),i[e].assign(l.multiply(r*h)),s[e]=Math.PI*o.clamp(this._turbulence.getValue(),0,1)}})}),a})),e(t.getComponentUrl("particle-systems"),["x_ite/Components","x_ite/Browser/ParticleSystems/X3DParticleSystemsContext","x_ite/Components/ParticleSystems/BoundedPhysicsModel","x_ite/Components/ParticleSystems/ConeEmitter","x_ite/Components/ParticleSystems/ExplosionEmitter","x_ite/Components/ParticleSystems/ForcePhysicsModel","x_ite/Components/ParticleSystems/ParticleSystem","x_ite/Components/ParticleSystems/PointEmitter","x_ite/Components/ParticleSystems/PolylineEmitter","x_ite/Components/ParticleSystems/SurfaceEmitter","x_ite/Components/ParticleSystems/VolumeEmitter","x_ite/Components/ParticleSystems/WindPhysicsModel","x_ite/Components/ParticleSystems/X3DParticleEmitterNode","x_ite/Components/ParticleSystems/X3DParticlePhysicsModelNode"],(function(e,t,i,s,r,n,o,a,l,h,d,c,u,m){"use strict";e.addComponent({name:"ParticleSystems",types:{BoundedPhysicsModel:i,ConeEmitter:s,ExplosionEmitter:r,ForcePhysicsModel:n,ParticleSystem:o,PointEmitter:a,PolylineEmitter:l,SurfaceEmitter:h,VolumeEmitter:d,WindPhysicsModel:c},abstractTypes:{X3DParticleEmitterNode:u,X3DParticlePhysicsModelNode:m},browser:t})}))}();
1
+ !function(){const e=window[Symbol.for("X_ITE.X3D-5.0.2")].define,t=window[Symbol.for("X_ITE.X3D-5.0.2")].require;e("x_ite/Components/ParticleSystems/X3DParticleEmitterNode",["x_ite/Components/Core/X3DNode","x_ite/Base/X3DConstants","standard/Math/Numbers/Vector3","standard/Math/Numbers/Rotation4","standard/Math/Geometry/Line3","standard/Math/Geometry/Plane3","standard/Math/Algorithm","standard/Math/Algorithms/QuickSort"],(function(e,t,i,s,r,n,o,a){"use strict";var l=new i(0,0,0),h=new i(0,0,0),d=new r(i.Zero,i.zAxis),c=new n(i.Zero,i.zAxis);function u(e,t){return c.getDistanceToPoint(e)<c.getDistanceToPoint(t)}function m(e,t){return e<c.getDistanceToPoint(t)}function f(i){e.call(this,i),this.addType(t.X3DParticleEmitterNode),this._speed.setUnit("speed"),this._mass.setUnit("mass"),this._surfaceArea.setUnit("area"),this.rotations=[],this.intersections=[],this.intersectionNormals=[],this.sorter=new a(this.intersections,u)}return f.prototype=Object.assign(Object.create(e.prototype),{constructor:f,initialize:function(){e.prototype.initialize.call(this),this._speed.addInterest("set_speed__",this),this._variation.addInterest("set_variation__",this),this._mass.addInterest("set_mass__",this),this.set_speed__(),this.set_variation__(),this.set_mass__()},set_speed__:function(){this.speed=this._speed.getValue()},set_variation__:function(){this.variation=this._variation.getValue()},set_mass__:function(){this.mass=this._mass.getValue()},isExplosive:function(){return!1},getMass:function(){return this.mass},getRandomLifetime:function(e,t){var i=e*t,s=Math.max(0,e-i),r=e+i;return Math.random()*(r-s)+s},getRandomSpeed:function(){var e=this.speed,t=e*this.variation,i=Math.max(0,e-t),s=e+t;return Math.random()*(s-i)+i},getSphericalRandomVelocity:function(e){return this.getRandomNormal(e).multiply(this.getRandomSpeed())},getRandomValue:function(e,t){return Math.random()*(t-e)+e},getRandomNormal:function(e){var t=this.getRandomValue(-1,1)*Math.PI,i=this.getRandomValue(-1,1),s=Math.acos(i),r=Math.sin(s);return e.set(Math.sin(t)*r,Math.cos(t)*r,i)},getRandomNormalWithAngle:function(e,t){var i=(2*Math.random()-1)*Math.PI,s=this.getRandomValue(Math.cos(e),1),r=Math.acos(s),n=Math.sin(r);return t.set(Math.sin(i)*n,Math.cos(i)*n,s)},getRandomNormalWithDirectionAndAngle:function(e,t,s){return rotation.setFromToVec(i.zAxis,e),rotation.multVecRot(this.getRandomNormalWithAngle(t,s))},getRandomSurfaceNormal:function(e){var t=this.getRandomValue(-1,1)*Math.PI,i=Math.pow(Math.random(),1/3),s=Math.acos(i),r=Math.sin(s);return e.set(Math.sin(t)*r,Math.cos(t)*r,i)},animate:function(e,t){for(var r=e.particles,n=e.numParticles,o=e.createParticles,a=e.particleLifetime,d=e.lifetimeVariation,c=e.speeds,u=e.velocities,m=e.turbulences,f=this.rotations,p=e.numForces,_=e.boundedVertices.length,y=e.boundedVolume,g=f.length;g<p;++g)f[g]=new s(0,0,1,0);for(g=0;g<p;++g)f[g].setFromToVec(i.zAxis,u[g]);for(g=0;g<n;++g){var x=r[g],A=x.elapsedTime+t;if(A>x.lifetime)x.lifetime=this.getRandomLifetime(a,d),x.elapsedTime=0,o?(++x.life,this.getRandomPosition(x.position),this.getRandomVelocity(x.velocity)):x.position.set(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY);else{for(var F=x.position,w=x.velocity,R=0;R<p;++R)w.add(f[R].multVecRot(this.getRandomNormalWithAngle(m[R],l)).multiply(c[R]));_?(h.x=F.x,h.y=F.y,h.z=F.z,F.x+=w.x*t,F.y+=w.y*t,F.z+=w.z*t,this.bounce(y,h,F,w)):(F.x+=w.x*t,F.y+=w.y*t,F.z+=w.z*t),x.elapsedTime=A}}e.geometryContext.colorMaterial&&this.getColors(r,e.colorKeys,e.colorRamp,n)},bounce:function(e,t,i,s){l.assign(s).normalize(),d.set(t,l);var r=this.intersections,n=this.intersectionNormals,a=e.intersectsLine(d,r,n);if(a){for(var h=0;h<a;++h)r[h].index=h;c.set(t,l),this.sorter.sort(0,a);var u=o.upperBound(r,0,a,0,m);if(u<a){var f=r[u],p=n[f.index];if(c.set(f,p),c.getDistanceToPoint(t)*c.getDistanceToPoint(i)<0){var _=2*p.dot(s);s.x-=p.x*_,s.y-=p.y*_,s.z-=p.z*_,l.assign(s).normalize();var y=f.distance(t);i.x=f.x+l.x*y,i.y=f.y+l.y*y,i.z=f.z+l.z*y}}}},getColors:function(e,t,i,s){for(var r=t.length,n=0,a=0,l=0,h=0;h<s;++h){var d=e[h],c=d.elapsedTime/d.lifetime,u=d.color;if(1==r||c<=t[0])n=0,a=0,l=0;else if(c>=t[r-1])n=r-2,a=r-1,l=1;else{var m=o.upperBound(t,0,r,c,o.less);if(m<r){a=m;var f=t[n=m-1],p=t[a];l=o.clamp((c-f)/(p-f),0,1)}else n=0,a=0,l=0}var _=i[n],y=i[a];u.x=_.x+l*(y.x-_.x),u.y=_.y+l*(y.y-_.y),u.z=_.z+l*(y.z-_.z),u.w=_.w+l*(y.w-_.w)}}}),f})),e("x_ite/Components/ParticleSystems/PointEmitter",["x_ite/Fields","x_ite/Base/X3DFieldDefinition","x_ite/Base/FieldDefinitionArray","x_ite/Components/ParticleSystems/X3DParticleEmitterNode","x_ite/Base/X3DConstants","standard/Math/Numbers/Vector3"],(function(e,t,i,s,r,n){"use strict";function o(e){s.call(this,e),this.addType(r.PointEmitter),this._position.setUnit("length"),this._speed.setUnit("speed"),this._mass.setUnit("mass"),this._surfaceArea.setUnit("area"),this.direction=new n(0,0,0)}return o.prototype=Object.assign(Object.create(s.prototype),{constructor:o,[Symbol.for("X_ITE.X3DBaseNode.fieldDefinitions")]:new i([new t(r.inputOutput,"metadata",new e.SFNode),new t(r.inputOutput,"position",new e.SFVec3f),new t(r.inputOutput,"direction",new e.SFVec3f(0,1,0)),new t(r.inputOutput,"speed",new e.SFFloat),new t(r.inputOutput,"variation",new e.SFFloat(.25)),new t(r.initializeOnly,"mass",new e.SFFloat),new t(r.initializeOnly,"surfaceArea",new e.SFFloat)]),getTypeName:function(){return"PointEmitter"},getComponentName:function(){return"ParticleSystems"},getContainerField:function(){return"emitter"},initialize:function(){s.prototype.initialize.call(this),this._position.addInterest("set_position__",this),this._direction.addInterest("set_direction__",this),this.set_position__(),this.set_direction__()},set_position__:function(){this.position=this._position.getValue()},set_direction__:function(){this.direction.assign(this._direction.getValue()).normalize(),this.direction.equals(n.Zero)?this.getRandomVelocity=this.getSphericalRandomVelocity:delete this.getRandomVelocity},getRandomPosition:function(e){return e.assign(this.position)},getRandomVelocity:function(e){var t=this.direction,i=this.getRandomSpeed();return e.x=t.x*i,e.y=t.y*i,e.z=t.z*i,e}}),o})),e("x_ite/Browser/ParticleSystems/X3DParticleSystemsContext",["x_ite/Components/ParticleSystems/PointEmitter"],(function(e){"use strict";const t=Symbol();function i(){}return i.prototype={getDefaultEmitter:function(){return this[t]=new e(this.getPrivateScene()),this[t].setup(),this.getDefaultEmitter=function(){return this[t]},Object.defineProperty(this,"getDefaultEmitter",{enumerable:!1}),v,this[t]}},i})),e("x_ite/Components/ParticleSystems/X3DParticlePhysicsModelNode",["x_ite/Components/Core/X3DNode","x_ite/Base/X3DConstants"],(function(e,t){"use strict";function i(i){e.call(this,i),this.addType(t.X3DParticlePhysicsModelNode)}return i.prototype=Object.assign(Object.create(e.prototype),{constructor:i,addForce:function(){}}),i})),e("x_ite/Components/ParticleSystems/BoundedPhysicsModel",["x_ite/Fields","x_ite/Base/X3DFieldDefinition","x_ite/Base/FieldDefinitionArray","x_ite/Components/ParticleSystems/X3DParticlePhysicsModelNode","x_ite/Base/X3DConstants","x_ite/Base/X3DCast"],(function(e,t,i,s,r,n){"use strict";function o(e){s.call(this,e),this.addType(r.BoundedPhysicsModel)}return o.prototype=Object.assign(Object.create(s.prototype),{constructor:o,[Symbol.for("X_ITE.X3DBaseNode.fieldDefinitions")]:new i([new t(r.inputOutput,"metadata",new e.SFNode),new t(r.inputOutput,"enabled",new e.SFBool(!0)),new t(r.inputOutput,"geometry",new e.SFNode)]),getTypeName:function(){return"BoundedPhysicsModel"},getComponentName:function(){return"ParticleSystems"},getContainerField:function(){return"physics"},initialize:function(){s.prototype.initialize.call(this),this._geometry.addInterest("set_geometry__",this),this.set_geometry__()},set_geometry__:function(){this.geometryNode&&this.geometryNode._rebuild.removeInterest("addNodeEvent",this),this.geometryNode=n(r.X3DGeometryNode,this._geometry),this.geometryNode&&this.geometryNode._rebuild.addInterest("addNodeEvent",this)},addGeometry:function(e,t){if(this.geometryNode){for(var i=this.geometryNode.getNormals().getValue(),s=this.geometryNode.getVertices().getValue(),r=0,n=i.length;r<n;++r)e.push(i[r]);for(r=0,n=s.length;r<n;++r)t.push(s[r])}}}),o})),e("x_ite/Components/ParticleSystems/ConeEmitter",["x_ite/Fields","x_ite/Base/X3DFieldDefinition","x_ite/Base/FieldDefinitionArray","x_ite/Components/ParticleSystems/X3DParticleEmitterNode","x_ite/Base/X3DConstants","standard/Math/Numbers/Vector3","standard/Math/Numbers/Rotation4"],(function(e,t,i,s,r,n,o){"use strict";function a(e){s.call(this,e),this.addType(r.ConeEmitter),this._position.setUnit("length"),this._angle.setUnit("angle"),this._speed.setUnit("speed"),this._mass.setUnit("mass"),this._surfaceArea.setUnit("area"),this.rotation=new o(0,0,1,0)}return a.prototype=Object.assign(Object.create(s.prototype),{constructor:a,[Symbol.for("X_ITE.X3DBaseNode.fieldDefinitions")]:new i([new t(r.inputOutput,"metadata",new e.SFNode),new t(r.inputOutput,"position",new e.SFVec3f),new t(r.inputOutput,"direction",new e.SFVec3f(0,1,0)),new t(r.inputOutput,"angle",new e.SFFloat(.7854)),new t(r.inputOutput,"speed",new e.SFFloat),new t(r.inputOutput,"variation",new e.SFFloat(.25)),new t(r.initializeOnly,"mass",new e.SFFloat),new t(r.initializeOnly,"surfaceArea",new e.SFFloat)]),getTypeName:function(){return"ConeEmitter"},getComponentName:function(){return"ParticleSystems"},getContainerField:function(){return"emitter"},initialize:function(){s.prototype.initialize.call(this),this._position.addInterest("set_position__",this),this._direction.addInterest("set_direction__",this),this._angle.addInterest("set_angle__",this),this.set_position__(),this.set_direction__(),this.set_angle__()},set_position__:function(){this.position=this._position.getValue()},set_direction__:function(){var e=this._direction.getValue();this.rotation.setFromToVec(n.zAxis,e),e.equals(n.Zero)?this.getRandomVelocity=this.getSphericalRandomVelocity:delete this.getRandomVelocity},set_angle__:function(){this.angle=this._angle.getValue()},getRandomPosition:function(e){return e.assign(this.position)},getRandomVelocity:function(e){return this.rotation.multVecRot(this.getRandomNormalWithAngle(this.angle,e).multiply(this.getRandomSpeed()))}}),a})),e("x_ite/Components/ParticleSystems/ExplosionEmitter",["x_ite/Fields","x_ite/Base/X3DFieldDefinition","x_ite/Base/FieldDefinitionArray","x_ite/Components/ParticleSystems/X3DParticleEmitterNode","x_ite/Base/X3DConstants"],(function(e,t,i,s,r){"use strict";function n(e){s.call(this,e),this.addType(r.ExplosionEmitter),this._position.setUnit("length"),this._speed.setUnit("speed"),this._mass.setUnit("mass"),this._surfaceArea.setUnit("area"),this.getRandomVelocity=this.getSphericalRandomVelocity}return n.prototype=Object.assign(Object.create(s.prototype),{constructor:n,[Symbol.for("X_ITE.X3DBaseNode.fieldDefinitions")]:new i([new t(r.inputOutput,"metadata",new e.SFNode),new t(r.inputOutput,"position",new e.SFVec3f),new t(r.inputOutput,"speed",new e.SFFloat),new t(r.inputOutput,"variation",new e.SFFloat(.25)),new t(r.initializeOnly,"mass",new e.SFFloat),new t(r.initializeOnly,"surfaceArea",new e.SFFloat)]),getTypeName:function(){return"ExplosionEmitter"},getComponentName:function(){return"ParticleSystems"},getContainerField:function(){return"emitter"},initialize:function(){s.prototype.initialize.call(this),this._position.addInterest("set_position__",this),this.set_position__()},set_position__:function(){this.position=this._position.getValue()},isExplosive:function(){return!0},getRandomPosition:function(e){return e.assign(this.position)}}),n})),e("x_ite/Components/ParticleSystems/ForcePhysicsModel",["x_ite/Fields","x_ite/Base/X3DFieldDefinition","x_ite/Base/FieldDefinitionArray","x_ite/Components/ParticleSystems/X3DParticlePhysicsModelNode","x_ite/Base/X3DConstants"],(function(e,t,i,s,r){"use strict";function n(e){s.call(this,e),this.addType(r.ForcePhysicsModel),this._force.setUnit("force")}return n.prototype=Object.assign(Object.create(s.prototype),{constructor:n,[Symbol.for("X_ITE.X3DBaseNode.fieldDefinitions")]:new i([new t(r.inputOutput,"metadata",new e.SFNode),new t(r.inputOutput,"enabled",new e.SFBool(!0)),new t(r.inputOutput,"force",new e.SFVec3f(0,-9.8,0))]),getTypeName:function(){return"ForcePhysicsModel"},getComponentName:function(){return"ParticleSystems"},getContainerField:function(){return"physics"},addForce:function(e,t,i,s){this._enabled.getValue()&&(i[e].assign(this._force.getValue()),s[e]=0)}}),n})),e("standard/Math/Utility/BVH",["standard/Math/Numbers/Vector3","standard/Math/Geometry/Plane3","standard/Math/Algorithms/QuickSort"],(function(e,t,i){"use strict";const s=new e(0,0,0),r=new e(0,0,0),n=new e(0,0,0),o={u:0,v:0,t:0},a=[new e(0,0,1),new e(0,0,-1),new e(0,1,0),new e(0,-1,0),new e(1,0,0)];function l(e,t){this.vertices=e.vertices,this.normals=e.normals,this.i4=12*t,this.i3=9*t}function h(i,o,d,c){this.min=new e(0,0,0),this.max=new e(0,0,0),this.planes=[],this.intersection=new e(0,0,0);const u=i.vertices,m=this.min,f=this.max,p=d+c;let _=12*o[d];m.set(u[_],u[_+1],u[_+2]),f.assign(m);for(let e=d;e<p;++e)_=12*o[e],s.set(u[_],u[_+1],u[_+2]),r.set(u[_+4],u[_+5],u[_+6]),n.set(u[_+8],u[_+9],u[_+10]),m.min(s,r,n),f.max(s,r,n);for(let e=0;e<5;++e)this.planes[e]=new t(e%2?m:f,a[e]);if(c>2){i.sorter.compare.axis=this.getLongestAxis(m,f),i.sorter.sort(d,p);var y=c>>>1}else y=1;const g=c-y;this.left=y>1?new h(i,o,d,y):new l(i,o[d]),this.right=g>1?new h(i,o,d+y,g):new l(i,o[d+y])}function d(e,t){this.vertices=e,this.normals=t;const s=e.length/12;switch(s){case 0:this.root=null;break;case 1:this.root=new l(this,0);break;default:{const t=[];for(let e=0;e<s;++e)t.push(e);this.sorter=new i(t,function(e,t){function i(e,s){const r=i.vertices;return t=i.axis,Math.min(r[e+t],r[e+4+t],r[e+8+t])<Math.min(r[s+t],r[s+4+t],r[s+8+t])}return i.vertices=e,i.axis=t,i}(e,0)),this.root=new h(this,t,0,s);break}}}return l.prototype={intersectsLine:function(t,i,a){const l=this.vertices,h=this.normals,d=this.i4,c=this.i3;if(s.x=l[d],s.y=l[d+1],s.z=l[d+2],r.x=l[d+4],r.y=l[d+5],r.z=l[d+6],n.x=l[d+8],n.y=l[d+9],n.z=l[d+10],t.intersectsTriangle(s,r,n,o)){const t=o.u,s=o.v,r=1-t-s,n=i.size++;n>=i.length&&i.push(new e(0,0,0)),i[n].set(r*l[d]+t*l[d+4]+s*l[d+8],r*l[d+1]+t*l[d+5]+s*l[d+9],r*l[d+2]+t*l[d+6]+s*l[d+10]),a&&(n>=a.length&&a.push(new e(0,0,0)),a[n].set(r*h[c]+t*h[c+3]+s*h[c+6],r*h[c+1]+t*h[c+4]+s*h[c+7],r*h[c+2]+t*h[c+5]+s*h[c+8]))}}},h.prototype={intersectsLine:function(e,t,i){this.intersectsBBox(e)&&(this.left.intersectsLine(e,t,i),this.right.intersectsLine(e,t,i))},intersectsBBox:function(e){const t=this.planes,i=this.min,s=this.max,r=i.x,n=s.x,o=i.y,a=s.y,l=i.z,h=s.z,d=this.intersection;return!!(t[0].intersectsLine(e,d)&&d.x>=r&&d.x<=n&&d.y>=o&&d.y<=a)||(!!(t[1].intersectsLine(e,d)&&d.x>=r&&d.x<=n&&d.y>=o&&d.y<=a)||(!!(t[2].intersectsLine(e,d)&&d.x>=r&&d.x<=n&&d.z>=l&&d.z<=h)||(!!(t[3].intersectsLine(e,d)&&d.x>=r&&d.x<=n&&d.z>=l&&d.z<=h)||!!(t[4].intersectsLine(e,d)&&d.y>=o&&d.y<=a&&d.z>=l&&d.z<=h))))},getLongestAxis:function(e,t){const i=t.x-e.x,s=t.y-e.y,r=t.z-e.z;return i<s?s<r?2:1:i<r?2:0}},d.prototype={constructor:d,intersectsLine:function(e,t,i){return t.size=0,this.root?(this.root.intersectsLine(e,t,i),t.size):0}},d})),e("x_ite/Components/ParticleSystems/ParticleSystem",["x_ite/Fields","x_ite/Base/X3DFieldDefinition","x_ite/Base/FieldDefinitionArray","x_ite/Components/Shape/X3DShapeNode","x_ite/Rendering/TraverseType","x_ite/Base/X3DConstants","x_ite/Base/X3DCast","x_ite/Browser/Shape/AlphaMode","standard/Math/Numbers/Vector3","standard/Math/Numbers/Vector4","standard/Math/Numbers/Matrix4","standard/Math/Numbers/Matrix3","standard/Math/Algorithms/QuickSort","standard/Math/Algorithm","standard/Math/Utility/BVH"],(function(e,t,i,s,r,n,o,a,l,h,d,c,u,m,f){"use strict";var p=0;const _=p++,y=p++,g=p++,x=p++,A=p++,F=p++,w={POINT:_,LINE:y,TRIANGLE:g,QUAD:x,GEOMETRY:A,SPRITE:F},R=new d,b=new l(0,0,0),P=new l(0,0,0),S=new l(0,0,0),v=new l(0,0,0),B=new l(0,0,0),C=new l(0,0,0),N=new l(0,0,0),T=new l(0,0,0),D=new l(0,0,0),V=new l(0,0,0);function I(e,t){return e.distance<t.distance}function M(e){s.call(this,e),this.addType(n.ParticleSystem),this._particleSize.setUnit("length"),this.createParticles=!0,this.particles=[],this.velocities=[],this.speeds=[],this.turbulences=[],this.geometryType=_,this.maxParticles=0,this.numParticles=0,this.particleLifetime=0,this.lifetimeVariation=0,this.emitterNode=null,this.forcePhysicsModelNodes=[],this.boundedPhysicsModelNodes=[],this.boundedNormals=[],this.boundedVertices=[],this.boundedVolume=null,this.creationTime=0,this.pauseTime=0,this.deltaTime=0,this.numForces=0,this.colorKeys=[],this.colorRamppNode=null,this.colorRamp=[],this.texCoordKeys=[],this.texCoordRampNode=null,this.texCoordRamp=[],this.texCoordAnim=!1,this.vertexCount=0,this.shaderNode=null,this.rotation=new c,this.particleSorter=new u(this.particles,I),this.sortParticles=!1,this.geometryContext={}}return M.prototype=Object.assign(Object.create(s.prototype),{constructor:M,[Symbol.for("X_ITE.X3DBaseNode.fieldDefinitions")]:new i([new t(n.inputOutput,"metadata",new e.SFNode),new t(n.inputOutput,"enabled",new e.SFBool(!0)),new t(n.inputOutput,"createParticles",new e.SFBool(!0)),new t(n.initializeOnly,"geometryType",new e.SFString("QUAD")),new t(n.inputOutput,"maxParticles",new e.SFInt32(200)),new t(n.inputOutput,"particleLifetime",new e.SFFloat(5)),new t(n.inputOutput,"lifetimeVariation",new e.SFFloat(.25)),new t(n.inputOutput,"particleSize",new e.SFVec2f(.02,.02)),new t(n.initializeOnly,"emitter",new e.SFNode),new t(n.initializeOnly,"physics",new e.MFNode),new t(n.initializeOnly,"colorKey",new e.MFFloat),new t(n.initializeOnly,"colorRamp",new e.SFNode),new t(n.initializeOnly,"texCoordKey",new e.MFFloat),new t(n.initializeOnly,"texCoordRamp",new e.SFNode),new t(n.outputOnly,"isActive",new e.SFBool),new t(n.inputOutput,"visible",new e.SFBool(!0)),new t(n.inputOutput,"castShadow",new e.SFBool(!0)),new t(n.inputOutput,"bboxDisplay",new e.SFBool),new t(n.initializeOnly,"bboxSize",new e.SFVec3f(-1,-1,-1)),new t(n.initializeOnly,"bboxCenter",new e.SFVec3f),new t(n.inputOutput,"appearance",new e.SFNode),new t(n.inputOutput,"geometry",new e.SFNode)]),getTypeName:function(){return"ParticleSystem"},getComponentName:function(){return"ParticleSystems"},getContainerField:function(){return"children"},initialize:function(){s.prototype.initialize.call(this);const e=this.getBrowser(),t=e.getContext();this.isLive().addInterest("set_live__",this),e.getBrowserOptions()._Shading.addInterest("set_shader__",this),this._enabled.addInterest("set_enabled__",this),this._createParticles.addInterest("set_createParticles__",this),this._geometryType.addInterest("set_geometryType__",this),this._maxParticles.addInterest("set_enabled__",this),this._particleLifetime.addInterest("set_particleLifetime__",this),this._lifetimeVariation.addInterest("set_lifetimeVariation__",this),this._emitter.addInterest("set_emitter__",this),this._physics.addInterest("set_physics__",this),this._colorKey.addInterest("set_color__",this),this._colorRamp.addInterest("set_colorRamp__",this),this._texCoordKey.addInterest("set_texCoord__",this),this._texCoordRamp.addInterest("set_texCoordRamp__",this),this.idBuffer=t.createBuffer(),this.positionBuffer=t.createBuffer(),this.elapsedTimeBuffer=t.createBuffer(),this.lifeBuffer=t.createBuffer(),this.colorBuffer=t.createBuffer(),this.texCoordBuffers=[t.createBuffer()],this.normalBuffer=t.createBuffer(),this.vertexBuffer=t.createBuffer();for(var i=1,r=this.getBrowser().getMaxTextures();i<r;++i)this.texCoordBuffers.push(this.texCoordBuffers[0]);this.idArray=new Float32Array,this.positionArray=new Float32Array,this.elapsedTimeArray=new Float32Array,this.lifeArray=new Float32Array,this.colorArray=new Float32Array,this.texCoordArray=new Float32Array,this.normalArray=new Float32Array,this.vertexArray=new Float32Array,this.primitiveMode=t.TRIANGLES,this.geometryContext.fogCoords=!1,this.geometryContext.textureCoordinateNode=e.getDefaultTextureCoordinate(),this.geometryContext.textureCoordinateMapping=new Map,this.set_emitter__(),this.set_enabled__(),this.set_createParticles__(),this.set_particleLifetime__(),this.set_lifetimeVariation__(),this.set_physics__(),this.set_colorRamp__(),this.set_texCoordRamp__()},set_bbox__:function(){this._bboxSize.getValue().equals(this.getDefaultBBoxSize())?this.bbox.set():this.bbox.set(this._bboxSize.getValue(),this._bboxCenter.getValue()),this.bboxSize.assign(this.bbox.size),this.bboxCenter.assign(this.bbox.center)},set_transparent__:function(){if(this.getAppearance().getAlphaMode()===a.AUTO)if(this.geometryType===_)this.setTransparent(!0);else this.setTransparent(this.getAppearance().getTransparent()||this.colorRampNode&&this.colorRampNode.getTransparent()||this.geometryType===A&&this.geometryNode&&this.geometryNode.getTransparent());else this.setTransparent(this.getAppearance().getTransparent())},set_live__:function(){this.isLive().getValue()?this._isActive.getValue()&&this._maxParticles.getValue()&&(this.getBrowser().sensorEvents().addInterest("animateParticles",this),this.pauseTime&&(this.creationTime+=performance.now()/1e3-this.pauseTime,this.pauseTime=0)):this._isActive.getValue()&&this._maxParticles.getValue()&&(this.getBrowser().sensorEvents().removeInterest("animateParticles",this),0===this.pauseTime&&(this.pauseTime=performance.now()/1e3))},set_enabled__:function(){this._enabled.getValue()&&this._maxParticles.getValue()?this._isActive.getValue()||(this.isLive().getValue()?(this.getBrowser().sensorEvents().addInterest("animateParticles",this),this.pauseTime=0):this.pauseTime=performance.now()/1e3,this._isActive=!0):this._isActive.getValue()&&(this.isLive().getValue()&&this.getBrowser().sensorEvents().removeInterest("animateParticles",this),this._isActive=!1,this.numParticles=0),this.set_maxParticles__()},set_createParticles__:function(){this.createParticles=this._createParticles.getValue()},set_geometryType__:function(){var e=this.getBrowser().getContext(),t=this.maxParticles;switch(this.geometryType=w[this._geometryType.getValue()],this.geometryType||(this.geometryType=_),this.geometryType){case _:this.idArray=new Float32Array(t),this.positionArray=new Float32Array(3*t),this.elapsedTimeArray=new Float32Array(t),this.lifeArray=new Float32Array(t),this.colorArray=new Float32Array(4*t),this.texCoordArray=new Float32Array,this.normalArray=new Float32Array,this.vertexArray=new Float32Array(4*t);for(var i=0,s=(r=this.idArray).length;i<s;++i)r[i]=i;this.colorArray.fill(1),this.vertexArray.fill(1),this.testWireframe=!1,this.primitiveMode=e.POINTS,this.texCoordCount=0,this.vertexCount=1,this.geometryContext.geometryType=0;break;case y:this.idArray=new Float32Array(2*t),this.positionArray=new Float32Array(6*t),this.elapsedTimeArray=new Float32Array(2*t),this.lifeArray=new Float32Array(2*t),this.colorArray=new Float32Array(8*t),this.texCoordArray=new Float32Array,this.normalArray=new Float32Array,this.vertexArray=new Float32Array(8*t);for(i=0,s=(r=this.idArray).length;i<s;++i)r[i]=Math.floor(i/2);this.colorArray.fill(1),this.vertexArray.fill(1),this.testWireframe=!1,this.primitiveMode=e.LINES,this.texCoordCount=2,this.vertexCount=2,this.geometryContext.geometryType=1;break;case g:case x:case F:this.idArray=new Float32Array(6*t),this.positionArray=new Float32Array(18*t),this.elapsedTimeArray=new Float32Array(6*t),this.lifeArray=new Float32Array(6*t),this.colorArray=new Float32Array(24*t),this.texCoordArray=new Float32Array(24*t),this.normalArray=new Float32Array(18*t),this.vertexArray=new Float32Array(24*t);var r;for(i=0,s=(r=this.idArray).length;i<s;++i)r[i]=Math.floor(i/6);this.colorArray.fill(1),this.vertexArray.fill(1);for(var n=this.texCoordArray,o=this.normalArray,a=(i=0,18*t);i<a;i+=3)o[i]=0,o[i+1]=0,o[i+2]=1;e.bindBuffer(e.ARRAY_BUFFER,this.normalBuffer),e.bufferData(e.ARRAY_BUFFER,this.normalArray,e.STATIC_DRAW);for(i=0;i<t;++i){var l=24*i;n[l]=n[l+12]=0,n[l+1]=n[l+13]=0,n[l+2]=n[l+14]=0,n[l+3]=n[l+15]=1,n[l+4]=1,n[l+5]=0,n[l+6]=0,n[l+7]=1,n[l+8]=n[l+16]=1,n[l+9]=n[l+17]=1,n[l+10]=n[l+18]=0,n[l+11]=n[l+19]=1,n[l+20]=0,n[l+21]=1,n[l+22]=0,n[l+23]=1}e.bindBuffer(e.ARRAY_BUFFER,this.texCoordBuffers[0]),e.bufferData(e.ARRAY_BUFFER,this.texCoordArray,e.STATIC_DRAW),this.testWireframe=!0,this.primitiveMode=e.TRIANGLES,this.texCoordCount=4,this.vertexCount=6,this.geometryContext.geometryType=2;break;case A:this.texCoordCount=0,this.vertexCount=0}e.bindBuffer(e.ARRAY_BUFFER,this.idBuffer),e.bufferData(e.ARRAY_BUFFER,this.idArray,e.STATIC_DRAW),this.set_shader__(),this.set_transparent__()},set_shader__:function(){switch(this.geometryType){case _:this.shaderNode=this.getBrowser().getPointShader();break;case y:this.shaderNode=this.getBrowser().getLineShader();break;case g:case x:case F:case A:this.shaderNode=null}},set_maxParticles__:function(){for(var e=this.particles,t=Math.max(0,this._maxParticles.getValue()),i=this.numParticles,s=Math.min(e.length,t);i<s;++i)e[i].life=1,e[i].lifetime=-1;for(i=e.length,s=t;i<s;++i)e[i]={id:i,life:1,lifetime:-1,elapsedTime:0,position:new l(0,0,0),velocity:new l(0,0,0),color:new h(1,1,1,1),distance:0};this.maxParticles=t,this.numParticles=Math.min(this.numParticles,t),this.emitterNode.isExplosive()||(this.creationTime=performance.now()/1e3),this.set_geometryType__()},set_particleLifetime__:function(){this.particleLifetime=this._particleLifetime.getValue()},set_lifetimeVariation__:function(){this.lifetimeVariation=this._lifetimeVariation.getValue()},set_emitter__:function(){this.emitterNode=o(n.X3DParticleEmitterNode,this._emitter),this.emitterNode||(this.emitterNode=this.getBrowser().getDefaultEmitter()),this.createParticles=this._createParticles.getValue()},set_physics__:function(){for(var e=this._physics.getValue(),t=this.forcePhysicsModelNodes,i=this.boundedPhysicsModelNodes,s=0,r=i.length;s<r;++s)i[s].removeInterest("set_boundedPhysics__",this);t.length=0,i.length=0;for(s=0,r=e.length;s<r;++s)try{for(var o=e[s].getValue().getInnerNode(),a=o.getType(),l=a.length-1;l>=0;--l){switch(a[l]){case n.ForcePhysicsModel:case n.WindPhysicsModel:t.push(o);break;case n.BoundedPhysicsModel:o.addInterest("set_boundedPhysics__",this),i.push(o);break;default:continue}break}}catch(e){}this.set_boundedPhysics__()},set_boundedPhysics__:function(){var e=this.boundedPhysicsModelNodes,t=this.boundedNormals,i=this.boundedVertices;t.length=0,i.length=0;for(var s=0,r=e.length;s<r;++s)e[s].addGeometry(t,i);this.boundedVolume=new f(i,t)},set_colorRamp__:function(){this.colorRampNode&&this.colorRampNode.removeInterest("set_color__",this),this.colorRampNode=o(n.X3DColorNode,this._colorRamp),this.colorRampNode&&this.colorRampNode.addInterest("set_color__",this),this.set_color__(),this.set_transparent__()},set_color__:function(){for(var e=this._colorKey,t=this.colorKeys,i=this.colorRamp,s=0,r=e.length;s<r;++s)t[s]=e[s];t.length=r,this.colorRampNode&&this.colorRampNode.getVectors(this.colorRamp);for(s=i.length,r=e.length;s<r;++s)i[s]=new h(1,1,1,1);i.length=r,this.geometryContext.colorMaterial=!(!t.length||!this.colorRampNode)},set_texCoordRamp__:function(){this.texCoordRampNode&&this.texCoordRampNode.removeInterest("set_texCoord__",this),this.texCoordRampNode=o(n.X3DTextureCoordinateNode,this._texCoordRamp),this.texCoordRampNode&&this.texCoordRampNode.addInterest("set_texCoord__",this),this.set_texCoord__()},set_texCoord__:function(){for(var e=this._texCoordKey,t=this.texCoordKeys,i=this.texCoordRamp,s=0,r=e.length;s<r;++s)t[s]=e[s];t.length=r,this.texCoordRampNode&&this.texCoordRampNode.getTexCoord(i);for(s=i.length,r=e.length*this.texCoordCount;s<r;++s)i[s]=new h(0,0,0,0);i.length=r,this.texCoordAnim=!(!t.length||!this.texCoordRampNode)},intersectsBox:function(e,t){},animateParticles:function(){var e=this.emitterNode,t=1/Math.max(10,this.getBrowser().getCurrentFrameRate()),i=this.deltaTime=(14*this.deltaTime+t)/15;if(e.isExplosive()){var s=performance.now()/1e3,r=this.particleLifetime+this.particleLifetime*this.lifetimeVariation;0===this.numParticles||s-this.creationTime>r?(this.creationTime=s,this.numParticles=this.maxParticles,this.createParticles=this._createParticles.getValue(),i=Number.POSITIVE_INFINITY):this.createParticles=!1}else if(this.numParticles<this.maxParticles){s=performance.now()/1e3;var n=Math.max(0,Math.floor((s-this.creationTime)*this.maxParticles/this.particleLifetime));n&&(this.creationTime=s),this.numParticles=Math.floor(Math.min(this.maxParticles,this.numParticles+n))}if(e.getMass()){for(var o=this.forcePhysicsModelNodes,a=this.velocities,h=this.speeds,d=this.turbulences,c=this.deltaTime/e.getMass(),u=a.length,m=o.length;u<m;++u)a[u]=new l(0,0,0);for(u=0,m=o.length;u<m;++u)o[u].addForce(u,e,a,d);for(u=0,m=a.length;u<m;++u)a[u].multiply(c),h[u]=a[u].abs();this.numForces=m}else this.numForces=0;e.animate(this,i),this.updateGeometry(null),this.getBrowser().addBrowserEvent()},updateGeometry:function(e){switch(this.geometryType){case _:e||this.updatePoint();break;case y:e||this.updateLine();break;case g:case x:case F:this.updateQuad(e)}},updatePoint:function(){var e=this.getBrowser().getContext(),t=this.particles,i=this.numParticles,s=this.positionArray,r=this.elapsedTimeArray,n=this.lifeArray,o=this.colorArray,a=this.vertexArray;if(this.geometryContext.colorMaterial){for(var l=0;l<i;++l){var h=t[l].color;o[m=4*l]=h.x,o[m+1]=h.y,o[m+2]=h.z,o[m+3]=h.w}e.bindBuffer(e.ARRAY_BUFFER,this.colorBuffer),e.bufferData(e.ARRAY_BUFFER,this.colorArray,e.STATIC_DRAW)}for(l=0;l<i;++l){var d=t[l].position,c=t[l].elapsedTime/t[l].lifetime,u=3*l,m=4*l;s[u]=d.x,s[u+1]=d.y,s[u+2]=d.z,r[l]=c,n[l]=t[l].life,a[m]=d.x,a[m+1]=d.y,a[m+2]=d.z}e.bindBuffer(e.ARRAY_BUFFER,this.positionBuffer),e.bufferData(e.ARRAY_BUFFER,this.positionArray,e.STATIC_DRAW),e.bindBuffer(e.ARRAY_BUFFER,this.elapsedTimeBuffer),e.bufferData(e.ARRAY_BUFFER,this.elapsedTimeArray,e.STATIC_DRAW),e.bindBuffer(e.ARRAY_BUFFER,this.lifeBuffer),e.bufferData(e.ARRAY_BUFFER,this.lifeArray,e.STATIC_DRAW),e.bindBuffer(e.ARRAY_BUFFER,this.vertexBuffer),e.bufferData(e.ARRAY_BUFFER,this.vertexArray,e.STATIC_DRAW)},updateLine:function(){var e=this.getBrowser().getContext(),t=this.particles,i=this.numParticles,s=this.positionArray,r=this.elapsedTimeArray,n=this.lifeArray,o=this.colorArray,a=this.vertexArray,l=this._particleSize.y/2;if(this.geometryContext.colorMaterial){for(var h=0;h<i;++h){var d=t[h].color;o[A=8*h]=d.x,o[A+1]=d.y,o[A+2]=d.z,o[A+3]=d.w,o[A+4]=d.x,o[A+5]=d.y,o[A+6]=d.z,o[A+7]=d.w}e.bindBuffer(e.ARRAY_BUFFER,this.colorBuffer),e.bufferData(e.ARRAY_BUFFER,this.colorArray,e.STATIC_DRAW)}for(h=0;h<i;++h){var c=t[h],u=c.position,m=t[h].elapsedTime/t[h].lifetime,f=t[h].life,p=u.x,_=u.y,y=u.z,g=2*h,x=6*h,A=8*h;s[x]=p,s[x+1]=_,s[x+2]=y,s[x+3]=p,s[x+4]=_,s[x+5]=y,r[g]=m,r[g+1]=m,n[g]=f,n[g+1]=f,v.assign(c.velocity).normalize().multiply(l),a[A]=p-v.x,a[A+1]=_-v.y,a[A+2]=y-v.z,a[A+4]=p+v.x,a[A+5]=_+v.y,a[A+6]=y+v.z}e.bindBuffer(e.ARRAY_BUFFER,this.positionBuffer),e.bufferData(e.ARRAY_BUFFER,this.positionArray,e.STATIC_DRAW),e.bindBuffer(e.ARRAY_BUFFER,this.elapsedTimeBuffer),e.bufferData(e.ARRAY_BUFFER,this.elapsedTimeArray,e.STATIC_DRAW),e.bindBuffer(e.ARRAY_BUFFER,this.lifeBuffer),e.bufferData(e.ARRAY_BUFFER,this.lifeArray,e.STATIC_DRAW),e.bindBuffer(e.ARRAY_BUFFER,this.vertexBuffer),e.bufferData(e.ARRAY_BUFFER,this.vertexArray,e.STATIC_DRAW)},updateQuad:function(e){try{var t=this.getBrowser().getContext(),i=this.particles,s=this.maxParticles,r=this.numParticles,n=this.positionArray,o=this.elapsedTimeArray,a=this.lifeArray,l=this.colorArray,h=this.texCoordArray,d=this.normalArray,c=this.vertexArray,u=this._particleSize.x/2,f=this._particleSize.y/2;if(!e){if(this.geometryContext.colorMaterial){for(var p=0;p<s;++p){var _=i[p].color;l[G=24*p]=l[G+4]=l[G+8]=l[G+12]=l[G+16]=l[G+20]=_.x,l[G+1]=l[G+5]=l[G+9]=l[G+13]=l[G+17]=l[G+21]=_.y,l[G+2]=l[G+6]=l[G+10]=l[G+14]=l[G+18]=l[G+22]=_.z,l[G+3]=l[G+7]=l[G+11]=l[G+15]=l[G+19]=l[G+23]=_.w}t.bindBuffer(t.ARRAY_BUFFER,this.colorBuffer),t.bufferData(t.ARRAY_BUFFER,this.colorArray,t.STATIC_DRAW)}if(this.texCoordAnim&&this.texCoordArray.length){var y=this.texCoordKeys,g=this.texCoordRamp,x=y.length,A=0;for(p=0;p<s;++p){var w=i[p],R=w.elapsedTime/w.lifetime;if(1==x||R<=y[0])A=0;else if(R>=y.at(-1))A=x-2;else{var b=m.upperBound(y,0,x,R,m.less);A=b<x?b-1:0}var P=g[A*=this.texCoordCount],D=g[A+1],V=g[A+2],I=g[A+3];h[G=24*p]=h[G+12]=P.x,h[G+1]=h[G+13]=P.y,h[G+2]=h[G+14]=P.z,h[G+3]=h[G+15]=P.w,h[G+4]=D.x,h[G+5]=D.y,h[G+6]=D.z,h[G+7]=D.w,h[G+8]=h[G+16]=V.x,h[G+9]=h[G+17]=V.y,h[G+10]=h[G+18]=V.z,h[G+11]=h[G+19]=V.w,h[G+20]=I.x,h[G+21]=I.y,h[G+22]=I.z,h[G+23]=I.w}t.bindBuffer(t.ARRAY_BUFFER,this.texCoordBuffers[0]),t.bufferData(t.ARRAY_BUFFER,this.texCoordArray,t.STATIC_DRAW)}}if(this.geometryType===F){if(e){var M=this.getScreenAlignedRotation(e);v.set(M[0],M[1],M[2]).cross(S.set(M[3],M[4],M[5])).normalize();var z=v.x,E=v.y,O=v.z;for(p=0,x=18*s;p<x;p+=3)d[p]=z,d[p+1]=E,d[p+2]=O;t.bindBuffer(t.ARRAY_BUFFER,this.normalBuffer),t.bufferData(t.ARRAY_BUFFER,this.normalArray,t.STATIC_DRAW),B.set(-u,-f,0),C.set(u,-f,0),N.set(u,f,0),T.set(-u,f,0),M.multVecMatrix(B),M.multVecMatrix(C),M.multVecMatrix(N),M.multVecMatrix(T);for(p=0;p<r;++p){var U=i[p].position,X=i[p].elapsedTime/i[p].lifetime,Y=U.x,L=U.y,W=U.z,j=6*p,G=24*p;n[k=18*p]=n[k+3]=n[k+6]=n[k+9]=n[k+12]=n[k+15]=Y,n[k+1]=n[k+4]=n[k+7]=n[k+10]=n[k+13]=n[k+16]=L,n[k+2]=n[k+5]=n[k+8]=n[k+11]=n[k+14]=n[k+17]=W,o[j]=o[j+1]=o[j+2]=o[j+3]=o[j+4]=o[j+5]=X,a[j]=a[j+1]=a[j+2]=a[j+3]=a[j+4]=a[j+5]=i[p].life,c[G]=c[G+12]=Y+B.x,c[G+1]=c[G+13]=L+B.y,c[G+2]=c[G+14]=W+B.z,c[G+4]=Y+C.x,c[G+5]=L+C.y,c[G+6]=W+C.z,c[G+8]=c[G+16]=Y+N.x,c[G+9]=c[G+17]=L+N.y,c[G+10]=c[G+18]=W+N.z,c[G+20]=Y+T.x,c[G+21]=L+T.y,c[G+22]=W+T.z}t.bindBuffer(t.ARRAY_BUFFER,this.positionBuffer),t.bufferData(t.ARRAY_BUFFER,this.positionArray,t.STATIC_DRAW),t.bindBuffer(t.ARRAY_BUFFER,this.elapsedTimeBuffer),t.bufferData(t.ARRAY_BUFFER,this.elapsedTimeArray,t.STATIC_DRAW),t.bindBuffer(t.ARRAY_BUFFER,this.lifeBuffer),t.bufferData(t.ARRAY_BUFFER,this.lifeArray,t.STATIC_DRAW),t.bindBuffer(t.ARRAY_BUFFER,this.vertexBuffer),t.bufferData(t.ARRAY_BUFFER,this.vertexArray,t.STATIC_DRAW)}}else if(!e){for(p=0;p<r;++p){var k;U=i[p].position,X=i[p].elapsedTime/i[p].lifetime,Y=U.x,L=U.y,W=U.z,j=6*p,G=24*p;n[k=18*p]=n[k+3]=n[k+6]=n[k+9]=n[k+12]=n[k+15]=Y,n[k+1]=n[k+4]=n[k+7]=n[k+10]=n[k+13]=n[k+16]=L,n[k+2]=n[k+5]=n[k+8]=n[k+11]=n[k+14]=n[k+17]=W,o[j]=o[j+1]=o[j+2]=o[j+3]=o[j+4]=o[j+5]=X,a[j]=a[j+1]=a[j+2]=a[j+3]=a[j+4]=a[j+5]=i[p].life,c[G]=c[G+12]=Y-u,c[G+1]=c[G+13]=L-f,c[G+2]=c[G+14]=W,c[G+4]=Y+u,c[G+5]=L-f,c[G+6]=W,c[G+8]=c[G+16]=Y+u,c[G+9]=c[G+17]=L+f,c[G+10]=c[G+18]=W,c[G+20]=Y-u,c[G+21]=L+f,c[G+22]=W}t.bindBuffer(t.ARRAY_BUFFER,this.positionBuffer),t.bufferData(t.ARRAY_BUFFER,this.positionArray,t.STATIC_DRAW),t.bindBuffer(t.ARRAY_BUFFER,this.elapsedTimeBuffer),t.bufferData(t.ARRAY_BUFFER,this.elapsedTimeArray,t.STATIC_DRAW),t.bindBuffer(t.ARRAY_BUFFER,this.lifeBuffer),t.bufferData(t.ARRAY_BUFFER,this.lifeArray,t.STATIC_DRAW),t.bindBuffer(t.ARRAY_BUFFER,this.vertexBuffer),t.bufferData(t.ARRAY_BUFFER,this.vertexArray,t.STATIC_DRAW)}}catch(e){console.error(e)}},traverse:function(e,t){if(this._isActive.getValue()){switch(e){case r.POINTER:case r.PICKING:case r.COLLISION:break;case r.SHADOW:this._castShadow.getValue()&&t.addDepthShape(this);break;case r.DISPLAY:t.addDisplayShape(this)&&this.getAppearance().traverse(e,t)}this.geometryType===A&&this.getGeometry()&&this.getGeometry().traverse(e,t)}},depth:function(e,t,i){if(this.updateGeometry(t.modelViewMatrix),this.geometryType===A){var s=this.getGeometry();s&&s.displayParticlesDepth(e,t,i,this.particles,this.numParticles)}else{if(this.numParticles<=0)return;i.getValid()&&(i.enableFloatAttrib(e,"x3d_ParticleId",this.idBuffer,1),i.enableFloatAttrib(e,"x3d_ParticlePosition",this.positionBuffer,3),i.enableFloatAttrib(e,"x3d_ParticleElapsedTime",this.elapsedTimeBuffer,1),i.enableFloatAttrib(e,"x3d_ParticleLife",this.lifeBuffer,1),i.enableVertexAttribute(e,this.vertexBuffer),e.drawArrays(this.primitiveMode,0,this.numParticles*this.vertexCount),i.disableFloatAttrib(e,"x3d_ParticleId"),i.disableFloatAttrib(e,"x3d_ParticlePosition"),i.disableFloatAttrib(e,"x3d_ParticleElapsedTime"),i.disableFloatAttrib(e,"x3d_ParticleLife"))}},display:function(e,t){try{if(this.numParticles<=0)return;if(this.updateGeometry(t.modelViewMatrix),this.geometryType===A){const i=this.getGeometry();i&&i.displayParticles(e,t,this.particles,this.numParticles)}else{const r=this.getAppearance(),n=r.shaderNode||this.shaderNode||r.materialNode.getShader(t.browser,t.shadow);if(n.getValid()){t.geometryContext=this.geometryContext;const o=r.blendModeNode;if(o&&o.enable(e),n.enable(e),n.setLocalUniforms(e,t),n.enableFloatAttrib(e,"x3d_ParticleId",this.idBuffer,1),n.enableFloatAttrib(e,"x3d_ParticlePosition",this.positionBuffer,3),n.enableFloatAttrib(e,"x3d_ParticleElapsedTime",this.elapsedTimeBuffer,1),n.enableFloatAttrib(e,"x3d_ParticleLife",this.lifeBuffer,1),this.geometryContext.colorMaterial&&n.enableColorAttribute(e,this.colorBuffer),this.texCoordArray.length&&n.enableTexCoordAttribute(e,this.texCoordBuffers),this.normalArray.length&&n.enableNormalAttribute(e,this.normalBuffer),n.enableVertexAttribute(e,this.vertexBuffer),n.wireframe&&this.testWireframe)for(var i=0,s=this.numParticles*this.vertexCount;i<s;i+=3)e.drawArrays(n.primitiveMode,i,3);else{const i=d.prototype.determinant3.call(t.modelViewMatrix)>0;e.frontFace(i?e.CCW:e.CW),e.enable(e.CULL_FACE),e.cullFace(e.BACK),e.drawArrays(this.primitiveMode,0,this.numParticles*this.vertexCount)}n.disableFloatAttrib(e,"x3d_ParticleId"),n.disableFloatAttrib(e,"x3d_ParticlePosition"),n.disableFloatAttrib(e,"x3d_ParticleElapsedTime"),n.disableFloatAttrib(e,"x3d_ParticleLife"),n.disableColorAttribute(e),n.disableTexCoordAttribute(e),n.disableNormalAttribute(e),o&&o.disable(e),t.geometryContext=null}}}catch(e){console.error(e)}},getScreenAlignedRotation:function(e){R.assign(e).inverse(),R.multDirMatrix(b.assign(l.zAxis)),R.multDirMatrix(P.assign(l.yAxis)),D.assign(P).cross(b),V.assign(b).cross(D);var t=b;return D.normalize(),V.normalize(),t.normalize(),this.rotation.set(D.x,D.y,D.z,V.x,V.y,V.z,t.x,t.y,t.z)}}),M})),e("x_ite/Components/ParticleSystems/PolylineEmitter",["x_ite/Fields","x_ite/Base/X3DFieldDefinition","x_ite/Base/FieldDefinitionArray","x_ite/Components/ParticleSystems/X3DParticleEmitterNode","x_ite/Components/Rendering/IndexedLineSet","x_ite/Base/X3DConstants","standard/Math/Numbers/Vector3","standard/Math/Algorithm"],(function(e,t,i,s,r,n,o,a){"use strict";function l(e){s.call(this,e),this.addType(n.PolylineEmitter),this._speed.setUnit("speed"),this._mass.setUnit("mass"),this._surfaceArea.setUnit("area"),this.direction=new o(0,0,0),this.polylineNode=new r(e),this.polylines=[],this.lengthSoFarArray=[0]}var h,d;function c(e){return e.set(0,0,0)}return l.prototype=Object.assign(Object.create(s.prototype),{constructor:l,[Symbol.for("X_ITE.X3DBaseNode.fieldDefinitions")]:new i([new t(n.inputOutput,"metadata",new e.SFNode),new t(n.inputOutput,"direction",new e.SFVec3f(0,1,0)),new t(n.inputOutput,"speed",new e.SFFloat),new t(n.inputOutput,"variation",new e.SFFloat(.25)),new t(n.initializeOnly,"mass",new e.SFFloat),new t(n.initializeOnly,"surfaceArea",new e.SFFloat),new t(n.inputOutput,"coordIndex",new e.MFInt32(-1)),new t(n.inputOutput,"coord",new e.SFNode)]),getTypeName:function(){return"PolylineEmitter"},getComponentName:function(){return"ParticleSystems"},getContainerField:function(){return"emitter"},initialize:function(){s.prototype.initialize.call(this),this._direction.addInterest("set_direction__",this),this._coordIndex.addFieldInterest(this.polylineNode._coordIndex),this._coord.addFieldInterest(this.polylineNode._coord),this.polylineNode._coordIndex=this._coordIndex,this.polylineNode._coord=this._coord,this.polylineNode._rebuild.addInterest("set_polyline",this),this.polylineNode.setPrivate(!0),this.polylineNode.setup(),this.set_direction__(),this.set_polyline()},set_direction__:function(){this.direction.assign(this._direction.getValue()).normalize(),this.direction.equals(o.Zero)?this.getRandomVelocity=this.getSphericalRandomVelocity:delete this.getRandomVelocity},set_polyline:(h=new o(0,0,0),d=new o(0,0,0),function(){var e=this.vertices=this.polylineNode.getVertices().getValue();if(e.length){delete this.getRandomPosition;var t=0,i=this.lengthSoFarArray;i.length=1;for(var s=0,r=e.length;s<r;s+=8)h.set(e[s],e[s+1],e[s+2]),d.set(e[s+4],e[s+5],e[s+6]),t+=d.subtract(h).abs(),i.push(t)}else this.getRandomPosition=c}),getRandomPosition:function(e){var t=this.lengthSoFarArray,i=t.length,s=Math.random()*t.at(-1),r=0,n=0,o=0;if(1==i||s<=t[0])r=0,o=0;else if(s>=t.at(-1))r=i-2,o=1;else{var l=a.upperBound(t,0,i,s,a.less);if(l<i){n=l;var h=t[r=l-1],d=t[n];o=a.clamp((s-h)/(d-h),0,1)}else r=0,o=0}n=(r*=8)+4;var c=this.vertices,u=c[r],m=c[r+1],f=c[r+2],p=c[n],_=c[n+1],y=c[n+2];return e.x=u+o*(p-u),e.y=m+o*(_-m),e.z=f+o*(y-f),e},getRandomVelocity:function(e){var t=this.direction,i=this.getRandomSpeed();return e.x=t.x*i,e.y=t.y*i,e.z=t.z*i,e}}),l})),e("x_ite/Components/ParticleSystems/SurfaceEmitter",["x_ite/Fields","x_ite/Base/X3DFieldDefinition","x_ite/Base/FieldDefinitionArray","x_ite/Components/ParticleSystems/X3DParticleEmitterNode","x_ite/Base/X3DConstants","x_ite/Base/X3DCast","standard/Math/Geometry/Triangle3","standard/Math/Numbers/Vector3","standard/Math/Algorithm"],(function(e,t,i,s,r,n,o,a,l){"use strict";function h(e){s.call(this,e),this.addType(r.SurfaceEmitter),this._speed.setUnit("speed"),this._mass.setUnit("mass"),this._surfaceArea.setUnit("area"),this.surfaceNode=null,this.areaSoFarArray=[0],this.direction=new a(0,0,0)}var d,c,u;function m(e){return e.set(0,0,0)}return h.prototype=Object.assign(Object.create(s.prototype),{constructor:h,[Symbol.for("X_ITE.X3DBaseNode.fieldDefinitions")]:new i([new t(r.inputOutput,"metadata",new e.SFNode),new t(r.inputOutput,"speed",new e.SFFloat),new t(r.inputOutput,"variation",new e.SFFloat(.25)),new t(r.initializeOnly,"mass",new e.SFFloat),new t(r.initializeOnly,"surfaceArea",new e.SFFloat),new t(r.initializeOnly,"surface",new e.SFNode)]),getTypeName:function(){return"SurfaceEmitter"},getComponentName:function(){return"ParticleSystems"},getContainerField:function(){return"emitter"},initialize:function(){s.prototype.initialize.call(this),this._surface.addInterest("set_surface__",this),this.set_surface__()},set_surface__:function(){this.surfaceNode&&this.surfaceNode._rebuild.removeInterest("set_geometry__",this),this.surfaceNode=n(r.X3DGeometryNode,this._surface),this.surfaceNode&&this.surfaceNode._rebuild.addInterest("set_geometry__",this),this.set_geometry__()},set_geometry__:(d=new a(0,0,0),c=new a(0,0,0),u=new a(0,0,0),function(){if(this.surfaceNode){delete this.getRandomPosition,delete this.getRandomVelocity;var e=0,t=this.areaSoFarArray,i=this.surfaceNode.getVertices().getValue();this.normals=this.surfaceNode.getNormals().getValue(),this.vertices=i,t.length=1;for(var s=0,r=i.length;s<r;s+=12)d.set(i[s],i[s+1],i[s+2]),c.set(i[s+4],i[s+5],i[s+6]),u.set(i[s+8],i[s+9],i[s+10]),e+=o.area(d,c,u),t.push(e)}else this.getRandomPosition=m,this.getRandomVelocity=this.getSphericalRandomVelocity}),getRandomPosition:function(e){var t=this.areaSoFarArray,i=t.length,s=Math.random()*t.at(-1),r=0;if(1==i||s<=t[0])r=0;else if(s>=t.at(-1))r=i-2;else{var n=l.upperBound(t,0,i,s,l.less);r=n<i?n-1:0}var o=Math.random(),a=Math.random();o+a>1&&(o=1-o,a=1-a);var h=1-o-a,d=12*r,c=this.vertices;e.x=o*c[d]+a*c[d+4]+h*c[d+8],e.y=o*c[d+1]+a*c[d+5]+h*c[d+9],e.z=o*c[d+2]+a*c[d+6]+h*c[d+10];d=9*r;var u=this.normals,m=this.direction;return m.x=o*u[d]+a*u[d+3]+h*u[d+6],m.y=o*u[d+1]+a*u[d+4]+h*u[d+7],m.z=o*u[d+2]+a*u[d+5]+h*u[d+8],e},getRandomVelocity:function(e){var t=this.getRandomSpeed(),i=this.direction;return e.x=i.x*t,e.y=i.y*t,e.z=i.z*t,e}}),h})),e("x_ite/Components/ParticleSystems/VolumeEmitter",["x_ite/Fields","x_ite/Base/X3DFieldDefinition","x_ite/Base/FieldDefinitionArray","x_ite/Components/ParticleSystems/X3DParticleEmitterNode","x_ite/Components/Geometry3D/IndexedFaceSet","x_ite/Base/X3DConstants","standard/Math/Numbers/Vector3","standard/Math/Numbers/Rotation4","standard/Math/Geometry/Line3","standard/Math/Geometry/Plane3","standard/Math/Geometry/Triangle3","standard/Math/Algorithm","standard/Math/Utility/BVH","standard/Math/Algorithms/QuickSort"],(function(e,t,i,s,r,n,o,a,l,h,d,c,u,m){"use strict";function f(e){s.call(this,e),this.addType(n.VolumeEmitter),this._speed.setUnit("speed"),this._mass.setUnit("mass"),this._surfaceArea.setUnit("area"),this.direction=new o(0,0,0),this.volumeNode=new r(e),this.areaSoFarArray=[0]}var p,_,y;return f.prototype=Object.assign(Object.create(s.prototype),{constructor:f,[Symbol.for("X_ITE.X3DBaseNode.fieldDefinitions")]:new i([new t(n.inputOutput,"metadata",new e.SFNode),new t(n.initializeOnly,"internal",new e.SFBool(!0)),new t(n.inputOutput,"direction",new e.SFVec3f(0,1,0)),new t(n.inputOutput,"speed",new e.SFFloat),new t(n.inputOutput,"variation",new e.SFFloat(.25)),new t(n.initializeOnly,"mass",new e.SFFloat),new t(n.initializeOnly,"surfaceArea",new e.SFFloat),new t(n.inputOutput,"coordIndex",new e.MFInt32(-1)),new t(n.inputOutput,"coord",new e.SFNode)]),getTypeName:function(){return"VolumeEmitter"},getComponentName:function(){return"ParticleSystems"},getContainerField:function(){return"emitter"},initialize:function(){s.prototype.initialize.call(this),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._rebuild.addInterest("set_geometry__",this),this.volumeNode.setPrivate(!0),this.volumeNode.setup(),this.set_direction__(),this.set_geometry__()},set_direction__:function(){this.direction.assign(this._direction.getValue()).normalize(),this.direction.equals(o.Zero)?this.getRandomVelocity=this.getSphericalRandomVelocity:delete this.getRandomVelocity},set_geometry__:(p=new o(0,0,0),_=new o(0,0,0),y=new o(0,0,0),function(){var e=0,t=this.areaSoFarArray,i=this.volumeNode.getNormals().getValue(),s=this.volumeNode.getVertices().getValue();this.normals=i,this.vertices=s,t.length=1;for(var r=0,n=s.length;r<n;r+=12)p.set(s[r],s[r+1],s[r+2]),_.set(s[r+4],s[r+5],s[r+6]),y.set(s[r+8],s[r+9],s[r+10]),e+=d.area(p,_,y),t.push(e);this.bvh=new u(s,i)}),getRandomPosition:function(){var e=new o(0,0,0),t=new o(0,0,0),i=new a(0,0,1,0),s=new l(o.Zero,o.zAxis),r=new h(o.Zero,o.zAxis),n=[],d=new m(n,(function(e,t){return r.getDistanceToPoint(e)<r.getDistanceToPoint(t)}));return function(a){var l=this.areaSoFarArray,h=l.length,u=Math.random()*l.at(-1),m=0;if(1==h||u<=l[0])m=0;else if(u>=l.at(-1))m=h-2;else{m=(F=c.upperBound(l,0,h,u,c.less))<h?F-1:0}var f=Math.random(),p=Math.random();f+p>1&&(f=1-f,p=1-p);var _=1-f-p,y=12*m,g=this.vertices;e.x=f*g[y]+p*g[y+4]+_*g[y+8],e.y=f*g[y+1]+p*g[y+5]+_*g[y+9],e.z=f*g[y+2]+p*g[y+6]+_*g[y+10];y=9*m;var x=this.normals;t.x=f*x[y]+p*x[y+3]+_*x[y+6],t.y=f*x[y+1]+p*x[y+4]+_*x[y+7],t.z=f*x[y+2]+p*x[y+5]+_*x[y+8],i.setFromToVec(o.zAxis,t),i.multVecRot(this.getRandomSurfaceNormal(t)),s.set(e,t),r.set(e,t);var A=this.bvh.intersectsLine(s,n);if(A-=A%2){d.sort(0,A);var F=2*Math.round(this.getRandomValue(0,A/2-1)),w=n[F],R=n[F+1];_=Math.random();return a.x=w.x+(R.x-w.x)*_,a.y=w.y+(R.y-w.y)*_,a.z=w.z+(R.z-w.z)*_,a}return a.set(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY)}}(),getRandomVelocity:function(e){var t=this.direction,i=this.getRandomSpeed();return e.x=t.x*i,e.y=t.y*i,e.z=t.z*i,e}}),f})),e("x_ite/Components/ParticleSystems/WindPhysicsModel",["x_ite/Fields","x_ite/Base/X3DFieldDefinition","x_ite/Base/FieldDefinitionArray","x_ite/Components/ParticleSystems/X3DParticlePhysicsModelNode","x_ite/Base/X3DConstants","standard/Math/Numbers/Vector3","standard/Math/Algorithm"],(function(e,t,i,s,r,n,o){"use strict";function a(e){s.call(this,e),this.addType(r.WindPhysicsModel),this._speed.setUnit("speed")}var l;return a.prototype=Object.assign(Object.create(s.prototype),{constructor:a,[Symbol.for("X_ITE.X3DBaseNode.fieldDefinitions")]:new i([new t(r.inputOutput,"metadata",new e.SFNode),new t(r.inputOutput,"enabled",new e.SFBool(!0)),new t(r.inputOutput,"direction",new e.SFVec3f),new t(r.inputOutput,"speed",new e.SFFloat(.1)),new t(r.inputOutput,"gustiness",new e.SFFloat(.1)),new t(r.inputOutput,"turbulence",new e.SFFloat)]),getTypeName:function(){return"WindPhysicsModel"},getComponentName:function(){return"ParticleSystems"},getContainerField:function(){return"physics"},getRandomSpeed:function(e){var t=Math.max(0,this._speed.getValue()),i=t*Math.max(0,this._gustiness.getValue());return e.getRandomValue(Math.max(0,t-i),t+i)},addForce:(l=new n(0,0,0),function(e,t,i,s){var r=t._surfaceArea.getValue();if(this._enabled.getValue()){var a=this.getRandomSpeed(t),h=.64615*Math.pow(10,2*Math.log(a));this._direction.getValue().equals(n.Zero)?t.getRandomNormal(l):l.assign(this._direction.getValue()).normalize(),i[e].assign(l.multiply(r*h)),s[e]=Math.PI*o.clamp(this._turbulence.getValue(),0,1)}})}),a})),e(t.getComponentUrl("particle-systems"),["x_ite/Components","x_ite/Browser/ParticleSystems/X3DParticleSystemsContext","x_ite/Components/ParticleSystems/BoundedPhysicsModel","x_ite/Components/ParticleSystems/ConeEmitter","x_ite/Components/ParticleSystems/ExplosionEmitter","x_ite/Components/ParticleSystems/ForcePhysicsModel","x_ite/Components/ParticleSystems/ParticleSystem","x_ite/Components/ParticleSystems/PointEmitter","x_ite/Components/ParticleSystems/PolylineEmitter","x_ite/Components/ParticleSystems/SurfaceEmitter","x_ite/Components/ParticleSystems/VolumeEmitter","x_ite/Components/ParticleSystems/WindPhysicsModel","x_ite/Components/ParticleSystems/X3DParticleEmitterNode","x_ite/Components/ParticleSystems/X3DParticlePhysicsModelNode"],(function(e,t,i,s,r,n,o,a,l,h,d,c,u,m){"use strict";e.addComponent({name:"ParticleSystems",types:{BoundedPhysicsModel:i,ConeEmitter:s,ExplosionEmitter:r,ForcePhysicsModel:n,ParticleSystem:o,PointEmitter:a,PolylineEmitter:l,SurfaceEmitter:h,VolumeEmitter:d,WindPhysicsModel:c},abstractTypes:{X3DParticleEmitterNode:u,X3DParticlePhysicsModelNode:m},browser:t})}))}();
@@ -4,8 +4,8 @@
4
4
  var module = { }, exports, process;
5
5
 
6
6
  const
7
- define = window [Symbol .for ("X_ITE.X3D-5.0.0")] .define,
8
- require = window [Symbol .for ("X_ITE.X3D-5.0.0")] .require;
7
+ define = window [Symbol .for ("X_ITE.X3D-5.0.2")] .define,
8
+ require = window [Symbol .for ("X_ITE.X3D-5.0.2")] .require;
9
9
  /* -*- Mode: JavaScript; coding: utf-8; tab-width: 3; indent-tabs-mode: tab; c-basic-offset: 3 -*-
10
10
  *******************************************************************************
11
11
  *
@@ -1 +1 @@
1
- !function(){const e=window[Symbol.for("X_ITE.X3D-5.0.0")].define,t=window[Symbol.for("X_ITE.X3D-5.0.0")].require;e("x_ite/Browser/Picking/MatchCriterion",[],(function(){"use strict";let e=0;return{MATCH_ANY:e++,MATCH_EVERY:e++,MATCH_ONLY_ONE:e++}})),e("x_ite/Browser/Picking/IntersectionType",[],(function(){"use strict";let e=0;return{BOUNDS:e++,GEOMETRY:e++}})),e("x_ite/Browser/Picking/SortOrder",[],(function(){"use strict";let e=0;return{ANY:e++,CLOSEST:e++,ALL:e++,ALL_SORTED:e++}})),e("x_ite/Components/Picking/X3DPickSensorNode",["x_ite/Fields","x_ite/Components/Core/X3DSensorNode","x_ite/Rendering/TraverseType","x_ite/Base/X3DConstants","x_ite/Browser/Picking/MatchCriterion","x_ite/Browser/Picking/IntersectionType","x_ite/Browser/Picking/SortOrder","standard/Math/Numbers/Matrix4","standard/Math/Algorithms/QuickSort","standard/Utility/ObjectCache"],(function(e,t,i,n,o,s,r,c,a,h){"use strict";var p,d,g,l,u=h(c);function m(e,t){return e.distance<t.distance}function _(i){t.call(this,i),this.addType(n.X3DPickSensorNode),this.objectType=new Set,this.intersectionType=s.BOUNDS,this.sortOrder=r.CLOSEST,this.pickTargetNodes=new Set,this.modelMatrices=[],this.targets=[],this.targets.size=0,this.pickedTargets=[],this.pickedTargetsSorter=new a(this.pickedTargets,m),this.pickedGeometries=new e.MFNode}return _.prototype=Object.assign(Object.create(t.prototype),{constructor:_,initialize:function(){this.isLive().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:function(){return this.objectType},getMatchCriterion:function(){return this.matchCriterion},getIntersectionType:function(){return this.intersectionType},getSortOrder:function(){return this.sortOrder},getModelMatrices:function(){return this.modelMatrices},getTargets:function(){return this.targets},getPickShape:(l=new WeakMap,function(e){var t=l.get(e);if(void 0!==t)return t;var i=this.getExecutionContext().createNode("Shape",!1),n=this.getExecutionContext().createNode("CollidableShape",!1);return i.setPrivate(!0),n.setPrivate(!0),n.setConvex(!0),i._geometry=e,n._shape=i,i.setup(),n.setup(),l.set(e,n),n}),getPickedGeometries:function(){var e=this.targets,t=e.size,i=this.pickedTargets,n=this.pickedGeometries;i.length=0;for(var o=0;o<t;++o){var s=e[o];s.intersected&&i.push(s)}if(0===i.length)return n.length=0,n;switch(this.sortOrder){case r.ANY:i.length=1,n[0]=this.getPickedGeometry(i[0]),n.length=1;break;case r.CLOSEST:this.pickedTargetsSorter.sort(0,i.length),i.length=1,n[0]=this.getPickedGeometry(i[0]),n.length=1;break;case r.ALL:o=0;for(var c=i.length;o<c;++o)n[o]=this.getPickedGeometry(i[o]);n.length=c;break;case r.ALL_SORTED:for(this.pickedTargetsSorter.sort(0,i.length),o=0,c=i.length;o<c;++o)n[o]=this.getPickedGeometry(i[o]);n.length=c}return n},getPickedGeometry:function(e){var t=this.getExecutionContext(),i=e.geometryNode;if(i.getExecutionContext()===t)return i;if(-1!==(r=i.getExecutionContext()).getType().indexOf(n.X3DPrototypeInstance)&&r.getExecutionContext()===t)return r;for(var o=e.pickingHierarchy,s=o.length-1;s>=0;--s){var r,c=o[s];if(c.getExecutionContext()===t)return c;if(-1!==(r=c.getExecutionContext()).getType().indexOf(n.X3DPrototypeInstance)&&r.getExecutionContext()===t)return r}return null},getPickedTargets:function(){return this.pickedTargets},set_live__:function(){this.isLive().getValue()&&this._enabled.getValue()&&!this.objectType.has("NONE")?(this.getBrowser().addPickSensor(this),this.setPickableObject(!0)):(this.getBrowser().removePickSensor(this),this.setPickableObject(!1))},set_objectType__:function(){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__:(g=new Map([["MATCH_ANY",o.MATCH_ANY],["MATCH_EVERY",o.MATCH_EVERY],["MATCH_ONLY_ONE",o.MATCH_ONLY_ONE]]),function(){this.matchCriterion=g.get(this._matchCriterion.getValue()),void 0===this.matchCriterion&&(this.matchCriterion=MatchCriterionType.MATCH_ANY)}),set_intersectionType__:(d=new Map([["BOUNDS",s.BOUNDS],["GEOMETRY",s.GEOMETRY]]),function(){this.intersectionType=d.get(this._intersectionType.getValue()),void 0===this.intersectionType&&(this.intersectionType=s.BOUNDS)}),set_sortOrder__:(p=new Map([["ANY",r.ANY],["CLOSEST",r.CLOSEST],["ALL",r.ALL],["ALL_SORTED",r.ALL_SORTED]]),function(){this.sortOrder=p.get(this._sortOrder.getValue()),void 0===this.sortOrder&&(this.sortOrder=r.CLOSEST)}),set_pickTarget__:function(){this.pickTargetNodes.clear();for(var e=0,t=this._pickTarget.length;e<t;++e)try{for(var i=this._pickTarget[e].getValue().getInnerNode(),o=i.getType(),s=o.length-1;s>=0;--s)switch(o[s]){case n.Inline:case n.Shape:case n.X3DGroupingNode:this.pickTargetNodes.add(i);break;default:continue}}catch(e){}},traverse:function(e,t){e===i.PICKING&&this.getPickableObject()&&this.modelMatrices.push(u.pop().assign(t.getModelViewMatrix().get()))},collect:function(e,t,i){var n=this.pickTargetNodes;if(i.some((function(e){return n.has(e)}))){var o=this.targets;if(o.size<o.length)var s=o[o.size];else{s={modelMatrix:new c,pickingHierarchy:[],pickedPoint:[],intersections:[]};o.push(s)}++o.size,s.intersected=!1,s.geometryNode=e,s.pickedPoint.length=0,s.intersections.length=0,s.modelMatrix.assign(t);for(var r=s.pickingHierarchy,a=0,h=i.length;a<h;++a)r[a]=i[a];r.length=h}},process:function(){for(var e=this.modelMatrices,t=0,i=e.length;t<i;++t)u.push(e[t]);this.modelMatrices.length=0,this.targets.size=0}}),_})),e("x_ite/Components/Picking/LinePickSensor",["x_ite/Fields","x_ite/Base/X3DFieldDefinition","x_ite/Base/FieldDefinitionArray","x_ite/Components/Picking/X3DPickSensorNode","x_ite/Base/X3DConstants","x_ite/Browser/Picking/IntersectionType","standard/Math/Numbers/Vector3","standard/Math/Numbers/Matrix4","standard/Math/Geometry/Box3","standard/Math/Geometry/Line3"],(function(e,t,i,n,o,s,r,c,a,h){"use strict";function p(e){n.call(this,e),this.addType(o.LinePickSensor),this.pickingGeometryNode=null}var d,g,l,u,m,_,y,k,f,w,S,C,T,b,N,O;return p.prototype=Object.assign(Object.create(n.prototype),{constructor:p,[Symbol.for("X_ITE.X3DBaseNode.fieldDefinitions")]:new i([new t(o.inputOutput,"metadata",new e.SFNode),new t(o.inputOutput,"enabled",new e.SFBool(!0)),new t(o.inputOutput,"objectType",new e.MFString("ALL")),new t(o.inputOutput,"matchCriterion",new e.SFString("MATCH_ANY")),new t(o.initializeOnly,"intersectionType",new e.SFString("BOUNDS")),new t(o.initializeOnly,"sortOrder",new e.SFString("CLOSEST")),new t(o.outputOnly,"isActive",new e.SFBool),new t(o.outputOnly,"pickedTextureCoordinate",new e.MFVec3f),new t(o.outputOnly,"pickedNormal",new e.MFVec3f),new t(o.outputOnly,"pickedPoint",new e.MFVec3f),new t(o.inputOutput,"pickingGeometry",new e.SFNode),new t(o.inputOutput,"pickTarget",new e.MFNode),new t(o.outputOnly,"pickedGeometry",new e.MFNode)]),getTypeName:function(){return"LinePickSensor"},getComponentName:function(){return"Picking"},getContainerField:function(){return"children"},initialize:function(){n.prototype.initialize.call(this),this._pickingGeometry.addInterest("set_pickingGeometry__",this),this.set_pickingGeometry__()},set_pickingGeometry__:function(){this.pickingGeometryNode=null;try{for(var e=this._pickingGeometry.getValue().getInnerNode(),t=e.getType(),i=t.length-1;i>=0;--i)switch(t[i]){case o.IndexedLineSet:case o.LineSet:this.pickingGeometryNode=e;break;default:continue}}catch(e){}},process:(d=new a,g=new a,l=new r(0,0,0),u=new r(0,0,0),m=new c,_=new r(0,0,0),y=new r(0,0,0),k=new h(r.Zero,r.zAxis),f=new r(0,0,0),w=new r(0,0,0),S=[],C=[],T=new r(0,0,0),b=new e.MFVec3f,N=new e.MFVec3f,O=new e.MFVec3f,function(){if(this.pickingGeometryNode){var e=this.getModelMatrices(),t=this.getTargets();switch(this.getIntersectionType()){case s.BOUNDS:for(var i=0,o=e.length;i<o;++i){var r=e[i];d.assign(this.pickingGeometryNode.getBBox()).multRight(r);for(var c=0,a=t.size;c<a;++c){var h=t[c];g.assign(h.geometryNode.getBBox()).multRight(h.modelMatrix),d.intersectsBox(g)&&(l.assign(d.center),u.assign(g.center),h.intersected=!0,h.distance=l.distance(u))}}var p=this.getPickedGeometries(),x=Boolean(p.length);p.remove(0,p.length,null),x!==this._isActive.getValue()&&(this._isActive=x),this._pickedGeometry.equals(p)||(this._pickedGeometry=p);break;case s.GEOMETRY:for(i=0,o=e.length;i<o;++i)for(r=e[i],d.assign(this.pickingGeometryNode.getBBox()).multRight(r),c=0,a=t.size;c<a;++c)try{var P=(h=t[c]).geometryNode,v=this.pickingGeometryNode.getVertices();g.assign(P.getBBox()).multRight(h.modelMatrix),m.assign(h.modelMatrix).inverse().multLeft(r);for(var B=0,M=v.length;B<M;B+=8)if(m.multVecMatrix(_.set(v[B+0],v[B+1],v[B+2])),m.multVecMatrix(y.set(v[B+4],v[B+5],v[B+6])),k.setPoints(_,y),C.length=0,P.intersectsLine(k,S,h.modelMatrix,C))for(var G=0,D=C.length;G<D;++G){var F=C[G];f.assign(F.point).subtract(_),w.assign(F.point).subtract(y),f.add(w).abs()<=_.distance(y)&&h.intersections.push(F)}h.intersections.length&&(l.assign(d.center),u.assign(g.center),h.intersected=!0,h.distance=l.distance(u))}catch(e){console.error(e)}p=this.getPickedGeometries(),x=Boolean(p.length),p.remove(0,p.length,null),x!==this._isActive.getValue()&&(this._isActive=x),this._pickedGeometry.equals(p)||(this._pickedGeometry=p);var A=this.getPickedTargets();for(b.length=0,N.length=0,O.length=0,c=0,a=A.length;c<a;++c){var V=A[c].intersections;for(G=0,D=V.length;G<D;++G)c=(F=V[G]).texCoord,T.set(c.x,c.y,c.z),b.push(T),N.push(F.normal),O.push(F.point)}this._pickedTextureCoordinate.equals(b)||(this._pickedTextureCoordinate=b),this._pickedNormal.equals(N)||(this._pickedNormal=N),this._pickedPoint.equals(O)||(this._pickedPoint=O)}}n.prototype.process.call(this)})}),p})),e("x_ite/Components/Picking/X3DPickableObject",["x_ite/Base/X3DConstants"],(function(e){"use strict";function t(t){this.addType(e.X3DPickableObject),this.objectType=new Set}return t.prototype={constructor:t,initialize:function(){this._objectType.addInterest("set_objectType__",this),this.set_objectType__()},getObjectType:function(){return this.objectType},set_objectType__:function(){this.objectType.clear();for(var e=0,t=this._objectType.length;e<t;++e)this.objectType.add(this._objectType[e])}},t})),e("x_ite/Components/Picking/PickableGroup",["x_ite/Fields","x_ite/Base/X3DFieldDefinition","x_ite/Base/FieldDefinitionArray","x_ite/Components/Grouping/X3DGroupingNode","x_ite/Components/Picking/X3DPickableObject","x_ite/Browser/Picking/MatchCriterion","x_ite/Base/X3DConstants","x_ite/Rendering/TraverseType"],(function(e,t,i,n,o,s,r,c){"use strict";function a(e){n.call(this,e),o.call(this,e),this.addType(r.PickableGroup)}return a.prototype=Object.assign(Object.create(n.prototype),o.prototype,{constructor:a,[Symbol.for("X_ITE.X3DBaseNode.fieldDefinitions")]:new i([new t(r.inputOutput,"metadata",new e.SFNode),new t(r.inputOutput,"pickable",new e.SFBool(!0)),new t(r.inputOutput,"objectType",new e.MFString("ALL")),new t(r.inputOutput,"visible",new e.SFBool(!0)),new t(r.inputOutput,"bboxDisplay",new e.SFBool),new t(r.initializeOnly,"bboxSize",new e.SFVec3f(-1,-1,-1)),new t(r.initializeOnly,"bboxCenter",new e.SFVec3f),new t(r.inputOnly,"addChildren",new e.MFNode),new t(r.inputOnly,"removeChildren",new e.MFNode),new t(r.inputOutput,"children",new e.MFNode)]),getTypeName:function(){return"PickableGroup"},getComponentName:function(){return"Picking"},getContainerField:function(){return"children"},initialize:function(){n.prototype.initialize.call(this),o.prototype.initialize.call(this),this._pickable.addInterest("set_pickable__",this),this.set_pickable__()},set_pickableObjects__:function(){this.set_pickable__()},set_pickable__:function(){this.setPickableObject(Boolean(this._pickable.getValue()||this.getTransformSensors().size))},traverse:function(){const e=new Set;return function(t,i){if(t===c.PICKING){if(this._pickable.getValue()){if(this.getObjectType().has("NONE"))return;const o=i.getBrowser(),r=o.getPickable();if(this.getObjectType().has("ALL"))r.push(!0),n.prototype.traverse.call(this,t,i),r.pop();else{const c=o.getPickSensors();for(const t of c.at(-1)){if(!t.getObjectType().has("ALL")){let e=0;for(const i of this.getObjectType())if(t.getObjectType().has(i)){++e;break}switch(t.getMatchCriterion()){case s.MATCH_ANY:if(0===e)continue;break;case s.MATCH_EVERY:if(e!==pickSensor.getObjectType().size)continue;break;case s.MATCH_ONLY_ONE:if(1!==e)continue}}e.add(t)}r.push(!0),c.push(e),n.prototype.traverse.call(this,t,i),c.pop(),r.pop(),e.clear()}}}else n.prototype.traverse.call(this,t,i)}}()}),a})),e("x_ite/Browser/Picking/VolumePicker",["standard/Math/Numbers/Vector3","standard/Math/Numbers/Rotation4","standard/Math/Numbers/Matrix4",t.getComponentUrl("rigid-body-physics")],(function(e,t,i,n){"use strict";const o=n.Ammo;function s(){this.broadphase=new o.btDbvtBroadphase,this.collisionConfiguration=new o.btDefaultCollisionConfiguration,this.dispatcher=new o.btCollisionDispatcher(this.collisionConfiguration),this.collisionWorld=new o.btCollisionWorld(this.dispatcher,this.broadphase,this.collisionConfiguration),this.compoundShape1=new o.btCompoundShape,this.motionState1=new o.btDefaultMotionState,this.constructionInfo1=new o.btRigidBodyConstructionInfo(0,this.motionState1,this.compoundShape1),this.rigidBody1=new o.btRigidBody(this.constructionInfo1),this.compoundShape2=new o.btCompoundShape,this.motionState2=new o.btDefaultMotionState,this.constructionInfo2=new o.btRigidBodyConstructionInfo(0,this.motionState2,this.compoundShape2),this.rigidBody2=new o.btRigidBody(this.constructionInfo2),this.collisionWorld.addCollisionObject(this.rigidBody1),this.collisionWorld.addCollisionObject(this.rigidBody2)}return s.prototype={constuctor:s,setChildShape1:function(e,t){this.setChildShape(this.compoundShape1,e,t)},setChildShape2:function(e,t){this.setChildShape(this.compoundShape2,e,t)},setChildShape1Components:function(e,t,i){this.setChildShapeComponents(this.compoundShape1,e,t,i)},setChildShape2Components:function(e,t,i){this.setChildShapeComponents(this.compoundShape2,e,t,i)},setChildShape:function(){const i=new e(0,0,0),n=new t(0,0,1,0),s=new e(1,1,1),r=new o.btVector3(0,0,0);return function(e,t,o){try{e.getNumChildShapes()&&e.removeChildShapeByIndex(0),o.getNumChildShapes()&&(t.get(i,n,s),r.setValue(s.x,s.y,s.z),o.setLocalScaling(r),e.addChildShape(this.getTransform(i,n),o))}catch(e){}}}(),setChildShapeComponents:function(e,t,i,n){e.getNumChildShapes()&&e.removeChildShapeByIndex(0),n.getNumChildShapes()&&(n.setLocalScaling(i),e.addChildShape(t,n))},contactTest:function(){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:function(){const e=new o.btTransform,t=new o.btVector3(0,0,0),n=new i;return function(i,o,s){const r=s||e;return n.set(i,o),t.setValue(n[12],n[13],n[14]),r.getBasis().setValue(n[0],n[4],n[8],n[1],n[5],n[9],n[2],n[6],n[10]),r.setOrigin(t),r}}()},s})),e("x_ite/Components/Picking/PointPickSensor",["x_ite/Fields","x_ite/Base/X3DFieldDefinition","x_ite/Base/FieldDefinitionArray","x_ite/Components/Picking/X3DPickSensorNode","x_ite/Base/X3DCast","x_ite/Base/X3DConstants","x_ite/Browser/Picking/IntersectionType","x_ite/Browser/Picking/VolumePicker","standard/Math/Numbers/Vector3","standard/Math/Numbers/Rotation4","standard/Math/Geometry/Box3",t.getComponentUrl("rigid-body-physics")],(function(e,t,i,n,o,s,r,c,a,h,p,d){"use strict";var g,l,u,m,_,y,k,f,w,S,C,T,b,N=d.Ammo;function O(e){n.call(this,e),this.addType(s.PointPickSensor),this.pickingGeometryNode=null,this.picker=new c,this.compoundShapes=[]}return O.prototype=Object.assign(Object.create(n.prototype),{constructor:O,[Symbol.for("X_ITE.X3DBaseNode.fieldDefinitions")]:new i([new t(s.inputOutput,"metadata",new e.SFNode),new t(s.inputOutput,"enabled",new e.SFBool(!0)),new t(s.inputOutput,"objectType",new e.MFString("ALL")),new t(s.inputOutput,"matchCriterion",new e.SFString("MATCH_ANY")),new t(s.initializeOnly,"intersectionType",new e.SFString("BOUNDS")),new t(s.initializeOnly,"sortOrder",new e.SFString("CLOSEST")),new t(s.outputOnly,"isActive",new e.SFBool),new t(s.outputOnly,"pickedPoint",new e.MFVec3f),new t(s.inputOutput,"pickingGeometry",new e.SFNode),new t(s.inputOutput,"pickTarget",new e.MFNode),new t(s.outputOnly,"pickedGeometry",new e.MFNode)]),getTypeName:function(){return"PointPickSensor"},getComponentName:function(){return"Picking"},getContainerField:function(){return"children"},initialize:function(){n.prototype.initialize.call(this),this._pickingGeometry.addInterest("set_pickingGeometry__",this),this.set_pickingGeometry__()},set_pickingGeometry__:function(){this.pickingGeometryNode&&this.pickingGeometryNode._rebuild.removeInterest("set_geometry__",this),this.pickingGeometryNode=o(s.PointSet,this._pickingGeometry),this.pickingGeometryNode&&this.pickingGeometryNode._rebuild.addInterest("set_geometry__",this),this.set_geometry__()},set_geometry__:(C=new N.btVector3(1,1,1),T=new N.btVector3,b=new N.btTransform,function(){var e=this.compoundShapes;if(this.pickingGeometryNode){var t=this.pickingGeometryNode.getCoord();if(t){for(var i=0,n=t.getSize();i<n;++i)if(i<e.length){var o=e[i],s=t.get1Point(i,o.point);T.setValue(s.x,s.y,s.z),b.setOrigin(T),o.setLocalScaling(C),o.updateChildTransform(0,b)}else{o=new N.btCompoundShape;var r=new N.btSphereShape(0);s=t.get1Point(i,new a(0,0,0)),o.point=s,T.setValue(s.x,s.y,s.z),b.setOrigin(T),o.addChildShape(b,r),e.push(o)}e.length=n}else e.length=0}else e.length=0}),process:(g=new p,l=new p,u=new a(0,0,0),m=new a(0,0,0),_=new N.btTransform,y=new N.btVector3,k=new a(0,0,0),f=new h(0,0,1,0),w=new a(1,1,1),S=new e.MFVec3f,function(){if(this.pickingGeometryNode){var e=this.getModelMatrices(),t=this.getTargets();switch(this.getIntersectionType()){case r.BOUNDS:for(var i=0,o=e.length;i<o;++i){var s=e[i];g.assign(this.pickingGeometryNode.getBBox()).multRight(s);for(var c=0,a=t.size;c<a;++c){var h=t[c];l.assign(h.geometryNode.getBBox()).multRight(h.modelMatrix),g.intersectsBox(l)&&(u.assign(g.center),m.assign(l.center),h.intersected=!0,h.distance=u.distance(m))}}var p=this.getPickedGeometries(),d=Boolean(p.length);p.remove(0,p.length,null),d!==this._isActive.getValue()&&(this._isActive=d),this._pickedGeometry.equals(p)||(this._pickedGeometry=p);break;case r.GEOMETRY:var C=this.picker,T=this.compoundShapes;for(i=0,o=e.length;i<o;++i){s=e[i],g.assign(this.pickingGeometryNode.getBBox()).multRight(s),s.get(k,f,w),C.getTransform(k,f,_),y.setValue(w.x,w.y,w.z);for(var b=0,N=T.length;b<N;++b){var O=T[b];for(C.setChildShape1Components(_,y,O),c=0,a=t.size;c<a;++c){h=t[c];var x=this.getPickShape(h.geometryNode);l.assign(h.geometryNode.getBBox()).multRight(h.modelMatrix),C.setChildShape2(h.modelMatrix,x.getCompoundShape()),C.contactTest()&&(u.assign(g.center),m.assign(l.center),h.intersected=!0,h.distance=u.distance(m),h.pickedPoint.push(O.point))}}}p=this.getPickedGeometries(),d=Boolean(p.length),p.remove(0,p.length,null),d!==this._isActive.getValue()&&(this._isActive=d),this._pickedGeometry.equals(p)||(this._pickedGeometry=p);var P=this.getPickedTargets();for(S.length=0,c=0,a=P.length;c<a;++c)for(var v=P[c].pickedPoint,B=0,M=v.length;B<M;++B)S.push(v[B]);this._pickedPoint.equals(S)||(this._pickedPoint=S)}}n.prototype.process.call(this)})}),O})),e("x_ite/Components/Picking/PrimitivePickSensor",["x_ite/Fields","x_ite/Base/X3DFieldDefinition","x_ite/Base/FieldDefinitionArray","x_ite/Components/Picking/X3DPickSensorNode","x_ite/Base/X3DConstants","x_ite/Browser/Picking/IntersectionType","x_ite/Browser/Picking/VolumePicker","standard/Math/Numbers/Vector3","standard/Math/Geometry/Box3"],(function(e,t,i,n,o,s,r,c,a){"use strict";function h(e){n.call(this,e),this.addType(o.PrimitivePickSensor),this.pickingGeometryNode=null,this.picker=new r}var p,d,g,l;return h.prototype=Object.assign(Object.create(n.prototype),{constructor:h,[Symbol.for("X_ITE.X3DBaseNode.fieldDefinitions")]:new i([new t(o.inputOutput,"metadata",new e.SFNode),new t(o.inputOutput,"enabled",new e.SFBool(!0)),new t(o.inputOutput,"objectType",new e.MFString("ALL")),new t(o.inputOutput,"matchCriterion",new e.SFString("MATCH_ANY")),new t(o.initializeOnly,"intersectionType",new e.SFString("BOUNDS")),new t(o.initializeOnly,"sortOrder",new e.SFString("CLOSEST")),new t(o.outputOnly,"isActive",new e.SFBool),new t(o.inputOutput,"pickingGeometry",new e.SFNode),new t(o.inputOutput,"pickTarget",new e.MFNode),new t(o.outputOnly,"pickedGeometry",new e.MFNode)]),getTypeName:function(){return"PrimitivePickSensor"},getComponentName:function(){return"Picking"},getContainerField:function(){return"children"},initialize:function(){n.prototype.initialize.call(this),this._pickingGeometry.addInterest("set_pickingGeometry__",this),this.set_pickingGeometry__()},set_pickingGeometry__:function(){this.pickingGeometryNode=null;try{for(var e=this._pickingGeometry.getValue().getInnerNode(),t=e.getType(),i=t.length-1;i>=0;--i)switch(t[i]){case o.Box:case o.Cone:case o.Cylinder:case o.Sphere:this.pickingGeometryNode=e;break;default:continue}}catch(e){}},process:(p=new a,d=new a,g=new c(0,0,0),l=new c(0,0,0),function(){if(this.pickingGeometryNode){var e=this.getModelMatrices(),t=this.getTargets();switch(this.getIntersectionType()){case s.BOUNDS:for(var i=0,o=e.length;i<o;++i){var r=e[i];p.assign(this.pickingGeometryNode.getBBox()).multRight(r);for(var c=0,a=t.size;c<a;++c){var h=t[c];d.assign(h.geometryNode.getBBox()).multRight(h.modelMatrix),p.intersectsBox(d)&&(g.assign(p.center),l.assign(d.center),h.intersected=!0,h.distance=g.distance(l))}}var u=this.getPickedGeometries(),m=Boolean(u.length);u.remove(0,u.length,null),m!==this._isActive.getValue()&&(this._isActive=m),this._pickedGeometry.equals(u)||(this._pickedGeometry=u);break;case s.GEOMETRY:var _=this.picker;for(i=0,o=e.length;i<o;++i){r=e[i];var y=this.getPickShape(this.pickingGeometryNode);for(p.assign(this.pickingGeometryNode.getBBox()).multRight(r),_.setChildShape1(r,y.getCompoundShape()),c=0,a=t.size;c<a;++c){h=t[c];var k=this.getPickShape(h.geometryNode);d.assign(h.geometryNode.getBBox()).multRight(h.modelMatrix),_.setChildShape2(h.modelMatrix,k.getCompoundShape()),_.contactTest()&&(g.assign(p.center),l.assign(d.center),h.intersected=!0,h.distance=g.distance(l))}}u=this.getPickedGeometries(),m=Boolean(u.length),u.remove(0,u.length,null),m!==this._isActive.getValue()&&(this._isActive=m),this._pickedGeometry.equals(u)||(this._pickedGeometry=u)}}n.prototype.process.call(this)})}),h})),e("x_ite/Components/Picking/VolumePickSensor",["x_ite/Fields","x_ite/Base/X3DFieldDefinition","x_ite/Base/FieldDefinitionArray","x_ite/Components/Picking/X3DPickSensorNode","x_ite/Base/X3DCast","x_ite/Base/X3DConstants","x_ite/Browser/Picking/IntersectionType","x_ite/Browser/Picking/VolumePicker","standard/Math/Numbers/Vector3","standard/Math/Geometry/Box3"],(function(e,t,i,n,o,s,r,c,a,h){"use strict";function p(e){n.call(this,e),this.addType(s.VolumePickSensor),this.pickingGeometryNode=null,this.picker=new c}var d,g,l,u;return p.prototype=Object.assign(Object.create(n.prototype),{constructor:p,[Symbol.for("X_ITE.X3DBaseNode.fieldDefinitions")]:new i([new t(s.inputOutput,"metadata",new e.SFNode),new t(s.inputOutput,"enabled",new e.SFBool(!0)),new t(s.inputOutput,"objectType",new e.MFString("ALL")),new t(s.inputOutput,"matchCriterion",new e.SFString("MATCH_ANY")),new t(s.initializeOnly,"intersectionType",new e.SFString("BOUNDS")),new t(s.initializeOnly,"sortOrder",new e.SFString("CLOSEST")),new t(s.outputOnly,"isActive",new e.SFBool),new t(s.inputOutput,"pickingGeometry",new e.SFNode),new t(s.inputOutput,"pickTarget",new e.MFNode),new t(s.outputOnly,"pickedGeometry",new e.MFNode)]),getTypeName:function(){return"VolumePickSensor"},getComponentName:function(){return"Picking"},getContainerField:function(){return"children"},initialize:function(){n.prototype.initialize.call(this),this._pickingGeometry.addInterest("set_pickingGeometry__",this),this.set_pickingGeometry__()},set_pickingGeometry__:function(){this.pickingGeometryNode=o(s.X3DGeometryNode,this._pickingGeometry)},process:(d=new h,g=new h,l=new a(0,0,0),u=new a(0,0,0),function(){if(this.pickingGeometryNode){var e=this.getModelMatrices(),t=this.getTargets();switch(this.getIntersectionType()){case r.BOUNDS:for(var i=0,o=e.length;i<o;++i){var s=e[i];d.assign(this.pickingGeometryNode.getBBox()).multRight(s);for(var c=0,a=t.size;c<a;++c){var h=t[c];g.assign(h.geometryNode.getBBox()).multRight(h.modelMatrix),d.intersectsBox(g)&&(l.assign(d.center),u.assign(g.center),h.intersected=!0,h.distance=l.distance(u))}}var p=this.getPickedGeometries(),m=Boolean(p.length);p.remove(0,p.length,null),m!==this._isActive.getValue()&&(this._isActive=m),this._pickedGeometry.equals(p)||(this._pickedGeometry=p);break;case r.GEOMETRY:var _=this.picker;for(i=0,o=e.length;i<o;++i){s=e[i];var y=this.getPickShape(this.pickingGeometryNode);for(d.assign(this.pickingGeometryNode.getBBox()).multRight(s),_.setChildShape1(s,y.getCompoundShape()),c=0,a=t.size;c<a;++c){h=t[c];var k=this.getPickShape(h.geometryNode);g.assign(h.geometryNode.getBBox()).multRight(h.modelMatrix),_.setChildShape2(h.modelMatrix,k.getCompoundShape()),_.contactTest()&&(l.assign(d.center),u.assign(g.center),h.intersected=!0,h.distance=l.distance(u))}}p=this.getPickedGeometries(),m=Boolean(p.length),p.remove(0,p.length,null),m!==this._isActive.getValue()&&(this._isActive=m),this._pickedGeometry.equals(p)||(this._pickedGeometry=p)}}n.prototype.process.call(this)})}),p})),e(t.getComponentUrl("picking"),["x_ite/Components","x_ite/Components/Picking/LinePickSensor","x_ite/Components/Picking/PickableGroup","x_ite/Components/Picking/PointPickSensor","x_ite/Components/Picking/PrimitivePickSensor","x_ite/Components/Picking/VolumePickSensor","x_ite/Components/Picking/X3DPickSensorNode","x_ite/Components/Picking/X3DPickableObject",t.getComponentUrl("rigid-body-physics")],(function(e,t,i,n,o,s,r,c){"use strict";e.addComponent({name:"Picking",types:{LinePickSensor:t,PickableGroup:i,PointPickSensor:n,PrimitivePickSensor:o,VolumePickSensor:s},abstractTypes:{X3DPickSensorNode:r,X3DPickableObject:c}})}))}();
1
+ !function(){const e=window[Symbol.for("X_ITE.X3D-5.0.2")].define,t=window[Symbol.for("X_ITE.X3D-5.0.2")].require;e("x_ite/Browser/Picking/MatchCriterion",[],(function(){"use strict";let e=0;return{MATCH_ANY:e++,MATCH_EVERY:e++,MATCH_ONLY_ONE:e++}})),e("x_ite/Browser/Picking/IntersectionType",[],(function(){"use strict";let e=0;return{BOUNDS:e++,GEOMETRY:e++}})),e("x_ite/Browser/Picking/SortOrder",[],(function(){"use strict";let e=0;return{ANY:e++,CLOSEST:e++,ALL:e++,ALL_SORTED:e++}})),e("x_ite/Components/Picking/X3DPickSensorNode",["x_ite/Fields","x_ite/Components/Core/X3DSensorNode","x_ite/Rendering/TraverseType","x_ite/Base/X3DConstants","x_ite/Browser/Picking/MatchCriterion","x_ite/Browser/Picking/IntersectionType","x_ite/Browser/Picking/SortOrder","standard/Math/Numbers/Matrix4","standard/Math/Algorithms/QuickSort","standard/Utility/ObjectCache"],(function(e,t,i,n,o,s,r,c,a,h){"use strict";var p,d,g,l,u=h(c);function m(e,t){return e.distance<t.distance}function _(i){t.call(this,i),this.addType(n.X3DPickSensorNode),this.objectType=new Set,this.intersectionType=s.BOUNDS,this.sortOrder=r.CLOSEST,this.pickTargetNodes=new Set,this.modelMatrices=[],this.targets=[],this.targets.size=0,this.pickedTargets=[],this.pickedTargetsSorter=new a(this.pickedTargets,m),this.pickedGeometries=new e.MFNode}return _.prototype=Object.assign(Object.create(t.prototype),{constructor:_,initialize:function(){this.isLive().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:function(){return this.objectType},getMatchCriterion:function(){return this.matchCriterion},getIntersectionType:function(){return this.intersectionType},getSortOrder:function(){return this.sortOrder},getModelMatrices:function(){return this.modelMatrices},getTargets:function(){return this.targets},getPickShape:(l=new WeakMap,function(e){var t=l.get(e);if(void 0!==t)return t;var i=this.getExecutionContext().createNode("Shape",!1),n=this.getExecutionContext().createNode("CollidableShape",!1);return i.setPrivate(!0),n.setPrivate(!0),n.setConvex(!0),i._geometry=e,n._shape=i,i.setup(),n.setup(),l.set(e,n),n}),getPickedGeometries:function(){var e=this.targets,t=e.size,i=this.pickedTargets,n=this.pickedGeometries;i.length=0;for(var o=0;o<t;++o){var s=e[o];s.intersected&&i.push(s)}if(0===i.length)return n.length=0,n;switch(this.sortOrder){case r.ANY:i.length=1,n[0]=this.getPickedGeometry(i[0]),n.length=1;break;case r.CLOSEST:this.pickedTargetsSorter.sort(0,i.length),i.length=1,n[0]=this.getPickedGeometry(i[0]),n.length=1;break;case r.ALL:o=0;for(var c=i.length;o<c;++o)n[o]=this.getPickedGeometry(i[o]);n.length=c;break;case r.ALL_SORTED:for(this.pickedTargetsSorter.sort(0,i.length),o=0,c=i.length;o<c;++o)n[o]=this.getPickedGeometry(i[o]);n.length=c}return n},getPickedGeometry:function(e){var t=this.getExecutionContext(),i=e.geometryNode;if(i.getExecutionContext()===t)return i;if(-1!==(r=i.getExecutionContext()).getType().indexOf(n.X3DPrototypeInstance)&&r.getExecutionContext()===t)return r;for(var o=e.pickingHierarchy,s=o.length-1;s>=0;--s){var r,c=o[s];if(c.getExecutionContext()===t)return c;if(-1!==(r=c.getExecutionContext()).getType().indexOf(n.X3DPrototypeInstance)&&r.getExecutionContext()===t)return r}return null},getPickedTargets:function(){return this.pickedTargets},set_live__:function(){this.isLive().getValue()&&this._enabled.getValue()&&!this.objectType.has("NONE")?(this.getBrowser().addPickSensor(this),this.setPickableObject(!0)):(this.getBrowser().removePickSensor(this),this.setPickableObject(!1))},set_objectType__:function(){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__:(g=new Map([["MATCH_ANY",o.MATCH_ANY],["MATCH_EVERY",o.MATCH_EVERY],["MATCH_ONLY_ONE",o.MATCH_ONLY_ONE]]),function(){this.matchCriterion=g.get(this._matchCriterion.getValue()),void 0===this.matchCriterion&&(this.matchCriterion=MatchCriterionType.MATCH_ANY)}),set_intersectionType__:(d=new Map([["BOUNDS",s.BOUNDS],["GEOMETRY",s.GEOMETRY]]),function(){this.intersectionType=d.get(this._intersectionType.getValue()),void 0===this.intersectionType&&(this.intersectionType=s.BOUNDS)}),set_sortOrder__:(p=new Map([["ANY",r.ANY],["CLOSEST",r.CLOSEST],["ALL",r.ALL],["ALL_SORTED",r.ALL_SORTED]]),function(){this.sortOrder=p.get(this._sortOrder.getValue()),void 0===this.sortOrder&&(this.sortOrder=r.CLOSEST)}),set_pickTarget__:function(){this.pickTargetNodes.clear();for(var e=0,t=this._pickTarget.length;e<t;++e)try{for(var i=this._pickTarget[e].getValue().getInnerNode(),o=i.getType(),s=o.length-1;s>=0;--s)switch(o[s]){case n.Inline:case n.Shape:case n.X3DGroupingNode:this.pickTargetNodes.add(i);break;default:continue}}catch(e){}},traverse:function(e,t){e===i.PICKING&&this.getPickableObject()&&this.modelMatrices.push(u.pop().assign(t.getModelViewMatrix().get()))},collect:function(e,t,i){var n=this.pickTargetNodes;if(i.some((function(e){return n.has(e)}))){var o=this.targets;if(o.size<o.length)var s=o[o.size];else{s={modelMatrix:new c,pickingHierarchy:[],pickedPoint:[],intersections:[]};o.push(s)}++o.size,s.intersected=!1,s.geometryNode=e,s.pickedPoint.length=0,s.intersections.length=0,s.modelMatrix.assign(t);for(var r=s.pickingHierarchy,a=0,h=i.length;a<h;++a)r[a]=i[a];r.length=h}},process:function(){for(var e=this.modelMatrices,t=0,i=e.length;t<i;++t)u.push(e[t]);this.modelMatrices.length=0,this.targets.size=0}}),_})),e("x_ite/Components/Picking/LinePickSensor",["x_ite/Fields","x_ite/Base/X3DFieldDefinition","x_ite/Base/FieldDefinitionArray","x_ite/Components/Picking/X3DPickSensorNode","x_ite/Base/X3DConstants","x_ite/Browser/Picking/IntersectionType","standard/Math/Numbers/Vector3","standard/Math/Numbers/Matrix4","standard/Math/Geometry/Box3","standard/Math/Geometry/Line3"],(function(e,t,i,n,o,s,r,c,a,h){"use strict";function p(e){n.call(this,e),this.addType(o.LinePickSensor),this.pickingGeometryNode=null}var d,g,l,u,m,_,y,k,f,w,S,C,T,b,N,O;return p.prototype=Object.assign(Object.create(n.prototype),{constructor:p,[Symbol.for("X_ITE.X3DBaseNode.fieldDefinitions")]:new i([new t(o.inputOutput,"metadata",new e.SFNode),new t(o.inputOutput,"enabled",new e.SFBool(!0)),new t(o.inputOutput,"objectType",new e.MFString("ALL")),new t(o.inputOutput,"matchCriterion",new e.SFString("MATCH_ANY")),new t(o.initializeOnly,"intersectionType",new e.SFString("BOUNDS")),new t(o.initializeOnly,"sortOrder",new e.SFString("CLOSEST")),new t(o.outputOnly,"isActive",new e.SFBool),new t(o.outputOnly,"pickedTextureCoordinate",new e.MFVec3f),new t(o.outputOnly,"pickedNormal",new e.MFVec3f),new t(o.outputOnly,"pickedPoint",new e.MFVec3f),new t(o.inputOutput,"pickingGeometry",new e.SFNode),new t(o.inputOutput,"pickTarget",new e.MFNode),new t(o.outputOnly,"pickedGeometry",new e.MFNode)]),getTypeName:function(){return"LinePickSensor"},getComponentName:function(){return"Picking"},getContainerField:function(){return"children"},initialize:function(){n.prototype.initialize.call(this),this._pickingGeometry.addInterest("set_pickingGeometry__",this),this.set_pickingGeometry__()},set_pickingGeometry__:function(){this.pickingGeometryNode=null;try{for(var e=this._pickingGeometry.getValue().getInnerNode(),t=e.getType(),i=t.length-1;i>=0;--i)switch(t[i]){case o.IndexedLineSet:case o.LineSet:this.pickingGeometryNode=e;break;default:continue}}catch(e){}},process:(d=new a,g=new a,l=new r(0,0,0),u=new r(0,0,0),m=new c,_=new r(0,0,0),y=new r(0,0,0),k=new h(r.Zero,r.zAxis),f=new r(0,0,0),w=new r(0,0,0),S=[],C=[],T=new r(0,0,0),b=new e.MFVec3f,N=new e.MFVec3f,O=new e.MFVec3f,function(){if(this.pickingGeometryNode){var e=this.getModelMatrices(),t=this.getTargets();switch(this.getIntersectionType()){case s.BOUNDS:for(var i=0,o=e.length;i<o;++i){var r=e[i];d.assign(this.pickingGeometryNode.getBBox()).multRight(r);for(var c=0,a=t.size;c<a;++c){var h=t[c];g.assign(h.geometryNode.getBBox()).multRight(h.modelMatrix),d.intersectsBox(g)&&(l.assign(d.center),u.assign(g.center),h.intersected=!0,h.distance=l.distance(u))}}var p=this.getPickedGeometries(),x=Boolean(p.length);p.remove(0,p.length,null),x!==this._isActive.getValue()&&(this._isActive=x),this._pickedGeometry.equals(p)||(this._pickedGeometry=p);break;case s.GEOMETRY:for(i=0,o=e.length;i<o;++i)for(r=e[i],d.assign(this.pickingGeometryNode.getBBox()).multRight(r),c=0,a=t.size;c<a;++c)try{var P=(h=t[c]).geometryNode,v=this.pickingGeometryNode.getVertices();g.assign(P.getBBox()).multRight(h.modelMatrix),m.assign(h.modelMatrix).inverse().multLeft(r);for(var B=0,M=v.length;B<M;B+=8)if(m.multVecMatrix(_.set(v[B+0],v[B+1],v[B+2])),m.multVecMatrix(y.set(v[B+4],v[B+5],v[B+6])),k.setPoints(_,y),C.length=0,P.intersectsLine(k,S,h.modelMatrix,C))for(var G=0,D=C.length;G<D;++G){var F=C[G];f.assign(F.point).subtract(_),w.assign(F.point).subtract(y),f.add(w).abs()<=_.distance(y)&&h.intersections.push(F)}h.intersections.length&&(l.assign(d.center),u.assign(g.center),h.intersected=!0,h.distance=l.distance(u))}catch(e){console.error(e)}p=this.getPickedGeometries(),x=Boolean(p.length),p.remove(0,p.length,null),x!==this._isActive.getValue()&&(this._isActive=x),this._pickedGeometry.equals(p)||(this._pickedGeometry=p);var A=this.getPickedTargets();for(b.length=0,N.length=0,O.length=0,c=0,a=A.length;c<a;++c){var V=A[c].intersections;for(G=0,D=V.length;G<D;++G)c=(F=V[G]).texCoord,T.set(c.x,c.y,c.z),b.push(T),N.push(F.normal),O.push(F.point)}this._pickedTextureCoordinate.equals(b)||(this._pickedTextureCoordinate=b),this._pickedNormal.equals(N)||(this._pickedNormal=N),this._pickedPoint.equals(O)||(this._pickedPoint=O)}}n.prototype.process.call(this)})}),p})),e("x_ite/Components/Picking/X3DPickableObject",["x_ite/Base/X3DConstants"],(function(e){"use strict";function t(t){this.addType(e.X3DPickableObject),this.objectType=new Set}return t.prototype={constructor:t,initialize:function(){this._objectType.addInterest("set_objectType__",this),this.set_objectType__()},getObjectType:function(){return this.objectType},set_objectType__:function(){this.objectType.clear();for(var e=0,t=this._objectType.length;e<t;++e)this.objectType.add(this._objectType[e])}},t})),e("x_ite/Components/Picking/PickableGroup",["x_ite/Fields","x_ite/Base/X3DFieldDefinition","x_ite/Base/FieldDefinitionArray","x_ite/Components/Grouping/X3DGroupingNode","x_ite/Components/Picking/X3DPickableObject","x_ite/Browser/Picking/MatchCriterion","x_ite/Base/X3DConstants","x_ite/Rendering/TraverseType"],(function(e,t,i,n,o,s,r,c){"use strict";function a(e){n.call(this,e),o.call(this,e),this.addType(r.PickableGroup)}return a.prototype=Object.assign(Object.create(n.prototype),o.prototype,{constructor:a,[Symbol.for("X_ITE.X3DBaseNode.fieldDefinitions")]:new i([new t(r.inputOutput,"metadata",new e.SFNode),new t(r.inputOutput,"pickable",new e.SFBool(!0)),new t(r.inputOutput,"objectType",new e.MFString("ALL")),new t(r.inputOutput,"visible",new e.SFBool(!0)),new t(r.inputOutput,"bboxDisplay",new e.SFBool),new t(r.initializeOnly,"bboxSize",new e.SFVec3f(-1,-1,-1)),new t(r.initializeOnly,"bboxCenter",new e.SFVec3f),new t(r.inputOnly,"addChildren",new e.MFNode),new t(r.inputOnly,"removeChildren",new e.MFNode),new t(r.inputOutput,"children",new e.MFNode)]),getTypeName:function(){return"PickableGroup"},getComponentName:function(){return"Picking"},getContainerField:function(){return"children"},initialize:function(){n.prototype.initialize.call(this),o.prototype.initialize.call(this),this._pickable.addInterest("set_pickable__",this),this.set_pickable__()},set_pickableObjects__:function(){this.set_pickable__()},set_pickable__:function(){this.setPickableObject(Boolean(this._pickable.getValue()||this.getTransformSensors().size))},traverse:function(){const e=new Set;return function(t,i){if(t===c.PICKING){if(this._pickable.getValue()){if(this.getObjectType().has("NONE"))return;const o=i.getBrowser(),r=o.getPickable();if(this.getObjectType().has("ALL"))r.push(!0),n.prototype.traverse.call(this,t,i),r.pop();else{const c=o.getPickSensors();for(const t of c.at(-1)){if(!t.getObjectType().has("ALL")){let e=0;for(const i of this.getObjectType())if(t.getObjectType().has(i)){++e;break}switch(t.getMatchCriterion()){case s.MATCH_ANY:if(0===e)continue;break;case s.MATCH_EVERY:if(e!==pickSensor.getObjectType().size)continue;break;case s.MATCH_ONLY_ONE:if(1!==e)continue}}e.add(t)}r.push(!0),c.push(e),n.prototype.traverse.call(this,t,i),c.pop(),r.pop(),e.clear()}}}else n.prototype.traverse.call(this,t,i)}}()}),a})),e("x_ite/Browser/Picking/VolumePicker",["standard/Math/Numbers/Vector3","standard/Math/Numbers/Rotation4","standard/Math/Numbers/Matrix4",t.getComponentUrl("rigid-body-physics")],(function(e,t,i,n){"use strict";const o=n.Ammo;function s(){this.broadphase=new o.btDbvtBroadphase,this.collisionConfiguration=new o.btDefaultCollisionConfiguration,this.dispatcher=new o.btCollisionDispatcher(this.collisionConfiguration),this.collisionWorld=new o.btCollisionWorld(this.dispatcher,this.broadphase,this.collisionConfiguration),this.compoundShape1=new o.btCompoundShape,this.motionState1=new o.btDefaultMotionState,this.constructionInfo1=new o.btRigidBodyConstructionInfo(0,this.motionState1,this.compoundShape1),this.rigidBody1=new o.btRigidBody(this.constructionInfo1),this.compoundShape2=new o.btCompoundShape,this.motionState2=new o.btDefaultMotionState,this.constructionInfo2=new o.btRigidBodyConstructionInfo(0,this.motionState2,this.compoundShape2),this.rigidBody2=new o.btRigidBody(this.constructionInfo2),this.collisionWorld.addCollisionObject(this.rigidBody1),this.collisionWorld.addCollisionObject(this.rigidBody2)}return s.prototype={constuctor:s,setChildShape1:function(e,t){this.setChildShape(this.compoundShape1,e,t)},setChildShape2:function(e,t){this.setChildShape(this.compoundShape2,e,t)},setChildShape1Components:function(e,t,i){this.setChildShapeComponents(this.compoundShape1,e,t,i)},setChildShape2Components:function(e,t,i){this.setChildShapeComponents(this.compoundShape2,e,t,i)},setChildShape:function(){const i=new e(0,0,0),n=new t(0,0,1,0),s=new e(1,1,1),r=new o.btVector3(0,0,0);return function(e,t,o){try{e.getNumChildShapes()&&e.removeChildShapeByIndex(0),o.getNumChildShapes()&&(t.get(i,n,s),r.setValue(s.x,s.y,s.z),o.setLocalScaling(r),e.addChildShape(this.getTransform(i,n),o))}catch(e){}}}(),setChildShapeComponents:function(e,t,i,n){e.getNumChildShapes()&&e.removeChildShapeByIndex(0),n.getNumChildShapes()&&(n.setLocalScaling(i),e.addChildShape(t,n))},contactTest:function(){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:function(){const e=new o.btTransform,t=new o.btVector3(0,0,0),n=new i;return function(i,o,s){const r=s||e;return n.set(i,o),t.setValue(n[12],n[13],n[14]),r.getBasis().setValue(n[0],n[4],n[8],n[1],n[5],n[9],n[2],n[6],n[10]),r.setOrigin(t),r}}()},s})),e("x_ite/Components/Picking/PointPickSensor",["x_ite/Fields","x_ite/Base/X3DFieldDefinition","x_ite/Base/FieldDefinitionArray","x_ite/Components/Picking/X3DPickSensorNode","x_ite/Base/X3DCast","x_ite/Base/X3DConstants","x_ite/Browser/Picking/IntersectionType","x_ite/Browser/Picking/VolumePicker","standard/Math/Numbers/Vector3","standard/Math/Numbers/Rotation4","standard/Math/Geometry/Box3",t.getComponentUrl("rigid-body-physics")],(function(e,t,i,n,o,s,r,c,a,h,p,d){"use strict";var g,l,u,m,_,y,k,f,w,S,C,T,b,N=d.Ammo;function O(e){n.call(this,e),this.addType(s.PointPickSensor),this.pickingGeometryNode=null,this.picker=new c,this.compoundShapes=[]}return O.prototype=Object.assign(Object.create(n.prototype),{constructor:O,[Symbol.for("X_ITE.X3DBaseNode.fieldDefinitions")]:new i([new t(s.inputOutput,"metadata",new e.SFNode),new t(s.inputOutput,"enabled",new e.SFBool(!0)),new t(s.inputOutput,"objectType",new e.MFString("ALL")),new t(s.inputOutput,"matchCriterion",new e.SFString("MATCH_ANY")),new t(s.initializeOnly,"intersectionType",new e.SFString("BOUNDS")),new t(s.initializeOnly,"sortOrder",new e.SFString("CLOSEST")),new t(s.outputOnly,"isActive",new e.SFBool),new t(s.outputOnly,"pickedPoint",new e.MFVec3f),new t(s.inputOutput,"pickingGeometry",new e.SFNode),new t(s.inputOutput,"pickTarget",new e.MFNode),new t(s.outputOnly,"pickedGeometry",new e.MFNode)]),getTypeName:function(){return"PointPickSensor"},getComponentName:function(){return"Picking"},getContainerField:function(){return"children"},initialize:function(){n.prototype.initialize.call(this),this._pickingGeometry.addInterest("set_pickingGeometry__",this),this.set_pickingGeometry__()},set_pickingGeometry__:function(){this.pickingGeometryNode&&this.pickingGeometryNode._rebuild.removeInterest("set_geometry__",this),this.pickingGeometryNode=o(s.PointSet,this._pickingGeometry),this.pickingGeometryNode&&this.pickingGeometryNode._rebuild.addInterest("set_geometry__",this),this.set_geometry__()},set_geometry__:(C=new N.btVector3(1,1,1),T=new N.btVector3,b=new N.btTransform,function(){var e=this.compoundShapes;if(this.pickingGeometryNode){var t=this.pickingGeometryNode.getCoord();if(t){for(var i=0,n=t.getSize();i<n;++i)if(i<e.length){var o=e[i],s=t.get1Point(i,o.point);T.setValue(s.x,s.y,s.z),b.setOrigin(T),o.setLocalScaling(C),o.updateChildTransform(0,b)}else{o=new N.btCompoundShape;var r=new N.btSphereShape(0);s=t.get1Point(i,new a(0,0,0)),o.point=s,T.setValue(s.x,s.y,s.z),b.setOrigin(T),o.addChildShape(b,r),e.push(o)}e.length=n}else e.length=0}else e.length=0}),process:(g=new p,l=new p,u=new a(0,0,0),m=new a(0,0,0),_=new N.btTransform,y=new N.btVector3,k=new a(0,0,0),f=new h(0,0,1,0),w=new a(1,1,1),S=new e.MFVec3f,function(){if(this.pickingGeometryNode){var e=this.getModelMatrices(),t=this.getTargets();switch(this.getIntersectionType()){case r.BOUNDS:for(var i=0,o=e.length;i<o;++i){var s=e[i];g.assign(this.pickingGeometryNode.getBBox()).multRight(s);for(var c=0,a=t.size;c<a;++c){var h=t[c];l.assign(h.geometryNode.getBBox()).multRight(h.modelMatrix),g.intersectsBox(l)&&(u.assign(g.center),m.assign(l.center),h.intersected=!0,h.distance=u.distance(m))}}var p=this.getPickedGeometries(),d=Boolean(p.length);p.remove(0,p.length,null),d!==this._isActive.getValue()&&(this._isActive=d),this._pickedGeometry.equals(p)||(this._pickedGeometry=p);break;case r.GEOMETRY:var C=this.picker,T=this.compoundShapes;for(i=0,o=e.length;i<o;++i){s=e[i],g.assign(this.pickingGeometryNode.getBBox()).multRight(s),s.get(k,f,w),C.getTransform(k,f,_),y.setValue(w.x,w.y,w.z);for(var b=0,N=T.length;b<N;++b){var O=T[b];for(C.setChildShape1Components(_,y,O),c=0,a=t.size;c<a;++c){h=t[c];var x=this.getPickShape(h.geometryNode);l.assign(h.geometryNode.getBBox()).multRight(h.modelMatrix),C.setChildShape2(h.modelMatrix,x.getCompoundShape()),C.contactTest()&&(u.assign(g.center),m.assign(l.center),h.intersected=!0,h.distance=u.distance(m),h.pickedPoint.push(O.point))}}}p=this.getPickedGeometries(),d=Boolean(p.length),p.remove(0,p.length,null),d!==this._isActive.getValue()&&(this._isActive=d),this._pickedGeometry.equals(p)||(this._pickedGeometry=p);var P=this.getPickedTargets();for(S.length=0,c=0,a=P.length;c<a;++c)for(var v=P[c].pickedPoint,B=0,M=v.length;B<M;++B)S.push(v[B]);this._pickedPoint.equals(S)||(this._pickedPoint=S)}}n.prototype.process.call(this)})}),O})),e("x_ite/Components/Picking/PrimitivePickSensor",["x_ite/Fields","x_ite/Base/X3DFieldDefinition","x_ite/Base/FieldDefinitionArray","x_ite/Components/Picking/X3DPickSensorNode","x_ite/Base/X3DConstants","x_ite/Browser/Picking/IntersectionType","x_ite/Browser/Picking/VolumePicker","standard/Math/Numbers/Vector3","standard/Math/Geometry/Box3"],(function(e,t,i,n,o,s,r,c,a){"use strict";function h(e){n.call(this,e),this.addType(o.PrimitivePickSensor),this.pickingGeometryNode=null,this.picker=new r}var p,d,g,l;return h.prototype=Object.assign(Object.create(n.prototype),{constructor:h,[Symbol.for("X_ITE.X3DBaseNode.fieldDefinitions")]:new i([new t(o.inputOutput,"metadata",new e.SFNode),new t(o.inputOutput,"enabled",new e.SFBool(!0)),new t(o.inputOutput,"objectType",new e.MFString("ALL")),new t(o.inputOutput,"matchCriterion",new e.SFString("MATCH_ANY")),new t(o.initializeOnly,"intersectionType",new e.SFString("BOUNDS")),new t(o.initializeOnly,"sortOrder",new e.SFString("CLOSEST")),new t(o.outputOnly,"isActive",new e.SFBool),new t(o.inputOutput,"pickingGeometry",new e.SFNode),new t(o.inputOutput,"pickTarget",new e.MFNode),new t(o.outputOnly,"pickedGeometry",new e.MFNode)]),getTypeName:function(){return"PrimitivePickSensor"},getComponentName:function(){return"Picking"},getContainerField:function(){return"children"},initialize:function(){n.prototype.initialize.call(this),this._pickingGeometry.addInterest("set_pickingGeometry__",this),this.set_pickingGeometry__()},set_pickingGeometry__:function(){this.pickingGeometryNode=null;try{for(var e=this._pickingGeometry.getValue().getInnerNode(),t=e.getType(),i=t.length-1;i>=0;--i)switch(t[i]){case o.Box:case o.Cone:case o.Cylinder:case o.Sphere:this.pickingGeometryNode=e;break;default:continue}}catch(e){}},process:(p=new a,d=new a,g=new c(0,0,0),l=new c(0,0,0),function(){if(this.pickingGeometryNode){var e=this.getModelMatrices(),t=this.getTargets();switch(this.getIntersectionType()){case s.BOUNDS:for(var i=0,o=e.length;i<o;++i){var r=e[i];p.assign(this.pickingGeometryNode.getBBox()).multRight(r);for(var c=0,a=t.size;c<a;++c){var h=t[c];d.assign(h.geometryNode.getBBox()).multRight(h.modelMatrix),p.intersectsBox(d)&&(g.assign(p.center),l.assign(d.center),h.intersected=!0,h.distance=g.distance(l))}}var u=this.getPickedGeometries(),m=Boolean(u.length);u.remove(0,u.length,null),m!==this._isActive.getValue()&&(this._isActive=m),this._pickedGeometry.equals(u)||(this._pickedGeometry=u);break;case s.GEOMETRY:var _=this.picker;for(i=0,o=e.length;i<o;++i){r=e[i];var y=this.getPickShape(this.pickingGeometryNode);for(p.assign(this.pickingGeometryNode.getBBox()).multRight(r),_.setChildShape1(r,y.getCompoundShape()),c=0,a=t.size;c<a;++c){h=t[c];var k=this.getPickShape(h.geometryNode);d.assign(h.geometryNode.getBBox()).multRight(h.modelMatrix),_.setChildShape2(h.modelMatrix,k.getCompoundShape()),_.contactTest()&&(g.assign(p.center),l.assign(d.center),h.intersected=!0,h.distance=g.distance(l))}}u=this.getPickedGeometries(),m=Boolean(u.length),u.remove(0,u.length,null),m!==this._isActive.getValue()&&(this._isActive=m),this._pickedGeometry.equals(u)||(this._pickedGeometry=u)}}n.prototype.process.call(this)})}),h})),e("x_ite/Components/Picking/VolumePickSensor",["x_ite/Fields","x_ite/Base/X3DFieldDefinition","x_ite/Base/FieldDefinitionArray","x_ite/Components/Picking/X3DPickSensorNode","x_ite/Base/X3DCast","x_ite/Base/X3DConstants","x_ite/Browser/Picking/IntersectionType","x_ite/Browser/Picking/VolumePicker","standard/Math/Numbers/Vector3","standard/Math/Geometry/Box3"],(function(e,t,i,n,o,s,r,c,a,h){"use strict";function p(e){n.call(this,e),this.addType(s.VolumePickSensor),this.pickingGeometryNode=null,this.picker=new c}var d,g,l,u;return p.prototype=Object.assign(Object.create(n.prototype),{constructor:p,[Symbol.for("X_ITE.X3DBaseNode.fieldDefinitions")]:new i([new t(s.inputOutput,"metadata",new e.SFNode),new t(s.inputOutput,"enabled",new e.SFBool(!0)),new t(s.inputOutput,"objectType",new e.MFString("ALL")),new t(s.inputOutput,"matchCriterion",new e.SFString("MATCH_ANY")),new t(s.initializeOnly,"intersectionType",new e.SFString("BOUNDS")),new t(s.initializeOnly,"sortOrder",new e.SFString("CLOSEST")),new t(s.outputOnly,"isActive",new e.SFBool),new t(s.inputOutput,"pickingGeometry",new e.SFNode),new t(s.inputOutput,"pickTarget",new e.MFNode),new t(s.outputOnly,"pickedGeometry",new e.MFNode)]),getTypeName:function(){return"VolumePickSensor"},getComponentName:function(){return"Picking"},getContainerField:function(){return"children"},initialize:function(){n.prototype.initialize.call(this),this._pickingGeometry.addInterest("set_pickingGeometry__",this),this.set_pickingGeometry__()},set_pickingGeometry__:function(){this.pickingGeometryNode=o(s.X3DGeometryNode,this._pickingGeometry)},process:(d=new h,g=new h,l=new a(0,0,0),u=new a(0,0,0),function(){if(this.pickingGeometryNode){var e=this.getModelMatrices(),t=this.getTargets();switch(this.getIntersectionType()){case r.BOUNDS:for(var i=0,o=e.length;i<o;++i){var s=e[i];d.assign(this.pickingGeometryNode.getBBox()).multRight(s);for(var c=0,a=t.size;c<a;++c){var h=t[c];g.assign(h.geometryNode.getBBox()).multRight(h.modelMatrix),d.intersectsBox(g)&&(l.assign(d.center),u.assign(g.center),h.intersected=!0,h.distance=l.distance(u))}}var p=this.getPickedGeometries(),m=Boolean(p.length);p.remove(0,p.length,null),m!==this._isActive.getValue()&&(this._isActive=m),this._pickedGeometry.equals(p)||(this._pickedGeometry=p);break;case r.GEOMETRY:var _=this.picker;for(i=0,o=e.length;i<o;++i){s=e[i];var y=this.getPickShape(this.pickingGeometryNode);for(d.assign(this.pickingGeometryNode.getBBox()).multRight(s),_.setChildShape1(s,y.getCompoundShape()),c=0,a=t.size;c<a;++c){h=t[c];var k=this.getPickShape(h.geometryNode);g.assign(h.geometryNode.getBBox()).multRight(h.modelMatrix),_.setChildShape2(h.modelMatrix,k.getCompoundShape()),_.contactTest()&&(l.assign(d.center),u.assign(g.center),h.intersected=!0,h.distance=l.distance(u))}}p=this.getPickedGeometries(),m=Boolean(p.length),p.remove(0,p.length,null),m!==this._isActive.getValue()&&(this._isActive=m),this._pickedGeometry.equals(p)||(this._pickedGeometry=p)}}n.prototype.process.call(this)})}),p})),e(t.getComponentUrl("picking"),["x_ite/Components","x_ite/Components/Picking/LinePickSensor","x_ite/Components/Picking/PickableGroup","x_ite/Components/Picking/PointPickSensor","x_ite/Components/Picking/PrimitivePickSensor","x_ite/Components/Picking/VolumePickSensor","x_ite/Components/Picking/X3DPickSensorNode","x_ite/Components/Picking/X3DPickableObject",t.getComponentUrl("rigid-body-physics")],(function(e,t,i,n,o,s,r,c){"use strict";e.addComponent({name:"Picking",types:{LinePickSensor:t,PickableGroup:i,PointPickSensor:n,PrimitivePickSensor:o,VolumePickSensor:s},abstractTypes:{X3DPickSensorNode:r,X3DPickableObject:c}})}))}();
@@ -4,8 +4,8 @@
4
4
  var module = { }, exports, process;
5
5
 
6
6
  const
7
- define = window [Symbol .for ("X_ITE.X3D-5.0.0")] .define,
8
- require = window [Symbol .for ("X_ITE.X3D-5.0.0")] .require;
7
+ define = window [Symbol .for ("X_ITE.X3D-5.0.2")] .define,
8
+ require = window [Symbol .for ("X_ITE.X3D-5.0.2")] .require;
9
9
  /* -*- Mode: JavaScript; coding: utf-8; tab-width: 3; indent-tabs-mode: tab; c-basic-offset: 3 -*-
10
10
  *******************************************************************************
11
11
  *
@@ -1 +1 @@
1
- !function(){const t=window[Symbol.for("X_ITE.X3D-5.0.0")].define,e=window[Symbol.for("X_ITE.X3D-5.0.0")].require;t("x_ite/Components/ProjectiveTextureMapping/X3DTextureProjectorNode",["x_ite/Components/Core/X3DChildNode","x_ite/Base/X3DConstants","x_ite/Base/X3DCast","standard/Math/Numbers/Vector3","standard/Math/Numbers/Rotation4","standard/Math/Numbers/Matrix4"],(function(t,e,i,r,n,o){"use strict";function a(i){t.call(this,i),this.addType(e.X3DTextureProjectorNode),this._location.setUnit("length"),this._farDistance.setUnit("length"),this._location.setUnit("length")}var s,u,c,h,x;return a.prototype=Object.assign(Object.create(t.prototype),{constructor:a,initialize:function(){t.prototype.initialize.call(this),this._on.addInterest("set_on__",this),this._texture.addInterest("set_texture__",this),this.set_texture__()},getGlobal:function(){return this._global.getValue()},getLocation:function(){return this._location.getValue()},getDirection:function(){return this._direction.getValue()},getNearDistance:function(){return this._nearDistance.getValue()},getFarDistance:function(){return this._farDistance.getValue()},getTexture:function(){return this.textureNode},getBiasMatrix:(x=new o(.5,0,0,0,0,.5,0,0,0,0,.5,0,.5,.5,.5,1),function(){return x}),straightenHorizon:(s=new r(0,0,0),u=new r(0,0,0),c=new r(0,0,0),h=new n(0,0,1,0),function(t){t.multVecRot(s.assign(r.xAxis).negate()),t.multVecRot(u.assign(r.zAxis)),c.assign(this._upVector.getValue()).normalize();var e=u.cross(c);return Math.abs(u.dot(c))>=1||Math.abs(e.dot(s))>=1?t:(h.setFromToVec(s,e),t.multRight(h))}),set_on__:function(){this._on.getValue()&&this.textureNode&&this.getBrowser().getProjectiveTextureMapping()?(delete this.push,delete this.pop):(this.push=Function.prototype,this.pop=Function.prototype)},set_texture__:function(){this.textureNode&&this.textureNode.removeInterest("set_aspectRatio__",this),this.textureNode=i(e.X3DTexture2DNode,this._texture),this.textureNode&&this.textureNode.addInterest("set_aspectRatio__",this),this.set_aspectRatio__(),this.set_on__()},set_aspectRatio__:function(){this.textureNode?this._aspectRatio=this.textureNode.getWidth()/this.textureNode.getHeight():this._aspectRatio=0},push:function(t){var e=this.getTextureProjectors().pop();e.set(t.getBrowser(),this,t.getModelViewMatrix().get()),this._global.getValue()?(t.getGlobalObjects().push(e),t.getTextureProjectors().push(e)):(t.getLocalObjects().push(e),t.getTextureProjectors().push(e))},pop:function(t){this._global.getValue()||t.getLocalObjects().pop()}}),a})),t("x_ite/Components/ProjectiveTextureMapping/TextureProjectorPerspective",["x_ite/Fields","x_ite/Base/X3DFieldDefinition","x_ite/Base/FieldDefinitionArray","x_ite/Components/ProjectiveTextureMapping/X3DTextureProjectorNode","x_ite/Base/X3DConstants","standard/Math/Geometry/Camera","standard/Math/Numbers/Vector3","standard/Math/Numbers/Rotation4","standard/Math/Numbers/Matrix4","standard/Utility/ObjectCache"],(function(t,e,i,r,n,o,a,s,u,c){"use strict";var h=c(x);function x(){this.projectionMatrix=new u,this.modelViewMatrix=new u,this.modelMatrix=new u,this.invTextureSpaceMatrix=new u,this.invTextureSpaceProjectionMatrix=new u,this.location=new a(0,0,0),this.locationArray=new Float32Array(3),this.direction=new a(0,0,0),this.rotation=new s,this.projectiveTextureMatrix=new u,this.projectiveTextureMatrixArray=new Float32Array(16)}function l(t){r.call(this,t),this.addType(n.TextureProjectorPerspective),this._fieldOfView.setUnit("angle")}return x.prototype={constructor:x,set:function(t,e,i){this.browser=t,this.textureProjectorNode=e,this.modelViewMatrix.assign(i)},getModelViewMatrix:function(){return this.modelViewMatrix},setGlobalVariables:function(t){try{var e=this.textureProjectorNode,i=t.getCameraSpaceMatrix().get(),r=this.modelMatrix.assign(this.modelViewMatrix).multRight(i),n=this.invTextureSpaceMatrix.assign(e.getGlobal()?r:u.Identity);this.rotation.setFromToVec(a.zAxis,this.direction.assign(e.getDirection()).negate()),e.straightenHorizon(this.rotation),n.translate(e.getLocation()),n.rotate(this.rotation),n.inverse();var s=e.getTexture().getWidth(),c=e.getTexture().getHeight(),h=e.getNearDistance(),x=e.getFarDistance(),l=e.getFieldOfView();o.perspective(l,h,x,s,c,this.projectionMatrix),e.getGlobal()||n.multLeft(r.inverse()),this.invTextureSpaceProjectionMatrix.assign(n).multRight(this.projectionMatrix).multRight(e.getBiasMatrix()),this.projectiveTextureMatrix.assign(i).multRight(this.invTextureSpaceProjectionMatrix),this.projectiveTextureMatrixArray.set(this.projectiveTextureMatrix),this.modelViewMatrix.multVecMatrix(this.location.assign(e._location.getValue())),this.locationArray.set(this.location)}catch(t){console.error(t)}},setShaderUniforms:function(t,e,i){const r=e.numProjectiveTextures++;if(e.hasTextureProjector(r,this))return;const n=this.textureProjectorNode.getTexture(),o=i.getBrowser().getTexture2DUnit();t.activeTexture(t.TEXTURE0+o),t.bindTexture(t.TEXTURE_2D,n.getTexture()),t.uniform1i(e.x3d_ProjectiveTexture[r],o),t.uniformMatrix4fv(e.x3d_ProjectiveTextureMatrix[r],!1,this.projectiveTextureMatrixArray),t.uniform3fv(e.x3d_ProjectiveTextureLocation[r],this.locationArray)},dispose:function(){h.push(this)}},l.prototype=Object.assign(Object.create(r.prototype),{constructor:l,[Symbol.for("X_ITE.X3DBaseNode.fieldDefinitions")]:new i([new e(n.inputOutput,"metadata",new t.SFNode),new e(n.inputOutput,"description",new t.SFString),new e(n.inputOutput,"on",new t.SFBool(!0)),new e(n.inputOutput,"global",new t.SFBool(!0)),new e(n.inputOutput,"location",new t.SFVec3f(0,0,1)),new e(n.inputOutput,"direction",new t.SFVec3f(0,0,1)),new e(n.inputOutput,"upVector",new t.SFVec3f(0,0,1)),new e(n.inputOutput,"fieldOfView",new t.SFFloat(.7854)),new e(n.inputOutput,"nearDistance",new t.SFFloat(1)),new e(n.inputOutput,"farDistance",new t.SFFloat(10)),new e(n.outputOnly,"aspectRatio",new t.SFFloat),new e(n.inputOutput,"texture",new t.SFNode)]),getTypeName:function(){return"TextureProjectorPerspective"},getComponentName:function(){return"ProjectiveTextureMapping"},getContainerField:function(){return"children"},initialize:function(){r.prototype.initialize.call(this)},getFieldOfView:function(){var t=this._fieldOfView.getValue();return t>0&&t<Math.PI?t:Math.PI/4},getTextureProjectors:function(){return h}}),l})),t("x_ite/Components/ProjectiveTextureMapping/TextureProjectorParallel",["x_ite/Fields","x_ite/Base/X3DFieldDefinition","x_ite/Base/FieldDefinitionArray","x_ite/Components/ProjectiveTextureMapping/X3DTextureProjectorNode","x_ite/Base/X3DConstants","standard/Math/Geometry/Camera","standard/Math/Numbers/Vector3","standard/Math/Numbers/Rotation4","standard/Math/Numbers/Matrix4","standard/Utility/ObjectCache"],(function(t,e,i,r,n,o,a,s,u,c){"use strict";var h=c(x);function x(){this.projectionMatrix=new u,this.modelViewMatrix=new u,this.modelMatrix=new u,this.invTextureSpaceMatrix=new u,this.location=new a(0,0,0),this.locationArray=new Float32Array(3),this.invTextureSpaceProjectionMatrix=new u,this.direction=new a(0,0,0),this.rotation=new s,this.projectiveTextureMatrix=new u,this.projectiveTextureMatrixArray=new Float32Array(16)}function l(t){r.call(this,t),this.addType(n.TextureProjectorParallel),this._fieldOfView.setUnit("length")}return x.prototype={constructor:x,set:function(t,e,i){this.browser=t,this.textureProjectorNode=e,this.modelViewMatrix.assign(i)},getModelViewMatrix:function(){return this.modelViewMatrix},setGlobalVariables:function(t){try{var e=this.textureProjectorNode,i=t.getCameraSpaceMatrix().get(),r=this.modelMatrix.assign(this.modelViewMatrix).multRight(i),n=this.invTextureSpaceMatrix.assign(e.getGlobal()?r:u.Identity);this.rotation.setFromToVec(a.zAxis,this.direction.assign(e.getDirection()).negate()),e.straightenHorizon(this.rotation),n.translate(e.getLocation()),n.rotate(this.rotation),n.inverse();var s=e.getTexture().getWidth()/e.getTexture().getHeight(),c=e.getMinimumX(),h=e.getMaximumX(),x=e.getMinimumY(),l=e.getMaximumY(),p=e.getSizeX(),g=e.getSizeY(),d=e.getNearDistance(),m=e.getFarDistance();if(s>p/g){var f=(c+h)/2,w=g*s/2;o.ortho(f-w,f+w,x,l,d,m,this.projectionMatrix)}else{f=(x+l)/2,w=p/s/2;o.ortho(c,h,f-w,f+w,d,m,this.projectionMatrix)}e.getGlobal()||n.multLeft(r.inverse()),this.invTextureSpaceProjectionMatrix.assign(n).multRight(this.projectionMatrix).multRight(e.getBiasMatrix()),this.projectiveTextureMatrix.assign(i).multRight(this.invTextureSpaceProjectionMatrix),this.projectiveTextureMatrixArray.set(this.projectiveTextureMatrix),this.modelViewMatrix.multVecMatrix(this.location.assign(e._location.getValue())),this.locationArray.set(this.location)}catch(t){console.error(t)}},setShaderUniforms:function(t,e,i){const r=e.numProjectiveTextures++;if(e.hasTextureProjector(r,this))return;const n=this.textureProjectorNode.getTexture(),o=i.getBrowser().getTexture2DUnit();t.activeTexture(t.TEXTURE0+o),t.bindTexture(t.TEXTURE_2D,n.getTexture()),t.uniform1i(e.x3d_ProjectiveTexture[r],o),t.uniformMatrix4fv(e.x3d_ProjectiveTextureMatrix[r],!1,this.projectiveTextureMatrixArray),t.uniform3fv(e.x3d_ProjectiveTextureLocation[r],this.locationArray)},dispose:function(){h.push(this)}},l.prototype=Object.assign(Object.create(r.prototype),{constructor:l,[Symbol.for("X_ITE.X3DBaseNode.fieldDefinitions")]:new i([new e(n.inputOutput,"metadata",new t.SFNode),new e(n.inputOutput,"description",new t.SFString),new e(n.inputOutput,"on",new t.SFBool(!0)),new e(n.inputOutput,"global",new t.SFBool(!0)),new e(n.inputOutput,"location",new t.SFVec3f(0,0,1)),new e(n.inputOutput,"direction",new t.SFVec3f(0,0,1)),new e(n.inputOutput,"upVector",new t.SFVec3f(0,0,1)),new e(n.inputOutput,"fieldOfView",new t.MFFloat(-1,-1,1,1)),new e(n.inputOutput,"nearDistance",new t.SFFloat(1)),new e(n.inputOutput,"farDistance",new t.SFFloat(10)),new e(n.outputOnly,"aspectRatio",new t.SFFloat),new e(n.inputOutput,"texture",new t.SFNode)]),getTypeName:function(){return"TextureProjectorParallel"},getComponentName:function(){return"ProjectiveTextureMapping"},getContainerField:function(){return"children"},initialize:function(){r.prototype.initialize.call(this),this._fieldOfView.addInterest("set_fieldOfView___",this),this.set_fieldOfView___()},getMinimumX:function(){return this.minimumX},getMinimumY:function(){return this.minimumY},getMaximumX:function(){return this.maximumX},getMaximumY:function(){return this.maximumY},getSizeX:function(){return this.sizeX},getSizeY:function(){return this.sizeY},getTextureProjectors:function(){return h},set_fieldOfView___:function(){var t=this._fieldOfView.length;this.minimumX=t>0?this._fieldOfView[0]:-1,this.minimumY=t>1?this._fieldOfView[1]:-1,this.maximumX=t>2?this._fieldOfView[2]:1,this.maximumY=t>3?this._fieldOfView[3]:1,this.sizeX=this.maximumX-this.minimumX,this.sizeY=this.maximumY-this.minimumY}}),l})),t(e.getComponentUrl("projective-texture-mapping"),["x_ite/Components","x_ite/Components/ProjectiveTextureMapping/TextureProjectorPerspective","x_ite/Components/ProjectiveTextureMapping/TextureProjectorParallel","x_ite/Components/ProjectiveTextureMapping/X3DTextureProjectorNode"],(function(t,e,i,r){"use strict";t.addComponent({name:"ProjectiveTextureMapping",types:{TextureProjectorPerspective:e,TextureProjectorParallel:i},abstractTypes:{X3DTextureProjectorNode:r}})}))}();
1
+ !function(){const t=window[Symbol.for("X_ITE.X3D-5.0.2")].define,e=window[Symbol.for("X_ITE.X3D-5.0.2")].require;t("x_ite/Components/ProjectiveTextureMapping/X3DTextureProjectorNode",["x_ite/Components/Core/X3DChildNode","x_ite/Base/X3DConstants","x_ite/Base/X3DCast","standard/Math/Numbers/Vector3","standard/Math/Numbers/Rotation4","standard/Math/Numbers/Matrix4"],(function(t,e,i,r,n,o){"use strict";function a(i){t.call(this,i),this.addType(e.X3DTextureProjectorNode),this._location.setUnit("length"),this._farDistance.setUnit("length"),this._location.setUnit("length")}var s,u,c,h,x;return a.prototype=Object.assign(Object.create(t.prototype),{constructor:a,initialize:function(){t.prototype.initialize.call(this),this._on.addInterest("set_on__",this),this._texture.addInterest("set_texture__",this),this.set_texture__()},getGlobal:function(){return this._global.getValue()},getLocation:function(){return this._location.getValue()},getDirection:function(){return this._direction.getValue()},getNearDistance:function(){return this._nearDistance.getValue()},getFarDistance:function(){return this._farDistance.getValue()},getTexture:function(){return this.textureNode},getBiasMatrix:(x=new o(.5,0,0,0,0,.5,0,0,0,0,.5,0,.5,.5,.5,1),function(){return x}),straightenHorizon:(s=new r(0,0,0),u=new r(0,0,0),c=new r(0,0,0),h=new n(0,0,1,0),function(t){t.multVecRot(s.assign(r.xAxis).negate()),t.multVecRot(u.assign(r.zAxis)),c.assign(this._upVector.getValue()).normalize();var e=u.cross(c);return Math.abs(u.dot(c))>=1||Math.abs(e.dot(s))>=1?t:(h.setFromToVec(s,e),t.multRight(h))}),set_on__:function(){this._on.getValue()&&this.textureNode&&this.getBrowser().getProjectiveTextureMapping()?(delete this.push,delete this.pop):(this.push=Function.prototype,this.pop=Function.prototype)},set_texture__:function(){this.textureNode&&this.textureNode.removeInterest("set_aspectRatio__",this),this.textureNode=i(e.X3DTexture2DNode,this._texture),this.textureNode&&this.textureNode.addInterest("set_aspectRatio__",this),this.set_aspectRatio__(),this.set_on__()},set_aspectRatio__:function(){this.textureNode?this._aspectRatio=this.textureNode.getWidth()/this.textureNode.getHeight():this._aspectRatio=0},push:function(t){var e=this.getTextureProjectors().pop();e.set(t.getBrowser(),this,t.getModelViewMatrix().get()),this._global.getValue()?(t.getGlobalObjects().push(e),t.getTextureProjectors().push(e)):(t.getLocalObjects().push(e),t.getTextureProjectors().push(e))},pop:function(t){this._global.getValue()||t.getLocalObjects().pop()}}),a})),t("x_ite/Components/ProjectiveTextureMapping/TextureProjectorPerspective",["x_ite/Fields","x_ite/Base/X3DFieldDefinition","x_ite/Base/FieldDefinitionArray","x_ite/Components/ProjectiveTextureMapping/X3DTextureProjectorNode","x_ite/Base/X3DConstants","standard/Math/Geometry/Camera","standard/Math/Numbers/Vector3","standard/Math/Numbers/Rotation4","standard/Math/Numbers/Matrix4","standard/Utility/ObjectCache"],(function(t,e,i,r,n,o,a,s,u,c){"use strict";var h=c(x);function x(){this.projectionMatrix=new u,this.modelViewMatrix=new u,this.modelMatrix=new u,this.invTextureSpaceMatrix=new u,this.invTextureSpaceProjectionMatrix=new u,this.location=new a(0,0,0),this.locationArray=new Float32Array(3),this.direction=new a(0,0,0),this.rotation=new s,this.projectiveTextureMatrix=new u,this.projectiveTextureMatrixArray=new Float32Array(16)}function l(t){r.call(this,t),this.addType(n.TextureProjectorPerspective),this._fieldOfView.setUnit("angle")}return x.prototype={constructor:x,set:function(t,e,i){this.browser=t,this.textureProjectorNode=e,this.modelViewMatrix.assign(i)},getModelViewMatrix:function(){return this.modelViewMatrix},setGlobalVariables:function(t){try{var e=this.textureProjectorNode,i=t.getCameraSpaceMatrix().get(),r=this.modelMatrix.assign(this.modelViewMatrix).multRight(i),n=this.invTextureSpaceMatrix.assign(e.getGlobal()?r:u.Identity);this.rotation.setFromToVec(a.zAxis,this.direction.assign(e.getDirection()).negate()),e.straightenHorizon(this.rotation),n.translate(e.getLocation()),n.rotate(this.rotation),n.inverse();var s=e.getTexture().getWidth(),c=e.getTexture().getHeight(),h=e.getNearDistance(),x=e.getFarDistance(),l=e.getFieldOfView();o.perspective(l,h,x,s,c,this.projectionMatrix),e.getGlobal()||n.multLeft(r.inverse()),this.invTextureSpaceProjectionMatrix.assign(n).multRight(this.projectionMatrix).multRight(e.getBiasMatrix()),this.projectiveTextureMatrix.assign(i).multRight(this.invTextureSpaceProjectionMatrix),this.projectiveTextureMatrixArray.set(this.projectiveTextureMatrix),this.modelViewMatrix.multVecMatrix(this.location.assign(e._location.getValue())),this.locationArray.set(this.location)}catch(t){console.error(t)}},setShaderUniforms:function(t,e,i){const r=e.numProjectiveTextures++;if(e.hasTextureProjector(r,this))return;const n=this.textureProjectorNode.getTexture(),o=i.getBrowser().getTexture2DUnit();t.activeTexture(t.TEXTURE0+o),t.bindTexture(t.TEXTURE_2D,n.getTexture()),t.uniform1i(e.x3d_ProjectiveTexture[r],o),t.uniformMatrix4fv(e.x3d_ProjectiveTextureMatrix[r],!1,this.projectiveTextureMatrixArray),t.uniform3fv(e.x3d_ProjectiveTextureLocation[r],this.locationArray)},dispose:function(){h.push(this)}},l.prototype=Object.assign(Object.create(r.prototype),{constructor:l,[Symbol.for("X_ITE.X3DBaseNode.fieldDefinitions")]:new i([new e(n.inputOutput,"metadata",new t.SFNode),new e(n.inputOutput,"description",new t.SFString),new e(n.inputOutput,"on",new t.SFBool(!0)),new e(n.inputOutput,"global",new t.SFBool(!0)),new e(n.inputOutput,"location",new t.SFVec3f(0,0,1)),new e(n.inputOutput,"direction",new t.SFVec3f(0,0,1)),new e(n.inputOutput,"upVector",new t.SFVec3f(0,0,1)),new e(n.inputOutput,"fieldOfView",new t.SFFloat(.7854)),new e(n.inputOutput,"nearDistance",new t.SFFloat(1)),new e(n.inputOutput,"farDistance",new t.SFFloat(10)),new e(n.outputOnly,"aspectRatio",new t.SFFloat),new e(n.inputOutput,"texture",new t.SFNode)]),getTypeName:function(){return"TextureProjectorPerspective"},getComponentName:function(){return"ProjectiveTextureMapping"},getContainerField:function(){return"children"},initialize:function(){r.prototype.initialize.call(this)},getFieldOfView:function(){var t=this._fieldOfView.getValue();return t>0&&t<Math.PI?t:Math.PI/4},getTextureProjectors:function(){return h}}),l})),t("x_ite/Components/ProjectiveTextureMapping/TextureProjectorParallel",["x_ite/Fields","x_ite/Base/X3DFieldDefinition","x_ite/Base/FieldDefinitionArray","x_ite/Components/ProjectiveTextureMapping/X3DTextureProjectorNode","x_ite/Base/X3DConstants","standard/Math/Geometry/Camera","standard/Math/Numbers/Vector3","standard/Math/Numbers/Rotation4","standard/Math/Numbers/Matrix4","standard/Utility/ObjectCache"],(function(t,e,i,r,n,o,a,s,u,c){"use strict";var h=c(x);function x(){this.projectionMatrix=new u,this.modelViewMatrix=new u,this.modelMatrix=new u,this.invTextureSpaceMatrix=new u,this.location=new a(0,0,0),this.locationArray=new Float32Array(3),this.invTextureSpaceProjectionMatrix=new u,this.direction=new a(0,0,0),this.rotation=new s,this.projectiveTextureMatrix=new u,this.projectiveTextureMatrixArray=new Float32Array(16)}function l(t){r.call(this,t),this.addType(n.TextureProjectorParallel),this._fieldOfView.setUnit("length")}return x.prototype={constructor:x,set:function(t,e,i){this.browser=t,this.textureProjectorNode=e,this.modelViewMatrix.assign(i)},getModelViewMatrix:function(){return this.modelViewMatrix},setGlobalVariables:function(t){try{var e=this.textureProjectorNode,i=t.getCameraSpaceMatrix().get(),r=this.modelMatrix.assign(this.modelViewMatrix).multRight(i),n=this.invTextureSpaceMatrix.assign(e.getGlobal()?r:u.Identity);this.rotation.setFromToVec(a.zAxis,this.direction.assign(e.getDirection()).negate()),e.straightenHorizon(this.rotation),n.translate(e.getLocation()),n.rotate(this.rotation),n.inverse();var s=e.getTexture().getWidth()/e.getTexture().getHeight(),c=e.getMinimumX(),h=e.getMaximumX(),x=e.getMinimumY(),l=e.getMaximumY(),p=e.getSizeX(),g=e.getSizeY(),d=e.getNearDistance(),m=e.getFarDistance();if(s>p/g){var f=(c+h)/2,w=g*s/2;o.ortho(f-w,f+w,x,l,d,m,this.projectionMatrix)}else{f=(x+l)/2,w=p/s/2;o.ortho(c,h,f-w,f+w,d,m,this.projectionMatrix)}e.getGlobal()||n.multLeft(r.inverse()),this.invTextureSpaceProjectionMatrix.assign(n).multRight(this.projectionMatrix).multRight(e.getBiasMatrix()),this.projectiveTextureMatrix.assign(i).multRight(this.invTextureSpaceProjectionMatrix),this.projectiveTextureMatrixArray.set(this.projectiveTextureMatrix),this.modelViewMatrix.multVecMatrix(this.location.assign(e._location.getValue())),this.locationArray.set(this.location)}catch(t){console.error(t)}},setShaderUniforms:function(t,e,i){const r=e.numProjectiveTextures++;if(e.hasTextureProjector(r,this))return;const n=this.textureProjectorNode.getTexture(),o=i.getBrowser().getTexture2DUnit();t.activeTexture(t.TEXTURE0+o),t.bindTexture(t.TEXTURE_2D,n.getTexture()),t.uniform1i(e.x3d_ProjectiveTexture[r],o),t.uniformMatrix4fv(e.x3d_ProjectiveTextureMatrix[r],!1,this.projectiveTextureMatrixArray),t.uniform3fv(e.x3d_ProjectiveTextureLocation[r],this.locationArray)},dispose:function(){h.push(this)}},l.prototype=Object.assign(Object.create(r.prototype),{constructor:l,[Symbol.for("X_ITE.X3DBaseNode.fieldDefinitions")]:new i([new e(n.inputOutput,"metadata",new t.SFNode),new e(n.inputOutput,"description",new t.SFString),new e(n.inputOutput,"on",new t.SFBool(!0)),new e(n.inputOutput,"global",new t.SFBool(!0)),new e(n.inputOutput,"location",new t.SFVec3f(0,0,1)),new e(n.inputOutput,"direction",new t.SFVec3f(0,0,1)),new e(n.inputOutput,"upVector",new t.SFVec3f(0,0,1)),new e(n.inputOutput,"fieldOfView",new t.MFFloat(-1,-1,1,1)),new e(n.inputOutput,"nearDistance",new t.SFFloat(1)),new e(n.inputOutput,"farDistance",new t.SFFloat(10)),new e(n.outputOnly,"aspectRatio",new t.SFFloat),new e(n.inputOutput,"texture",new t.SFNode)]),getTypeName:function(){return"TextureProjectorParallel"},getComponentName:function(){return"ProjectiveTextureMapping"},getContainerField:function(){return"children"},initialize:function(){r.prototype.initialize.call(this),this._fieldOfView.addInterest("set_fieldOfView___",this),this.set_fieldOfView___()},getMinimumX:function(){return this.minimumX},getMinimumY:function(){return this.minimumY},getMaximumX:function(){return this.maximumX},getMaximumY:function(){return this.maximumY},getSizeX:function(){return this.sizeX},getSizeY:function(){return this.sizeY},getTextureProjectors:function(){return h},set_fieldOfView___:function(){var t=this._fieldOfView.length;this.minimumX=t>0?this._fieldOfView[0]:-1,this.minimumY=t>1?this._fieldOfView[1]:-1,this.maximumX=t>2?this._fieldOfView[2]:1,this.maximumY=t>3?this._fieldOfView[3]:1,this.sizeX=this.maximumX-this.minimumX,this.sizeY=this.maximumY-this.minimumY}}),l})),t(e.getComponentUrl("projective-texture-mapping"),["x_ite/Components","x_ite/Components/ProjectiveTextureMapping/TextureProjectorPerspective","x_ite/Components/ProjectiveTextureMapping/TextureProjectorParallel","x_ite/Components/ProjectiveTextureMapping/X3DTextureProjectorNode"],(function(t,e,i,r){"use strict";t.addComponent({name:"ProjectiveTextureMapping",types:{TextureProjectorPerspective:e,TextureProjectorParallel:i},abstractTypes:{X3DTextureProjectorNode:r}})}))}();
@@ -4,8 +4,8 @@
4
4
  var module = { }, exports, process;
5
5
 
6
6
  const
7
- define = window [Symbol .for ("X_ITE.X3D-5.0.0")] .define,
8
- require = window [Symbol .for ("X_ITE.X3D-5.0.0")] .require;
7
+ define = window [Symbol .for ("X_ITE.X3D-5.0.2")] .define,
8
+ require = window [Symbol .for ("X_ITE.X3D-5.0.2")] .require;
9
9
  /* -*- Mode: JavaScript; coding: utf-8; tab-width: 3; indent-tabs-mode: tab; c-basic-offset: 3 -*-
10
10
  *******************************************************************************
11
11
  *