x_ite 4.7.5 → 4.7.9

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 (157) hide show
  1. package/.vscode/launch.json +15 -0
  2. package/.vscode/settings.json +2 -5
  3. package/Makefile +1 -0
  4. package/README.md +1 -1
  5. package/build/components/annotation.build.js +2 -2
  6. package/build/components/cad-geometry.build.js +2 -2
  7. package/build/components/cube-map-texturing.build.js +2 -2
  8. package/build/components/dis.build.js +2 -2
  9. package/build/components/event-utilities.build.js +2 -2
  10. package/build/components/geometry2d.build.js +2 -2
  11. package/build/components/geospatial.build.js +2 -2
  12. package/build/components/h-anim.build.js +2 -2
  13. package/build/components/key-device-sensor.build.js +2 -2
  14. package/build/components/layout.build.js +2 -2
  15. package/build/components/nurbs.build.js +2 -2
  16. package/build/components/particle-systems.build.js +2 -2
  17. package/build/components/picking.build.js +2 -2
  18. package/build/components/projective-texture-mapping.build.js +2 -2
  19. package/build/components/rigid-body-physics.build.js +2 -2
  20. package/build/components/scripting.build.js +2 -2
  21. package/build/components/texturing-3d.build.js +2 -2
  22. package/build/components/volume-rendering.build.js +2 -2
  23. package/build/components/x_ite.build.js +2 -2
  24. package/build/parts/default.end.frag.js +2 -0
  25. package/build/parts/default.start.frag.js +8 -0
  26. package/build/parts/{x_ite.end.frag → x_ite.end.frag.js} +4 -2
  27. package/build/parts/x_ite.start.frag.js +16 -0
  28. package/build/x_ite.build.js +2 -2
  29. package/dist/assets/components/annotation.js +9 -7
  30. package/dist/assets/components/annotation.min.js +1 -1
  31. package/dist/assets/components/cad-geometry.js +9 -7
  32. package/dist/assets/components/cad-geometry.min.js +1 -1
  33. package/dist/assets/components/cube-map-texturing.js +9 -7
  34. package/dist/assets/components/cube-map-texturing.min.js +1 -1
  35. package/dist/assets/components/dis.js +9 -7
  36. package/dist/assets/components/dis.min.js +1 -1
  37. package/dist/assets/components/event-utilities.js +9 -7
  38. package/dist/assets/components/event-utilities.min.js +1 -1
  39. package/dist/assets/components/geometry2d.js +9 -7
  40. package/dist/assets/components/geometry2d.min.js +1 -1
  41. package/dist/assets/components/geospatial.js +9 -7
  42. package/dist/assets/components/geospatial.min.js +2 -2
  43. package/dist/assets/components/h-anim.js +9 -7
  44. package/dist/assets/components/h-anim.min.js +1 -1
  45. package/dist/assets/components/key-device-sensor.js +9 -7
  46. package/dist/assets/components/key-device-sensor.min.js +1 -1
  47. package/dist/assets/components/layout.js +9 -7
  48. package/dist/assets/components/layout.min.js +1 -1
  49. package/dist/assets/components/nurbs.js +9 -7
  50. package/dist/assets/components/nurbs.min.js +2 -2
  51. package/dist/assets/components/particle-systems.js +9 -7
  52. package/dist/assets/components/particle-systems.min.js +2 -2
  53. package/dist/assets/components/picking.js +13 -11
  54. package/dist/assets/components/picking.min.js +1 -1
  55. package/dist/assets/components/projective-texture-mapping.js +9 -7
  56. package/dist/assets/components/projective-texture-mapping.min.js +1 -1
  57. package/dist/assets/components/rigid-body-physics.js +9 -7
  58. package/dist/assets/components/rigid-body-physics.min.js +17 -17
  59. package/dist/assets/components/scripting.js +16 -9
  60. package/dist/assets/components/scripting.min.js +1 -1
  61. package/dist/assets/components/texturing-3d.js +9 -7
  62. package/dist/assets/components/texturing-3d.min.js +3 -3
  63. package/dist/assets/components/volume-rendering.js +11 -9
  64. package/dist/assets/components/volume-rendering.min.js +3 -3
  65. package/dist/assets/components/x_ite.js +9 -7
  66. package/dist/assets/components/x_ite.min.js +1 -1
  67. package/dist/assets/shaders/webgl1/FallbackUnlit.fs +3 -4
  68. package/dist/assets/shaders/webgl1/Gouraud.vs +0 -1
  69. package/dist/assets/shaders/webgl1/Phong.fs +0 -1
  70. package/dist/assets/shaders/webgl1/Unlit.fs +0 -3
  71. package/dist/assets/shaders/webgl2/Gouraud.vs +0 -1
  72. package/dist/assets/shaders/webgl2/Phong.fs +0 -1
  73. package/dist/assets/shaders/webgl2/Unlit.fs +0 -3
  74. package/dist/example.html +2 -2
  75. package/dist/x_ite.css +4 -3
  76. package/dist/x_ite.js +28281 -27706
  77. package/dist/x_ite.min.js +41 -41
  78. package/dist/x_ite.zip +0 -0
  79. package/docs/Accessing-the-External-Browser.md +32 -3
  80. package/docs/Custom-Shaders.md +165 -174
  81. package/docs/What's-New.md +61 -6
  82. package/docs/_config.yml +1 -1
  83. package/docs/index.md +21 -14
  84. package/docs/reference/Browser-Services.md +36 -8
  85. package/docs/reference/Script-Node-Authoring-Interface.md +12 -4
  86. package/package.json +13 -6
  87. package/src/assets/components/picking.js +2 -2
  88. package/src/assets/components/volume-rendering.js +2 -2
  89. package/src/assets/shaders/webgl1/FallbackUnlit.fs +3 -4
  90. package/src/assets/shaders/webgl1/Gouraud.vs +0 -1
  91. package/src/assets/shaders/webgl1/Phong.fs +0 -1
  92. package/src/assets/shaders/webgl1/Unlit.fs +0 -3
  93. package/src/assets/shaders/webgl2/Gouraud.vs +0 -1
  94. package/src/assets/shaders/webgl2/Phong.fs +0 -1
  95. package/src/assets/shaders/webgl2/Unlit.fs +0 -3
  96. package/src/bookmarks.js +8 -11
  97. package/src/examples.js +1 -1
  98. package/src/locale/de.po +19 -75
  99. package/src/locale/fr.po +18 -75
  100. package/src/standard/Time/MicroTime.js +3 -1
  101. package/src/standard/Utility/DataStorage.js +7 -10
  102. package/src/tests.js +2 -1
  103. package/src/x_ite/Browser/Core/BrowserOptions.js +40 -28
  104. package/src/x_ite/Browser/Core/BrowserTimings.js +13 -24
  105. package/src/x_ite/Browser/Core/ContextMenu.js +26 -12
  106. package/src/x_ite/Browser/Core/X3DCoreContext.js +95 -42
  107. package/src/x_ite/Browser/Navigation/ExamineViewer.js +3 -0
  108. package/src/x_ite/Browser/Navigation/LookAtViewer.js +3 -0
  109. package/src/x_ite/Browser/Navigation/PlaneViewer.js +3 -0
  110. package/src/x_ite/Browser/Navigation/X3DFlyViewer.js +3 -0
  111. package/src/x_ite/Browser/Networking/X3DNetworkingContext.js +1 -3
  112. package/src/x_ite/Browser/Networking/urls.js +25 -0
  113. package/src/x_ite/Browser/Picking/VolumePicker.js +1 -1
  114. package/src/x_ite/Browser/PointingDeviceSensor/PointingDevice.js +4 -1
  115. package/src/x_ite/Browser/Shaders/ShaderTest.js +3 -3
  116. package/src/x_ite/Browser/VERSION.js +1 -1
  117. package/src/x_ite/Browser/X3DBrowser.js +70 -50
  118. package/src/x_ite/Components/Grouping/Switch.js +1 -1
  119. package/src/x_ite/Components/Lighting/DirectionalLight.js +1 -1
  120. package/src/x_ite/Components/Navigation/Collision.js +1 -1
  121. package/src/x_ite/Components/Navigation/LOD.js +1 -1
  122. package/src/x_ite/Components/Picking/PointPickSensor.js +1 -1
  123. package/src/x_ite/Components/Rendering/X3DGeometryNode.js +25 -11
  124. package/src/x_ite/Components/Rendering/X3DLineGeometryNode.js +35 -1
  125. package/src/x_ite/Components/Scripting/Script.js +7 -2
  126. package/src/x_ite/Components/Shaders/X3DProgrammableShaderObject.js +10 -12
  127. package/src/x_ite/Components/Shaders.js +9 -9
  128. package/src/x_ite/Execution/X3DExecutionContext.js +9 -11
  129. package/src/x_ite/Fields/SFColor.js +20 -7
  130. package/src/x_ite/Fields/SFColorRGBA.js +6 -6
  131. package/src/x_ite/Fields/SFDouble.js +2 -2
  132. package/src/x_ite/Fields/SFFloat.js +2 -2
  133. package/src/x_ite/Fields/SFImage.js +13 -13
  134. package/src/x_ite/Fields/SFMatrix3.js +5 -5
  135. package/src/x_ite/Fields/SFMatrix4.js +6 -6
  136. package/src/x_ite/Fields/SFMatrixPrototypeTemplate.js +14 -3
  137. package/src/x_ite/Fields/SFNode.js +23 -19
  138. package/src/x_ite/Fields/SFNodeCache.js +14 -10
  139. package/src/x_ite/Fields/SFRotation.js +10 -10
  140. package/src/x_ite/Fields/SFString.js +1 -1
  141. package/src/x_ite/Fields/SFTime.js +1 -1
  142. package/src/x_ite/Fields/SFVec2.js +6 -6
  143. package/src/x_ite/Fields/SFVec3.js +7 -7
  144. package/src/x_ite/Fields/SFVec4.js +8 -8
  145. package/src/x_ite/Fields/SFVecPrototypeTemplate.js +7 -6
  146. package/src/x_ite/InputOutput/Generator.js +85 -65
  147. package/src/x_ite/Parser/X3DParser.js +6 -0
  148. package/src/x_ite/Parser/XMLParser.js +1 -1
  149. package/src/x_ite/X3D.js +8 -2
  150. package/src/x_ite.config.js +0 -5
  151. package/src/x_ite.css +2 -1
  152. package/src/x_ite.html +3 -3
  153. package/src/x_ite.js +21 -12
  154. package/x_ite.min.html +3 -3
  155. package/build/parts/default.end.frag +0 -2
  156. package/build/parts/default.start.frag +0 -6
  157. package/build/parts/x_ite.start.frag +0 -8
@@ -1,2 +1,2 @@
1
- !function(){var t=X3D.define;X3D.require;t("x_ite/Components/ParticleSystems/X3DParticleEmitterNode",["x_ite/Components/Core/X3DNode","x_ite/Bits/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(t,e,i,s,r,n,o,a){"use strict";function l(t,e){return f.getDistanceToPoint(t)<f.getDistanceToPoint(e)}function h(t,e){return t<f.getDistanceToPoint(e)}function c(i){t.call(this,i),this.addType(e.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,l)}var d=new i(0,0,0),u=new i(0,0,0),m=new r(i.Zero,i.zAxis),f=new n(i.Zero,i.zAxis);return c.prototype=Object.assign(Object.create(t.prototype),{constructor:c,initialize:function(){t.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(t,e){var i=t*e,s=Math.max(0,t-i),r=t+i;return Math.random()*(r-s)+s},getRandomSpeed:function(){var t=this.speed,e=t*this.variation,i=Math.max(0,t-e),s=t+e;return Math.random()*(s-i)+i},getSphericalRandomVelocity:function(t){return this.getRandomNormal(t).multiply(this.getRandomSpeed())},getRandomValue:function(t,e){return Math.random()*(e-t)+t},getRandomNormal:function(t){var e=this.getRandomValue(-1,1)*Math.PI,i=this.getRandomValue(-1,1),s=Math.acos(i),r=Math.sin(s);return t.set(Math.sin(e)*r,Math.cos(e)*r,i)},getRandomNormalWithAngle:function(t,e){var i=(2*Math.random()-1)*Math.PI,s=this.getRandomValue(Math.cos(t),1),r=Math.acos(s),n=Math.sin(r);return e.set(Math.sin(i)*n,Math.cos(i)*n,s)},getRandomNormalWithDirectionAndAngle:function(t,e,s){return rotation.setFromToVec(i.zAxis,t),rotation.multVecRot(this.getRandomNormalWithAngle(e,s))},getRandomSurfaceNormal:function(t){var e=this.getRandomValue(-1,1)*Math.PI,i=Math.pow(Math.random(),1/3),s=Math.acos(i),r=Math.sin(s);return t.set(Math.sin(e)*r,Math.cos(e)*r,i)},animate:function(t,e){for(var r=t.particles,n=t.numParticles,o=t.createParticles,a=t.particleLifetime,l=t.lifetimeVariation,h=t.speeds,c=t.velocities,m=t.turbulences,f=this.rotations,p=t.numForces,_=t.boundedVertices.length,y=t.boundedVolume,g=f.length;g<p;++g)f[g]=new s(0,0,1,0);for(var g=0;g<p;++g)f[g].setFromToVec(i.zAxis,c[g]);for(var g=0;g<n;++g){var x=r[g],A=x.elapsedTime+e;if(A>x.lifetime)x.lifetime=this.getRandomLifetime(a,l),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],d)).multiply(h[R]));_?(u.x=F.x,u.y=F.y,u.z=F.z,F.x+=w.x*e,F.y+=w.y*e,F.z+=w.z*e,this.bounce(y,u,F,w)):(F.x+=w.x*e,F.y+=w.y*e,F.z+=w.z*e),x.elapsedTime=A}}t.geometryContext.colorMaterial&&this.getColors(r,t.colorKeys,t.colorRamp,n)},bounce:function(t,e,i,s){d.assign(s).normalize(),m.set(e,d);var r=this.intersections,n=this.intersectionNormals,a=t.intersectsLine(m,r,n);if(a){for(var l=0;l<a;++l)r[l].index=l;f.set(e,d),this.sorter.sort(0,a);var c=o.upperBound(r,0,a,0,h);if(c<a){var u=r[c],p=n[u.index];if(f.set(u,p),f.getDistanceToPoint(e)*f.getDistanceToPoint(i)<0){var _=2*p.dot(s);s.x-=p.x*_,s.y-=p.y*_,s.z-=p.z*_,d.assign(s).normalize();var y=u.distance(e);i.x=u.x+d.x*y,i.y=u.y+d.y*y,i.z=u.z+d.z*y}}}},getColors:function(t,e,i,s){for(var r=e.length,n=0,a=0,l=0,h=0;h<s;++h){var c=t[h],d=c.elapsedTime/c.lifetime,u=c.color;if(1==r||d<=e[0])n=0,a=0,l=0;else if(d>=e[r-1])n=r-2,a=r-1,l=1;else{var m=o.upperBound(e,0,r,d,o.less);if(m<r){a=m,n=m-1;var f=e[n],p=e[a];l=o.clamp((d-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)}}}),c}),t("x_ite/Components/ParticleSystems/PointEmitter",["x_ite/Fields","x_ite/Basic/X3DFieldDefinition","x_ite/Basic/FieldDefinitionArray","x_ite/Components/ParticleSystems/X3DParticleEmitterNode","x_ite/Bits/X3DConstants","standard/Math/Numbers/Vector3"],function(t,e,i,s,r,n){"use strict";function o(t){s.call(this,t),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,fieldDefinitions:new i([new e(r.inputOutput,"metadata",new t.SFNode),new e(r.inputOutput,"position",new t.SFVec3f),new e(r.inputOutput,"direction",new t.SFVec3f(0,1,0)),new e(r.inputOutput,"speed",new t.SFFloat),new e(r.inputOutput,"variation",new t.SFFloat(.25)),new e(r.initializeOnly,"mass",new t.SFFloat),new e(r.initializeOnly,"surfaceArea",new t.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(t){return t.assign(this.position)},getRandomVelocity:function(t){var e=this.direction,i=this.getRandomSpeed();return t.x=e.x*i,t.y=e.y*i,t.z=e.z*i,t}}),o}),t("x_ite/Browser/ParticleSystems/X3DParticleSystemsContext",["x_ite/Components/ParticleSystems/PointEmitter"],function(t){"use strict";function e(){}return e.prototype={getDefaultEmitter:function(){return this.defaultEmitter=new t(this.getPrivateScene()),this.defaultEmitter.setup(),this.getDefaultEmitter=function(){return this.defaultEmitter},this.defaultEmitter}},e}),t("x_ite/Components/ParticleSystems/X3DParticlePhysicsModelNode",["x_ite/Components/Core/X3DNode","x_ite/Bits/X3DConstants"],function(t,e){"use strict";function i(i){t.call(this,i),this.addType(e.X3DParticlePhysicsModelNode)}return i.prototype=Object.assign(Object.create(t.prototype),{constructor:i,addForce:function(){}}),i}),t("x_ite/Components/ParticleSystems/BoundedPhysicsModel",["x_ite/Fields","x_ite/Basic/X3DFieldDefinition","x_ite/Basic/FieldDefinitionArray","x_ite/Components/ParticleSystems/X3DParticlePhysicsModelNode","x_ite/Bits/X3DConstants","x_ite/Bits/X3DCast"],function(t,e,i,s,r,n){"use strict";function o(t){s.call(this,t),this.addType(r.BoundedPhysicsModel)}return o.prototype=Object.assign(Object.create(s.prototype),{constructor:o,fieldDefinitions:new i([new e(r.inputOutput,"metadata",new t.SFNode),new e(r.inputOutput,"enabled",new t.SFBool(!0)),new e(r.inputOutput,"geometry",new t.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(t,e){if(this.geometryNode){for(var i=this.geometryNode.getNormals().getValue(),s=this.geometryNode.getVertices().getValue(),r=0,n=i.length;r<n;++r)t.push(i[r]);for(var r=0,n=s.length;r<n;++r)e.push(s[r])}}}),o}),t("x_ite/Components/ParticleSystems/ConeEmitter",["x_ite/Fields","x_ite/Basic/X3DFieldDefinition","x_ite/Basic/FieldDefinitionArray","x_ite/Components/ParticleSystems/X3DParticleEmitterNode","x_ite/Bits/X3DConstants","standard/Math/Numbers/Vector3","standard/Math/Numbers/Rotation4"],function(t,e,i,s,r,n,o){"use strict";function a(t){s.call(this,t),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,fieldDefinitions:new i([new e(r.inputOutput,"metadata",new t.SFNode),new e(r.inputOutput,"position",new t.SFVec3f),new e(r.inputOutput,"direction",new t.SFVec3f(0,1,0)),new e(r.inputOutput,"angle",new t.SFFloat(.7854)),new e(r.inputOutput,"speed",new t.SFFloat),new e(r.inputOutput,"variation",new t.SFFloat(.25)),new e(r.initializeOnly,"mass",new t.SFFloat),new e(r.initializeOnly,"surfaceArea",new t.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 t=this.direction_.getValue();this.rotation.setFromToVec(n.zAxis,t),t.equals(n.Zero)?this.getRandomVelocity=this.getSphericalRandomVelocity:delete this.getRandomVelocity},set_angle__:function(){this.angle=this.angle_.getValue()},getRandomPosition:function(t){return t.assign(this.position)},getRandomVelocity:function(t){return this.rotation.multVecRot(this.getRandomNormalWithAngle(this.angle,t).multiply(this.getRandomSpeed()))}}),a}),t("x_ite/Components/ParticleSystems/ExplosionEmitter",["x_ite/Fields","x_ite/Basic/X3DFieldDefinition","x_ite/Basic/FieldDefinitionArray","x_ite/Components/ParticleSystems/X3DParticleEmitterNode","x_ite/Bits/X3DConstants"],function(t,e,i,s,r){"use strict";function n(t){s.call(this,t),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,fieldDefinitions:new i([new e(r.inputOutput,"metadata",new t.SFNode),new e(r.inputOutput,"position",new t.SFVec3f),new e(r.inputOutput,"speed",new t.SFFloat),new e(r.inputOutput,"variation",new t.SFFloat(.25)),new e(r.initializeOnly,"mass",new t.SFFloat),new e(r.initializeOnly,"surfaceArea",new t.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(t){return t.assign(this.position)}}),n}),t("x_ite/Components/ParticleSystems/ForcePhysicsModel",["x_ite/Fields","x_ite/Basic/X3DFieldDefinition","x_ite/Basic/FieldDefinitionArray","x_ite/Components/ParticleSystems/X3DParticlePhysicsModelNode","x_ite/Bits/X3DConstants"],function(t,e,i,s,r){"use strict";function n(t){s.call(this,t),this.addType(r.ForcePhysicsModel),this.force_.setUnit("force")}return n.prototype=Object.assign(Object.create(s.prototype),{constructor:n,fieldDefinitions:new i([new e(r.inputOutput,"metadata",new t.SFNode),new e(r.inputOutput,"enabled",new t.SFBool(!0)),new e(r.inputOutput,"force",new t.SFVec3f(0,-9.8,0))]),getTypeName:function(){return"ForcePhysicsModel"},getComponentName:function(){return"ParticleSystems"},getContainerField:function(){return"physics"},addForce:function(t,e,i,s){this.enabled_.getValue()&&(i[t].assign(this.force_.getValue()),s[t]=0)}}),n}),t("standard/Math/Utility/BVH",["standard/Math/Numbers/Vector3","standard/Math/Geometry/Plane3","standard/Math/Algorithms/QuickSort"],function(t,e,i){"use strict";function s(t,e){function i(t,s){const r=i.vertices;return e=i.axis,Math.min(r[t+e],r[t+4+e],r[t+8+e])<Math.min(r[s+e],r[s+4+e],r[s+8+e])}return i.vertices=t,i.axis=e,i}function r(t,e){this.vertices=t.vertices,this.normals=t.normals,this.i4=12*e,this.i3=9*e}function n(i,s,o,c){this.min=new t(0,0,0),this.max=new t(0,0,0),this.planes=[],this.intersection=new t(0,0,0);const u=i.vertices,m=this.min,f=this.max,p=o+c;let _=12*s[o];m.set(u[_],u[_+1],u[_+2]),f.assign(m);for(let t=o;t<p;++t)_=12*s[t],a.set(u[_],u[_+1],u[_+2]),l.set(u[_+4],u[_+5],u[_+6]),h.set(u[_+8],u[_+9],u[_+10]),m.min(a,l,h),f.max(a,l,h);for(let t=0;t<5;++t)this.planes[t]=new e(t%2?m:f,d[t]);if(c>2){i.sorter.compare.axis=this.getLongestAxis(m,f),i.sorter.sort(o,p);var y=c>>>1}else var y=1;const g=c-y;this.left=y>1?new n(i,s,o,y):new r(i,s[o]),this.right=g>1?new n(i,s,o+y,g):new r(i,s[o+y])}function o(t,e){this.vertices=t,this.normals=e;const o=t.length/12;switch(o){case 0:this.root=null;break;case 1:this.root=new r(this,0);break;default:{const e=[];for(let t=0;t<o;++t)e.push(t);this.sorter=new i(e,s(t,0)),this.root=new n(this,e,0,o);break}}}const a=new t(0,0,0),l=new t(0,0,0),h=new t(0,0,0),c={u:0,v:0,t:0},d=[new t(0,0,1),new t(0,0,-1),new t(0,1,0),new t(0,-1,0),new t(1,0,0)];return r.prototype={intersectsLine:function(e,i,s){const r=this.vertices,n=this.normals,o=this.i4,d=this.i3;if(a.x=r[o],a.y=r[o+1],a.z=r[o+2],l.x=r[o+4],l.y=r[o+5],l.z=r[o+6],h.x=r[o+8],h.y=r[o+9],h.z=r[o+10],e.intersectsTriangle(a,l,h,c)){const e=c.u,a=c.v,l=1-e-a,h=i.size++;h>=i.length&&i.push(new t(0,0,0)),i[h].set(l*r[o]+e*r[o+4]+a*r[o+8],l*r[o+1]+e*r[o+5]+a*r[o+9],l*r[o+2]+e*r[o+6]+a*r[o+10]),s&&(h>=s.length&&s.push(new t(0,0,0)),s[h].set(l*n[d]+e*n[d+3]+a*n[d+6],l*n[d+1]+e*n[d+4]+a*n[d+7],l*n[d+2]+e*n[d+5]+a*n[d+8]))}}},n.prototype={intersectsLine:function(t,e,i){this.intersectsBBox(t)&&(this.left.intersectsLine(t,e,i),this.right.intersectsLine(t,e,i))},intersectsBBox:function(t){const e=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,c=this.intersection;return!!(e[0].intersectsLine(t,c)&&c.x>=r&&c.x<=n&&c.y>=o&&c.y<=a)||(!!(e[1].intersectsLine(t,c)&&c.x>=r&&c.x<=n&&c.y>=o&&c.y<=a)||(!!(e[2].intersectsLine(t,c)&&c.x>=r&&c.x<=n&&c.z>=l&&c.z<=h)||(!!(e[3].intersectsLine(t,c)&&c.x>=r&&c.x<=n&&c.z>=l&&c.z<=h)||!!(e[4].intersectsLine(t,c)&&c.y>=o&&c.y<=a&&c.z>=l&&c.z<=h))))},getLongestAxis:function(t,e){const i=e.x-t.x,s=e.y-t.y,r=e.z-t.z;return i<s?s<r?2:1:i<r?2:0}},o.prototype={constructor:o,intersectsLine:function(t,e,i){return e.size=0,this.root?(this.root.intersectsLine(t,e,i),e.size):0}},o}),t("x_ite/Components/ParticleSystems/ParticleSystem",["x_ite/Fields","x_ite/Basic/X3DFieldDefinition","x_ite/Basic/FieldDefinitionArray","x_ite/Components/Shape/X3DShapeNode","x_ite/Bits/TraverseType","x_ite/Bits/X3DConstants","x_ite/Bits/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(t,e,i,s,r,n,o,a,l,h,c,d,u,m,f){"use strict";function p(t,e){return t.distance<e.distance}function _(t){s.call(this,t),this.addType(n.ParticleSystem),this.particleSize_.setUnit("length"),this.createParticles=!0,this.particles=[],this.velocities=[],this.speeds=[],this.turbulences=[],this.geometryType=g,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 d,this.particleSorter=new u(this.particles,p),this.sortParticles=!1,this.geometryContext={}}var y=0;const g=y++,x=y++,A=y++,F=y++,w=y++,R=y++,b={POINT:g,LINE:x,TRIANGLE:A,QUAD:F,GEOMETRY:w,SPRITE:R},v=new c,P=new l(0,0,0),S=new l(0,0,0),C=new l(0,0,0),B=new l(0,0,0),N=new l(0,0,0),T=new l(0,0,0),V=new l(0,0,0),D=new l(0,0,0),M=new l(0,0,0),I=new l(0,0,0);return _.prototype=Object.assign(Object.create(s.prototype),{constructor:_,fieldDefinitions:new i([new e(n.inputOutput,"metadata",new t.SFNode),new e(n.inputOutput,"enabled",new t.SFBool(!0)),new e(n.inputOutput,"createParticles",new t.SFBool(!0)),new e(n.initializeOnly,"geometryType",new t.SFString("QUAD")),new e(n.inputOutput,"maxParticles",new t.SFInt32(200)),new e(n.inputOutput,"particleLifetime",new t.SFFloat(5)),new e(n.inputOutput,"lifetimeVariation",new t.SFFloat(.25)),new e(n.inputOutput,"particleSize",new t.SFVec2f(.02,.02)),new e(n.initializeOnly,"emitter",new t.SFNode),new e(n.initializeOnly,"physics",new t.MFNode),new e(n.initializeOnly,"colorKey",new t.MFFloat),new e(n.initializeOnly,"colorRamp",new t.SFNode),new e(n.initializeOnly,"texCoordKey",new t.MFFloat),new e(n.initializeOnly,"texCoordRamp",new t.SFNode),new e(n.outputOnly,"isActive",new t.SFBool),new e(n.inputOutput,"visible",new t.SFBool(!0)),new e(n.inputOutput,"castShadow",new t.SFBool(!0)),new e(n.inputOutput,"bboxDisplay",new t.SFBool),new e(n.initializeOnly,"bboxSize",new t.SFVec3f(-1,-1,-1)),new e(n.initializeOnly,"bboxCenter",new t.SFVec3f),new e(n.inputOutput,"appearance",new t.SFNode),new e(n.inputOutput,"geometry",new t.SFNode)]),getTypeName:function(){return"ParticleSystem"},getComponentName:function(){return"ParticleSystems"},getContainerField:function(){return"children"},initialize:function(){s.prototype.initialize.call(this);const t=this.getBrowser(),e=t.getContext();this.isLive().addInterest("set_live__",this),t.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=e.createBuffer(),this.positionBuffer=e.createBuffer(),this.elapsedTimeBuffer=e.createBuffer(),this.lifeBuffer=e.createBuffer(),this.colorBuffer=e.createBuffer(),this.texCoordBuffers=[e.createBuffer()],this.normalBuffer=e.createBuffer(),this.vertexBuffer=e.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=e.TRIANGLES,this.geometryContext.fogCoords=!1,this.geometryContext.textureCoordinateNode=t.getDefaultTextureCoordinate(),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)switch(this.geometryType){case g:this.setTransparent(!0);break;default:this.setTransparent(this.getAppearance().getTransparent()||this.colorRampNode&&this.colorRampNode.getTransparent()||this.geometryType===w&&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 t=this.getBrowser().getContext(),e=this.maxParticles;switch(this.geometryType=b[this.geometryType_.getValue()],this.geometryType||(this.geometryType=g),this.geometryType){case g:this.idArray=new Float32Array(e),this.positionArray=new Float32Array(3*e),this.elapsedTimeArray=new Float32Array(e),this.lifeArray=new Float32Array(e),this.colorArray=new Float32Array(4*e),this.texCoordArray=new Float32Array,this.normalArray=new Float32Array,this.vertexArray=new Float32Array(4*e);for(var i=0,s=this.idArray,r=s.length;i<r;++i)s[i]=i;this.colorArray.fill(1),this.vertexArray.fill(1),this.testWireframe=!1,this.primitiveMode=t.POINTS,this.texCoordCount=0,this.vertexCount=1,this.geometryContext.geometryType=0;break;case x:this.idArray=new Float32Array(2*e),this.positionArray=new Float32Array(6*e),this.elapsedTimeArray=new Float32Array(2*e),this.lifeArray=new Float32Array(2*e),this.colorArray=new Float32Array(8*e),this.texCoordArray=new Float32Array,this.normalArray=new Float32Array,this.vertexArray=new Float32Array(8*e);for(var i=0,s=this.idArray,r=s.length;i<r;++i)s[i]=Math.floor(i/2);this.colorArray.fill(1),this.vertexArray.fill(1),this.testWireframe=!1,this.primitiveMode=t.LINES,this.texCoordCount=2,this.vertexCount=2,this.geometryContext.geometryType=1;break;case A:case F:case R:this.idArray=new Float32Array(6*e),this.positionArray=new Float32Array(18*e),this.elapsedTimeArray=new Float32Array(6*e),this.lifeArray=new Float32Array(6*e),this.colorArray=new Float32Array(24*e),this.texCoordArray=new Float32Array(24*e),this.normalArray=new Float32Array(18*e),this.vertexArray=new Float32Array(24*e);for(var i=0,s=this.idArray,r=s.length;i<r;++i)s[i]=Math.floor(i/6);this.colorArray.fill(1),this.vertexArray.fill(1);for(var n=this.texCoordArray,o=this.normalArray,i=0,a=18*e;i<a;i+=3)o[i]=0,o[i+1]=0,o[i+2]=1;t.bindBuffer(t.ARRAY_BUFFER,this.normalBuffer),t.bufferData(t.ARRAY_BUFFER,this.normalArray,t.STATIC_DRAW);for(var i=0;i<e;++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}t.bindBuffer(t.ARRAY_BUFFER,this.texCoordBuffers[0]),t.bufferData(t.ARRAY_BUFFER,this.texCoordArray,t.STATIC_DRAW),this.testWireframe=!0,this.primitiveMode=t.TRIANGLES,this.texCoordCount=4,this.vertexCount=6,this.geometryContext.geometryType=2;break;case w:this.texCoordCount=0,this.vertexCount=0}t.bindBuffer(t.ARRAY_BUFFER,this.idBuffer),t.bufferData(t.ARRAY_BUFFER,this.idArray,t.STATIC_DRAW),this.set_shader__(),this.set_transparent__()},set_shader__:function(){switch(this.geometryType){case g:this.shaderNode=this.getBrowser().getPointShader();break;case x:this.shaderNode=this.getBrowser().getLineShader();break;case A:case F:case R:case w:this.shaderNode=null}},set_maxParticles__:function(){for(var t=this.particles,e=Math.max(0,this.maxParticles_.getValue()),i=this.numParticles,s=Math.min(t.length,e);i<s;++i)t[i].life=1,t[i].lifetime=-1;for(var i=t.length,s=e;i<s;++i)t[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=e,this.numParticles=Math.min(this.numParticles,e),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 t=this.physics_.getValue(),e=this.forcePhysicsModelNodes,i=this.boundedPhysicsModelNodes,s=0,r=i.length;s<r;++s)i[s].removeInterest("set_boundedPhysics__",this);e.length=0,i.length=0;for(var s=0,r=t.length;s<r;++s)try{for(var o=t[s].getValue().getInnerNode(),a=o.getType(),l=a.length-1;l>=0;--l){switch(a[l]){case n.ForcePhysicsModel:case n.WindPhysicsModel:e.push(o);break;case n.BoundedPhysicsModel:o.addInterest("set_boundedPhysics__",this),i.push(o);break;default:continue}break}}catch(t){}this.set_boundedPhysics__()},set_boundedPhysics__:function(){var t=this.boundedPhysicsModelNodes,e=this.boundedNormals,i=this.boundedVertices;e.length=0,i.length=0;for(var s=0,r=t.length;s<r;++s)t[s].addGeometry(e,i);this.boundedVolume=new f(i,e)},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 t=this.colorKey_,e=this.colorKeys,i=this.colorRamp,s=0,r=t.length;s<r;++s)e[s]=t[s];e.length=r,this.colorRampNode&&this.colorRampNode.getVectors(this.colorRamp);for(var s=i.length,r=t.length;s<r;++s)i[s]=new h(1,1,1,1);i.length=r,this.geometryContext.colorMaterial=!(!e.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 t=this.texCoordKey_,e=this.texCoordKeys,i=this.texCoordRamp,s=0,r=t.length;s<r;++s)e[s]=t[s];e.length=r,this.texCoordRampNode&&this.texCoordRampNode.getTexCoord(i);for(var s=i.length,r=t.length*this.texCoordCount;s<r;++s)i[s]=new h(0,0,0,0);i.length=r,this.texCoordAnim=!(!e.length||!this.texCoordRampNode)},intersectsBox:function(t,e){},animateParticles:function(){var t=this.emitterNode,e=1/Math.max(10,this.getBrowser().getCurrentFrameRate()),i=this.deltaTime=(14*this.deltaTime+e)/15;if(t.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){var s=performance.now()/1e3,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(t.getMass()){for(var o=this.forcePhysicsModelNodes,a=this.velocities,h=this.speeds,c=this.turbulences,d=this.deltaTime/t.getMass(),u=a.length,m=o.length;u<m;++u)a[u]=new l(0,0,0);for(var u=0,m=o.length;u<m;++u)o[u].addForce(u,t,a,c);for(var u=0,m=a.length;u<m;++u)a[u].multiply(d),h[u]=a[u].abs();this.numForces=m}else this.numForces=0;t.animate(this,i),this.updateGeometry(null),this.getBrowser().addBrowserEvent()},updateGeometry:function(t){switch(this.geometryType){case g:t||this.updatePoint();break;case x:t||this.updateLine();break;case A:case F:case R:this.updateQuad(t);break;case w:}},updatePoint:function(){var t=this.getBrowser().getContext(),e=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=e[l].color,c=4*l;o[c]=h.x,o[c+1]=h.y,o[c+2]=h.z,o[c+3]=h.w}t.bindBuffer(t.ARRAY_BUFFER,this.colorBuffer),t.bufferData(t.ARRAY_BUFFER,this.colorArray,t.STATIC_DRAW)}for(var l=0;l<i;++l){var d=e[l].position,u=e[l].elapsedTime/e[l].lifetime,m=3*l,c=4*l;s[m]=d.x,s[m+1]=d.y,s[m+2]=d.z,r[l]=u,n[l]=e[l].life,a[c]=d.x,a[c+1]=d.y,a[c+2]=d.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)},updateLine:function(){var t=this.getBrowser().getContext(),e=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 c=e[h].color,d=8*h;o[d]=c.x,o[d+1]=c.y,o[d+2]=c.z,o[d+3]=c.w,o[d+4]=c.x,o[d+5]=c.y,o[d+6]=c.z,o[d+7]=c.w}t.bindBuffer(t.ARRAY_BUFFER,this.colorBuffer),t.bufferData(t.ARRAY_BUFFER,this.colorArray,t.STATIC_DRAW)}for(var h=0;h<i;++h){var u=e[h],m=u.position,f=e[h].elapsedTime/e[h].lifetime,p=e[h].life,_=m.x,y=m.y,g=m.z,x=2*h,A=6*h,d=8*h;s[A]=_,s[A+1]=y,s[A+2]=g,s[A+3]=_,s[A+4]=y,s[A+5]=g,r[x]=f,r[x+1]=f,n[x]=p,n[x+1]=p,B.assign(u.velocity).normalize().multiply(l),a[d]=_-B.x,a[d+1]=y-B.y,a[d+2]=g-B.z,a[d+4]=_+B.x,a[d+5]=y+B.y,a[d+6]=g+B.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)},updateQuad:function(t){try{var e=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,c=this.normalArray,d=this.vertexArray,u=this.particleSize_.x/2,f=this.particleSize_.y/2;if(!t){if(this.geometryContext.colorMaterial){for(var p=0;p<s;++p){var _=i[p].color,y=24*p;l[y]=l[y+4]=l[y+8]=l[y+12]=l[y+16]=l[y+20]=_.x,l[y+1]=l[y+5]=l[y+9]=l[y+13]=l[y+17]=l[y+21]=_.y,l[y+2]=l[y+6]=l[y+10]=l[y+14]=l[y+18]=l[y+22]=_.z,l[y+3]=l[y+7]=l[y+11]=l[y+15]=l[y+19]=l[y+23]=_.w}e.bindBuffer(e.ARRAY_BUFFER,this.colorBuffer),e.bufferData(e.ARRAY_BUFFER,this.colorArray,e.STATIC_DRAW)}if(this.texCoordAnim&&this.texCoordArray.length){for(var g=this.texCoordKeys,x=this.texCoordRamp,A=g.length,F=0,p=0;p<s;++p){var w=i[p],b=w.elapsedTime/w.lifetime
2
- ;if(1==A||b<=g[0])F=0;else if(b>=g.at(-1))F=A-2;else{var v=m.upperBound(g,0,A,b,m.less);F=v<A?v-1:0}F*=this.texCoordCount;var P=x[F],S=x[F+1],M=x[F+2],I=x[F+3],y=24*p;h[y]=h[y+12]=P.x,h[y+1]=h[y+13]=P.y,h[y+2]=h[y+14]=P.z,h[y+3]=h[y+15]=P.w,h[y+4]=S.x,h[y+5]=S.y,h[y+6]=S.z,h[y+7]=S.w,h[y+8]=h[y+16]=M.x,h[y+9]=h[y+17]=M.y,h[y+10]=h[y+18]=M.z,h[y+11]=h[y+19]=M.w,h[y+20]=I.x,h[y+21]=I.y,h[y+22]=I.z,h[y+23]=I.w}e.bindBuffer(e.ARRAY_BUFFER,this.texCoordBuffers[0]),e.bufferData(e.ARRAY_BUFFER,this.texCoordArray,e.STATIC_DRAW)}}if(this.geometryType===R){if(t){var z=this.getScreenAlignedRotation(t);B.set(z[0],z[1],z[2]).cross(C.set(z[3],z[4],z[5])).normalize();for(var E=B.x,O=B.y,U=B.z,p=0,A=18*s;p<A;p+=3)c[p]=E,c[p+1]=O,c[p+2]=U;e.bindBuffer(e.ARRAY_BUFFER,this.normalBuffer),e.bufferData(e.ARRAY_BUFFER,this.normalArray,e.STATIC_DRAW),N.set(-u,-f,0),T.set(u,-f,0),V.set(u,f,0),D.set(-u,f,0),z.multVecMatrix(N),z.multVecMatrix(T),z.multVecMatrix(V),z.multVecMatrix(D);for(var p=0;p<r;++p){var Y=i[p].position,L=i[p].elapsedTime/i[p].lifetime,X=Y.x,W=Y.y,G=Y.z,j=6*p,k=18*p,y=24*p;n[k]=n[k+3]=n[k+6]=n[k+9]=n[k+12]=n[k+15]=X,n[k+1]=n[k+4]=n[k+7]=n[k+10]=n[k+13]=n[k+16]=W,n[k+2]=n[k+5]=n[k+8]=n[k+11]=n[k+14]=n[k+17]=G,o[j]=o[j+1]=o[j+2]=o[j+3]=o[j+4]=o[j+5]=L,a[j]=a[j+1]=a[j+2]=a[j+3]=a[j+4]=a[j+5]=i[p].life,d[y]=d[y+12]=X+N.x,d[y+1]=d[y+13]=W+N.y,d[y+2]=d[y+14]=G+N.z,d[y+4]=X+T.x,d[y+5]=W+T.y,d[y+6]=G+T.z,d[y+8]=d[y+16]=X+V.x,d[y+9]=d[y+17]=W+V.y,d[y+10]=d[y+18]=G+V.z,d[y+20]=X+D.x,d[y+21]=W+D.y,d[y+22]=G+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)}}else if(!t){for(var p=0;p<r;++p){var Y=i[p].position,L=i[p].elapsedTime/i[p].lifetime,X=Y.x,W=Y.y,G=Y.z,j=6*p,k=18*p,y=24*p;n[k]=n[k+3]=n[k+6]=n[k+9]=n[k+12]=n[k+15]=X,n[k+1]=n[k+4]=n[k+7]=n[k+10]=n[k+13]=n[k+16]=W,n[k+2]=n[k+5]=n[k+8]=n[k+11]=n[k+14]=n[k+17]=G,o[j]=o[j+1]=o[j+2]=o[j+3]=o[j+4]=o[j+5]=L,a[j]=a[j+1]=a[j+2]=a[j+3]=a[j+4]=a[j+5]=i[p].life,d[y]=d[y+12]=X-u,d[y+1]=d[y+13]=W-f,d[y+2]=d[y+14]=G,d[y+4]=X+u,d[y+5]=W-f,d[y+6]=G,d[y+8]=d[y+16]=X+u,d[y+9]=d[y+17]=W+f,d[y+10]=d[y+18]=G,d[y+20]=X-u,d[y+21]=W+f,d[y+22]=G}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)}}catch(t){console.log(t)}},traverse:function(t,e){if(this.isActive_.getValue()){switch(t){case r.POINTER:break;case r.PICKING:break;case r.COLLISION:break;case r.SHADOW:this.castShadow_.getValue()&&e.addDepthShape(this);break;case r.DISPLAY:e.addDisplayShape(this)&&this.getAppearance().traverse(t,e)}this.geometryType===w&&this.getGeometry()&&this.getGeometry().traverse(t,e)}},depth:function(t,e,i){if(this.updateGeometry(e.modelViewMatrix),this.geometryType===w){var s=this.getGeometry();s&&s.displayParticlesDepth(t,e,i,this.particles,this.numParticles)}else{if(this.numParticles<=0)return;i.getValid()&&(i.enableFloatAttrib(t,"x3d_ParticleId",this.idBuffer,1),i.enableFloatAttrib(t,"x3d_ParticlePosition",this.positionBuffer,3),i.enableFloatAttrib(t,"x3d_ParticleElapsedTime",this.elapsedTimeBuffer,1),i.enableFloatAttrib(t,"x3d_ParticleLife",this.lifeBuffer,1),i.enableVertexAttribute(t,this.vertexBuffer),t.drawArrays(this.primitiveMode,0,this.numParticles*this.vertexCount),i.disableFloatAttrib(t,"x3d_ParticleId"),i.disableFloatAttrib(t,"x3d_ParticlePosition"),i.disableFloatAttrib(t,"x3d_ParticleElapsedTime"),i.disableFloatAttrib(t,"x3d_ParticleLife"))}},display:function(t,e){try{if(this.numParticles<=0)return;if(this.updateGeometry(e.modelViewMatrix),this.geometryType===w){const i=this.getGeometry();i&&i.displayParticles(t,e,this.particles,this.numParticles)}else{const r=this.getAppearance(),n=r.shaderNode||this.shaderNode||r.materialNode.getShader(e.browser,e.shadow);if(n.getValid()){e.geometryContext=this.geometryContext;const o=r.blendModeNode;if(o&&o.enable(t),n.enable(t),n.setLocalUniforms(t,e),n.enableFloatAttrib(t,"x3d_ParticleId",this.idBuffer,1),n.enableFloatAttrib(t,"x3d_ParticlePosition",this.positionBuffer,3),n.enableFloatAttrib(t,"x3d_ParticleElapsedTime",this.elapsedTimeBuffer,1),n.enableFloatAttrib(t,"x3d_ParticleLife",this.lifeBuffer,1),this.geometryContext.colorMaterial&&n.enableColorAttribute(t,this.colorBuffer),this.texCoordArray.length&&n.enableTexCoordAttribute(t,this.texCoordBuffers),this.normalArray.length&&n.enableNormalAttribute(t,this.normalBuffer),n.enableVertexAttribute(t,this.vertexBuffer),n.wireframe&&this.testWireframe)for(var i=0,s=this.numParticles*this.vertexCount;i<s;i+=3)t.drawArrays(n.primitiveMode,i,3);else{const i=c.prototype.determinant3.call(e.modelViewMatrix)>0;t.frontFace(i?t.CCW:t.CW),t.enable(t.CULL_FACE),t.cullFace(t.BACK),t.drawArrays(this.primitiveMode,0,this.numParticles*this.vertexCount)}n.disableFloatAttrib(t,"x3d_ParticleId"),n.disableFloatAttrib(t,"x3d_ParticlePosition"),n.disableFloatAttrib(t,"x3d_ParticleElapsedTime"),n.disableFloatAttrib(t,"x3d_ParticleLife"),n.disableColorAttribute(t),n.disableTexCoordAttribute(t),n.disableNormalAttribute(t),n.disable(t),o&&o.disable(t),e.geometryContext=null}}}catch(t){console.log(t)}},getScreenAlignedRotation:function(t){v.assign(t).inverse(),v.multDirMatrix(P.assign(l.zAxis)),v.multDirMatrix(S.assign(l.yAxis)),M.assign(S).cross(P),I.assign(P).cross(M);var e=P;return M.normalize(),I.normalize(),e.normalize(),this.rotation.set(M.x,M.y,M.z,I.x,I.y,I.z,e.x,e.y,e.z)}}),_}),t("x_ite/Components/ParticleSystems/PolylineEmitter",["x_ite/Fields","x_ite/Basic/X3DFieldDefinition","x_ite/Basic/FieldDefinitionArray","x_ite/Components/ParticleSystems/X3DParticleEmitterNode","x_ite/Components/Rendering/IndexedLineSet","x_ite/Bits/X3DConstants","standard/Math/Numbers/Vector3","standard/Math/Algorithm"],function(t,e,i,s,r,n,o,a){"use strict";function l(t){s.call(this,t),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(t),this.polylines=[],this.lengthSoFarArray=[0]}function h(t){return t.set(0,0,0)}return l.prototype=Object.assign(Object.create(s.prototype),{constructor:l,fieldDefinitions:new i([new e(n.inputOutput,"metadata",new t.SFNode),new e(n.inputOutput,"direction",new t.SFVec3f(0,1,0)),new e(n.inputOutput,"speed",new t.SFFloat),new e(n.inputOutput,"variation",new t.SFFloat(.25)),new e(n.initializeOnly,"mass",new t.SFFloat),new e(n.initializeOnly,"surfaceArea",new t.SFFloat),new e(n.inputOutput,"coordIndex",new t.MFInt32(-1)),new e(n.inputOutput,"coord",new t.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:function(){var t=new o(0,0,0),e=new o(0,0,0);return function(){var i=this.vertices=this.polylineNode.getVertices().getValue();if(i.length){delete this.getRandomPosition;var s=0,r=this.lengthSoFarArray;r.length=1;for(var n=0,o=i.length;n<o;n+=8)t.set(i[n],i[n+1],i[n+2]),e.set(i[n+4],i[n+5],i[n+6]),s+=e.subtract(t).abs(),r.push(s)}else this.getRandomPosition=h}}(),getRandomPosition:function(t){var e=this.lengthSoFarArray,i=e.length,s=Math.random()*e.at(-1),r=0,n=0,o=0;if(1==i||s<=e[0])r=0,o=0;else if(s>=e.at(-1))r=i-2,o=1;else{var l=a.upperBound(e,0,i,s,a.less);if(l<i){n=l,r=l-1;var h=e[r],c=e[n];o=a.clamp((s-h)/(c-h),0,1)}else r=0,o=0}r*=8,n=r+4;var d=this.vertices,u=d[r],m=d[r+1],f=d[r+2],p=d[n],_=d[n+1],y=d[n+2];return t.x=u+o*(p-u),t.y=m+o*(_-m),t.z=f+o*(y-f),t},getRandomVelocity:function(t){var e=this.direction,i=this.getRandomSpeed();return t.x=e.x*i,t.y=e.y*i,t.z=e.z*i,t}}),l}),t("x_ite/Components/ParticleSystems/SurfaceEmitter",["x_ite/Fields","x_ite/Basic/X3DFieldDefinition","x_ite/Basic/FieldDefinitionArray","x_ite/Components/ParticleSystems/X3DParticleEmitterNode","x_ite/Bits/X3DConstants","x_ite/Bits/X3DCast","standard/Math/Geometry/Triangle3","standard/Math/Numbers/Vector3","standard/Math/Algorithm"],function(t,e,i,s,r,n,o,a,l){"use strict";function h(t){s.call(this,t),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)}function c(t){return t.set(0,0,0)}return h.prototype=Object.assign(Object.create(s.prototype),{constructor:h,fieldDefinitions:new i([new e(r.inputOutput,"metadata",new t.SFNode),new e(r.inputOutput,"speed",new t.SFFloat),new e(r.inputOutput,"variation",new t.SFFloat(.25)),new e(r.initializeOnly,"mass",new t.SFFloat),new e(r.initializeOnly,"surfaceArea",new t.SFFloat),new e(r.initializeOnly,"surface",new t.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__:function(){var t=new a(0,0,0),e=new a(0,0,0),i=new a(0,0,0);return function(){if(this.surfaceNode){delete this.getRandomPosition,delete this.getRandomVelocity;var s=0,r=this.areaSoFarArray,n=this.surfaceNode.getVertices().getValue();this.normals=this.surfaceNode.getNormals().getValue(),this.vertices=n,r.length=1;for(var a=0,l=n.length;a<l;a+=12)t.set(n[a],n[a+1],n[a+2]),e.set(n[a+4],n[a+5],n[a+6]),i.set(n[a+8],n[a+9],n[a+10]),s+=o.area(t,e,i),r.push(s)}else this.getRandomPosition=c,this.getRandomVelocity=this.getSphericalRandomVelocity}}(),getRandomPosition:function(t){var e=this.areaSoFarArray,i=e.length,s=Math.random()*e.at(-1),r=0;if(1==i||s<=e[0])r=0;else if(s>=e.at(-1))r=i-2;else{var n=l.upperBound(e,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,c=12*r,d=this.vertices;t.x=o*d[c]+a*d[c+4]+h*d[c+8],t.y=o*d[c+1]+a*d[c+5]+h*d[c+9],t.z=o*d[c+2]+a*d[c+6]+h*d[c+10];var c=9*r,u=this.normals,m=this.direction;return m.x=o*u[c]+a*u[c+3]+h*u[c+6],m.y=o*u[c+1]+a*u[c+4]+h*u[c+7],m.z=o*u[c+2]+a*u[c+5]+h*u[c+8],t},getRandomVelocity:function(t){var e=this.getRandomSpeed(),i=this.direction;return t.x=i.x*e,t.y=i.y*e,t.z=i.z*e,t}}),h}),t("x_ite/Components/ParticleSystems/VolumeEmitter",["x_ite/Fields","x_ite/Basic/X3DFieldDefinition","x_ite/Basic/FieldDefinitionArray","x_ite/Components/ParticleSystems/X3DParticleEmitterNode","x_ite/Components/Geometry3D/IndexedFaceSet","x_ite/Bits/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(t,e,i,s,r,n,o,a,l,h,c,d,u,m){"use strict";function f(t){s.call(this,t),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(t),this.areaSoFarArray=[0]}return f.prototype=Object.assign(Object.create(s.prototype),{constructor:f,fieldDefinitions:new i([new e(n.inputOutput,"metadata",new t.SFNode),new e(n.initializeOnly,"internal",new t.SFBool(!0)),new e(n.inputOutput,"direction",new t.SFVec3f(0,1,0)),new e(n.inputOutput,"speed",new t.SFFloat),new e(n.inputOutput,"variation",new t.SFFloat(.25)),new e(n.initializeOnly,"mass",new t.SFFloat),new e(n.initializeOnly,"surfaceArea",new t.SFFloat),new e(n.inputOutput,"coordIndex",new t.MFInt32(-1)),new e(n.inputOutput,"coord",new t.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__:function(){var t=new o(0,0,0),e=new o(0,0,0),i=new o(0,0,0);return function(){var s=0,r=this.areaSoFarArray,n=this.volumeNode.getNormals().getValue(),o=this.volumeNode.getVertices().getValue();this.normals=n,this.vertices=o,r.length=1;for(var a=0,l=o.length;a<l;a+=12)t.set(o[a],o[a+1],o[a+2]),e.set(o[a+4],o[a+5],o[a+6]),i.set(o[a+8],o[a+9],o[a+10]),s+=c.area(t,e,i),r.push(s);this.bvh=new u(o,n)}}(),getRandomPosition:function(){function t(t,e){return n.getDistanceToPoint(t)<n.getDistanceToPoint(e)}var e=new o(0,0,0),i=new o(0,0,0),s=new a(0,0,1,0),r=new l(o.Zero,o.zAxis),n=new h(o.Zero,o.zAxis),c=[],u=new m(c,t);return function(t){var a=this.areaSoFarArray,l=a.length,h=Math.random()*a.at(-1),m=0;if(1==l||h<=a[0])m=0;else if(h>=a.at(-1))m=l-2;else{var f=d.upperBound(a,0,l,h,d.less);m=f<l?f-1:0}var p=Math.random(),_=Math.random();p+_>1&&(p=1-p,_=1-_);var y=1-p-_,g=12*m,x=this.vertices;e.x=p*x[g]+_*x[g+4]+y*x[g+8],e.y=p*x[g+1]+_*x[g+5]+y*x[g+9],e.z=p*x[g+2]+_*x[g+6]+y*x[g+10];var g=9*m,A=this.normals;i.x=p*A[g]+_*A[g+3]+y*A[g+6],i.y=p*A[g+1]+_*A[g+4]+y*A[g+7],i.z=p*A[g+2]+_*A[g+5]+y*A[g+8],s.setFromToVec(o.zAxis,i),s.multVecRot(this.getRandomSurfaceNormal(i)),r.set(e,i),n.set(e,i);var F=this.bvh.intersectsLine(r,c);if(F-=F%2){u.sort(0,F);var f=2*Math.round(this.getRandomValue(0,F/2-1)),w=c[f],R=c[f+1],y=Math.random();return t.x=w.x+(R.x-w.x)*y,t.y=w.y+(R.y-w.y)*y,t.z=w.z+(R.z-w.z)*y,t}return t.set(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY)}}(),getRandomVelocity:function(t){var e=this.direction,i=this.getRandomSpeed();return t.x=e.x*i,t.y=e.y*i,t.z=e.z*i,t}}),f}),t("x_ite/Components/ParticleSystems/WindPhysicsModel",["x_ite/Fields","x_ite/Basic/X3DFieldDefinition","x_ite/Basic/FieldDefinitionArray","x_ite/Components/ParticleSystems/X3DParticlePhysicsModelNode","x_ite/Bits/X3DConstants","standard/Math/Numbers/Vector3","standard/Math/Algorithm"],function(t,e,i,s,r,n,o){"use strict";function a(t){s.call(this,t),this.addType(r.WindPhysicsModel),this.speed_.setUnit("speed")}return a.prototype=Object.assign(Object.create(s.prototype),{constructor:a,fieldDefinitions:new i([new e(r.inputOutput,"metadata",new t.SFNode),new e(r.inputOutput,"enabled",new t.SFBool(!0)),new e(r.inputOutput,"direction",new t.SFVec3f),new e(r.inputOutput,"speed",new t.SFFloat(.1)),new e(r.inputOutput,"gustiness",new t.SFFloat(.1)),new e(r.inputOutput,"turbulence",new t.SFFloat)]),getTypeName:function(){return"WindPhysicsModel"},getComponentName:function(){return"ParticleSystems"},getContainerField:function(){return"physics"},getRandomSpeed:function(t){var e=Math.max(0,this.speed_.getValue()),i=e*Math.max(0,this.gustiness_.getValue());return t.getRandomValue(Math.max(0,e-i),e+i)},addForce:function(){var t=new n(0,0,0);return function(e,i,s,r){var a=i.surfaceArea_.getValue();if(this.enabled_.getValue()){var l=this.getRandomSpeed(i),h=.64615*Math.pow(10,2*Math.log(l));this.direction_.getValue().equals(n.Zero)?i.getRandomNormal(t):t.assign(this.direction_.getValue()).normalize(),s[e].assign(t.multiply(a*h)),r[e]=Math.PI*o.clamp(this.turbulence_.getValue(),0,1)}}}()}),a}),t(["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(t,e,i,s,r,n,o,a,l,h,c,d,u,m){"use strict";t.addComponent({name:"ParticleSystems",types:{BoundedPhysicsModel:i,ConeEmitter:s,ExplosionEmitter:r,ForcePhysicsModel:n,ParticleSystem:o,PointEmitter:a,PolylineEmitter:l,SurfaceEmitter:h,VolumeEmitter:c,WindPhysicsModel:d},abstractTypes:{X3DParticleEmitterNode:u,X3DParticlePhysicsModelNode:m},browser:e})})}();
1
+ !function(){const t=X3D.define,e=X3D.require;t("x_ite/Components/ParticleSystems/X3DParticleEmitterNode",["x_ite/Components/Core/X3DNode","x_ite/Bits/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(t,e,i,s,r,n,o,a){"use strict";function l(t,e){return f.getDistanceToPoint(t)<f.getDistanceToPoint(e)}function h(t,e){return t<f.getDistanceToPoint(e)}function c(i){t.call(this,i),this.addType(e.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,l)}var d=new i(0,0,0),u=new i(0,0,0),m=new r(i.Zero,i.zAxis),f=new n(i.Zero,i.zAxis);return c.prototype=Object.assign(Object.create(t.prototype),{constructor:c,initialize:function(){t.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(t,e){var i=t*e,s=Math.max(0,t-i),r=t+i;return Math.random()*(r-s)+s},getRandomSpeed:function(){var t=this.speed,e=t*this.variation,i=Math.max(0,t-e),s=t+e;return Math.random()*(s-i)+i},getSphericalRandomVelocity:function(t){return this.getRandomNormal(t).multiply(this.getRandomSpeed())},getRandomValue:function(t,e){return Math.random()*(e-t)+t},getRandomNormal:function(t){var e=this.getRandomValue(-1,1)*Math.PI,i=this.getRandomValue(-1,1),s=Math.acos(i),r=Math.sin(s);return t.set(Math.sin(e)*r,Math.cos(e)*r,i)},getRandomNormalWithAngle:function(t,e){var i=(2*Math.random()-1)*Math.PI,s=this.getRandomValue(Math.cos(t),1),r=Math.acos(s),n=Math.sin(r);return e.set(Math.sin(i)*n,Math.cos(i)*n,s)},getRandomNormalWithDirectionAndAngle:function(t,e,s){return rotation.setFromToVec(i.zAxis,t),rotation.multVecRot(this.getRandomNormalWithAngle(e,s))},getRandomSurfaceNormal:function(t){var e=this.getRandomValue(-1,1)*Math.PI,i=Math.pow(Math.random(),1/3),s=Math.acos(i),r=Math.sin(s);return t.set(Math.sin(e)*r,Math.cos(e)*r,i)},animate:function(t,e){for(var r=t.particles,n=t.numParticles,o=t.createParticles,a=t.particleLifetime,l=t.lifetimeVariation,h=t.speeds,c=t.velocities,m=t.turbulences,f=this.rotations,p=t.numForces,_=t.boundedVertices.length,y=t.boundedVolume,g=f.length;g<p;++g)f[g]=new s(0,0,1,0);for(var g=0;g<p;++g)f[g].setFromToVec(i.zAxis,c[g]);for(var g=0;g<n;++g){var x=r[g],A=x.elapsedTime+e;if(A>x.lifetime)x.lifetime=this.getRandomLifetime(a,l),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],d)).multiply(h[R]));_?(u.x=F.x,u.y=F.y,u.z=F.z,F.x+=w.x*e,F.y+=w.y*e,F.z+=w.z*e,this.bounce(y,u,F,w)):(F.x+=w.x*e,F.y+=w.y*e,F.z+=w.z*e),x.elapsedTime=A}}t.geometryContext.colorMaterial&&this.getColors(r,t.colorKeys,t.colorRamp,n)},bounce:function(t,e,i,s){d.assign(s).normalize(),m.set(e,d);var r=this.intersections,n=this.intersectionNormals,a=t.intersectsLine(m,r,n);if(a){for(var l=0;l<a;++l)r[l].index=l;f.set(e,d),this.sorter.sort(0,a);var c=o.upperBound(r,0,a,0,h);if(c<a){var u=r[c],p=n[u.index];if(f.set(u,p),f.getDistanceToPoint(e)*f.getDistanceToPoint(i)<0){var _=2*p.dot(s);s.x-=p.x*_,s.y-=p.y*_,s.z-=p.z*_,d.assign(s).normalize();var y=u.distance(e);i.x=u.x+d.x*y,i.y=u.y+d.y*y,i.z=u.z+d.z*y}}}},getColors:function(t,e,i,s){for(var r=e.length,n=0,a=0,l=0,h=0;h<s;++h){var c=t[h],d=c.elapsedTime/c.lifetime,u=c.color;if(1==r||d<=e[0])n=0,a=0,l=0;else if(d>=e[r-1])n=r-2,a=r-1,l=1;else{var m=o.upperBound(e,0,r,d,o.less);if(m<r){a=m,n=m-1;var f=e[n],p=e[a];l=o.clamp((d-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)}}}),c}),t("x_ite/Components/ParticleSystems/PointEmitter",["x_ite/Fields","x_ite/Basic/X3DFieldDefinition","x_ite/Basic/FieldDefinitionArray","x_ite/Components/ParticleSystems/X3DParticleEmitterNode","x_ite/Bits/X3DConstants","standard/Math/Numbers/Vector3"],function(t,e,i,s,r,n){"use strict";function o(t){s.call(this,t),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,fieldDefinitions:new i([new e(r.inputOutput,"metadata",new t.SFNode),new e(r.inputOutput,"position",new t.SFVec3f),new e(r.inputOutput,"direction",new t.SFVec3f(0,1,0)),new e(r.inputOutput,"speed",new t.SFFloat),new e(r.inputOutput,"variation",new t.SFFloat(.25)),new e(r.initializeOnly,"mass",new t.SFFloat),new e(r.initializeOnly,"surfaceArea",new t.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(t){return t.assign(this.position)},getRandomVelocity:function(t){var e=this.direction,i=this.getRandomSpeed();return t.x=e.x*i,t.y=e.y*i,t.z=e.z*i,t}}),o}),t("x_ite/Browser/ParticleSystems/X3DParticleSystemsContext",["x_ite/Components/ParticleSystems/PointEmitter"],function(t){"use strict";function e(){}return e.prototype={getDefaultEmitter:function(){return this.defaultEmitter=new t(this.getPrivateScene()),this.defaultEmitter.setup(),this.getDefaultEmitter=function(){return this.defaultEmitter},this.defaultEmitter}},e}),t("x_ite/Components/ParticleSystems/X3DParticlePhysicsModelNode",["x_ite/Components/Core/X3DNode","x_ite/Bits/X3DConstants"],function(t,e){"use strict";function i(i){t.call(this,i),this.addType(e.X3DParticlePhysicsModelNode)}return i.prototype=Object.assign(Object.create(t.prototype),{constructor:i,addForce:function(){}}),i}),t("x_ite/Components/ParticleSystems/BoundedPhysicsModel",["x_ite/Fields","x_ite/Basic/X3DFieldDefinition","x_ite/Basic/FieldDefinitionArray","x_ite/Components/ParticleSystems/X3DParticlePhysicsModelNode","x_ite/Bits/X3DConstants","x_ite/Bits/X3DCast"],function(t,e,i,s,r,n){"use strict";function o(t){s.call(this,t),this.addType(r.BoundedPhysicsModel)}return o.prototype=Object.assign(Object.create(s.prototype),{constructor:o,fieldDefinitions:new i([new e(r.inputOutput,"metadata",new t.SFNode),new e(r.inputOutput,"enabled",new t.SFBool(!0)),new e(r.inputOutput,"geometry",new t.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(t,e){if(this.geometryNode){for(var i=this.geometryNode.getNormals().getValue(),s=this.geometryNode.getVertices().getValue(),r=0,n=i.length;r<n;++r)t.push(i[r]);for(var r=0,n=s.length;r<n;++r)e.push(s[r])}}}),o}),t("x_ite/Components/ParticleSystems/ConeEmitter",["x_ite/Fields","x_ite/Basic/X3DFieldDefinition","x_ite/Basic/FieldDefinitionArray","x_ite/Components/ParticleSystems/X3DParticleEmitterNode","x_ite/Bits/X3DConstants","standard/Math/Numbers/Vector3","standard/Math/Numbers/Rotation4"],function(t,e,i,s,r,n,o){"use strict";function a(t){s.call(this,t),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,fieldDefinitions:new i([new e(r.inputOutput,"metadata",new t.SFNode),new e(r.inputOutput,"position",new t.SFVec3f),new e(r.inputOutput,"direction",new t.SFVec3f(0,1,0)),new e(r.inputOutput,"angle",new t.SFFloat(.7854)),new e(r.inputOutput,"speed",new t.SFFloat),new e(r.inputOutput,"variation",new t.SFFloat(.25)),new e(r.initializeOnly,"mass",new t.SFFloat),new e(r.initializeOnly,"surfaceArea",new t.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 t=this.direction_.getValue();this.rotation.setFromToVec(n.zAxis,t),t.equals(n.Zero)?this.getRandomVelocity=this.getSphericalRandomVelocity:delete this.getRandomVelocity},set_angle__:function(){this.angle=this.angle_.getValue()},getRandomPosition:function(t){return t.assign(this.position)},getRandomVelocity:function(t){return this.rotation.multVecRot(this.getRandomNormalWithAngle(this.angle,t).multiply(this.getRandomSpeed()))}}),a}),t("x_ite/Components/ParticleSystems/ExplosionEmitter",["x_ite/Fields","x_ite/Basic/X3DFieldDefinition","x_ite/Basic/FieldDefinitionArray","x_ite/Components/ParticleSystems/X3DParticleEmitterNode","x_ite/Bits/X3DConstants"],function(t,e,i,s,r){"use strict";function n(t){s.call(this,t),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,fieldDefinitions:new i([new e(r.inputOutput,"metadata",new t.SFNode),new e(r.inputOutput,"position",new t.SFVec3f),new e(r.inputOutput,"speed",new t.SFFloat),new e(r.inputOutput,"variation",new t.SFFloat(.25)),new e(r.initializeOnly,"mass",new t.SFFloat),new e(r.initializeOnly,"surfaceArea",new t.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(t){return t.assign(this.position)}}),n}),t("x_ite/Components/ParticleSystems/ForcePhysicsModel",["x_ite/Fields","x_ite/Basic/X3DFieldDefinition","x_ite/Basic/FieldDefinitionArray","x_ite/Components/ParticleSystems/X3DParticlePhysicsModelNode","x_ite/Bits/X3DConstants"],function(t,e,i,s,r){"use strict";function n(t){s.call(this,t),this.addType(r.ForcePhysicsModel),this.force_.setUnit("force")}return n.prototype=Object.assign(Object.create(s.prototype),{constructor:n,fieldDefinitions:new i([new e(r.inputOutput,"metadata",new t.SFNode),new e(r.inputOutput,"enabled",new t.SFBool(!0)),new e(r.inputOutput,"force",new t.SFVec3f(0,-9.8,0))]),getTypeName:function(){return"ForcePhysicsModel"},getComponentName:function(){return"ParticleSystems"},getContainerField:function(){return"physics"},addForce:function(t,e,i,s){this.enabled_.getValue()&&(i[t].assign(this.force_.getValue()),s[t]=0)}}),n}),t("standard/Math/Utility/BVH",["standard/Math/Numbers/Vector3","standard/Math/Geometry/Plane3","standard/Math/Algorithms/QuickSort"],function(t,e,i){"use strict";function s(t,e){function i(t,s){const r=i.vertices;return e=i.axis,Math.min(r[t+e],r[t+4+e],r[t+8+e])<Math.min(r[s+e],r[s+4+e],r[s+8+e])}return i.vertices=t,i.axis=e,i}function r(t,e){this.vertices=t.vertices,this.normals=t.normals,this.i4=12*e,this.i3=9*e}function n(i,s,o,c){this.min=new t(0,0,0),this.max=new t(0,0,0),this.planes=[],this.intersection=new t(0,0,0);const u=i.vertices,m=this.min,f=this.max,p=o+c;let _=12*s[o];m.set(u[_],u[_+1],u[_+2]),f.assign(m);for(let t=o;t<p;++t)_=12*s[t],a.set(u[_],u[_+1],u[_+2]),l.set(u[_+4],u[_+5],u[_+6]),h.set(u[_+8],u[_+9],u[_+10]),m.min(a,l,h),f.max(a,l,h);for(let t=0;t<5;++t)this.planes[t]=new e(t%2?m:f,d[t]);if(c>2){i.sorter.compare.axis=this.getLongestAxis(m,f),i.sorter.sort(o,p);var y=c>>>1}else var y=1;const g=c-y;this.left=y>1?new n(i,s,o,y):new r(i,s[o]),this.right=g>1?new n(i,s,o+y,g):new r(i,s[o+y])}function o(t,e){this.vertices=t,this.normals=e;const o=t.length/12;switch(o){case 0:this.root=null;break;case 1:this.root=new r(this,0);break;default:{const e=[];for(let t=0;t<o;++t)e.push(t);this.sorter=new i(e,s(t,0)),this.root=new n(this,e,0,o);break}}}const a=new t(0,0,0),l=new t(0,0,0),h=new t(0,0,0),c={u:0,v:0,t:0},d=[new t(0,0,1),new t(0,0,-1),new t(0,1,0),new t(0,-1,0),new t(1,0,0)];return r.prototype={intersectsLine:function(e,i,s){const r=this.vertices,n=this.normals,o=this.i4,d=this.i3;if(a.x=r[o],a.y=r[o+1],a.z=r[o+2],l.x=r[o+4],l.y=r[o+5],l.z=r[o+6],h.x=r[o+8],h.y=r[o+9],h.z=r[o+10],e.intersectsTriangle(a,l,h,c)){const e=c.u,a=c.v,l=1-e-a,h=i.size++;h>=i.length&&i.push(new t(0,0,0)),i[h].set(l*r[o]+e*r[o+4]+a*r[o+8],l*r[o+1]+e*r[o+5]+a*r[o+9],l*r[o+2]+e*r[o+6]+a*r[o+10]),s&&(h>=s.length&&s.push(new t(0,0,0)),s[h].set(l*n[d]+e*n[d+3]+a*n[d+6],l*n[d+1]+e*n[d+4]+a*n[d+7],l*n[d+2]+e*n[d+5]+a*n[d+8]))}}},n.prototype={intersectsLine:function(t,e,i){this.intersectsBBox(t)&&(this.left.intersectsLine(t,e,i),this.right.intersectsLine(t,e,i))},intersectsBBox:function(t){const e=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,c=this.intersection;return!!(e[0].intersectsLine(t,c)&&c.x>=r&&c.x<=n&&c.y>=o&&c.y<=a)||(!!(e[1].intersectsLine(t,c)&&c.x>=r&&c.x<=n&&c.y>=o&&c.y<=a)||(!!(e[2].intersectsLine(t,c)&&c.x>=r&&c.x<=n&&c.z>=l&&c.z<=h)||(!!(e[3].intersectsLine(t,c)&&c.x>=r&&c.x<=n&&c.z>=l&&c.z<=h)||!!(e[4].intersectsLine(t,c)&&c.y>=o&&c.y<=a&&c.z>=l&&c.z<=h))))},getLongestAxis:function(t,e){const i=e.x-t.x,s=e.y-t.y,r=e.z-t.z;return i<s?s<r?2:1:i<r?2:0}},o.prototype={constructor:o,intersectsLine:function(t,e,i){return e.size=0,this.root?(this.root.intersectsLine(t,e,i),e.size):0}},o}),t("x_ite/Components/ParticleSystems/ParticleSystem",["x_ite/Fields","x_ite/Basic/X3DFieldDefinition","x_ite/Basic/FieldDefinitionArray","x_ite/Components/Shape/X3DShapeNode","x_ite/Bits/TraverseType","x_ite/Bits/X3DConstants","x_ite/Bits/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(t,e,i,s,r,n,o,a,l,h,c,d,u,m,f){"use strict";function p(t,e){return t.distance<e.distance}function _(t){s.call(this,t),this.addType(n.ParticleSystem),this.particleSize_.setUnit("length"),this.createParticles=!0,this.particles=[],this.velocities=[],this.speeds=[],this.turbulences=[],this.geometryType=g,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 d,this.particleSorter=new u(this.particles,p),this.sortParticles=!1,this.geometryContext={}}var y=0;const g=y++,x=y++,A=y++,F=y++,w=y++,R=y++,b={POINT:g,LINE:x,TRIANGLE:A,QUAD:F,GEOMETRY:w,SPRITE:R},P=new c,v=new l(0,0,0),S=new l(0,0,0),C=new l(0,0,0),B=new l(0,0,0),N=new l(0,0,0),T=new l(0,0,0),V=new l(0,0,0),D=new l(0,0,0),M=new l(0,0,0),I=new l(0,0,0);return _.prototype=Object.assign(Object.create(s.prototype),{constructor:_,fieldDefinitions:new i([new e(n.inputOutput,"metadata",new t.SFNode),new e(n.inputOutput,"enabled",new t.SFBool(!0)),new e(n.inputOutput,"createParticles",new t.SFBool(!0)),new e(n.initializeOnly,"geometryType",new t.SFString("QUAD")),new e(n.inputOutput,"maxParticles",new t.SFInt32(200)),new e(n.inputOutput,"particleLifetime",new t.SFFloat(5)),new e(n.inputOutput,"lifetimeVariation",new t.SFFloat(.25)),new e(n.inputOutput,"particleSize",new t.SFVec2f(.02,.02)),new e(n.initializeOnly,"emitter",new t.SFNode),new e(n.initializeOnly,"physics",new t.MFNode),new e(n.initializeOnly,"colorKey",new t.MFFloat),new e(n.initializeOnly,"colorRamp",new t.SFNode),new e(n.initializeOnly,"texCoordKey",new t.MFFloat),new e(n.initializeOnly,"texCoordRamp",new t.SFNode),new e(n.outputOnly,"isActive",new t.SFBool),new e(n.inputOutput,"visible",new t.SFBool(!0)),new e(n.inputOutput,"castShadow",new t.SFBool(!0)),new e(n.inputOutput,"bboxDisplay",new t.SFBool),new e(n.initializeOnly,"bboxSize",new t.SFVec3f(-1,-1,-1)),new e(n.initializeOnly,"bboxCenter",new t.SFVec3f),new e(n.inputOutput,"appearance",new t.SFNode),new e(n.inputOutput,"geometry",new t.SFNode)]),getTypeName:function(){return"ParticleSystem"},getComponentName:function(){return"ParticleSystems"},getContainerField:function(){return"children"},initialize:function(){s.prototype.initialize.call(this);const t=this.getBrowser(),e=t.getContext();this.isLive().addInterest("set_live__",this),t.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=e.createBuffer(),this.positionBuffer=e.createBuffer(),this.elapsedTimeBuffer=e.createBuffer(),this.lifeBuffer=e.createBuffer(),this.colorBuffer=e.createBuffer(),this.texCoordBuffers=[e.createBuffer()],this.normalBuffer=e.createBuffer(),this.vertexBuffer=e.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=e.TRIANGLES,this.geometryContext.fogCoords=!1,this.geometryContext.textureCoordinateNode=t.getDefaultTextureCoordinate(),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)switch(this.geometryType){case g:this.setTransparent(!0);break;default:this.setTransparent(this.getAppearance().getTransparent()||this.colorRampNode&&this.colorRampNode.getTransparent()||this.geometryType===w&&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 t=this.getBrowser().getContext(),e=this.maxParticles;switch(this.geometryType=b[this.geometryType_.getValue()],this.geometryType||(this.geometryType=g),this.geometryType){case g:this.idArray=new Float32Array(e),this.positionArray=new Float32Array(3*e),this.elapsedTimeArray=new Float32Array(e),this.lifeArray=new Float32Array(e),this.colorArray=new Float32Array(4*e),this.texCoordArray=new Float32Array,this.normalArray=new Float32Array,this.vertexArray=new Float32Array(4*e);for(var i=0,s=this.idArray,r=s.length;i<r;++i)s[i]=i;this.colorArray.fill(1),this.vertexArray.fill(1),this.testWireframe=!1,this.primitiveMode=t.POINTS,this.texCoordCount=0,this.vertexCount=1,this.geometryContext.geometryType=0;break;case x:this.idArray=new Float32Array(2*e),this.positionArray=new Float32Array(6*e),this.elapsedTimeArray=new Float32Array(2*e),this.lifeArray=new Float32Array(2*e),this.colorArray=new Float32Array(8*e),this.texCoordArray=new Float32Array,this.normalArray=new Float32Array,this.vertexArray=new Float32Array(8*e);for(var i=0,s=this.idArray,r=s.length;i<r;++i)s[i]=Math.floor(i/2);this.colorArray.fill(1),this.vertexArray.fill(1),this.testWireframe=!1,this.primitiveMode=t.LINES,this.texCoordCount=2,this.vertexCount=2,this.geometryContext.geometryType=1;break;case A:case F:case R:this.idArray=new Float32Array(6*e),this.positionArray=new Float32Array(18*e),this.elapsedTimeArray=new Float32Array(6*e),this.lifeArray=new Float32Array(6*e),this.colorArray=new Float32Array(24*e),this.texCoordArray=new Float32Array(24*e),this.normalArray=new Float32Array(18*e),this.vertexArray=new Float32Array(24*e);for(var i=0,s=this.idArray,r=s.length;i<r;++i)s[i]=Math.floor(i/6);this.colorArray.fill(1),this.vertexArray.fill(1);for(var n=this.texCoordArray,o=this.normalArray,i=0,a=18*e;i<a;i+=3)o[i]=0,o[i+1]=0,o[i+2]=1;t.bindBuffer(t.ARRAY_BUFFER,this.normalBuffer),t.bufferData(t.ARRAY_BUFFER,this.normalArray,t.STATIC_DRAW);for(var i=0;i<e;++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}t.bindBuffer(t.ARRAY_BUFFER,this.texCoordBuffers[0]),t.bufferData(t.ARRAY_BUFFER,this.texCoordArray,t.STATIC_DRAW),this.testWireframe=!0,this.primitiveMode=t.TRIANGLES,this.texCoordCount=4,this.vertexCount=6,this.geometryContext.geometryType=2;break;case w:this.texCoordCount=0,this.vertexCount=0}t.bindBuffer(t.ARRAY_BUFFER,this.idBuffer),t.bufferData(t.ARRAY_BUFFER,this.idArray,t.STATIC_DRAW),this.set_shader__(),this.set_transparent__()},set_shader__:function(){switch(this.geometryType){case g:this.shaderNode=this.getBrowser().getPointShader();break;case x:this.shaderNode=this.getBrowser().getLineShader();break;case A:case F:case R:case w:this.shaderNode=null}},set_maxParticles__:function(){for(var t=this.particles,e=Math.max(0,this.maxParticles_.getValue()),i=this.numParticles,s=Math.min(t.length,e);i<s;++i)t[i].life=1,t[i].lifetime=-1;for(var i=t.length,s=e;i<s;++i)t[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=e,this.numParticles=Math.min(this.numParticles,e),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 t=this.physics_.getValue(),e=this.forcePhysicsModelNodes,i=this.boundedPhysicsModelNodes,s=0,r=i.length;s<r;++s)i[s].removeInterest("set_boundedPhysics__",this);e.length=0,i.length=0;for(var s=0,r=t.length;s<r;++s)try{for(var o=t[s].getValue().getInnerNode(),a=o.getType(),l=a.length-1;l>=0;--l){switch(a[l]){case n.ForcePhysicsModel:case n.WindPhysicsModel:e.push(o);break;case n.BoundedPhysicsModel:o.addInterest("set_boundedPhysics__",this),i.push(o);break;default:continue}break}}catch(t){}this.set_boundedPhysics__()},set_boundedPhysics__:function(){var t=this.boundedPhysicsModelNodes,e=this.boundedNormals,i=this.boundedVertices;e.length=0,i.length=0;for(var s=0,r=t.length;s<r;++s)t[s].addGeometry(e,i);this.boundedVolume=new f(i,e)},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 t=this.colorKey_,e=this.colorKeys,i=this.colorRamp,s=0,r=t.length;s<r;++s)e[s]=t[s];e.length=r,this.colorRampNode&&this.colorRampNode.getVectors(this.colorRamp);for(var s=i.length,r=t.length;s<r;++s)i[s]=new h(1,1,1,1);i.length=r,this.geometryContext.colorMaterial=!(!e.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 t=this.texCoordKey_,e=this.texCoordKeys,i=this.texCoordRamp,s=0,r=t.length;s<r;++s)e[s]=t[s];e.length=r,this.texCoordRampNode&&this.texCoordRampNode.getTexCoord(i);for(var s=i.length,r=t.length*this.texCoordCount;s<r;++s)i[s]=new h(0,0,0,0);i.length=r,this.texCoordAnim=!(!e.length||!this.texCoordRampNode)},intersectsBox:function(t,e){},animateParticles:function(){var t=this.emitterNode,e=1/Math.max(10,this.getBrowser().getCurrentFrameRate()),i=this.deltaTime=(14*this.deltaTime+e)/15;if(t.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){var s=performance.now()/1e3,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(t.getMass()){for(var o=this.forcePhysicsModelNodes,a=this.velocities,h=this.speeds,c=this.turbulences,d=this.deltaTime/t.getMass(),u=a.length,m=o.length;u<m;++u)a[u]=new l(0,0,0);for(var u=0,m=o.length;u<m;++u)o[u].addForce(u,t,a,c);for(var u=0,m=a.length;u<m;++u)a[u].multiply(d),h[u]=a[u].abs();this.numForces=m}else this.numForces=0;t.animate(this,i),this.updateGeometry(null),this.getBrowser().addBrowserEvent()},updateGeometry:function(t){switch(this.geometryType){case g:t||this.updatePoint();break;case x:t||this.updateLine();break;case A:case F:case R:this.updateQuad(t);break;case w:}},updatePoint:function(){var t=this.getBrowser().getContext(),e=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=e[l].color,c=4*l;o[c]=h.x,o[c+1]=h.y,o[c+2]=h.z,o[c+3]=h.w}t.bindBuffer(t.ARRAY_BUFFER,this.colorBuffer),t.bufferData(t.ARRAY_BUFFER,this.colorArray,t.STATIC_DRAW)}for(var l=0;l<i;++l){var d=e[l].position,u=e[l].elapsedTime/e[l].lifetime,m=3*l,c=4*l;s[m]=d.x,s[m+1]=d.y,s[m+2]=d.z,r[l]=u,n[l]=e[l].life,a[c]=d.x,a[c+1]=d.y,a[c+2]=d.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)},updateLine:function(){var t=this.getBrowser().getContext(),e=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 c=e[h].color,d=8*h;o[d]=c.x,o[d+1]=c.y,o[d+2]=c.z,o[d+3]=c.w,o[d+4]=c.x,o[d+5]=c.y,o[d+6]=c.z,o[d+7]=c.w}t.bindBuffer(t.ARRAY_BUFFER,this.colorBuffer),t.bufferData(t.ARRAY_BUFFER,this.colorArray,t.STATIC_DRAW)}for(var h=0;h<i;++h){var u=e[h],m=u.position,f=e[h].elapsedTime/e[h].lifetime,p=e[h].life,_=m.x,y=m.y,g=m.z,x=2*h,A=6*h,d=8*h;s[A]=_,s[A+1]=y,s[A+2]=g,s[A+3]=_,s[A+4]=y,s[A+5]=g,r[x]=f,r[x+1]=f,n[x]=p,n[x+1]=p,B.assign(u.velocity).normalize().multiply(l),a[d]=_-B.x,a[d+1]=y-B.y,a[d+2]=g-B.z,a[d+4]=_+B.x,a[d+5]=y+B.y,a[d+6]=g+B.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)},updateQuad:function(t){try{var e=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,c=this.normalArray,d=this.vertexArray,u=this.particleSize_.x/2,f=this.particleSize_.y/2;if(!t){if(this.geometryContext.colorMaterial){for(var p=0;p<s;++p){var _=i[p].color,y=24*p;l[y]=l[y+4]=l[y+8]=l[y+12]=l[y+16]=l[y+20]=_.x,l[y+1]=l[y+5]=l[y+9]=l[y+13]=l[y+17]=l[y+21]=_.y,l[y+2]=l[y+6]=l[y+10]=l[y+14]=l[y+18]=l[y+22]=_.z,l[y+3]=l[y+7]=l[y+11]=l[y+15]=l[y+19]=l[y+23]=_.w}e.bindBuffer(e.ARRAY_BUFFER,this.colorBuffer),e.bufferData(e.ARRAY_BUFFER,this.colorArray,e.STATIC_DRAW)}if(this.texCoordAnim&&this.texCoordArray.length){for(var g=this.texCoordKeys,x=this.texCoordRamp,A=g.length,F=0,p=0;p<s;++p){
2
+ var w=i[p],b=w.elapsedTime/w.lifetime;if(1==A||b<=g[0])F=0;else if(b>=g.at(-1))F=A-2;else{var P=m.upperBound(g,0,A,b,m.less);F=P<A?P-1:0}F*=this.texCoordCount;var v=x[F],S=x[F+1],M=x[F+2],I=x[F+3],y=24*p;h[y]=h[y+12]=v.x,h[y+1]=h[y+13]=v.y,h[y+2]=h[y+14]=v.z,h[y+3]=h[y+15]=v.w,h[y+4]=S.x,h[y+5]=S.y,h[y+6]=S.z,h[y+7]=S.w,h[y+8]=h[y+16]=M.x,h[y+9]=h[y+17]=M.y,h[y+10]=h[y+18]=M.z,h[y+11]=h[y+19]=M.w,h[y+20]=I.x,h[y+21]=I.y,h[y+22]=I.z,h[y+23]=I.w}e.bindBuffer(e.ARRAY_BUFFER,this.texCoordBuffers[0]),e.bufferData(e.ARRAY_BUFFER,this.texCoordArray,e.STATIC_DRAW)}}if(this.geometryType===R){if(t){var z=this.getScreenAlignedRotation(t);B.set(z[0],z[1],z[2]).cross(C.set(z[3],z[4],z[5])).normalize();for(var E=B.x,O=B.y,U=B.z,p=0,A=18*s;p<A;p+=3)c[p]=E,c[p+1]=O,c[p+2]=U;e.bindBuffer(e.ARRAY_BUFFER,this.normalBuffer),e.bufferData(e.ARRAY_BUFFER,this.normalArray,e.STATIC_DRAW),N.set(-u,-f,0),T.set(u,-f,0),V.set(u,f,0),D.set(-u,f,0),z.multVecMatrix(N),z.multVecMatrix(T),z.multVecMatrix(V),z.multVecMatrix(D);for(var p=0;p<r;++p){var Y=i[p].position,L=i[p].elapsedTime/i[p].lifetime,X=Y.x,W=Y.y,G=Y.z,j=6*p,k=18*p,y=24*p;n[k]=n[k+3]=n[k+6]=n[k+9]=n[k+12]=n[k+15]=X,n[k+1]=n[k+4]=n[k+7]=n[k+10]=n[k+13]=n[k+16]=W,n[k+2]=n[k+5]=n[k+8]=n[k+11]=n[k+14]=n[k+17]=G,o[j]=o[j+1]=o[j+2]=o[j+3]=o[j+4]=o[j+5]=L,a[j]=a[j+1]=a[j+2]=a[j+3]=a[j+4]=a[j+5]=i[p].life,d[y]=d[y+12]=X+N.x,d[y+1]=d[y+13]=W+N.y,d[y+2]=d[y+14]=G+N.z,d[y+4]=X+T.x,d[y+5]=W+T.y,d[y+6]=G+T.z,d[y+8]=d[y+16]=X+V.x,d[y+9]=d[y+17]=W+V.y,d[y+10]=d[y+18]=G+V.z,d[y+20]=X+D.x,d[y+21]=W+D.y,d[y+22]=G+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)}}else if(!t){for(var p=0;p<r;++p){var Y=i[p].position,L=i[p].elapsedTime/i[p].lifetime,X=Y.x,W=Y.y,G=Y.z,j=6*p,k=18*p,y=24*p;n[k]=n[k+3]=n[k+6]=n[k+9]=n[k+12]=n[k+15]=X,n[k+1]=n[k+4]=n[k+7]=n[k+10]=n[k+13]=n[k+16]=W,n[k+2]=n[k+5]=n[k+8]=n[k+11]=n[k+14]=n[k+17]=G,o[j]=o[j+1]=o[j+2]=o[j+3]=o[j+4]=o[j+5]=L,a[j]=a[j+1]=a[j+2]=a[j+3]=a[j+4]=a[j+5]=i[p].life,d[y]=d[y+12]=X-u,d[y+1]=d[y+13]=W-f,d[y+2]=d[y+14]=G,d[y+4]=X+u,d[y+5]=W-f,d[y+6]=G,d[y+8]=d[y+16]=X+u,d[y+9]=d[y+17]=W+f,d[y+10]=d[y+18]=G,d[y+20]=X-u,d[y+21]=W+f,d[y+22]=G}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)}}catch(t){console.log(t)}},traverse:function(t,e){if(this.isActive_.getValue()){switch(t){case r.POINTER:break;case r.PICKING:break;case r.COLLISION:break;case r.SHADOW:this.castShadow_.getValue()&&e.addDepthShape(this);break;case r.DISPLAY:e.addDisplayShape(this)&&this.getAppearance().traverse(t,e)}this.geometryType===w&&this.getGeometry()&&this.getGeometry().traverse(t,e)}},depth:function(t,e,i){if(this.updateGeometry(e.modelViewMatrix),this.geometryType===w){var s=this.getGeometry();s&&s.displayParticlesDepth(t,e,i,this.particles,this.numParticles)}else{if(this.numParticles<=0)return;i.getValid()&&(i.enableFloatAttrib(t,"x3d_ParticleId",this.idBuffer,1),i.enableFloatAttrib(t,"x3d_ParticlePosition",this.positionBuffer,3),i.enableFloatAttrib(t,"x3d_ParticleElapsedTime",this.elapsedTimeBuffer,1),i.enableFloatAttrib(t,"x3d_ParticleLife",this.lifeBuffer,1),i.enableVertexAttribute(t,this.vertexBuffer),t.drawArrays(this.primitiveMode,0,this.numParticles*this.vertexCount),i.disableFloatAttrib(t,"x3d_ParticleId"),i.disableFloatAttrib(t,"x3d_ParticlePosition"),i.disableFloatAttrib(t,"x3d_ParticleElapsedTime"),i.disableFloatAttrib(t,"x3d_ParticleLife"))}},display:function(t,e){try{if(this.numParticles<=0)return;if(this.updateGeometry(e.modelViewMatrix),this.geometryType===w){const i=this.getGeometry();i&&i.displayParticles(t,e,this.particles,this.numParticles)}else{const r=this.getAppearance(),n=r.shaderNode||this.shaderNode||r.materialNode.getShader(e.browser,e.shadow);if(n.getValid()){e.geometryContext=this.geometryContext;const o=r.blendModeNode;if(o&&o.enable(t),n.enable(t),n.setLocalUniforms(t,e),n.enableFloatAttrib(t,"x3d_ParticleId",this.idBuffer,1),n.enableFloatAttrib(t,"x3d_ParticlePosition",this.positionBuffer,3),n.enableFloatAttrib(t,"x3d_ParticleElapsedTime",this.elapsedTimeBuffer,1),n.enableFloatAttrib(t,"x3d_ParticleLife",this.lifeBuffer,1),this.geometryContext.colorMaterial&&n.enableColorAttribute(t,this.colorBuffer),this.texCoordArray.length&&n.enableTexCoordAttribute(t,this.texCoordBuffers),this.normalArray.length&&n.enableNormalAttribute(t,this.normalBuffer),n.enableVertexAttribute(t,this.vertexBuffer),n.wireframe&&this.testWireframe)for(var i=0,s=this.numParticles*this.vertexCount;i<s;i+=3)t.drawArrays(n.primitiveMode,i,3);else{const i=c.prototype.determinant3.call(e.modelViewMatrix)>0;t.frontFace(i?t.CCW:t.CW),t.enable(t.CULL_FACE),t.cullFace(t.BACK),t.drawArrays(this.primitiveMode,0,this.numParticles*this.vertexCount)}n.disableFloatAttrib(t,"x3d_ParticleId"),n.disableFloatAttrib(t,"x3d_ParticlePosition"),n.disableFloatAttrib(t,"x3d_ParticleElapsedTime"),n.disableFloatAttrib(t,"x3d_ParticleLife"),n.disableColorAttribute(t),n.disableTexCoordAttribute(t),n.disableNormalAttribute(t),n.disable(t),o&&o.disable(t),e.geometryContext=null}}}catch(t){console.log(t)}},getScreenAlignedRotation:function(t){P.assign(t).inverse(),P.multDirMatrix(v.assign(l.zAxis)),P.multDirMatrix(S.assign(l.yAxis)),M.assign(S).cross(v),I.assign(v).cross(M);var e=v;return M.normalize(),I.normalize(),e.normalize(),this.rotation.set(M.x,M.y,M.z,I.x,I.y,I.z,e.x,e.y,e.z)}}),_}),t("x_ite/Components/ParticleSystems/PolylineEmitter",["x_ite/Fields","x_ite/Basic/X3DFieldDefinition","x_ite/Basic/FieldDefinitionArray","x_ite/Components/ParticleSystems/X3DParticleEmitterNode","x_ite/Components/Rendering/IndexedLineSet","x_ite/Bits/X3DConstants","standard/Math/Numbers/Vector3","standard/Math/Algorithm"],function(t,e,i,s,r,n,o,a){"use strict";function l(t){s.call(this,t),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(t),this.polylines=[],this.lengthSoFarArray=[0]}function h(t){return t.set(0,0,0)}return l.prototype=Object.assign(Object.create(s.prototype),{constructor:l,fieldDefinitions:new i([new e(n.inputOutput,"metadata",new t.SFNode),new e(n.inputOutput,"direction",new t.SFVec3f(0,1,0)),new e(n.inputOutput,"speed",new t.SFFloat),new e(n.inputOutput,"variation",new t.SFFloat(.25)),new e(n.initializeOnly,"mass",new t.SFFloat),new e(n.initializeOnly,"surfaceArea",new t.SFFloat),new e(n.inputOutput,"coordIndex",new t.MFInt32(-1)),new e(n.inputOutput,"coord",new t.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:function(){var t=new o(0,0,0),e=new o(0,0,0);return function(){var i=this.vertices=this.polylineNode.getVertices().getValue();if(i.length){delete this.getRandomPosition;var s=0,r=this.lengthSoFarArray;r.length=1;for(var n=0,o=i.length;n<o;n+=8)t.set(i[n],i[n+1],i[n+2]),e.set(i[n+4],i[n+5],i[n+6]),s+=e.subtract(t).abs(),r.push(s)}else this.getRandomPosition=h}}(),getRandomPosition:function(t){var e=this.lengthSoFarArray,i=e.length,s=Math.random()*e.at(-1),r=0,n=0,o=0;if(1==i||s<=e[0])r=0,o=0;else if(s>=e.at(-1))r=i-2,o=1;else{var l=a.upperBound(e,0,i,s,a.less);if(l<i){n=l,r=l-1;var h=e[r],c=e[n];o=a.clamp((s-h)/(c-h),0,1)}else r=0,o=0}r*=8,n=r+4;var d=this.vertices,u=d[r],m=d[r+1],f=d[r+2],p=d[n],_=d[n+1],y=d[n+2];return t.x=u+o*(p-u),t.y=m+o*(_-m),t.z=f+o*(y-f),t},getRandomVelocity:function(t){var e=this.direction,i=this.getRandomSpeed();return t.x=e.x*i,t.y=e.y*i,t.z=e.z*i,t}}),l}),t("x_ite/Components/ParticleSystems/SurfaceEmitter",["x_ite/Fields","x_ite/Basic/X3DFieldDefinition","x_ite/Basic/FieldDefinitionArray","x_ite/Components/ParticleSystems/X3DParticleEmitterNode","x_ite/Bits/X3DConstants","x_ite/Bits/X3DCast","standard/Math/Geometry/Triangle3","standard/Math/Numbers/Vector3","standard/Math/Algorithm"],function(t,e,i,s,r,n,o,a,l){"use strict";function h(t){s.call(this,t),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)}function c(t){return t.set(0,0,0)}return h.prototype=Object.assign(Object.create(s.prototype),{constructor:h,fieldDefinitions:new i([new e(r.inputOutput,"metadata",new t.SFNode),new e(r.inputOutput,"speed",new t.SFFloat),new e(r.inputOutput,"variation",new t.SFFloat(.25)),new e(r.initializeOnly,"mass",new t.SFFloat),new e(r.initializeOnly,"surfaceArea",new t.SFFloat),new e(r.initializeOnly,"surface",new t.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__:function(){var t=new a(0,0,0),e=new a(0,0,0),i=new a(0,0,0);return function(){if(this.surfaceNode){delete this.getRandomPosition,delete this.getRandomVelocity;var s=0,r=this.areaSoFarArray,n=this.surfaceNode.getVertices().getValue();this.normals=this.surfaceNode.getNormals().getValue(),this.vertices=n,r.length=1;for(var a=0,l=n.length;a<l;a+=12)t.set(n[a],n[a+1],n[a+2]),e.set(n[a+4],n[a+5],n[a+6]),i.set(n[a+8],n[a+9],n[a+10]),s+=o.area(t,e,i),r.push(s)}else this.getRandomPosition=c,this.getRandomVelocity=this.getSphericalRandomVelocity}}(),getRandomPosition:function(t){var e=this.areaSoFarArray,i=e.length,s=Math.random()*e.at(-1),r=0;if(1==i||s<=e[0])r=0;else if(s>=e.at(-1))r=i-2;else{var n=l.upperBound(e,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,c=12*r,d=this.vertices;t.x=o*d[c]+a*d[c+4]+h*d[c+8],t.y=o*d[c+1]+a*d[c+5]+h*d[c+9],t.z=o*d[c+2]+a*d[c+6]+h*d[c+10];var c=9*r,u=this.normals,m=this.direction;return m.x=o*u[c]+a*u[c+3]+h*u[c+6],m.y=o*u[c+1]+a*u[c+4]+h*u[c+7],m.z=o*u[c+2]+a*u[c+5]+h*u[c+8],t},getRandomVelocity:function(t){var e=this.getRandomSpeed(),i=this.direction;return t.x=i.x*e,t.y=i.y*e,t.z=i.z*e,t}}),h}),t("x_ite/Components/ParticleSystems/VolumeEmitter",["x_ite/Fields","x_ite/Basic/X3DFieldDefinition","x_ite/Basic/FieldDefinitionArray","x_ite/Components/ParticleSystems/X3DParticleEmitterNode","x_ite/Components/Geometry3D/IndexedFaceSet","x_ite/Bits/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(t,e,i,s,r,n,o,a,l,h,c,d,u,m){"use strict";function f(t){s.call(this,t),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(t),this.areaSoFarArray=[0]}return f.prototype=Object.assign(Object.create(s.prototype),{constructor:f,fieldDefinitions:new i([new e(n.inputOutput,"metadata",new t.SFNode),new e(n.initializeOnly,"internal",new t.SFBool(!0)),new e(n.inputOutput,"direction",new t.SFVec3f(0,1,0)),new e(n.inputOutput,"speed",new t.SFFloat),new e(n.inputOutput,"variation",new t.SFFloat(.25)),new e(n.initializeOnly,"mass",new t.SFFloat),new e(n.initializeOnly,"surfaceArea",new t.SFFloat),new e(n.inputOutput,"coordIndex",new t.MFInt32(-1)),new e(n.inputOutput,"coord",new t.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__:function(){var t=new o(0,0,0),e=new o(0,0,0),i=new o(0,0,0);return function(){var s=0,r=this.areaSoFarArray,n=this.volumeNode.getNormals().getValue(),o=this.volumeNode.getVertices().getValue();this.normals=n,this.vertices=o,r.length=1;for(var a=0,l=o.length;a<l;a+=12)t.set(o[a],o[a+1],o[a+2]),e.set(o[a+4],o[a+5],o[a+6]),i.set(o[a+8],o[a+9],o[a+10]),s+=c.area(t,e,i),r.push(s);this.bvh=new u(o,n)}}(),getRandomPosition:function(){function t(t,e){return n.getDistanceToPoint(t)<n.getDistanceToPoint(e)}var e=new o(0,0,0),i=new o(0,0,0),s=new a(0,0,1,0),r=new l(o.Zero,o.zAxis),n=new h(o.Zero,o.zAxis),c=[],u=new m(c,t);return function(t){var a=this.areaSoFarArray,l=a.length,h=Math.random()*a.at(-1),m=0;if(1==l||h<=a[0])m=0;else if(h>=a.at(-1))m=l-2;else{var f=d.upperBound(a,0,l,h,d.less);m=f<l?f-1:0}var p=Math.random(),_=Math.random();p+_>1&&(p=1-p,_=1-_);var y=1-p-_,g=12*m,x=this.vertices;e.x=p*x[g]+_*x[g+4]+y*x[g+8],e.y=p*x[g+1]+_*x[g+5]+y*x[g+9],e.z=p*x[g+2]+_*x[g+6]+y*x[g+10];var g=9*m,A=this.normals;i.x=p*A[g]+_*A[g+3]+y*A[g+6],i.y=p*A[g+1]+_*A[g+4]+y*A[g+7],i.z=p*A[g+2]+_*A[g+5]+y*A[g+8],s.setFromToVec(o.zAxis,i),s.multVecRot(this.getRandomSurfaceNormal(i)),r.set(e,i),n.set(e,i);var F=this.bvh.intersectsLine(r,c);if(F-=F%2){u.sort(0,F);var f=2*Math.round(this.getRandomValue(0,F/2-1)),w=c[f],R=c[f+1],y=Math.random();return t.x=w.x+(R.x-w.x)*y,t.y=w.y+(R.y-w.y)*y,t.z=w.z+(R.z-w.z)*y,t}return t.set(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY)}}(),getRandomVelocity:function(t){var e=this.direction,i=this.getRandomSpeed();return t.x=e.x*i,t.y=e.y*i,t.z=e.z*i,t}}),f}),t("x_ite/Components/ParticleSystems/WindPhysicsModel",["x_ite/Fields","x_ite/Basic/X3DFieldDefinition","x_ite/Basic/FieldDefinitionArray","x_ite/Components/ParticleSystems/X3DParticlePhysicsModelNode","x_ite/Bits/X3DConstants","standard/Math/Numbers/Vector3","standard/Math/Algorithm"],function(t,e,i,s,r,n,o){"use strict";function a(t){s.call(this,t),this.addType(r.WindPhysicsModel),this.speed_.setUnit("speed")}return a.prototype=Object.assign(Object.create(s.prototype),{constructor:a,fieldDefinitions:new i([new e(r.inputOutput,"metadata",new t.SFNode),new e(r.inputOutput,"enabled",new t.SFBool(!0)),new e(r.inputOutput,"direction",new t.SFVec3f),new e(r.inputOutput,"speed",new t.SFFloat(.1)),new e(r.inputOutput,"gustiness",new t.SFFloat(.1)),new e(r.inputOutput,"turbulence",new t.SFFloat)]),getTypeName:function(){return"WindPhysicsModel"},getComponentName:function(){return"ParticleSystems"},getContainerField:function(){return"physics"},getRandomSpeed:function(t){var e=Math.max(0,this.speed_.getValue()),i=e*Math.max(0,this.gustiness_.getValue());return t.getRandomValue(Math.max(0,e-i),e+i)},addForce:function(){var t=new n(0,0,0);return function(e,i,s,r){var a=i.surfaceArea_.getValue();if(this.enabled_.getValue()){var l=this.getRandomSpeed(i),h=.64615*Math.pow(10,2*Math.log(l));this.direction_.getValue().equals(n.Zero)?i.getRandomNormal(t):t.assign(this.direction_.getValue()).normalize(),s[e].assign(t.multiply(a*h)),r[e]=Math.PI*o.clamp(this.turbulence_.getValue(),0,1)}}}()}),a}),t(e.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(t,e,i,s,r,n,o,a,l,h,c,d,u,m){"use strict";t.addComponent({name:"ParticleSystems",types:{BoundedPhysicsModel:i,ConeEmitter:s,ExplosionEmitter:r,ForcePhysicsModel:n,ParticleSystem:o,PointEmitter:a,PolylineEmitter:l,SurfaceEmitter:h,VolumeEmitter:c,WindPhysicsModel:d},abstractTypes:{X3DParticleEmitterNode:u,X3DParticlePhysicsModelNode:m},browser:e})})}();
@@ -1,9 +1,11 @@
1
- (function () {
1
+ (function ()
2
+ {
3
+ // Undefine global variables.
4
+ var module = { }, exports, process;
2
5
 
3
- var
4
- define = X3D .define,
5
- require = X3D .require,
6
- module = { };
6
+ const
7
+ define = X3D .define,
8
+ require = X3D .require;
7
9
  /* -*- Mode: JavaScript; coding: utf-8; tab-width: 3; indent-tabs-mode: tab; c-basic-offset: 3 -*-
8
10
  *******************************************************************************
9
11
  *
@@ -1363,7 +1365,7 @@ define ('x_ite/Browser/Picking/VolumePicker',[
1363
1365
  "standard/Math/Numbers/Vector3",
1364
1366
  "standard/Math/Numbers/Rotation4",
1365
1367
  "standard/Math/Numbers/Matrix4",
1366
- X3D .getComponentUrl ("rigid-body-physics"),
1368
+ require .getComponentUrl ("rigid-body-physics"),
1367
1369
  ],
1368
1370
  function (Vector3,
1369
1371
  Rotation4,
@@ -1569,7 +1571,7 @@ define ('x_ite/Components/Picking/PointPickSensor',[
1569
1571
  "standard/Math/Numbers/Vector3",
1570
1572
  "standard/Math/Numbers/Rotation4",
1571
1573
  "standard/Math/Geometry/Box3",
1572
- X3D .getComponentUrl ("rigid-body-physics"),
1574
+ require .getComponentUrl ("rigid-body-physics"),
1573
1575
  ],
1574
1576
  function (Fields,
1575
1577
  X3DFieldDefinition,
@@ -2436,7 +2438,8 @@ function (Fields,
2436
2438
  *
2437
2439
  ******************************************************************************/
2438
2440
 
2439
- define ([
2441
+
2442
+ define (require .getComponentUrl ("picking"), [
2440
2443
  "x_ite/Components",
2441
2444
  "x_ite/Components/Picking/LinePickSensor",
2442
2445
  "x_ite/Components/Picking/PickableGroup",
@@ -2445,7 +2448,7 @@ define ([
2445
2448
  "x_ite/Components/Picking/VolumePickSensor",
2446
2449
  "x_ite/Components/Picking/X3DPickSensorNode",
2447
2450
  "x_ite/Components/Picking/X3DPickableObject",
2448
- X3D .getComponentUrl ("rigid-body-physics"),
2451
+ require .getComponentUrl ("rigid-body-physics"),
2449
2452
  ],
2450
2453
  function (Components,
2451
2454
  LinePickSensor,
@@ -2477,5 +2480,4 @@ function (Components,
2477
2480
  });
2478
2481
 
2479
2482
 
2480
-
2481
- }());
2483
+ })();
@@ -1 +1 @@
1
- !function(){var e=X3D.define;X3D.require;e("x_ite/Browser/Picking/MatchCriterion",[],function(){"use strict";var e=0;return{MATCH_ANY:e++,MATCH_EVERY:e++,MATCH_ONLY_ONE:e++}}),e("x_ite/Browser/Picking/IntersectionType",[],function(){"use strict";var e=0;return{BOUNDS:e++,GEOMETRY:e++}}),e("x_ite/Browser/Picking/SortOrder",[],function(){"use strict";var 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/Bits/TraverseType","x_ite/Bits/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";function p(e,t){return e.distance<t.distance}function g(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,p),this.pickedGeometries=new e.MFNode}var u=h(c);return g.prototype=Object.assign(Object.create(t.prototype),{constructor:g,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:function(){var e=new WeakMap;return function(t){var i=e.get(t);if(void 0!==i)return i;var n=this.getExecutionContext().createNode("Shape",!1),o=this.getExecutionContext().createNode("CollidableShape",!1);return n.setPrivate(!0),o.setPrivate(!0),o.setConvex(!0),n.geometry_=t,o.shape_=n,n.setup(),o.setup(),e.set(t,o),o}}(),getPickedGeometries:function(){return 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:for(var o=0,c=i.length;o<c;++o)n[o]=this.getPickedGeometry(i[o]);n.length=c;break;case r.ALL_SORTED:this.pickedTargetsSorter.sort(0,i.length);for(var 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;var o=i.getExecutionContext();if(o.getType().indexOf(n.X3DPrototypeInstance)!==-1&&o.getExecutionContext()===t)return o;for(var s=e.pickingHierarchy,r=s.length-1;r>=0;--r){var c=s[r];if(c.getExecutionContext()===t)return c;var o=c.getExecutionContext();if(o.getType().indexOf(n.X3DPrototypeInstance)!==-1&&o.getExecutionContext()===t)return o}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__:function(){var e=new Map([["MATCH_ANY",o.MATCH_ANY],["MATCH_EVERY",o.MATCH_EVERY],["MATCH_ONLY_ONE",o.MATCH_ONLY_ONE]]);return function(){this.matchCriterion=e.get(this.matchCriterion_.getValue()),void 0===this.matchCriterion&&(this.matchCriterion=MatchCriterionType.MATCH_ANY)}}(),set_intersectionType__:function(){var e=new Map([["BOUNDS",s.BOUNDS],["GEOMETRY",s.GEOMETRY]]);return function(){this.intersectionType=e.get(this.intersectionType_.getValue()),void 0===this.intersectionType&&(this.intersectionType=s.BOUNDS)}}(),set_sortOrder__:function(){var e=new Map([["ANY",r.ANY],["CLOSEST",r.CLOSEST],["ALL",r.ALL],["ALL_SORTED",r.ALL_SORTED]]);return function(){this.sortOrder=e.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{var 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}}),g}),e("x_ite/Components/Picking/LinePickSensor",["x_ite/Fields","x_ite/Basic/X3DFieldDefinition","x_ite/Basic/FieldDefinitionArray","x_ite/Components/Picking/X3DPickSensorNode","x_ite/Bits/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}return p.prototype=Object.assign(Object.create(n.prototype),{constructor:p,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:function(){var t=new a,i=new a,o=new r(0,0,0),p=new r(0,0,0),g=new c,u=new r(0,0,0),d=new r(0,0,0),l=new h(r.Zero,r.zAxis),m=new r(0,0,0),_=new r(0,0,0),y=[],k=[],f=new r(0,0,0),w=new e.MFVec3f,S=new e.MFVec3f,C=new e.MFVec3f;return function(){if(this.pickingGeometryNode){var e=this.getModelMatrices(),r=this.getTargets();switch(this.getIntersectionType()){case s.BOUNDS:for(var c=0,a=e.length;c<a;++c){var h=e[c];t.assign(this.pickingGeometryNode.getBBox()).multRight(h);for(var v=0,T=r.size;v<T;++v){var N=r[v];i.assign(N.geometryNode.getBBox()).multRight(N.modelMatrix),t.intersectsBox(i)&&(o.assign(t.center),p.assign(i.center),N.intersected=!0,N.distance=o.distance(p))}}var b=this.getPickedGeometries(),O=Boolean(b.length);b.remove(0,b.length,null),O!==this.isActive_.getValue()&&(this.isActive_=O),this.pickedGeometry_.equals(b)||(this.pickedGeometry_=b);break;case s.GEOMETRY:for(var c=0,a=e.length;c<a;++c){var h=e[c];t.assign(this.pickingGeometryNode.getBBox()).multRight(h);for(var v=0,T=r.size;v<T;++v)try{var N=r[v],x=N.geometryNode,P=this.pickingGeometryNode.getVertices();i.assign(x.getBBox()).multRight(N.modelMatrix),g.assign(N.modelMatrix).inverse().multLeft(h);for(var B=0,M=P.length;B<M;B+=8)if(g.multVecMatrix(u.set(P[B+0],P[B+1],P[B+2])),g.multVecMatrix(d.set(P[B+4],P[B+5],P[B+6])),l.setPoints(u,d),k.length=0,x.intersectsLine(l,y,N.modelMatrix,k))for(var G=0,F=k.length;G<F;++G){var D=k[G];m.assign(D.point).subtract(u),_.assign(D.point).subtract(d);var A=m.add(_).abs(),V=u.distance(d);A<=V&&N.intersections.push(D)}N.intersections.length&&(o.assign(t.center),p.assign(i.center),N.intersected=!0,N.distance=o.distance(p))}catch(e){console.log(e)}}var b=this.getPickedGeometries(),O=Boolean(b.length);b.remove(0,b.length,null),O!==this.isActive_.getValue()&&(this.isActive_=O),this.pickedGeometry_.equals(b)||(this.pickedGeometry_=b);var j=this.getPickedTargets();w.length=0,S.length=0,C.length=0;for(var v=0,T=j.length;v<T;++v)for(var L=j[v].intersections,G=0,F=L.length;G<F;++G){var D=L[G],v=D.texCoord;f.set(v.x,v.y,v.z),w.push(f),S.push(D.normal),C.push(D.point)}this.pickedTextureCoordinate_.equals(w)||(this.pickedTextureCoordinate_=w),this.pickedNormal_.equals(S)||(this.pickedNormal_=S),this.pickedPoint_.equals(C)||(this.pickedPoint_=C)}}n.prototype.process.call(this)}}()}),p}),e("x_ite/Components/Picking/X3DPickableObject",["x_ite/Bits/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/Basic/X3DFieldDefinition","x_ite/Basic/FieldDefinitionArray","x_ite/Components/Grouping/X3DGroupingNode","x_ite/Components/Picking/X3DPickableObject","x_ite/Browser/Picking/MatchCriterion","x_ite/Bits/X3DConstants","x_ite/Bits/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,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",X3D.getComponentUrl("rigid-body-physics")],function(e,t,i,n){"use strict";function o(){this.broadphase=new s.btDbvtBroadphase,this.collisionConfiguration=new s.btDefaultCollisionConfiguration,this.dispatcher=new s.btCollisionDispatcher(this.collisionConfiguration),this.collisionWorld=new s.btCollisionWorld(this.dispatcher,this.broadphase,this.collisionConfiguration),this.compoundShape1=new s.btCompoundShape,this.motionState1=new s.btDefaultMotionState,this.constructionInfo1=new s.btRigidBodyConstructionInfo(0,this.motionState1,this.compoundShape1),this.rigidBody1=new s.btRigidBody(this.constructionInfo1),this.compoundShape2=new s.btCompoundShape,this.motionState2=new s.btDefaultMotionState,this.constructionInfo2=new s.btRigidBodyConstructionInfo(0,this.motionState2,this.compoundShape2),this.rigidBody2=new s.btRigidBody(this.constructionInfo2),this.collisionWorld.addCollisionObject(this.rigidBody1),this.collisionWorld.addCollisionObject(this.rigidBody2)}var s=n.Ammo;return o.prototype={constuctor:o,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(){var i=new e(0,0,0),n=new t(0,0,1,0),o=new e(1,1,1),r=new s.btVector3(0,0,0);return function(e,t,s){try{e.getNumChildShapes()&&e.removeChildShapeByIndex(0),s.getNumChildShapes()&&(t.get(i,n,o),r.setValue(o.x,o.y,o.z),s.setLocalScaling(r),e.addChildShape(this.getTransform(i,n),s))}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();for(var e=this.dispatcher.getNumManifolds(),t=0;t<e;++t)for(var i=this.dispatcher.getManifoldByIndexInternal(t),n=i.getNumContacts(),o=0;o<n;++o){var s=i.getContactPoint(o);if(s.getDistance()<=0)return!0}return!1},getTransform:function(){var e=new s.btTransform,t=new s.btVector3(0,0,0),n=new i;return function(i,o,s){var 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}}()},o}),e("x_ite/Components/Picking/PointPickSensor",["x_ite/Fields","x_ite/Basic/X3DFieldDefinition","x_ite/Basic/FieldDefinitionArray","x_ite/Components/Picking/X3DPickSensorNode","x_ite/Bits/X3DCast","x_ite/Bits/X3DConstants","x_ite/Browser/Picking/IntersectionType","x_ite/Browser/Picking/VolumePicker","standard/Math/Numbers/Vector3","standard/Math/Numbers/Rotation4","standard/Math/Geometry/Box3",X3D.getComponentUrl("rigid-body-physics")],function(e,t,i,n,o,s,r,c,a,h,p,g){"use strict";function u(e){n.call(this,e),this.addType(s.PointPickSensor),this.pickingGeometryNode=null,this.picker=new c,this.compoundShapes=[]}var d=g.Ammo;return u.prototype=Object.assign(Object.create(n.prototype),{constructor:u,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__:function(){var e=new d.btVector3(1,1,1),t=new d.btVector3,i=new d.btTransform;return function(){var n=this.compoundShapes;if(this.pickingGeometryNode){var o=this.pickingGeometryNode.getCoord();if(o){for(var s=0,r=o.getSize();s<r;++s)if(s<n.length){var c=n[s],h=o.get1Point(s,c.point);t.setValue(h.x,h.y,h.z),i.setOrigin(t),c.setLocalScaling(e),c.updateChildTransform(0,i)}else{var c=new d.btCompoundShape,p=new d.btSphereShape(0),h=o.get1Point(s,new a(0,0,0));c.point=h,t.setValue(h.x,h.y,h.z),i.setOrigin(t),c.addChildShape(i,p),n.push(c)}n.length=r}else n.length=0}else n.length=0}}(),process:function(){var t=new p,i=new p,o=new a(0,0,0),s=new a(0,0,0),c=new d.btTransform,g=new d.btVector3,u=new a(0,0,0),l=new h(0,0,1,0),m=new a(1,1,1),_=new e.MFVec3f;return function(){if(this.pickingGeometryNode){var e=this.getModelMatrices(),a=this.getTargets();switch(this.getIntersectionType()){case r.BOUNDS:for(var h=0,p=e.length;h<p;++h){var d=e[h];t.assign(this.pickingGeometryNode.getBBox()).multRight(d);for(var y=0,k=a.size;y<k;++y){var f=a[y];i.assign(f.geometryNode.getBBox()).multRight(f.modelMatrix),t.intersectsBox(i)&&(o.assign(t.center),s.assign(i.center),f.intersected=!0,f.distance=o.distance(s))}}var w=this.getPickedGeometries(),S=Boolean(w.length);w.remove(0,w.length,null),S!==this.isActive_.getValue()&&(this.isActive_=S),this.pickedGeometry_.equals(w)||(this.pickedGeometry_=w);break;case r.GEOMETRY:for(var C=this.picker,v=this.compoundShapes,h=0,p=e.length;h<p;++h){var d=e[h];t.assign(this.pickingGeometryNode.getBBox()).multRight(d),d.get(u,l,m),C.getTransform(u,l,c),g.setValue(m.x,m.y,m.z);for(var T=0,N=v.length;T<N;++T){var b=v[T];C.setChildShape1Components(c,g,b);for(var y=0,k=a.size;y<k;++y){var f=a[y],O=this.getPickShape(f.geometryNode);i.assign(f.geometryNode.getBBox()).multRight(f.modelMatrix),C.setChildShape2(f.modelMatrix,O.getCompoundShape()),C.contactTest()&&(o.assign(t.center),s.assign(i.center),f.intersected=!0,f.distance=o.distance(s),f.pickedPoint.push(b.point))}}}var w=this.getPickedGeometries(),S=Boolean(w.length);w.remove(0,w.length,null),S!==this.isActive_.getValue()&&(this.isActive_=S),this.pickedGeometry_.equals(w)||(this.pickedGeometry_=w);var x=this.getPickedTargets();_.length=0;for(var y=0,k=x.length;y<k;++y)for(var P=x[y].pickedPoint,B=0,M=P.length;B<M;++B)_.push(P[B]);this.pickedPoint_.equals(_)||(this.pickedPoint_=_)}}n.prototype.process.call(this)}}()}),u}),e("x_ite/Components/Picking/PrimitivePickSensor",["x_ite/Fields","x_ite/Basic/X3DFieldDefinition","x_ite/Basic/FieldDefinitionArray","x_ite/Components/Picking/X3DPickSensorNode","x_ite/Bits/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}return h.prototype=Object.assign(Object.create(n.prototype),{constructor:h,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:function(){var e=new a,t=new a,i=new c(0,0,0),o=new c(0,0,0);return function(){if(this.pickingGeometryNode){var r=this.getModelMatrices(),c=this.getTargets();switch(this.getIntersectionType()){case s.BOUNDS:for(var a=0,h=r.length;a<h;++a){var p=r[a];e.assign(this.pickingGeometryNode.getBBox()).multRight(p);for(var g=0,u=c.size;g<u;++g){var d=c[g];t.assign(d.geometryNode.getBBox()).multRight(d.modelMatrix),e.intersectsBox(t)&&(i.assign(e.center),o.assign(t.center),d.intersected=!0,d.distance=i.distance(o))}}var l=this.getPickedGeometries(),m=Boolean(l.length);l.remove(0,l.length,null),m!==this.isActive_.getValue()&&(this.isActive_=m),this.pickedGeometry_.equals(l)||(this.pickedGeometry_=l);break;case s.GEOMETRY:for(var _=this.picker,a=0,h=r.length;a<h;++a){var p=r[a],y=this.getPickShape(this.pickingGeometryNode);e.assign(this.pickingGeometryNode.getBBox()).multRight(p),_.setChildShape1(p,y.getCompoundShape());for(var g=0,u=c.size;g<u;++g){var d=c[g],k=this.getPickShape(d.geometryNode);t.assign(d.geometryNode.getBBox()).multRight(d.modelMatrix),_.setChildShape2(d.modelMatrix,k.getCompoundShape()),_.contactTest()&&(i.assign(e.center),o.assign(t.center),d.intersected=!0,d.distance=i.distance(o))}}var l=this.getPickedGeometries(),m=Boolean(l.length);l.remove(0,l.length,null),m!==this.isActive_.getValue()&&(this.isActive_=m),this.pickedGeometry_.equals(l)||(this.pickedGeometry_=l)}}n.prototype.process.call(this)}}()}),h}),e("x_ite/Components/Picking/VolumePickSensor",["x_ite/Fields","x_ite/Basic/X3DFieldDefinition","x_ite/Basic/FieldDefinitionArray","x_ite/Components/Picking/X3DPickSensorNode","x_ite/Bits/X3DCast","x_ite/Bits/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}return p.prototype=Object.assign(Object.create(n.prototype),{constructor:p,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:function(){var e=new h,t=new h,i=new a(0,0,0),o=new a(0,0,0);return function(){if(this.pickingGeometryNode){var s=this.getModelMatrices(),c=this.getTargets();switch(this.getIntersectionType()){case r.BOUNDS:for(var a=0,h=s.length;a<h;++a){var p=s[a];e.assign(this.pickingGeometryNode.getBBox()).multRight(p);for(var g=0,u=c.size;g<u;++g){var d=c[g];t.assign(d.geometryNode.getBBox()).multRight(d.modelMatrix),e.intersectsBox(t)&&(i.assign(e.center),o.assign(t.center),d.intersected=!0,d.distance=i.distance(o))}}var l=this.getPickedGeometries(),m=Boolean(l.length);l.remove(0,l.length,null),m!==this.isActive_.getValue()&&(this.isActive_=m),this.pickedGeometry_.equals(l)||(this.pickedGeometry_=l);break;case r.GEOMETRY:for(var _=this.picker,a=0,h=s.length;a<h;++a){var p=s[a],y=this.getPickShape(this.pickingGeometryNode);e.assign(this.pickingGeometryNode.getBBox()).multRight(p),_.setChildShape1(p,y.getCompoundShape());for(var g=0,u=c.size;g<u;++g){var d=c[g],k=this.getPickShape(d.geometryNode);t.assign(d.geometryNode.getBBox()).multRight(d.modelMatrix),_.setChildShape2(d.modelMatrix,k.getCompoundShape()),_.contactTest()&&(i.assign(e.center),o.assign(t.center),d.intersected=!0,d.distance=i.distance(o))}}var l=this.getPickedGeometries(),m=Boolean(l.length);l.remove(0,l.length,null),m!==this.isActive_.getValue()&&(this.isActive_=m),this.pickedGeometry_.equals(l)||(this.pickedGeometry_=l)}}n.prototype.process.call(this)}}()}),p}),e(["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",X3D.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=X3D.define,t=X3D.require;e("x_ite/Browser/Picking/MatchCriterion",[],function(){"use strict";var e=0;return{MATCH_ANY:e++,MATCH_EVERY:e++,MATCH_ONLY_ONE:e++}}),e("x_ite/Browser/Picking/IntersectionType",[],function(){"use strict";var e=0;return{BOUNDS:e++,GEOMETRY:e++}}),e("x_ite/Browser/Picking/SortOrder",[],function(){"use strict";var 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/Bits/TraverseType","x_ite/Bits/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";function p(e,t){return e.distance<t.distance}function g(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,p),this.pickedGeometries=new e.MFNode}var u=h(c);return g.prototype=Object.assign(Object.create(t.prototype),{constructor:g,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:function(){var e=new WeakMap;return function(t){var i=e.get(t);if(void 0!==i)return i;var n=this.getExecutionContext().createNode("Shape",!1),o=this.getExecutionContext().createNode("CollidableShape",!1);return n.setPrivate(!0),o.setPrivate(!0),o.setConvex(!0),n.geometry_=t,o.shape_=n,n.setup(),o.setup(),e.set(t,o),o}}(),getPickedGeometries:function(){return 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:for(var o=0,c=i.length;o<c;++o)n[o]=this.getPickedGeometry(i[o]);n.length=c;break;case r.ALL_SORTED:this.pickedTargetsSorter.sort(0,i.length);for(var 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;var o=i.getExecutionContext();if(o.getType().indexOf(n.X3DPrototypeInstance)!==-1&&o.getExecutionContext()===t)return o;for(var s=e.pickingHierarchy,r=s.length-1;r>=0;--r){var c=s[r];if(c.getExecutionContext()===t)return c;var o=c.getExecutionContext();if(o.getType().indexOf(n.X3DPrototypeInstance)!==-1&&o.getExecutionContext()===t)return o}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__:function(){var e=new Map([["MATCH_ANY",o.MATCH_ANY],["MATCH_EVERY",o.MATCH_EVERY],["MATCH_ONLY_ONE",o.MATCH_ONLY_ONE]]);return function(){this.matchCriterion=e.get(this.matchCriterion_.getValue()),void 0===this.matchCriterion&&(this.matchCriterion=MatchCriterionType.MATCH_ANY)}}(),set_intersectionType__:function(){var e=new Map([["BOUNDS",s.BOUNDS],["GEOMETRY",s.GEOMETRY]]);return function(){this.intersectionType=e.get(this.intersectionType_.getValue()),void 0===this.intersectionType&&(this.intersectionType=s.BOUNDS)}}(),set_sortOrder__:function(){var e=new Map([["ANY",r.ANY],["CLOSEST",r.CLOSEST],["ALL",r.ALL],["ALL_SORTED",r.ALL_SORTED]]);return function(){this.sortOrder=e.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{var 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}}),g}),e("x_ite/Components/Picking/LinePickSensor",["x_ite/Fields","x_ite/Basic/X3DFieldDefinition","x_ite/Basic/FieldDefinitionArray","x_ite/Components/Picking/X3DPickSensorNode","x_ite/Bits/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}return p.prototype=Object.assign(Object.create(n.prototype),{constructor:p,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:function(){var t=new a,i=new a,o=new r(0,0,0),p=new r(0,0,0),g=new c,u=new r(0,0,0),d=new r(0,0,0),l=new h(r.Zero,r.zAxis),m=new r(0,0,0),_=new r(0,0,0),y=[],k=[],f=new r(0,0,0),w=new e.MFVec3f,S=new e.MFVec3f,C=new e.MFVec3f;return function(){if(this.pickingGeometryNode){var e=this.getModelMatrices(),r=this.getTargets();switch(this.getIntersectionType()){case s.BOUNDS:for(var c=0,a=e.length;c<a;++c){var h=e[c];t.assign(this.pickingGeometryNode.getBBox()).multRight(h);for(var v=0,T=r.size;v<T;++v){var N=r[v];i.assign(N.geometryNode.getBBox()).multRight(N.modelMatrix),t.intersectsBox(i)&&(o.assign(t.center),p.assign(i.center),N.intersected=!0,N.distance=o.distance(p))}}var b=this.getPickedGeometries(),O=Boolean(b.length);b.remove(0,b.length,null),O!==this.isActive_.getValue()&&(this.isActive_=O),this.pickedGeometry_.equals(b)||(this.pickedGeometry_=b);break;case s.GEOMETRY:for(var c=0,a=e.length;c<a;++c){var h=e[c];t.assign(this.pickingGeometryNode.getBBox()).multRight(h);for(var v=0,T=r.size;v<T;++v)try{var N=r[v],x=N.geometryNode,P=this.pickingGeometryNode.getVertices();i.assign(x.getBBox()).multRight(N.modelMatrix),g.assign(N.modelMatrix).inverse().multLeft(h);for(var B=0,M=P.length;B<M;B+=8)if(g.multVecMatrix(u.set(P[B+0],P[B+1],P[B+2])),g.multVecMatrix(d.set(P[B+4],P[B+5],P[B+6])),l.setPoints(u,d),k.length=0,x.intersectsLine(l,y,N.modelMatrix,k))for(var G=0,F=k.length;G<F;++G){var D=k[G];m.assign(D.point).subtract(u),_.assign(D.point).subtract(d);var A=m.add(_).abs(),V=u.distance(d);A<=V&&N.intersections.push(D)}N.intersections.length&&(o.assign(t.center),p.assign(i.center),N.intersected=!0,N.distance=o.distance(p))}catch(e){console.log(e)}}var b=this.getPickedGeometries(),O=Boolean(b.length);b.remove(0,b.length,null),O!==this.isActive_.getValue()&&(this.isActive_=O),this.pickedGeometry_.equals(b)||(this.pickedGeometry_=b);var j=this.getPickedTargets();w.length=0,S.length=0,C.length=0;for(var v=0,T=j.length;v<T;++v)for(var L=j[v].intersections,G=0,F=L.length;G<F;++G){var D=L[G],v=D.texCoord;f.set(v.x,v.y,v.z),w.push(f),S.push(D.normal),C.push(D.point)}this.pickedTextureCoordinate_.equals(w)||(this.pickedTextureCoordinate_=w),this.pickedNormal_.equals(S)||(this.pickedNormal_=S),this.pickedPoint_.equals(C)||(this.pickedPoint_=C)}}n.prototype.process.call(this)}}()}),p}),e("x_ite/Components/Picking/X3DPickableObject",["x_ite/Bits/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/Basic/X3DFieldDefinition","x_ite/Basic/FieldDefinitionArray","x_ite/Components/Grouping/X3DGroupingNode","x_ite/Components/Picking/X3DPickableObject","x_ite/Browser/Picking/MatchCriterion","x_ite/Bits/X3DConstants","x_ite/Bits/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,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";function o(){this.broadphase=new s.btDbvtBroadphase,this.collisionConfiguration=new s.btDefaultCollisionConfiguration,this.dispatcher=new s.btCollisionDispatcher(this.collisionConfiguration),this.collisionWorld=new s.btCollisionWorld(this.dispatcher,this.broadphase,this.collisionConfiguration),this.compoundShape1=new s.btCompoundShape,this.motionState1=new s.btDefaultMotionState,this.constructionInfo1=new s.btRigidBodyConstructionInfo(0,this.motionState1,this.compoundShape1),this.rigidBody1=new s.btRigidBody(this.constructionInfo1),this.compoundShape2=new s.btCompoundShape,this.motionState2=new s.btDefaultMotionState,this.constructionInfo2=new s.btRigidBodyConstructionInfo(0,this.motionState2,this.compoundShape2),this.rigidBody2=new s.btRigidBody(this.constructionInfo2),this.collisionWorld.addCollisionObject(this.rigidBody1),this.collisionWorld.addCollisionObject(this.rigidBody2)}var s=n.Ammo;return o.prototype={constuctor:o,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(){var i=new e(0,0,0),n=new t(0,0,1,0),o=new e(1,1,1),r=new s.btVector3(0,0,0);return function(e,t,s){try{e.getNumChildShapes()&&e.removeChildShapeByIndex(0),s.getNumChildShapes()&&(t.get(i,n,o),r.setValue(o.x,o.y,o.z),s.setLocalScaling(r),e.addChildShape(this.getTransform(i,n),s))}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();for(var e=this.dispatcher.getNumManifolds(),t=0;t<e;++t)for(var i=this.dispatcher.getManifoldByIndexInternal(t),n=i.getNumContacts(),o=0;o<n;++o){var s=i.getContactPoint(o);if(s.getDistance()<=0)return!0}return!1},getTransform:function(){var e=new s.btTransform,t=new s.btVector3(0,0,0),n=new i;return function(i,o,s){var 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}}()},o}),e("x_ite/Components/Picking/PointPickSensor",["x_ite/Fields","x_ite/Basic/X3DFieldDefinition","x_ite/Basic/FieldDefinitionArray","x_ite/Components/Picking/X3DPickSensorNode","x_ite/Bits/X3DCast","x_ite/Bits/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,g){"use strict";function u(e){n.call(this,e),this.addType(s.PointPickSensor),this.pickingGeometryNode=null,this.picker=new c,this.compoundShapes=[]}var d=g.Ammo;return u.prototype=Object.assign(Object.create(n.prototype),{constructor:u,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__:function(){var e=new d.btVector3(1,1,1),t=new d.btVector3,i=new d.btTransform;return function(){var n=this.compoundShapes;if(this.pickingGeometryNode){var o=this.pickingGeometryNode.getCoord();if(o){for(var s=0,r=o.getSize();s<r;++s)if(s<n.length){var c=n[s],h=o.get1Point(s,c.point);t.setValue(h.x,h.y,h.z),i.setOrigin(t),c.setLocalScaling(e),c.updateChildTransform(0,i)}else{var c=new d.btCompoundShape,p=new d.btSphereShape(0),h=o.get1Point(s,new a(0,0,0));c.point=h,t.setValue(h.x,h.y,h.z),i.setOrigin(t),c.addChildShape(i,p),n.push(c)}n.length=r}else n.length=0}else n.length=0}}(),process:function(){var t=new p,i=new p,o=new a(0,0,0),s=new a(0,0,0),c=new d.btTransform,g=new d.btVector3,u=new a(0,0,0),l=new h(0,0,1,0),m=new a(1,1,1),_=new e.MFVec3f;return function(){if(this.pickingGeometryNode){var e=this.getModelMatrices(),a=this.getTargets();switch(this.getIntersectionType()){case r.BOUNDS:for(var h=0,p=e.length;h<p;++h){var d=e[h];t.assign(this.pickingGeometryNode.getBBox()).multRight(d);for(var y=0,k=a.size;y<k;++y){var f=a[y];i.assign(f.geometryNode.getBBox()).multRight(f.modelMatrix),t.intersectsBox(i)&&(o.assign(t.center),s.assign(i.center),f.intersected=!0,f.distance=o.distance(s))}}var w=this.getPickedGeometries(),S=Boolean(w.length);w.remove(0,w.length,null),S!==this.isActive_.getValue()&&(this.isActive_=S),this.pickedGeometry_.equals(w)||(this.pickedGeometry_=w);break;case r.GEOMETRY:for(var C=this.picker,v=this.compoundShapes,h=0,p=e.length;h<p;++h){var d=e[h];t.assign(this.pickingGeometryNode.getBBox()).multRight(d),d.get(u,l,m),C.getTransform(u,l,c),g.setValue(m.x,m.y,m.z);for(var T=0,N=v.length;T<N;++T){var b=v[T];C.setChildShape1Components(c,g,b);for(var y=0,k=a.size;y<k;++y){var f=a[y],O=this.getPickShape(f.geometryNode);i.assign(f.geometryNode.getBBox()).multRight(f.modelMatrix),C.setChildShape2(f.modelMatrix,O.getCompoundShape()),C.contactTest()&&(o.assign(t.center),s.assign(i.center),f.intersected=!0,f.distance=o.distance(s),f.pickedPoint.push(b.point))}}}var w=this.getPickedGeometries(),S=Boolean(w.length);w.remove(0,w.length,null),S!==this.isActive_.getValue()&&(this.isActive_=S),this.pickedGeometry_.equals(w)||(this.pickedGeometry_=w);var x=this.getPickedTargets();_.length=0;for(var y=0,k=x.length;y<k;++y)for(var P=x[y].pickedPoint,B=0,M=P.length;B<M;++B)_.push(P[B]);this.pickedPoint_.equals(_)||(this.pickedPoint_=_)}}n.prototype.process.call(this)}}()}),u}),e("x_ite/Components/Picking/PrimitivePickSensor",["x_ite/Fields","x_ite/Basic/X3DFieldDefinition","x_ite/Basic/FieldDefinitionArray","x_ite/Components/Picking/X3DPickSensorNode","x_ite/Bits/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}return h.prototype=Object.assign(Object.create(n.prototype),{constructor:h,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:function(){var e=new a,t=new a,i=new c(0,0,0),o=new c(0,0,0);return function(){if(this.pickingGeometryNode){var r=this.getModelMatrices(),c=this.getTargets();switch(this.getIntersectionType()){case s.BOUNDS:for(var a=0,h=r.length;a<h;++a){var p=r[a];e.assign(this.pickingGeometryNode.getBBox()).multRight(p);for(var g=0,u=c.size;g<u;++g){var d=c[g];t.assign(d.geometryNode.getBBox()).multRight(d.modelMatrix),e.intersectsBox(t)&&(i.assign(e.center),o.assign(t.center),d.intersected=!0,d.distance=i.distance(o))}}var l=this.getPickedGeometries(),m=Boolean(l.length);l.remove(0,l.length,null),m!==this.isActive_.getValue()&&(this.isActive_=m),this.pickedGeometry_.equals(l)||(this.pickedGeometry_=l);break;case s.GEOMETRY:for(var _=this.picker,a=0,h=r.length;a<h;++a){var p=r[a],y=this.getPickShape(this.pickingGeometryNode);e.assign(this.pickingGeometryNode.getBBox()).multRight(p),_.setChildShape1(p,y.getCompoundShape());for(var g=0,u=c.size;g<u;++g){var d=c[g],k=this.getPickShape(d.geometryNode);t.assign(d.geometryNode.getBBox()).multRight(d.modelMatrix),_.setChildShape2(d.modelMatrix,k.getCompoundShape()),_.contactTest()&&(i.assign(e.center),o.assign(t.center),d.intersected=!0,d.distance=i.distance(o))}}var l=this.getPickedGeometries(),m=Boolean(l.length);l.remove(0,l.length,null),m!==this.isActive_.getValue()&&(this.isActive_=m),this.pickedGeometry_.equals(l)||(this.pickedGeometry_=l)}}n.prototype.process.call(this)}}()}),h}),e("x_ite/Components/Picking/VolumePickSensor",["x_ite/Fields","x_ite/Basic/X3DFieldDefinition","x_ite/Basic/FieldDefinitionArray","x_ite/Components/Picking/X3DPickSensorNode","x_ite/Bits/X3DCast","x_ite/Bits/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}return p.prototype=Object.assign(Object.create(n.prototype),{constructor:p,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:function(){var e=new h,t=new h,i=new a(0,0,0),o=new a(0,0,0);return function(){if(this.pickingGeometryNode){var s=this.getModelMatrices(),c=this.getTargets();switch(this.getIntersectionType()){case r.BOUNDS:for(var a=0,h=s.length;a<h;++a){var p=s[a];e.assign(this.pickingGeometryNode.getBBox()).multRight(p);for(var g=0,u=c.size;g<u;++g){var d=c[g];t.assign(d.geometryNode.getBBox()).multRight(d.modelMatrix),e.intersectsBox(t)&&(i.assign(e.center),o.assign(t.center),d.intersected=!0,d.distance=i.distance(o))}}var l=this.getPickedGeometries(),m=Boolean(l.length);l.remove(0,l.length,null),m!==this.isActive_.getValue()&&(this.isActive_=m),this.pickedGeometry_.equals(l)||(this.pickedGeometry_=l);break;case r.GEOMETRY:for(var _=this.picker,a=0,h=s.length;a<h;++a){var p=s[a],y=this.getPickShape(this.pickingGeometryNode);e.assign(this.pickingGeometryNode.getBBox()).multRight(p),_.setChildShape1(p,y.getCompoundShape());for(var g=0,u=c.size;g<u;++g){var d=c[g],k=this.getPickShape(d.geometryNode);t.assign(d.geometryNode.getBBox()).multRight(d.modelMatrix),_.setChildShape2(d.modelMatrix,k.getCompoundShape()),_.contactTest()&&(i.assign(e.center),o.assign(t.center),d.intersected=!0,d.distance=i.distance(o))}}var l=this.getPickedGeometries(),m=Boolean(l.length);l.remove(0,l.length,null),m!==this.isActive_.getValue()&&(this.isActive_=m),this.pickedGeometry_.equals(l)||(this.pickedGeometry_=l)}}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,9 +1,11 @@
1
- (function () {
1
+ (function ()
2
+ {
3
+ // Undefine global variables.
4
+ var module = { }, exports, process;
2
5
 
3
- var
4
- define = X3D .define,
5
- require = X3D .require,
6
- module = { };
6
+ const
7
+ define = X3D .define,
8
+ require = X3D .require;
7
9
  /* -*- Mode: JavaScript; coding: utf-8; tab-width: 3; indent-tabs-mode: tab; c-basic-offset: 3 -*-
8
10
  *******************************************************************************
9
11
  *
@@ -782,7 +784,7 @@ function (Fields,
782
784
  ******************************************************************************/
783
785
 
784
786
 
785
- define ([
787
+ define (require .getComponentUrl ("projective-texture-mapping"), [
786
788
  "x_ite/Components",
787
789
  "x_ite/Components/ProjectiveTextureMapping/TextureProjectorPerspective",
788
790
  "x_ite/Components/ProjectiveTextureMapping/TextureProjectorParallel",
@@ -810,4 +812,4 @@ function (Components,
810
812
  });
811
813
 
812
814
 
813
- }());
815
+ })();
@@ -1 +1 @@
1
- !function(){var t=X3D.define;X3D.require;t("x_ite/Components/ProjectiveTextureMapping/X3DTextureProjectorNode",["x_ite/Components/Core/X3DChildNode","x_ite/Bits/X3DConstants","x_ite/Bits/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")}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:function(){var t=new o(.5,0,0,0,0,.5,0,0,0,0,.5,0,.5,.5,.5,1);return function(){return t}}(),straightenHorizon:function(){var t=new r(0,0,0),e=new r(0,0,0),i=new r(0,0,0),o=new n(0,0,1,0);return function(n){n.multVecRot(t.assign(r.xAxis).negate()),n.multVecRot(e.assign(r.zAxis)),i.assign(this.upVector_.getValue()).normalize();var a=e.cross(i);return Math.abs(e.dot(i))>=1?n:Math.abs(a.dot(t))>=1?n:(o.setFromToVec(t,a),n.multRight(o))}}(),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/Basic/X3DFieldDefinition","x_ite/Basic/FieldDefinitionArray","x_ite/Components/ProjectiveTextureMapping/X3DTextureProjectorNode","x_ite/Bits/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";function h(){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 x(t){r.call(this,t),this.addType(n.TextureProjectorPerspective),this.fieldOfView_.setUnit("angle")}var l=c(h);return h.prototype={constructor:h,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.log(t)}},setShaderUniforms:function(t,e){var i=e.numProjectiveTextures++;if(!e.hasTextureProjector(i,this)){var r=this.textureProjectorNode,n=r.getTexture();t.activeTexture(t.TEXTURE0+this.browser.getProjectiveTextureUnits()[i]),t.bindTexture(t.TEXTURE_2D,n.getTexture()),t.activeTexture(t.TEXTURE0),t.uniformMatrix4fv(e.x3d_ProjectiveTextureMatrix[i],!1,this.projectiveTextureMatrixArray),t.uniform3fv(e.x3d_ProjectiveTextureLocation[i],this.locationArray)}},dispose:function(){l.push(this)}},x.prototype=Object.assign(Object.create(r.prototype),{constructor:x,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 l}}),x}),t("x_ite/Components/ProjectiveTextureMapping/TextureProjectorParallel",["x_ite/Fields","x_ite/Basic/X3DFieldDefinition","x_ite/Basic/FieldDefinitionArray","x_ite/Components/ProjectiveTextureMapping/X3DTextureProjectorNode","x_ite/Bits/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";function h(){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 x(t){r.call(this,t),this.addType(n.TextureProjectorParallel),this.fieldOfView_.setUnit("length")}var l=c(h);return h.prototype={constructor:h,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=s/c,x=e.getMinimumX(),l=e.getMaximumX(),p=e.getMinimumY(),g=e.getMaximumY(),d=e.getSizeX(),m=e.getSizeY(),f=e.getNearDistance(),w=e.getFarDistance();if(h>d/m){var T=(x+l)/2,M=m*h/2;o.ortho(T-M,T+M,p,g,f,w,this.projectionMatrix)}else{var T=(p+g)/2,M=d/h/2;o.ortho(x,l,T-M,T+M,f,w,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.log(t)}},setShaderUniforms:function(t,e){var i=e.numProjectiveTextures++;if(!e.hasTextureProjector(i,this)){var r=this.textureProjectorNode,n=r.getTexture();t.activeTexture(t.TEXTURE0+this.browser.getProjectiveTextureUnits()[i]),t.bindTexture(t.TEXTURE_2D,n.getTexture()),t.activeTexture(t.TEXTURE0),t.uniformMatrix4fv(e.x3d_ProjectiveTextureMatrix[i],!1,this.projectiveTextureMatrixArray),t.uniform3fv(e.x3d_ProjectiveTextureLocation[i],this.locationArray)}},dispose:function(){l.push(this)}},x.prototype=Object.assign(Object.create(r.prototype),{constructor:x,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 l},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}}),x}),t(["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=X3D.define,e=X3D.require;t("x_ite/Components/ProjectiveTextureMapping/X3DTextureProjectorNode",["x_ite/Components/Core/X3DChildNode","x_ite/Bits/X3DConstants","x_ite/Bits/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")}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:function(){var t=new o(.5,0,0,0,0,.5,0,0,0,0,.5,0,.5,.5,.5,1);return function(){return t}}(),straightenHorizon:function(){var t=new r(0,0,0),e=new r(0,0,0),i=new r(0,0,0),o=new n(0,0,1,0);return function(n){n.multVecRot(t.assign(r.xAxis).negate()),n.multVecRot(e.assign(r.zAxis)),i.assign(this.upVector_.getValue()).normalize();var a=e.cross(i);return Math.abs(e.dot(i))>=1?n:Math.abs(a.dot(t))>=1?n:(o.setFromToVec(t,a),n.multRight(o))}}(),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/Basic/X3DFieldDefinition","x_ite/Basic/FieldDefinitionArray","x_ite/Components/ProjectiveTextureMapping/X3DTextureProjectorNode","x_ite/Bits/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";function h(){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 x(t){r.call(this,t),this.addType(n.TextureProjectorPerspective),this.fieldOfView_.setUnit("angle")}var l=c(h);return h.prototype={constructor:h,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.log(t)}},setShaderUniforms:function(t,e){var i=e.numProjectiveTextures++;if(!e.hasTextureProjector(i,this)){var r=this.textureProjectorNode,n=r.getTexture();t.activeTexture(t.TEXTURE0+this.browser.getProjectiveTextureUnits()[i]),t.bindTexture(t.TEXTURE_2D,n.getTexture()),t.activeTexture(t.TEXTURE0),t.uniformMatrix4fv(e.x3d_ProjectiveTextureMatrix[i],!1,this.projectiveTextureMatrixArray),t.uniform3fv(e.x3d_ProjectiveTextureLocation[i],this.locationArray)}},dispose:function(){l.push(this)}},x.prototype=Object.assign(Object.create(r.prototype),{constructor:x,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 l}}),x}),t("x_ite/Components/ProjectiveTextureMapping/TextureProjectorParallel",["x_ite/Fields","x_ite/Basic/X3DFieldDefinition","x_ite/Basic/FieldDefinitionArray","x_ite/Components/ProjectiveTextureMapping/X3DTextureProjectorNode","x_ite/Bits/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";function h(){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 x(t){r.call(this,t),this.addType(n.TextureProjectorParallel),this.fieldOfView_.setUnit("length")}var l=c(h);return h.prototype={constructor:h,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=s/c,x=e.getMinimumX(),l=e.getMaximumX(),p=e.getMinimumY(),g=e.getMaximumY(),d=e.getSizeX(),m=e.getSizeY(),f=e.getNearDistance(),w=e.getFarDistance();if(h>d/m){var T=(x+l)/2,M=m*h/2;o.ortho(T-M,T+M,p,g,f,w,this.projectionMatrix)}else{var T=(p+g)/2,M=d/h/2;o.ortho(x,l,T-M,T+M,f,w,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.log(t)}},setShaderUniforms:function(t,e){var i=e.numProjectiveTextures++;if(!e.hasTextureProjector(i,this)){var r=this.textureProjectorNode,n=r.getTexture();t.activeTexture(t.TEXTURE0+this.browser.getProjectiveTextureUnits()[i]),t.bindTexture(t.TEXTURE_2D,n.getTexture()),t.activeTexture(t.TEXTURE0),t.uniformMatrix4fv(e.x3d_ProjectiveTextureMatrix[i],!1,this.projectiveTextureMatrixArray),t.uniform3fv(e.x3d_ProjectiveTextureLocation[i],this.locationArray)}},dispose:function(){l.push(this)}},x.prototype=Object.assign(Object.create(r.prototype),{constructor:x,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 l},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}}),x}),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,9 +1,11 @@
1
- (function () {
1
+ (function ()
2
+ {
3
+ // Undefine global variables.
4
+ var module = { }, exports, process;
2
5
 
3
- var
4
- define = X3D .define,
5
- require = X3D .require,
6
- module = { };
6
+ const
7
+ define = X3D .define,
8
+ require = X3D .require;
7
9
  /* -*- Mode: JavaScript; coding: utf-8; tab-width: 3; indent-tabs-mode: tab; c-basic-offset: 3 -*-
8
10
  *******************************************************************************
9
11
  *
@@ -4490,7 +4492,7 @@ function (Fields,
4490
4492
  ******************************************************************************/
4491
4493
 
4492
4494
 
4493
- define ([
4495
+ define (require .getComponentUrl ("rigid-body-physics"), [
4494
4496
  "x_ite/Components",
4495
4497
  "x_ite/Components/RigidBodyPhysics/BallJoint",
4496
4498
  "x_ite/Components/RigidBodyPhysics/CollidableOffset",
@@ -4566,4 +4568,4 @@ function (Components,
4566
4568
  });
4567
4569
 
4568
4570
 
4569
- }());
4571
+ })();