x_ite 8.0.0 → 8.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/pages-deploy.yml +64 -0
- package/.gitmodules +3 -0
- package/.vscode/settings.json +3 -2
- package/Makefile +9 -4
- package/README.md +6 -6
- package/build/bin/version.pl +3 -11
- package/dist/LICENSE.md +0 -2
- package/dist/assets/components/Annotation.js +55 -28
- package/dist/assets/components/Annotation.min.js +1 -1
- package/dist/assets/components/CADGeometry.js +55 -28
- package/dist/assets/components/CADGeometry.min.js +1 -1
- package/dist/assets/components/CubeMapTexturing.js +197 -38
- package/dist/assets/components/CubeMapTexturing.min.js +1 -1
- package/dist/assets/components/DIS.js +50 -26
- package/dist/assets/components/DIS.min.js +1 -1
- package/dist/assets/components/EventUtilities.js +61 -28
- package/dist/assets/components/EventUtilities.min.js +1 -1
- package/dist/assets/components/Geometry2D.js +96 -48
- package/dist/assets/components/Geometry2D.min.js +1 -1
- package/dist/assets/components/Geospatial.js +186 -193
- package/dist/assets/components/Geospatial.min.js +1 -1
- package/dist/assets/components/HAnim.js +92 -53
- package/dist/assets/components/HAnim.min.js +1 -1
- package/dist/assets/components/KeyDeviceSensor.js +35 -17
- package/dist/assets/components/KeyDeviceSensor.min.js +1 -1
- package/dist/assets/components/Layout.js +77 -45
- package/dist/assets/components/Layout.min.js +1 -1
- package/dist/assets/components/NURBS.js +209 -96
- package/dist/assets/components/NURBS.min.js +1 -1
- package/dist/assets/components/ParticleSystems.js +125 -62
- package/dist/assets/components/ParticleSystems.min.js +1 -1
- package/dist/assets/components/Picking.js +105 -70
- package/dist/assets/components/Picking.min.js +1 -1
- package/dist/assets/components/ProjectiveTextureMapping.js +69 -46
- package/dist/assets/components/ProjectiveTextureMapping.min.js +1 -1
- package/dist/assets/components/RigidBodyPhysics.js +125 -63
- package/dist/assets/components/RigidBodyPhysics.min.js +1 -1
- package/dist/assets/components/Scripting.js +56 -38
- package/dist/assets/components/Scripting.min.js +1 -1
- package/dist/assets/components/Text.js +16857 -0
- package/dist/assets/components/Text.min.js +1 -0
- package/dist/assets/components/Texturing3D.js +114 -77
- package/dist/assets/components/Texturing3D.min.js +1 -1
- package/dist/assets/components/VolumeRendering.js +126 -60
- package/dist/assets/components/VolumeRendering.min.js +1 -1
- package/dist/assets/components/X_ITE.js +21 -12
- package/dist/assets/components/X_ITE.min.js +1 -1
- package/dist/x_ite.css +1 -1
- package/dist/x_ite.js +17800 -31195
- package/dist/x_ite.min.js +1 -1
- package/dist/x_ite.zip +0 -0
- package/docs/Gemfile +11 -33
- package/docs/Gemfile.lock +53 -59
- package/docs/LICENSE +21 -0
- package/docs/README.md +46 -0
- package/docs/_config.yml +320 -127
- package/docs/_data/assets/cross_origin.yml +62 -0
- package/docs/_data/assets/self_host.yml +51 -0
- package/docs/_data/contact.yml +30 -0
- package/docs/_data/locales/bg-BG.yml +83 -0
- package/docs/_data/locales/de-DE.yml +82 -0
- package/docs/_data/locales/en.yml +93 -0
- package/docs/_data/locales/es-ES.yml +79 -0
- package/docs/_data/locales/fr-FR.yml +79 -0
- package/docs/_data/locales/hu-HU.yml +81 -0
- package/docs/_data/locales/id-ID.yml +79 -0
- package/docs/_data/locales/ko-KR.yml +86 -0
- package/docs/_data/locales/my-MM.yml +79 -0
- package/docs/_data/locales/pt-BR.yml +79 -0
- package/docs/_data/locales/ru-RU.yml +79 -0
- package/docs/_data/locales/tr-TR.yml +79 -0
- package/docs/_data/locales/uk-UA.yml +79 -0
- package/docs/_data/locales/vi-VN.yml +77 -0
- package/docs/_data/locales/zh-CN.yml +85 -0
- package/docs/_data/share.yml +27 -0
- package/docs/_includes/nav.html +19 -0
- package/docs/_includes/scripts.html +15 -0
- package/docs/_layouts/compress.html +11 -0
- package/docs/_layouts/redirect-page.html +6 -0
- package/docs/_layouts/wide.html +52 -0
- package/docs/_layouts/wrap.html +4 -0
- package/docs/_layouts/x_ite.html +8 -0
- package/docs/_plugins/no_date.rb +11 -0
- package/docs/_plugins/posts-lastmod-hook.rb +14 -0
- package/docs/{Accessing-the-External-Browser.md → _posts/accessing-the-external-browser.md} +26 -25
- package/docs/_posts/browser-support.md +53 -0
- package/docs/{Custom-Shaders.md → _posts/custom-shaders.md} +18 -14
- package/docs/{DOM-Integration.md → _posts/dom-integration.md} +29 -22
- package/docs/{Features.md → _posts/features.md} +11 -12
- package/docs/{index.md → _posts/getting-started.md} +203 -245
- package/docs/{Glossary.md → _posts/glossary.md} +5 -6
- package/docs/{How-To-Configure-Your-Web-Server.md → _posts/how-to-configure-your-web-server.md} +5 -6
- package/docs/{reference/Browser-Services.md → _posts/reference/browser-services.md} +8 -9
- package/docs/{reference/Constants-Services.md → _posts/reference/constants-services.md} +14 -15
- package/docs/{reference/ECMAScript-Object-and-Function-Definitions.md → _posts/reference/ecmascript-object-and-function-definitions.md} +14 -15
- package/docs/_posts/reference/field-services-and-objects.md +1127 -0
- package/docs/{reference/Prototype-Services.md → _posts/reference/prototype-services.md} +8 -14
- package/docs/{reference/Route-Services.md → _posts/reference/route-services.md} +6 -10
- package/docs/{reference/Scene-Services.md → _posts/reference/scene-services.md} +11 -21
- package/docs/{reference/Script-Node-Authoring-Interface.md → _posts/reference/script-node-authoring-interface.md} +10 -11
- package/docs/_posts/report-a-bug.md +15 -0
- package/docs/_posts/setup-a-localhost-server.md +42 -0
- package/docs/_posts/supported-nodes.md +377 -0
- package/docs/{tutorials/Adding-backgrounds.md → _posts/tutorials/adding-backgrounds.md} +13 -14
- package/docs/{tutorials/Adding-fog.md → _posts/tutorials/adding-fog.md} +6 -7
- package/docs/{tutorials/Adding-sound.md → _posts/tutorials/adding-sound.md} +27 -26
- package/docs/{tutorials/Animating-transforms.md → _posts/tutorials/animating-transforms.md} +36 -37
- package/docs/{tutorials/Basic-Nodes.md → _posts/tutorials/basic-nodes.md} +38 -49
- package/docs/{tutorials/Building-a-X3D-world.md → _posts/tutorials/building-a-x3d-world.md} +16 -16
- package/docs/{tutorials/Building-elevation-grids.md → _posts/tutorials/building-elevation-grids.md} +15 -14
- package/docs/{tutorials/Building-extruded-shapes.md → _posts/tutorials/building-extruded-shapes.md} +11 -12
- package/docs/{tutorials/Building-primitive-shapes.md → _posts/tutorials/building-primitive-shapes.md} +29 -28
- package/docs/{tutorials/Building-shapes-out-of-points,-lines,-and-faces.md → _posts/tutorials/building-shapes-out-of-points-lines-and-faces.md} +25 -27
- package/docs/{tutorials/Controlling-appearance-with-materials.md → _posts/tutorials/controlling-appearance-with-materials.md} +20 -19
- package/docs/{tutorials/Controlling-color-on-coordinate-based-geometry.md → _posts/tutorials/controlling-color-on-coordinate-based-geometry.md} +15 -16
- package/docs/{tutorials/Controlling-detail.md → _posts/tutorials/controlling-detail.md} +12 -11
- package/docs/{tutorials/Controlling-how-textures-are-mapped.md → _posts/tutorials/controlling-how-textures-are-mapped.md} +11 -12
- package/docs/{tutorials/Controlling-navigation.md → _posts/tutorials/controlling-navigation.md} +7 -8
- package/docs/{tutorials/Controlling-shading-on-coordinate-based-geometry.md → _posts/tutorials/controlling-shading-on-coordinate-based-geometry.md} +19 -20
- package/docs/{tutorials/Controlling-the-viewpoint.md → _posts/tutorials/controlling-the-viewpoint.md} +7 -8
- package/docs/{tutorials/Creating-new-node-types.md → _posts/tutorials/creating-new-node-types.md} +8 -9
- package/docs/{tutorials/Grouping-nodes.md → _posts/tutorials/grouping-nodes.md} +17 -18
- package/docs/{tutorials/Hello,-World!.md → _posts/tutorials/hello-world.md} +16 -28
- package/docs/{tutorials/Improving-Performance.md → _posts/tutorials/improving-performance.md} +7 -11
- package/docs/{tutorials/Increasing-Rendering-Speed.md → _posts/tutorials/increasing-rendering-speed.md} +5 -6
- package/docs/{tutorials/Introducing-animation.md → _posts/tutorials/introducing-animation.md} +14 -15
- package/docs/{tutorials/Introducing-script-use.md → _posts/tutorials/introducing-script-use.md} +7 -8
- package/docs/{tutorials/Introducing-X3D.md → _posts/tutorials/introducing-x3d.md} +7 -7
- package/docs/{tutorials/Lighting-your-world.md → _posts/tutorials/lighting-your-world.md} +8 -9
- package/docs/{tutorials/Mapping-textures.md → _posts/tutorials/mapping-textures.md} +11 -12
- package/docs/{tutorials/Naming-nodes.md → _posts/tutorials/naming-nodes.md} +9 -8
- package/docs/_posts/tutorials/overview.md +83 -0
- package/docs/{tutorials/Providing-information-about-your-world.md → _posts/tutorials/providing-information-about-your-world.md} +6 -7
- package/docs/{tutorials/Sensing-the-viewer.md → _posts/tutorials/sensing-the-viewer.md} +19 -20
- package/docs/{tutorials/Sensing-viewer-actions.md → _posts/tutorials/sensing-viewer-actions.md} +14 -15
- package/docs/{tutorials/Transforming-Shapes.md → _posts/tutorials/transforming-shapes.md} +8 -9
- package/docs/{tutorials/Writing-program-scripts-with-ECMAScript.md → _posts/tutorials/writing-program-scripts-with-ecmascript.md} +15 -15
- package/docs/{What's-New.md → _posts/what's-new.md} +152 -530
- package/docs/_tabs/imprint.md +52 -0
- package/docs/_tabs/laboratory.md +14 -0
- package/docs/_tabs/playground.html +246 -0
- package/docs/_tabs/reference.md +7 -0
- package/docs/_tabs/tags.md +5 -0
- package/docs/_tabs/tutorials.md +7 -0
- package/docs/assets/css/style.scss +194 -0
- package/docs/assets/img/favicons/android-chrome-192x192.png +0 -0
- package/docs/assets/img/favicons/android-chrome-512x512.png +0 -0
- package/docs/assets/img/favicons/apple-touch-icon.png +0 -0
- package/docs/assets/img/favicons/favicon-16x16.png +0 -0
- package/docs/assets/img/favicons/favicon-32x32.png +0 -0
- package/docs/assets/img/favicons/favicon.ico +0 -0
- package/docs/assets/img/favicons/mstile-150x150.png +0 -0
- package/docs/assets/img/favicons/safari-pinned-tab.svg +71 -0
- package/docs/assets/{images → img}/logo.png +0 -0
- package/docs/assets/js/example.js +34 -0
- package/docs/laboratory/3d-l-system-generator.html +169 -0
- package/docs/laboratory/online-dicom-and-nrrd-file-viewer.html +72 -0
- package/docs/laboratory/real-time-earth-quake-information.html +50 -0
- package/docs/laboratory/x3d-visual-blend-mode-editor.html +227 -0
- package/package.json +4 -4
- package/src/LICENSE.txt +1 -1
- package/src/assets/components/Annotation.js +1 -1
- package/src/assets/components/CADGeometry.js +1 -1
- package/src/assets/components/CubeMapTexturing.js +1 -1
- package/src/assets/components/DIS.js +1 -1
- package/src/assets/components/EventUtilities.js +1 -1
- package/src/assets/components/Geometry2D.js +1 -1
- package/src/assets/components/Geospatial.js +1 -1
- package/src/assets/components/HAnim.js +1 -1
- package/src/assets/components/KeyDeviceSensor.js +1 -1
- package/src/assets/components/Layout.js +1 -1
- package/src/assets/components/NURBS.js +1 -1
- package/src/assets/components/ParticleSystems.js +1 -1
- package/src/assets/components/Picking.js +1 -1
- package/src/assets/components/ProjectiveTextureMapping.js +6 -6
- package/src/assets/components/RigidBodyPhysics.js +1 -6
- package/src/assets/components/Scripting.js +1 -1
- package/src/{x_ite/Components → assets/components}/Text.js +19 -21
- package/src/assets/components/Texturing3D.js +1 -1
- package/src/assets/components/VolumeRendering.js +1 -1
- package/src/assets/components/X_ITE.js +1 -1
- package/src/assets/shaders/Types.glsl.js +1 -1
- package/src/assets/shaders/webgl1/include/Fragment.glsl.js +1 -1
- package/src/assets/shaders/webgl1/include/PointSize.glsl.js +6 -6
- package/src/assets/shaders/webgl1/include/Vertex.glsl.js +4 -4
- package/src/assets/shaders/webgl2/LineTransform.vs.js +11 -11
- package/src/assets/shaders/webgl2/include/Fragment.glsl.js +1 -1
- package/src/assets/shaders/webgl2/include/PointSize.glsl.js +6 -6
- package/src/assets/shaders/webgl2/include/Vertex.glsl.js +4 -4
- package/src/bookmarks.js +1 -1
- package/src/examples.js +3 -3
- package/src/lib/ammojs/AmmoClass.js +1 -1
- package/src/lib/jquery.js +1 -1
- package/src/locale/gettext.js +1 -1
- package/src/shim.js +1 -2
- package/src/standard/Geospatial/Geodetic.js +1 -1
- package/src/standard/Geospatial/ReferenceEllipsoids.js +3 -3
- package/src/standard/Geospatial/UniversalTransverseMercator.js +1 -1
- package/src/standard/Math/Algorithm.js +55 -45
- package/src/standard/Math/Algorithms/Bezier.js +1 -1
- package/src/standard/Math/Algorithms/MergeSort.js +1 -1
- package/src/standard/Math/Algorithms/PartialSort.js +1 -1
- package/src/standard/Math/Algorithms/QuickSort.js +1 -1
- package/src/standard/Math/Algorithms/SAT.js +2 -2
- package/src/standard/Math/Algorithms/eigen_decomposition.js +5 -3
- package/src/standard/Math/Geometry/Box2.js +1 -1
- package/src/standard/Math/Geometry/Box3.js +1 -1
- package/src/standard/Math/Geometry/Camera.js +4 -2
- package/src/standard/Math/Geometry/Cylinder3.js +1 -1
- package/src/standard/Math/Geometry/Line2.js +1 -1
- package/src/standard/Math/Geometry/Line3.js +1 -1
- package/src/standard/Math/Geometry/Plane3.js +1 -1
- package/src/standard/Math/Geometry/Sphere3.js +1 -1
- package/src/standard/Math/Geometry/Spheroid3.js +1 -1
- package/src/standard/Math/Geometry/Triangle2.js +4 -2
- package/src/standard/Math/Geometry/Triangle3.js +4 -2
- package/src/standard/Math/Geometry/ViewVolume.js +1 -1
- package/src/standard/Math/Numbers/Color3.js +3 -1
- package/src/standard/Math/Numbers/Color4.js +4 -1
- package/src/standard/Math/Numbers/Complex.js +1 -1
- package/src/standard/Math/Numbers/Matrix2.js +1 -1
- package/src/standard/Math/Numbers/Matrix3.js +1 -1
- package/src/standard/Math/Numbers/Matrix4.js +1 -1
- package/src/standard/Math/Numbers/Quaternion.js +1 -1
- package/src/standard/Math/Numbers/Rotation4.js +1 -1
- package/src/standard/Math/Numbers/Vector2.js +1 -1
- package/src/standard/Math/Numbers/Vector3.js +1 -1
- package/src/standard/Math/Numbers/Vector4.js +1 -1
- package/src/standard/Math/Utility/BVH.js +1 -1
- package/src/standard/Math/Utility/MatrixStack.js +1 -1
- package/src/standard/Networking/BinaryTransport.js +5 -3
- package/src/standard/Time/MicroTime.js +1 -1
- package/src/standard/Utility/BitSet.js +1 -1
- package/src/standard/Utility/DataStorage.js +1 -1
- package/src/standard/Utility/MapUtilities.js +1 -1
- package/src/standard/Utility/ObjectCache.js +5 -3
- package/src/standard/Utility/Shuffle.js +5 -3
- package/src/tests.js +3 -0
- package/src/x_ite/Base/Events.js +4 -2
- package/src/x_ite/Base/FieldArray.js +1 -1
- package/src/x_ite/Base/FieldDefinitionArray.js +1 -1
- package/src/x_ite/Base/X3DArrayField.js +8 -4
- package/src/x_ite/Base/X3DBaseNode.js +1 -1
- package/src/x_ite/Base/X3DCast.js +5 -3
- package/src/x_ite/Base/X3DChildObject.js +1 -1
- package/src/x_ite/Base/X3DConstants.js +1 -1
- package/src/x_ite/Base/X3DEventObject.js +1 -1
- package/src/x_ite/Base/X3DField.js +2 -13
- package/src/x_ite/Base/X3DFieldDefinition.js +1 -1
- package/src/x_ite/Base/X3DInfoArray.js +1 -1
- package/src/x_ite/Base/X3DObject.js +1 -1
- package/src/x_ite/Base/X3DObjectArrayField.js +1 -1
- package/src/x_ite/Base/X3DTypedArrayField.js +59 -33
- package/src/x_ite/Browser/Core/BrowserOptions.js +22 -30
- package/src/x_ite/Browser/Core/BrowserProperties.js +1 -1
- package/src/x_ite/Browser/Core/BrowserTimings.js +1 -1
- package/src/x_ite/Browser/Core/Context.js +1 -1
- package/src/x_ite/Browser/Core/ContextMenu.js +1 -1
- package/src/x_ite/Browser/Core/Notification.js +1 -1
- package/src/x_ite/Browser/Core/PrimitiveQuality.js +1 -1
- package/src/x_ite/Browser/Core/RenderingProperties.js +1 -1
- package/src/x_ite/Browser/Core/Shading.js +1 -1
- package/src/x_ite/Browser/Core/TextureQuality.js +1 -1
- package/src/x_ite/Browser/Core/X3DCoreContext.js +11 -8
- package/src/x_ite/Browser/DOMIntegration.js +25 -26
- package/src/x_ite/Browser/EnvironmentalEffects/X3DEnvironmentalEffectsContext.js +1 -1
- package/src/x_ite/Browser/Followers/X3DArrayChaserTemplate.js +5 -3
- package/src/x_ite/Browser/Followers/X3DArrayFollowerTemplate.js +5 -3
- package/src/x_ite/Browser/Geometry2D/Arc2DOptions.js +1 -1
- package/src/x_ite/Browser/Geometry2D/ArcClose2DOptions.js +1 -1
- package/src/x_ite/Browser/Geometry2D/Circle2DOptions.js +1 -1
- package/src/x_ite/Browser/Geometry2D/Disk2DOptions.js +1 -1
- package/src/x_ite/Browser/Geometry2D/Rectangle2DOptions.js +1 -1
- package/src/x_ite/Browser/Geometry2D/X3DGeometry2DContext.js +1 -1
- package/src/x_ite/Browser/Geometry3D/BoxOptions.js +1 -1
- package/src/x_ite/Browser/Geometry3D/ConeOptions.js +1 -1
- package/src/x_ite/Browser/Geometry3D/CylinderOptions.js +1 -1
- package/src/x_ite/Browser/Geometry3D/IcoSphere.js +1 -1
- package/src/x_ite/Browser/Geometry3D/IcoSphereOptions.js +1 -1
- package/src/x_ite/Browser/Geometry3D/QuadSphereOptions.js +1 -1
- package/src/x_ite/Browser/Geometry3D/X3DGeometry3DContext.js +1 -1
- package/src/x_ite/Browser/Geospatial/Geocentric.js +1 -2
- package/src/x_ite/Browser/Geospatial/Geospatial.js +1 -1
- package/src/x_ite/Browser/Grouping/X3DGroupingContext.js +1 -1
- package/src/x_ite/Browser/Interpolation/CatmullRomSplineInterpolator.js +1 -1
- package/src/x_ite/Browser/Interpolation/CatmullRomSplineInterpolator1.js +1 -1
- package/src/x_ite/Browser/Interpolation/CatmullRomSplineInterpolator2.js +4 -2
- package/src/x_ite/Browser/Interpolation/CatmullRomSplineInterpolator3.js +4 -2
- package/src/x_ite/Browser/Interpolation/CatmullRomSplineInterpolatorTemplate.js +5 -3
- package/src/x_ite/Browser/Interpolation/SquatInterpolator.js +1 -1
- package/src/x_ite/Browser/KeyDeviceSensor/X3DKeyDeviceSensorContext.js +1 -1
- package/src/x_ite/Browser/Layering/X3DLayeringContext.js +1 -1
- package/src/x_ite/Browser/Layout/ScreenText.js +1 -1
- package/src/x_ite/Browser/Layout/X3DLayoutContext.js +1 -1
- package/src/x_ite/Browser/Legacy.js +64 -0
- package/src/x_ite/Browser/Lighting/X3DLightingContext.js +1 -1
- package/src/x_ite/Browser/NURBS/NURBS.js +1 -1
- package/src/x_ite/Browser/Navigation/ExamineViewer.js +6 -39
- package/src/x_ite/Browser/Navigation/FlyViewer.js +1 -1
- package/src/x_ite/Browser/Navigation/LookAtViewer.js +1 -1
- package/src/x_ite/Browser/Navigation/NoneViewer.js +1 -1
- package/src/x_ite/Browser/Navigation/PlaneViewer.js +1 -4
- package/src/x_ite/Browser/Navigation/WalkViewer.js +1 -1
- package/src/x_ite/Browser/Navigation/X3DFlyViewer.js +1 -1
- package/src/x_ite/Browser/Navigation/X3DNavigationContext.js +3 -2
- package/src/x_ite/Browser/Navigation/X3DViewer.js +3 -3
- package/src/x_ite/Browser/Networking/Features.js +52 -0
- package/src/x_ite/Browser/Networking/URLs.js +11 -12
- package/src/x_ite/Browser/Networking/X3DNetworkingContext.js +9 -22
- package/src/x_ite/Browser/ParticleSystems/GeometryTypes.js +1 -1
- package/src/x_ite/Browser/ParticleSystems/X3DParticleSystemsContext.js +1 -1
- package/src/x_ite/Browser/Picking/IntersectionType.js +1 -1
- package/src/x_ite/Browser/Picking/MatchCriterion.js +1 -1
- package/src/x_ite/Browser/Picking/SortOrder.js +1 -1
- package/src/x_ite/Browser/Picking/VolumePicker.js +2 -4
- package/src/x_ite/Browser/Picking/X3DPickingContext.js +1 -1
- package/src/x_ite/Browser/PointingDeviceSensor/PointingDevice.js +1 -1
- package/src/x_ite/Browser/PointingDeviceSensor/PointingDeviceSensorContainer.js +1 -1
- package/src/x_ite/Browser/PointingDeviceSensor/X3DPointingDeviceSensorContext.js +1 -1
- package/src/x_ite/Browser/Rendering/GeometryContext.js +1 -1
- package/src/x_ite/Browser/Rendering/X3DRenderingContext.js +1 -1
- package/src/x_ite/Browser/RigidBodyPhysics/AppliedParametersType.js +1 -1
- package/src/x_ite/Browser/Scripting/X3DScriptingContext.js +1 -1
- package/src/x_ite/Browser/Scripting/evaluate.js +5 -3
- package/src/x_ite/Browser/Shaders/ShaderCompiler.js +1 -1
- package/src/x_ite/Browser/Shaders/ShaderSource.js +5 -5
- package/src/x_ite/Browser/Shaders/Shaders.js +1 -1
- package/src/x_ite/Browser/Shaders/X3DShadersContext.js +1 -1
- package/src/x_ite/Browser/Shape/AlphaMode.js +1 -1
- package/src/x_ite/Browser/Shape/X3DShapeContext.js +4 -4
- package/src/x_ite/Browser/Sound/X3DSoundContext.js +1 -1
- package/src/x_ite/Browser/Text/PolygonText.js +1 -1
- package/src/x_ite/Browser/Text/TextAlignment.js +1 -1
- package/src/x_ite/Browser/Text/X3DTextContext.js +1 -1
- package/src/x_ite/Browser/Text/X3DTextGeometry.js +1 -1
- package/src/x_ite/Browser/Texturing/FunctionType.js +1 -1
- package/src/x_ite/Browser/Texturing/ModeType.js +1 -1
- package/src/x_ite/Browser/Texturing/SourceType.js +1 -1
- package/src/x_ite/Browser/Texturing/TextureCoordinateGeneratorModeType.js +1 -1
- package/src/x_ite/Browser/Texturing/X3DTexturingContext.js +1 -1
- package/src/x_ite/Browser/Texturing3D/DICOMParser.js +3 -3
- package/src/x_ite/Browser/Texturing3D/NRRDParser.js +2 -2
- package/src/x_ite/Browser/Time/X3DTimeContext.js +1 -1
- package/src/x_ite/Browser/VERSION.js +2 -2
- package/src/x_ite/Browser/VolumeRendering/VolumeMaterial.js +1 -1
- package/src/x_ite/Browser/VolumeRendering/X3DVolumeRenderingContext.js +1 -1
- package/src/x_ite/Browser/X3DBrowser.js +43 -52
- package/src/x_ite/Browser/X3DBrowserContext.js +1 -5
- package/src/x_ite/Components/Annotation/AnnotationLayer.js +1 -1
- package/src/x_ite/Components/Annotation/AnnotationTarget.js +1 -1
- package/src/x_ite/Components/Annotation/GroupAnnotation.js +1 -1
- package/src/x_ite/Components/Annotation/IconAnnotation.js +1 -1
- package/src/x_ite/Components/Annotation/TextAnnotation.js +1 -1
- package/src/x_ite/Components/Annotation/URLAnnotation.js +1 -1
- package/src/x_ite/Components/Annotation/X3DAnnotationNode.js +1 -1
- package/src/x_ite/Components/CADGeometry/CADAssembly.js +1 -1
- package/src/x_ite/Components/CADGeometry/CADFace.js +1 -1
- package/src/x_ite/Components/CADGeometry/CADLayer.js +1 -1
- package/src/x_ite/Components/CADGeometry/CADPart.js +1 -1
- package/src/x_ite/Components/CADGeometry/IndexedQuadSet.js +1 -1
- package/src/x_ite/Components/CADGeometry/QuadSet.js +1 -1
- package/src/x_ite/Components/CADGeometry/X3DProductStructureChildNode.js +1 -1
- package/src/x_ite/Components/Core/MetadataBoolean.js +1 -1
- package/src/x_ite/Components/Core/MetadataDouble.js +1 -1
- package/src/x_ite/Components/Core/MetadataFloat.js +1 -1
- package/src/x_ite/Components/Core/MetadataInteger.js +1 -1
- package/src/x_ite/Components/Core/MetadataSet.js +1 -1
- package/src/x_ite/Components/Core/MetadataString.js +1 -1
- package/src/x_ite/Components/Core/WorldInfo.js +1 -1
- package/src/x_ite/Components/Core/X3DBindableNode.js +1 -1
- package/src/x_ite/Components/Core/X3DChildNode.js +1 -1
- package/src/x_ite/Components/Core/X3DInfoNode.js +1 -1
- package/src/x_ite/Components/Core/X3DMetadataObject.js +1 -1
- package/src/x_ite/Components/Core/X3DNode.js +5 -5
- package/src/x_ite/Components/Core/X3DPrototypeInstance.js +2 -2
- package/src/x_ite/Components/Core/X3DSensorNode.js +1 -1
- package/src/x_ite/Components/Core.js +1 -1
- package/src/x_ite/Components/CubeMapTexturing/ComposedCubeMapTexture.js +1 -1
- package/src/x_ite/Components/CubeMapTexturing/GeneratedCubeMapTexture.js +1 -1
- package/src/x_ite/Components/CubeMapTexturing/ImageCubeMapTexture.js +1 -1
- package/src/x_ite/Components/CubeMapTexturing/X3DEnvironmentTextureNode.js +1 -1
- package/src/x_ite/Components/DIS/DISEntityManager.js +1 -1
- package/src/x_ite/Components/DIS/DISEntityTypeMapping.js +1 -1
- package/src/x_ite/Components/DIS/EspduTransform.js +1 -1
- package/src/x_ite/Components/DIS/ReceiverPdu.js +1 -1
- package/src/x_ite/Components/DIS/SignalPdu.js +1 -1
- package/src/x_ite/Components/DIS/TransmitterPdu.js +1 -1
- package/src/x_ite/Components/EnvironmentalEffects/Background.js +1 -1
- package/src/x_ite/Components/EnvironmentalEffects/Fog.js +1 -1
- package/src/x_ite/Components/EnvironmentalEffects/FogCoordinate.js +1 -1
- package/src/x_ite/Components/EnvironmentalEffects/LocalFog.js +1 -1
- package/src/x_ite/Components/EnvironmentalEffects/TextureBackground.js +1 -1
- package/src/x_ite/Components/EnvironmentalEffects/X3DBackgroundNode.js +6 -12
- package/src/x_ite/Components/EnvironmentalEffects/X3DFogObject.js +1 -1
- package/src/x_ite/Components/EnvironmentalEffects.js +1 -1
- package/src/x_ite/Components/EnvironmentalSensor/ProximitySensor.js +1 -1
- package/src/x_ite/Components/EnvironmentalSensor/TransformSensor.js +1 -1
- package/src/x_ite/Components/EnvironmentalSensor/VisibilitySensor.js +1 -1
- package/src/x_ite/Components/EnvironmentalSensor/X3DEnvironmentalSensorNode.js +1 -1
- package/src/x_ite/Components/EnvironmentalSensor.js +1 -1
- package/src/x_ite/Components/EventUtilities/BooleanFilter.js +1 -1
- package/src/x_ite/Components/EventUtilities/BooleanSequencer.js +1 -1
- package/src/x_ite/Components/EventUtilities/BooleanToggle.js +1 -1
- package/src/x_ite/Components/EventUtilities/BooleanTrigger.js +1 -1
- package/src/x_ite/Components/EventUtilities/IntegerSequencer.js +1 -1
- package/src/x_ite/Components/EventUtilities/IntegerTrigger.js +1 -1
- package/src/x_ite/Components/EventUtilities/TimeTrigger.js +1 -1
- package/src/x_ite/Components/EventUtilities/X3DSequencerNode.js +1 -1
- package/src/x_ite/Components/EventUtilities/X3DTriggerNode.js +1 -1
- package/src/x_ite/Components/Followers/ColorChaser.js +1 -1
- package/src/x_ite/Components/Followers/ColorDamper.js +1 -1
- package/src/x_ite/Components/Followers/CoordinateChaser.js +1 -1
- package/src/x_ite/Components/Followers/CoordinateDamper.js +1 -1
- package/src/x_ite/Components/Followers/OrientationChaser.js +1 -1
- package/src/x_ite/Components/Followers/OrientationDamper.js +1 -1
- package/src/x_ite/Components/Followers/PositionChaser.js +1 -1
- package/src/x_ite/Components/Followers/PositionChaser2D.js +1 -1
- package/src/x_ite/Components/Followers/PositionDamper.js +1 -1
- package/src/x_ite/Components/Followers/PositionDamper2D.js +1 -1
- package/src/x_ite/Components/Followers/ScalarChaser.js +1 -1
- package/src/x_ite/Components/Followers/ScalarDamper.js +1 -1
- package/src/x_ite/Components/Followers/TexCoordChaser2D.js +1 -1
- package/src/x_ite/Components/Followers/TexCoordDamper2D.js +1 -1
- package/src/x_ite/Components/Followers/X3DChaserNode.js +1 -1
- package/src/x_ite/Components/Followers/X3DDamperNode.js +1 -1
- package/src/x_ite/Components/Followers/X3DFollowerNode.js +1 -1
- package/src/x_ite/Components/Followers.js +1 -1
- package/src/x_ite/Components/Geometry2D/Arc2D.js +1 -1
- package/src/x_ite/Components/Geometry2D/ArcClose2D.js +1 -1
- package/src/x_ite/Components/Geometry2D/Circle2D.js +1 -1
- package/src/x_ite/Components/Geometry2D/Disk2D.js +1 -1
- package/src/x_ite/Components/Geometry2D/Polyline2D.js +1 -1
- package/src/x_ite/Components/Geometry2D/Polypoint2D.js +1 -1
- package/src/x_ite/Components/Geometry2D/Rectangle2D.js +1 -1
- package/src/x_ite/Components/Geometry2D/TriangleSet2D.js +1 -1
- package/src/x_ite/Components/Geometry3D/Box.js +1 -1
- package/src/x_ite/Components/Geometry3D/Cone.js +3 -3
- package/src/x_ite/Components/Geometry3D/Cylinder.js +4 -4
- package/src/x_ite/Components/Geometry3D/ElevationGrid.js +1 -1
- package/src/x_ite/Components/Geometry3D/Extrusion.js +1 -1
- package/src/x_ite/Components/Geometry3D/IndexedFaceSet.js +1 -1
- package/src/x_ite/Components/Geometry3D/Sphere.js +1 -1
- package/src/x_ite/Components/Geometry3D.js +1 -1
- package/src/x_ite/Components/Geospatial/GeoCoordinate.js +1 -1
- package/src/x_ite/Components/Geospatial/GeoElevationGrid.js +1 -1
- package/src/x_ite/Components/Geospatial/GeoLOD.js +1 -1
- package/src/x_ite/Components/Geospatial/GeoLocation.js +1 -1
- package/src/x_ite/Components/Geospatial/GeoMetadata.js +1 -1
- package/src/x_ite/Components/Geospatial/GeoOrigin.js +1 -1
- package/src/x_ite/Components/Geospatial/GeoPositionInterpolator.js +17 -13
- package/src/x_ite/Components/Geospatial/GeoProximitySensor.js +1 -1
- package/src/x_ite/Components/Geospatial/GeoTouchSensor.js +1 -1
- package/src/x_ite/Components/Geospatial/GeoTransform.js +1 -1
- package/src/x_ite/Components/Geospatial/GeoViewpoint.js +39 -106
- package/src/x_ite/Components/Geospatial/X3DGeospatialObject.js +1 -1
- package/src/x_ite/Components/Grouping/Group.js +1 -1
- package/src/x_ite/Components/Grouping/StaticGroup.js +1 -1
- package/src/x_ite/Components/Grouping/Switch.js +1 -1
- package/src/x_ite/Components/Grouping/Transform.js +1 -1
- package/src/x_ite/Components/Grouping/X3DBoundedObject.js +1 -1
- package/src/x_ite/Components/Grouping/X3DGroupingNode.js +1 -1
- package/src/x_ite/Components/Grouping/X3DTransformMatrix3DNode.js +1 -1
- package/src/x_ite/Components/Grouping/X3DTransformNode.js +1 -1
- package/src/x_ite/Components/Grouping.js +1 -1
- package/src/x_ite/Components/HAnim/HAnimDisplacer.js +2 -1
- package/src/x_ite/Components/HAnim/HAnimHumanoid.js +32 -23
- package/src/x_ite/Components/HAnim/HAnimJoint.js +2 -1
- package/src/x_ite/Components/HAnim/HAnimMotion.js +3 -1
- package/src/x_ite/Components/HAnim/HAnimSegment.js +2 -1
- package/src/x_ite/Components/HAnim/HAnimSite.js +2 -1
- package/src/x_ite/Components/Interpolation/ColorInterpolator.js +2 -2
- package/src/x_ite/Components/Interpolation/CoordinateInterpolator.js +1 -1
- package/src/x_ite/Components/Interpolation/CoordinateInterpolator2D.js +1 -1
- package/src/x_ite/Components/Interpolation/EaseInEaseOut.js +1 -1
- package/src/x_ite/Components/Interpolation/NormalInterpolator.js +1 -1
- package/src/x_ite/Components/Interpolation/OrientationInterpolator.js +1 -1
- package/src/x_ite/Components/Interpolation/PositionInterpolator.js +1 -1
- package/src/x_ite/Components/Interpolation/PositionInterpolator2D.js +1 -1
- package/src/x_ite/Components/Interpolation/ScalarInterpolator.js +1 -1
- package/src/x_ite/Components/Interpolation/SplinePositionInterpolator.js +1 -1
- package/src/x_ite/Components/Interpolation/SplinePositionInterpolator2D.js +1 -1
- package/src/x_ite/Components/Interpolation/SplineScalarInterpolator.js +1 -1
- package/src/x_ite/Components/Interpolation/SquadOrientationInterpolator.js +1 -1
- package/src/x_ite/Components/Interpolation/X3DInterpolatorNode.js +1 -1
- package/src/x_ite/Components/Interpolation.js +1 -1
- package/src/x_ite/Components/KeyDeviceSensor/KeySensor.js +1 -1
- package/src/x_ite/Components/KeyDeviceSensor/StringSensor.js +1 -1
- package/src/x_ite/Components/KeyDeviceSensor/X3DKeyDeviceSensorNode.js +1 -1
- package/src/x_ite/Components/Layering/Layer.js +4 -2
- package/src/x_ite/Components/Layering/LayerSet.js +1 -1
- package/src/x_ite/Components/Layering/Viewport.js +4 -4
- package/src/x_ite/Components/Layering/X3DLayerNode.js +66 -49
- package/src/x_ite/Components/Layering/X3DViewportNode.js +1 -1
- package/src/x_ite/Components/Layering.js +1 -1
- package/src/x_ite/Components/Layout/Layout.js +1 -1
- package/src/x_ite/Components/Layout/LayoutGroup.js +1 -1
- package/src/x_ite/Components/Layout/LayoutLayer.js +4 -2
- package/src/x_ite/Components/Layout/ScreenFontStyle.js +1 -1
- package/src/x_ite/Components/Layout/ScreenGroup.js +1 -1
- package/src/x_ite/Components/Layout/X3DLayoutNode.js +1 -1
- package/src/x_ite/Components/Lighting/DirectionalLight.js +9 -5
- package/src/x_ite/Components/Lighting/EnvironmentLight.js +143 -0
- package/src/x_ite/Components/Lighting/PointLight.js +9 -5
- package/src/x_ite/Components/Lighting/SpotLight.js +9 -5
- package/src/x_ite/Components/Lighting/X3DLightNode.js +1 -1
- package/src/x_ite/Components/Lighting.js +3 -1
- package/src/x_ite/Components/NURBS/Contour2D.js +1 -1
- package/src/x_ite/Components/NURBS/ContourPolyline2D.js +1 -1
- package/src/x_ite/Components/NURBS/CoordinateDouble.js +1 -1
- package/src/x_ite/Components/NURBS/NurbsCurve.js +1 -1
- package/src/x_ite/Components/NURBS/NurbsCurve2D.js +1 -1
- package/src/x_ite/Components/NURBS/NurbsOrientationInterpolator.js +1 -1
- package/src/x_ite/Components/NURBS/NurbsPatchSurface.js +1 -1
- package/src/x_ite/Components/NURBS/NurbsPositionInterpolator.js +1 -1
- package/src/x_ite/Components/NURBS/NurbsSet.js +1 -1
- package/src/x_ite/Components/NURBS/NurbsSurfaceInterpolator.js +1 -1
- package/src/x_ite/Components/NURBS/NurbsSweptSurface.js +1 -1
- package/src/x_ite/Components/NURBS/NurbsSwungSurface.js +1 -1
- package/src/x_ite/Components/NURBS/NurbsTextureCoordinate.js +1 -1
- package/src/x_ite/Components/NURBS/NurbsTrimmedSurface.js +1 -1
- package/src/x_ite/Components/NURBS/X3DNurbsControlCurveNode.js +1 -1
- package/src/x_ite/Components/NURBS/X3DNurbsSurfaceGeometryNode.js +1 -1
- package/src/x_ite/Components/NURBS/X3DParametricGeometryNode.js +1 -1
- package/src/x_ite/Components/Navigation/Billboard.js +1 -1
- package/src/x_ite/Components/Navigation/Collision.js +1 -1
- package/src/x_ite/Components/Navigation/LOD.js +1 -1
- package/src/x_ite/Components/Navigation/NavigationInfo.js +2 -1
- package/src/x_ite/Components/Navigation/OrthoViewpoint.js +100 -68
- package/src/x_ite/Components/Navigation/Viewpoint.js +16 -16
- package/src/x_ite/Components/Navigation/ViewpointGroup.js +1 -1
- package/src/x_ite/Components/Navigation/X3DViewpointNode.js +219 -111
- package/src/x_ite/Components/Navigation.js +1 -1
- package/src/x_ite/Components/Networking/Anchor.js +1 -1
- package/src/x_ite/Components/Networking/Inline.js +99 -14
- package/src/x_ite/Components/Networking/LoadSensor.js +9 -9
- package/src/x_ite/Components/Networking/X3DNetworkSensorNode.js +1 -1
- package/src/x_ite/Components/Networking/X3DUrlObject.js +3 -3
- package/src/x_ite/Components/Networking.js +1 -1
- package/src/x_ite/Components/ParticleSystems/BoundedPhysicsModel.js +1 -1
- package/src/x_ite/Components/ParticleSystems/ConeEmitter.js +1 -1
- package/src/x_ite/Components/ParticleSystems/ExplosionEmitter.js +1 -1
- package/src/x_ite/Components/ParticleSystems/ForcePhysicsModel.js +1 -1
- package/src/x_ite/Components/ParticleSystems/ParticleSystem.js +1 -1
- package/src/x_ite/Components/ParticleSystems/PointEmitter.js +1 -1
- package/src/x_ite/Components/ParticleSystems/PolylineEmitter.js +1 -1
- package/src/x_ite/Components/ParticleSystems/SurfaceEmitter.js +1 -1
- package/src/x_ite/Components/ParticleSystems/VolumeEmitter.js +1 -1
- package/src/x_ite/Components/ParticleSystems/WindPhysicsModel.js +1 -1
- package/src/x_ite/Components/ParticleSystems/X3DParticleEmitterNode.js +1 -1
- package/src/x_ite/Components/ParticleSystems/X3DParticlePhysicsModelNode.js +1 -1
- package/src/x_ite/Components/Picking/LinePickSensor.js +1 -1
- package/src/x_ite/Components/Picking/PickableGroup.js +1 -1
- package/src/x_ite/Components/Picking/PointPickSensor.js +2 -4
- package/src/x_ite/Components/Picking/PrimitivePickSensor.js +1 -1
- package/src/x_ite/Components/Picking/VolumePickSensor.js +1 -1
- package/src/x_ite/Components/Picking/X3DPickSensorNode.js +1 -1
- package/src/x_ite/Components/Picking/X3DPickableObject.js +1 -1
- package/src/x_ite/Components/PointingDeviceSensor/CylinderSensor.js +1 -1
- package/src/x_ite/Components/PointingDeviceSensor/PlaneSensor.js +1 -1
- package/src/x_ite/Components/PointingDeviceSensor/SphereSensor.js +1 -1
- package/src/x_ite/Components/PointingDeviceSensor/TouchSensor.js +1 -1
- package/src/x_ite/Components/PointingDeviceSensor/X3DDragSensorNode.js +1 -1
- package/src/x_ite/Components/PointingDeviceSensor/X3DPointingDeviceSensorNode.js +1 -1
- package/src/x_ite/Components/PointingDeviceSensor/X3DTouchSensorNode.js +1 -1
- package/src/x_ite/Components/PointingDeviceSensor.js +1 -1
- package/src/x_ite/Components/ProjectiveTextureMapping/{TextureProjectorPerspective.js → TextureProjector.js} +17 -13
- package/src/x_ite/Components/ProjectiveTextureMapping/TextureProjectorParallel.js +17 -13
- package/src/x_ite/Components/ProjectiveTextureMapping/X3DTextureProjectorNode.js +1 -1
- package/src/x_ite/Components/Rendering/ClipPlane.js +1 -1
- package/src/x_ite/Components/Rendering/Color.js +1 -1
- package/src/x_ite/Components/Rendering/ColorRGBA.js +1 -1
- package/src/x_ite/Components/Rendering/Coordinate.js +1 -1
- package/src/x_ite/Components/Rendering/IndexedLineSet.js +6 -1
- package/src/x_ite/Components/Rendering/IndexedTriangleFanSet.js +1 -1
- package/src/x_ite/Components/Rendering/IndexedTriangleSet.js +1 -1
- package/src/x_ite/Components/Rendering/IndexedTriangleStripSet.js +1 -1
- package/src/x_ite/Components/Rendering/LineSet.js +6 -1
- package/src/x_ite/Components/Rendering/Normal.js +31 -1
- package/src/x_ite/Components/Rendering/PointSet.js +6 -1
- package/src/x_ite/Components/Rendering/TriangleFanSet.js +1 -1
- package/src/x_ite/Components/Rendering/TriangleSet.js +1 -1
- package/src/x_ite/Components/Rendering/TriangleStripSet.js +1 -1
- package/src/x_ite/Components/Rendering/X3DColorNode.js +1 -1
- package/src/x_ite/Components/Rendering/X3DComposedGeometryNode.js +1 -1
- package/src/x_ite/Components/Rendering/X3DCoordinateNode.js +1 -1
- package/src/x_ite/Components/Rendering/X3DGeometricPropertyNode.js +1 -1
- package/src/x_ite/Components/Rendering/X3DGeometryNode.js +40 -35
- package/src/x_ite/Components/Rendering/X3DLineGeometryNode.js +24 -6
- package/src/x_ite/Components/Rendering/X3DNormalNode.js +1 -1
- package/src/x_ite/Components/Rendering/X3DPointGeometryNode.js +7 -1
- package/src/x_ite/Components/Rendering.js +1 -1
- package/src/x_ite/Components/RigidBodyPhysics/BallJoint.js +1 -1
- package/src/x_ite/Components/RigidBodyPhysics/CollidableOffset.js +1 -1
- package/src/x_ite/Components/RigidBodyPhysics/CollidableShape.js +1 -1
- package/src/x_ite/Components/RigidBodyPhysics/CollisionCollection.js +1 -1
- package/src/x_ite/Components/RigidBodyPhysics/CollisionSensor.js +1 -1
- package/src/x_ite/Components/RigidBodyPhysics/CollisionSpace.js +1 -1
- package/src/x_ite/Components/RigidBodyPhysics/Contact.js +1 -1
- package/src/x_ite/Components/RigidBodyPhysics/DoubleAxisHingeJoint.js +1 -1
- package/src/x_ite/Components/RigidBodyPhysics/MotorJoint.js +1 -1
- package/src/x_ite/Components/RigidBodyPhysics/RigidBody.js +1 -1
- package/src/x_ite/Components/RigidBodyPhysics/RigidBodyCollection.js +1 -1
- package/src/x_ite/Components/RigidBodyPhysics/SingleAxisHingeJoint.js +3 -2
- package/src/x_ite/Components/RigidBodyPhysics/SliderJoint.js +1 -1
- package/src/x_ite/Components/RigidBodyPhysics/UniversalJoint.js +1 -1
- package/src/x_ite/Components/RigidBodyPhysics/X3DNBodyCollidableNode.js +1 -1
- package/src/x_ite/Components/RigidBodyPhysics/X3DNBodyCollisionSpaceNode.js +1 -1
- package/src/x_ite/Components/RigidBodyPhysics/X3DRigidJointNode.js +1 -1
- package/src/x_ite/Components/Scripting/Script.js +2 -1
- package/src/x_ite/Components/Scripting/X3DScriptNode.js +1 -1
- package/src/x_ite/Components/Shaders/ComposedShader.js +1 -1
- package/src/x_ite/Components/Shaders/FloatVertexAttribute.js +1 -1
- package/src/x_ite/Components/Shaders/Matrix3VertexAttribute.js +1 -1
- package/src/x_ite/Components/Shaders/Matrix4VertexAttribute.js +1 -1
- package/src/x_ite/Components/Shaders/PackagedShader.js +2 -1
- package/src/x_ite/Components/Shaders/ProgramShader.js +1 -1
- package/src/x_ite/Components/Shaders/ShaderPart.js +2 -1
- package/src/x_ite/Components/Shaders/ShaderProgram.js +2 -1
- package/src/x_ite/Components/Shaders/X3DProgrammableShaderObject.js +13 -10
- package/src/x_ite/Components/Shaders/X3DShaderNode.js +1 -1
- package/src/x_ite/Components/Shaders/X3DVertexAttributeNode.js +1 -1
- package/src/x_ite/Components/Shaders.js +1 -1
- package/src/x_ite/Components/Shape/AcousticProperties.js +1 -1
- package/src/x_ite/Components/Shape/Appearance.js +2 -2
- package/src/x_ite/Components/Shape/FillProperties.js +4 -1
- package/src/x_ite/Components/Shape/LineProperties.js +4 -1
- package/src/x_ite/Components/Shape/Material.js +24 -16
- package/src/x_ite/Components/Shape/PhysicalMaterial.js +1 -1
- package/src/x_ite/Components/Shape/PointProperties.js +14 -20
- package/src/x_ite/Components/Shape/Shape.js +1 -1
- package/src/x_ite/Components/Shape/TwoSidedMaterial.js +1 -1
- package/src/x_ite/Components/Shape/UnlitMaterial.js +1 -1
- package/src/x_ite/Components/Shape/X3DAppearanceChildNode.js +1 -1
- package/src/x_ite/Components/Shape/X3DAppearanceNode.js +1 -1
- package/src/x_ite/Components/Shape/X3DMaterialNode.js +1 -1
- package/src/x_ite/Components/Shape/X3DOneSidedMaterialNode.js +2 -2
- package/src/x_ite/Components/Shape/X3DShapeNode.js +1 -1
- package/src/x_ite/Components/Shape.js +1 -1
- package/src/x_ite/Components/Sound/Analyser.js +105 -0
- package/src/x_ite/Components/Sound/AudioClip.js +1 -1
- package/src/x_ite/Components/Sound/AudioDestination.js +94 -0
- package/src/x_ite/Components/Sound/BiquadFilter.js +104 -0
- package/src/x_ite/Components/Sound/BufferAudioSource.js +127 -0
- package/src/x_ite/Components/Sound/ChannelMerger.js +91 -0
- package/src/x_ite/Components/Sound/ChannelSelector.js +92 -0
- package/src/x_ite/Components/Sound/ChannelSplitter.js +92 -0
- package/src/x_ite/Components/Sound/Convolver.js +102 -0
- package/src/x_ite/Components/Sound/Delay.js +102 -0
- package/src/x_ite/Components/Sound/DynamicsCompressor.js +106 -0
- package/src/x_ite/Components/Sound/Gain.js +100 -0
- package/src/x_ite/Components/Sound/ListenerPointSource.js +102 -0
- package/src/x_ite/Components/Sound/MicrophoneSource.js +96 -0
- package/src/x_ite/Components/Sound/OscillatorSource.js +98 -0
- package/src/x_ite/Components/Sound/PeriodicWave.js +86 -0
- package/src/x_ite/Components/Sound/Sound.js +16 -13
- package/src/x_ite/Components/Sound/SpatialSound.js +103 -0
- package/src/x_ite/Components/Sound/StreamAudioDestination.js +94 -0
- package/src/x_ite/Components/Sound/StreamAudioSource.js +96 -0
- package/src/x_ite/Components/Sound/WaveShaper.js +102 -0
- package/src/x_ite/Components/Sound/X3DSoundChannelNode.js +63 -0
- package/src/x_ite/Components/Sound/X3DSoundDestinationNode.js +63 -0
- package/src/x_ite/Components/Sound/X3DSoundNode.js +1 -1
- package/src/x_ite/Components/Sound/X3DSoundProcessingNode.js +63 -0
- package/src/x_ite/Components/Sound/X3DSoundSourceNode.js +1 -1
- package/src/x_ite/Components/Sound.js +54 -10
- package/src/x_ite/Components/Text/FontStyle.js +1 -1
- package/src/x_ite/Components/Text/Text.js +1 -1
- package/src/x_ite/Components/Text/X3DFontStyleNode.js +1 -1
- package/src/x_ite/Components/Texturing/ImageTexture.js +1 -1
- package/src/x_ite/Components/Texturing/MovieTexture.js +1 -1
- package/src/x_ite/Components/Texturing/MultiTexture.js +1 -1
- package/src/x_ite/Components/Texturing/MultiTextureCoordinate.js +1 -1
- package/src/x_ite/Components/Texturing/MultiTextureTransform.js +1 -1
- package/src/x_ite/Components/Texturing/PixelTexture.js +1 -1
- package/src/x_ite/Components/Texturing/TextureCoordinate.js +1 -1
- package/src/x_ite/Components/Texturing/TextureCoordinateGenerator.js +1 -1
- package/src/x_ite/Components/Texturing/TextureProperties.js +8 -1
- package/src/x_ite/Components/Texturing/TextureTransform.js +1 -1
- package/src/x_ite/Components/Texturing/X3DSingleTextureCoordinateNode.js +1 -1
- package/src/x_ite/Components/Texturing/X3DSingleTextureNode.js +1 -1
- package/src/x_ite/Components/Texturing/X3DSingleTextureTransformNode.js +1 -1
- package/src/x_ite/Components/Texturing/X3DTexture2DNode.js +1 -1
- package/src/x_ite/Components/Texturing/X3DTextureCoordinateNode.js +1 -1
- package/src/x_ite/Components/Texturing/X3DTextureNode.js +1 -1
- package/src/x_ite/Components/Texturing/X3DTextureTransformNode.js +1 -1
- package/src/x_ite/Components/Texturing.js +1 -1
- package/src/x_ite/Components/Texturing3D/ComposedTexture3D.js +1 -1
- package/src/x_ite/Components/Texturing3D/ImageTexture3D.js +1 -1
- package/src/x_ite/Components/Texturing3D/PixelTexture3D.js +1 -1
- package/src/x_ite/Components/Texturing3D/TextureCoordinate3D.js +1 -1
- package/src/x_ite/Components/Texturing3D/TextureCoordinate4D.js +1 -1
- package/src/x_ite/Components/Texturing3D/TextureTransform3D.js +1 -1
- package/src/x_ite/Components/Texturing3D/TextureTransformMatrix3D.js +1 -1
- package/src/x_ite/Components/Texturing3D/X3DTexture3DNode.js +1 -1
- package/src/x_ite/Components/Time/TimeSensor.js +2 -1
- package/src/x_ite/Components/Time/X3DTimeDependentNode.js +1 -1
- package/src/x_ite/Components/Time.js +1 -1
- package/src/x_ite/Components/VolumeRendering/BlendedVolumeStyle.js +1 -1
- package/src/x_ite/Components/VolumeRendering/BoundaryEnhancementVolumeStyle.js +1 -1
- package/src/x_ite/Components/VolumeRendering/CartoonVolumeStyle.js +1 -1
- package/src/x_ite/Components/VolumeRendering/ComposedVolumeStyle.js +1 -1
- package/src/x_ite/Components/VolumeRendering/EdgeEnhancementVolumeStyle.js +1 -1
- package/src/x_ite/Components/VolumeRendering/IsoSurfaceVolumeData.js +1 -1
- package/src/x_ite/Components/VolumeRendering/OpacityMapVolumeStyle.js +1 -1
- package/src/x_ite/Components/VolumeRendering/ProjectionVolumeStyle.js +1 -1
- package/src/x_ite/Components/VolumeRendering/SegmentedVolumeData.js +1 -1
- package/src/x_ite/Components/VolumeRendering/ShadedVolumeStyle.js +1 -1
- package/src/x_ite/Components/VolumeRendering/SilhouetteEnhancementVolumeStyle.js +1 -1
- package/src/x_ite/Components/VolumeRendering/ToneMappedVolumeStyle.js +1 -1
- package/src/x_ite/Components/VolumeRendering/VolumeData.js +1 -1
- package/src/x_ite/Components/VolumeRendering/X3DComposableVolumeRenderStyleNode.js +1 -1
- package/src/x_ite/Components/VolumeRendering/X3DVolumeDataNode.js +1 -1
- package/src/x_ite/Components/VolumeRendering/X3DVolumeRenderStyleNode.js +1 -1
- package/src/x_ite/Components/X_ITE/BlendMode.js +1 -1
- package/src/x_ite/Components.js +6 -28
- package/src/x_ite/Configuration/ComponentInfo.js +10 -7
- package/src/x_ite/Configuration/ComponentInfoArray.js +2 -6
- package/src/x_ite/Configuration/ProfileInfo.js +1 -1
- package/src/x_ite/Configuration/ProfileInfoArray.js +1 -1
- package/src/x_ite/Configuration/SupportedComponents.js +136 -154
- package/src/x_ite/Configuration/SupportedNodes.js +7 -10
- package/src/x_ite/Configuration/SupportedProfiles.js +1 -1
- package/src/x_ite/Configuration/UnitInfo.js +1 -1
- package/src/x_ite/Configuration/UnitInfoArray.js +1 -1
- package/src/x_ite/DEBUG.js +1 -1
- package/src/x_ite/Execution/BindableList.js +1 -1
- package/src/x_ite/Execution/BindableStack.js +12 -12
- package/src/x_ite/Execution/ExportedNodesArray.js +1 -1
- package/src/x_ite/Execution/ImportedNodesArray.js +1 -1
- package/src/x_ite/Execution/NamedNodesArray.js +1 -1
- package/src/x_ite/Execution/Scene.js +13 -13
- package/src/x_ite/Execution/X3DExecutionContext.js +882 -882
- package/src/x_ite/Execution/X3DExportedNode.js +1 -1
- package/src/x_ite/Execution/X3DImportedNode.js +1 -1
- package/src/x_ite/Execution/X3DScene.js +14 -22
- package/src/x_ite/Execution/X3DWorld.js +1 -1
- package/src/x_ite/Fallback.js +1 -6
- package/src/x_ite/Fields/ArrayFields.js +1 -1
- package/src/x_ite/Fields/SFBool.js +1 -1
- package/src/x_ite/Fields/SFColor.js +2 -5
- package/src/x_ite/Fields/SFColorRGBA.js +2 -6
- package/src/x_ite/Fields/SFDouble.js +1 -1
- package/src/x_ite/Fields/SFFloat.js +1 -1
- package/src/x_ite/Fields/SFImage.js +1 -1
- package/src/x_ite/Fields/SFInt32.js +1 -1
- package/src/x_ite/Fields/SFMatrix3.js +16 -11
- package/src/x_ite/Fields/SFMatrix4.js +18 -11
- package/src/x_ite/Fields/SFMatrixPrototypeTemplate.js +15 -4
- package/src/x_ite/Fields/SFNode.js +1 -1
- package/src/x_ite/Fields/SFNodeCache.js +3 -5
- package/src/x_ite/Fields/SFRotation.js +27 -6
- package/src/x_ite/Fields/SFString.js +1 -1
- package/src/x_ite/Fields/SFTime.js +1 -1
- package/src/x_ite/Fields/SFVec2.js +5 -11
- package/src/x_ite/Fields/SFVec3.js +5 -11
- package/src/x_ite/Fields/SFVec4.js +5 -11
- package/src/x_ite/Fields/SFVecPrototypeTemplate.js +27 -17
- package/src/x_ite/Fields.js +1 -1
- package/src/x_ite/InputOutput/FileLoader.js +3 -3
- package/src/x_ite/InputOutput/Generator.js +1 -1
- package/src/x_ite/Namespace.js +2 -758
- package/src/x_ite/Parser/GoldenGate.js +1 -1
- package/src/x_ite/Parser/HTMLSupport.js +1 -1
- package/src/x_ite/Parser/JSONParser.js +4 -4
- package/src/x_ite/Parser/VRMLParser.js +15 -1
- package/src/x_ite/Parser/X3DParser.js +1 -1
- package/src/x_ite/Parser/XMLParser.js +1 -1
- package/src/x_ite/Prototype/ExternProtoDeclarationArray.js +1 -1
- package/src/x_ite/Prototype/ProtoDeclarationArray.js +1 -1
- package/src/x_ite/Prototype/X3DExternProtoDeclaration.js +1 -1
- package/src/x_ite/Prototype/X3DProtoDeclaration.js +1 -1
- package/src/x_ite/Prototype/X3DProtoDeclarationNode.js +1 -1
- package/src/x_ite/Rendering/DependentRenderer.js +1 -1
- package/src/x_ite/Rendering/TextureBuffer.js +1 -1
- package/src/x_ite/Rendering/TraverseType.js +1 -1
- package/src/x_ite/Rendering/VertexArray.js +2 -2
- package/src/x_ite/Rendering/X3DRenderObject.js +10 -7
- package/src/x_ite/Routing/RouteArray.js +1 -1
- package/src/x_ite/Routing/X3DRoute.js +1 -1
- package/src/x_ite/Routing/X3DRoutingContext.js +1 -1
- package/src/x_ite/X3D.js +25 -37
- package/src/x_ite/X3DCanvas.js +10 -12
- package/src/x_ite.css +20 -0
- package/src/x_ite.html +80 -77
- package/src/x_ite.js +1 -1
- package/webpack.config.js +79 -8
- package/x_ite.min.html +78 -76
- package/build/bin/namespace.mjs +0 -86
- package/docs/404.md +0 -11
- package/docs/Browser-Support.md +0 -53
- package/docs/Supported-Nodes.md +0 -378
- package/docs/_data/navigation.yml +0 -137
- package/docs/assets/css/main.scss +0 -126
- package/docs/reference/Field-Services-and-Objects.md +0 -1110
- package/docs/tutorials/index.md +0 -84
|
@@ -1 +1 @@
|
|
|
1
|
-
/* X_ITE v8.0.0 */(()=>{"use strict";var e={n:t=>{var n=t&&t.__esModule?()=>t.default:()=>t;return e.d(n,{a:n}),n},d:(t,n)=>{for(var i in n)e.o(n,i)&&!e.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:n[i]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)};const t=window[Symbol.for("X_ITE.X3D-8.0.0")].require("x_ite/Components");var n=e.n(t);const i=window[Symbol.for("X_ITE.X3D-8.0.0")].require("x_ite/Fields");var o=e.n(i);const r=window[Symbol.for("X_ITE.X3D-8.0.0")].require("x_ite/Base/X3DFieldDefinition");var s=e.n(r);const a=window[Symbol.for("X_ITE.X3D-8.0.0")].require("x_ite/Base/FieldDefinitionArray");var c=e.n(a);const l=window[Symbol.for("X_ITE.X3D-8.0.0")].require("x_ite/Components/Core/X3DNode");var u=e.n(l);let d=0;const m={POINT:d++,LINE:d++,TRIANGLE:d++,QUAD:d++,SPRITE:d++,GEOMETRY:d++},h=window[Symbol.for("X_ITE.X3D-8.0.0")].require("x_ite/Base/X3DConstants");var p=e.n(h);function f(e){u().call(this,e),this.addType(p().X3DParticleEmitterNode),this._speed.setUnit("speed"),this._mass.setUnit("mass"),this._surfaceArea.setUnit("area"),this.samplers=[],this.uniforms={},this.functions=[],this.program=null,this.addSampler("forces"),this.addSampler("boundedVolume"),this.addSampler("colorRamp"),this.addSampler("texCoordRamp"),this.addUniform("speed","uniform float speed;"),this.addUniform("variation","uniform float variation;"),this.addFunction("\nstruct Line3 {\n vec3 point;\n vec3 direction;\n};\n\n// Line3\n// line3 (const in vec3 point1, const in vec3 point2)\n// {\n// return Line3 (point1, normalize (point2 - point1));\n// }\n\n/* Line intersect triangle */\n\nbool\nintersects (const in Line3 line, const in vec3 a, const in vec3 b, const in vec3 c, out vec3 r)\n{\n // find vectors for two edges sharing vert0\n vec3 edge1 = b - a;\n vec3 edge2 = c - a;\n\n // begin calculating determinant - also used to calculate U parameter\n vec3 pvec = cross (line .direction, edge2);\n\n // if determinant is near zero, ray lies in plane of triangle\n float det = dot (edge1, pvec);\n\n // Non culling intersection\n\n if (det == 0.0)\n return false;\n\n float inv_det = 1.0 / det;\n\n // calculate distance from vert0 to ray point\n vec3 tvec = line .point - a;\n\n // calculate U parameter and test bounds\n float u = dot (tvec, pvec) * inv_det;\n\n if (u < 0.0 || u > 1.0)\n return false;\n\n // prepare to test V parameter\n vec3 qvec = cross (tvec, edge1);\n\n // calculate V parameter and test bounds\n float v = dot (line .direction, qvec) * inv_det;\n\n if (v < 0.0 || u + v > 1.0)\n return false;\n\n r = vec3 (u, v, 1.0 - u - v);\n\n return true;\n}\n"),this.addFunction("\nstruct Plane3\n{\n vec3 normal;\n float distanceFromOrigin;\n};\n\nPlane3\nplane3 (const in vec3 point, const in vec3 normal)\n{\n return Plane3 (normal, dot (normal, point));\n}\n\nfloat\nplane_distance (const in Plane3 plane, const in vec3 point)\n{\n return dot (point, plane .normal) - plane .distanceFromOrigin;\n}\n\n/* Plane intersect line */\nbool\nintersects (const in Plane3 plane, const in Line3 line, out vec3 point)\n{\n // Check if the line is parallel to the plane.\n float theta = dot (line .direction, plane .normal);\n\n // Plane and line are parallel.\n if (theta == 0.0)\n return false;\n\n // Plane and line are not parallel. The intersection point can be calculated now.\n float t = (plane .distanceFromOrigin - dot (plane .normal, line .point)) / theta;\n\n point = line .point + line .direction * t;\n\n return true;\n}\n\n/* Find find the first point that is farther to the plane than value. */\n// int\n// upper_bound (const in vec4 points [ARRAY_SIZE], in int count, const in float value, const in Plane3 plane)\n// {\n// int first = 0;\n// int step = 0;\n\n// while (count > 0)\n// {\n// int index = first;\n\n// step = count >> 1;\n\n// index += step;\n\n// if (value < plane_distance (plane, points [index] .xyz))\n// {\n// count = step;\n// }\n// else\n// {\n// first = ++ index;\n// count -= step + 1;\n// }\n// }\n\n// return first;\n// }\n\n/* CombSort: sort points in distance to a plane. */\nvoid\nsort (inout vec4 points [ARRAY_SIZE], const in int count, const in Plane3 plane)\n{\n const float shrink = 1.0 / 1.3;\n\n int gap = count;\n bool exchanged = true;\n\n while (exchanged)\n {\n gap = int (float (gap) * shrink);\n\n if (gap <= 1)\n {\n exchanged = false;\n gap = 1;\n }\n\n for (int i = 0, l = count - gap; i < l; ++ i)\n {\n int j = gap + i;\n\n if (plane_distance (plane, points [i] .xyz) > plane_distance (plane, points [j] .xyz))\n {\n vec4 tmp1 = points [i];\n points [i] = points [j];\n points [j] = tmp1;\n\n exchanged = true;\n }\n }\n }\n}\n\n\n// /* CombSort: sort points and normals in distance to a plane. */\n// void\n// sort (inout vec4 points [ARRAY_SIZE], inout vec3 normals [ARRAY_SIZE], const in int count, const in Plane3 plane)\n// {\n// const float shrink = 1.0 / 1.3;\n\n// int gap = count;\n// bool exchanged = true;\n\n// while (exchanged)\n// {\n// gap = int (float (gap) * shrink);\n\n// if (gap <= 1)\n// {\n// exchanged = false;\n// gap = 1;\n// }\n\n// for (int i = 0, l = count - gap; i < l; ++ i)\n// {\n// int j = gap + i;\n\n// if (plane_distance (plane, points [i] .xyz) > plane_distance (plane, points [j] .xyz))\n// {\n// vec4 tmp1 = points [i];\n// points [i] = points [j];\n// points [j] = tmp1;\n\n// vec3 tmp2 = normals [i];\n// normals [i] = normals [j];\n// normals [j] = tmp2;\n\n// exchanged = true;\n// }\n// }\n// }\n// }\n\nint\nmin_index (const in vec4 points [ARRAY_SIZE], const in int count, const in float value, const in Plane3 plane)\n{\n int index = -1;\n float dist = 1000000.0;\n\n for (int i = 0; i < count; ++ i)\n {\n float d = plane_distance (plane, points [i] .xyz);\n\n if (d >= value && d < dist)\n {\n dist = d;\n index = i;\n }\n }\n\n return index;\n}\n"),this.addFunction("\nbool\nintersects (const in vec3 min, const in vec3 max, const in Line3 line)\n{\n vec3 intersection;\n\n // front\n\n if (intersects (plane3 (max, vec3 (0.0, 0.0, 1.0)), line, intersection))\n {\n if (all (greaterThanEqual (vec4 (intersection .xy, max .xy), vec4 (min .xy, intersection .xy))))\n return true;\n }\n\n // back\n\n if (intersects (plane3 (min, vec3 (0.0, 0.0, -1.0)), line, intersection))\n {\n if (all (greaterThanEqual (vec4 (intersection .xy, max .xy), vec4 (min .xy, intersection .xy))))\n return true;\n }\n\n // top\n\n if (intersects (plane3 (max, vec3 (0.0, 1.0, 0.0)), line, intersection))\n {\n if (all (greaterThanEqual (vec4 (intersection .xz, max .xz), vec4 (min .xz, intersection .xz))))\n return true;\n }\n\n // bottom\n\n if (intersects (plane3 (min, vec3 (0.0, -1.0, 0.0)), line, intersection))\n {\n if (all (greaterThanEqual (vec4 (intersection .xz, max .xz), vec4 (min .xz, intersection .xz))))\n return true;\n }\n\n // right\n\n if (intersects (plane3 (max, vec3 (1.0, 0.0, 0.0)), line, intersection))\n {\n if (all (greaterThanEqual (vec4 (intersection .yz, max .yz), vec4 (min .yz, intersection .yz))))\n return true;\n }\n\n return false;\n}\n"),this.addFunction("\n#define BVH_NODE 0\n#define BVH_TRIANGLE 1\n#define BVH_STACK_SIZE 32\n\nint bvhNodeIndex = 0;\n\nvoid\nsetBVHIndex (const in int index)\n{\n bvhNodeIndex = index;\n}\n\nint\ngetBVHRoot (const in sampler2D volume, const in int hierarchyIndex, const in int rootIndex)\n{\n return int (texelFetch (volume, rootIndex, 0) .x) + hierarchyIndex;\n}\n\nint\ngetBVHType (const in sampler2D volume)\n{\n return int (texelFetch (volume, bvhNodeIndex, 0) .x);\n}\n\nvec3\ngetBVHMin (const in sampler2D volume)\n{\n return texelFetch (volume, bvhNodeIndex + 1, 0) .xyz;\n}\n\nvec3\ngetBVHMax (const in sampler2D volume)\n{\n return texelFetch (volume, bvhNodeIndex + 2, 0) .xyz;\n}\n\nint\ngetBVHLeft (const in sampler2D volume, const in int hierarchyIndex)\n{\n return int (texelFetch (volume, bvhNodeIndex, 0) .y) + hierarchyIndex;\n}\n\nint\ngetBVHRight (const in sampler2D volume, const in int hierarchyIndex)\n{\n return int (texelFetch (volume, bvhNodeIndex, 0) .z) + hierarchyIndex;\n}\n\nint\ngetBVHTriangle (const in sampler2D volume)\n{\n return int (texelFetch (volume, bvhNodeIndex, 0) .y);\n}\n\n/* Ray triangle intersection test */\n\nint\ngetIntersections (const in sampler2D volume, const in int verticesIndex, const in int hierarchyIndex, const in int rootIndex, const in Line3 line, out vec4 points [ARRAY_SIZE])\n{\n int current = getBVHRoot (volume, hierarchyIndex, rootIndex);\n int count = 0;\n int stackIndex = -1;\n int stack [BVH_STACK_SIZE];\n\n while (stackIndex >= 0 || current >= 0)\n {\n if (current >= 0)\n {\n setBVHIndex (current);\n\n if (getBVHType (volume) == BVH_NODE)\n {\n // Node\n\n if (intersects (getBVHMin (volume), getBVHMax (volume), line))\n {\n stack [++ stackIndex] = current;\n\n current = getBVHLeft (volume, hierarchyIndex);\n }\n else\n {\n current = -1;\n }\n }\n else\n {\n // Triangle\n\n int t = getBVHTriangle (volume);\n int v = verticesIndex + t;\n vec3 r = vec3 (0.0);\n\n vec3 a = texelFetch (volume, v, 0) .xyz;\n vec3 b = texelFetch (volume, v + 1, 0) .xyz;\n vec3 c = texelFetch (volume, v + 2, 0) .xyz;\n\n if (intersects (line, a, b, c, r))\n points [count ++] = vec4 (r .z * a + r .x * b + r .y * c, 1.0);\n\n current = -1;\n }\n }\n else\n {\n setBVHIndex (stack [stackIndex --]);\n\n current = getBVHRight (volume, hierarchyIndex);\n }\n }\n\n return count;\n}\n\nint\ngetIntersections (const in sampler2D volume, const in int verticesIndex, const in int normalsIndex, const in int hierarchyIndex, const in int rootIndex, const in Line3 line, out vec4 points [ARRAY_SIZE], out vec3 normals [ARRAY_SIZE])\n{\n int current = getBVHRoot (volume, hierarchyIndex, rootIndex);\n int count = 0;\n int stackIndex = -1;\n int stack [BVH_STACK_SIZE];\n\n while (stackIndex >= 0 || current >= 0)\n {\n if (current >= 0)\n {\n setBVHIndex (current);\n\n if (getBVHType (volume) == BVH_NODE)\n {\n // Node\n\n if (intersects (getBVHMin (volume), getBVHMax (volume), line))\n {\n stack [++ stackIndex] = current;\n\n current = getBVHLeft (volume, hierarchyIndex);\n }\n else\n {\n current = -1;\n }\n }\n else\n {\n // Triangle\n\n int t = getBVHTriangle (volume);\n int v = verticesIndex + t;\n vec3 r = vec3 (0.0);\n\n vec3 a = texelFetch (volume, v, 0) .xyz;\n vec3 b = texelFetch (volume, v + 1, 0) .xyz;\n vec3 c = texelFetch (volume, v + 2, 0) .xyz;\n\n if (intersects (line, a, b, c, r))\n {\n points [count] = vec4 (r .z * a + r .x * b + r .y * c, 1.0);\n\n int n = normalsIndex + t;\n\n vec3 n0 = texelFetch (volume, n, 0) .xyz;\n vec3 n1 = texelFetch (volume, n + 1, 0) .xyz;\n vec3 n2 = texelFetch (volume, n + 2, 0) .xyz;\n\n normals [count] = save_normalize (r .z * n0 + r .x * n1 + r .y * n2);\n\n ++ count;\n }\n\n current = -1;\n }\n }\n else\n {\n setBVHIndex (stack [stackIndex --]);\n\n current = getBVHRight (volume, hierarchyIndex);\n }\n }\n\n return count;\n}\n")}f.prototype=Object.assign(Object.create(u().prototype),{constructor:f,initialize:function(){u().prototype.initialize.call(this);const e=this.getBrowser().getContext();e.getVersion()<2||(this.program=this.createProgram(),this.transformFeedback=e.createTransformFeedback(),this._on.addInterest("set_on__",this),this._speed.addInterest("set_speed__",this),this._variation.addInterest("set_variation__",this),this._mass.addInterest("set_mass__",this),this.set_on__(),this.set_speed__(),this.set_variation__(),this.set_mass__())},isExplosive:function(){return!1},getMass:function(){return this.mass},set_on__:function(){this.on=this._on.getValue()},set_speed__:function(){this.setUniform("uniform1f","speed",this._speed.getValue())},set_variation__:function(){this.setUniform("uniform1f","variation",this._variation.getValue())},set_mass__:function(){this.mass=this._mass.getValue()},getRandomValue:function(e,t){return Math.random()*(t-e)+e},getRandomNormal:function(e){const t=this.getRandomValue(-1,1)*Math.PI,n=this.getRandomValue(-1,1),i=Math.acos(n),o=Math.sin(i);return e.set(Math.sin(t)*o,Math.cos(t)*o,n)},animate:function(e,t){const n=this.getBrowser().getContext(),i=e.inputParticles,o=e.particleStride,r=e.particleOffsets,s=this.program;if(n.useProgram(s),n.uniform1i(s.randomSeed,4294967295*Math.random()),n.uniform1i(s.geometryType,e.geometryType),n.uniform1i(s.createParticles,e.createParticles&&this.on),n.uniform1f(s.particleLifetime,e.particleLifetime),n.uniform1f(s.lifetimeVariation,e.lifetimeVariation),n.uniform1f(s.deltaTime,t),n.uniform2f(s.particleSize,e._particleSize.x,e._particleSize.y),n.uniform1i(s.numForces,e.numForces),e.numForces&&(n.activeTexture(n.TEXTURE0+s.forcesTextureUnit),n.bindTexture(n.TEXTURE_2D,e.forcesTexture)),e.boundedHierarchyRoot<0?n.uniform1i(s.boundedHierarchyRoot,-1):(n.uniform1i(s.boundedVerticesIndex,e.boundedVerticesIndex),n.uniform1i(s.boundedNormalsIndex,e.boundedNormalsIndex),n.uniform1i(s.boundedHierarchyIndex,e.boundedHierarchyIndex),n.uniform1i(s.boundedHierarchyRoot,e.boundedHierarchyRoot),n.activeTexture(n.TEXTURE0+s.boundedVolumeTextureUnit),n.bindTexture(n.TEXTURE_2D,e.boundedTexture)),n.uniform1i(s.numColors,e.numColors),e.numColors&&(n.activeTexture(n.TEXTURE0+s.colorRampTextureUnit),n.bindTexture(n.TEXTURE_2D,e.colorRampTexture)),n.uniform1i(s.numTexCoords,e.numTexCoords),e.numTexCoords&&(n.uniform1i(s.texCoordCount,e.texCoordCount),n.activeTexture(n.TEXTURE0+s.texCoordRampTextureUnit),n.bindTexture(n.TEXTURE_2D,e.texCoordRampTexture)),this.activateTextures(n,s),i.emitterArrayObject.enable(n,s)){for(const[e,t]of s.inputs)n.bindBuffer(n.ARRAY_BUFFER,i),n.enableVertexAttribArray(t),n.vertexAttribPointer(t,4,n.FLOAT,!1,o,r[e]);n.bindBuffer(n.ARRAY_BUFFER,null)}n.bindTransformFeedback(n.TRANSFORM_FEEDBACK,this.transformFeedback),n.bindBufferBase(n.TRANSFORM_FEEDBACK_BUFFER,0,e.outputParticles),n.enable(n.RASTERIZER_DISCARD),n.beginTransformFeedback(n.POINTS),n.drawArrays(n.POINTS,0,e.numParticles),n.endTransformFeedback(),n.disable(n.RASTERIZER_DISCARD),n.bindTransformFeedback(n.TRANSFORM_FEEDBACK,null)},addSampler:function(e){this.samplers.push(e)},addUniform:function(e,t){this.uniforms[e]=t},setUniform:function(e,t,n,i,o){const r=this.getBrowser().getContext(),s=this.program;r.useProgram(s),r[e](s[t],n,i,o)},addFunction:function(e){this.functions.push(e)},createProgram:function(){const e=this.getBrowser(),t=e.getContext(),n=`#version 300 es\n\n precision highp float;\n precision highp int;\n precision highp sampler2D;\n\n uniform int randomSeed;\n uniform int geometryType;\n uniform bool createParticles;\n uniform float particleLifetime;\n uniform float lifetimeVariation;\n uniform float deltaTime;\n uniform vec2 particleSize;\n\n uniform int numForces;\n uniform sampler2D forces;\n\n uniform int boundedVerticesIndex;\n uniform int boundedNormalsIndex;\n uniform int boundedHierarchyIndex;\n uniform int boundedHierarchyRoot;\n uniform sampler2D boundedVolume;\n\n uniform int numColors;\n uniform sampler2D colorRamp;\n\n uniform int texCoordCount;\n uniform int numTexCoords;\n uniform sampler2D texCoordRamp;\n\n ${Object.values(this.uniforms).join("\n")}\n\n in vec4 input0;\n in vec4 input2;\n in vec4 input6;\n\n out vec4 output0;\n out vec4 output1;\n out vec4 output2;\n\n out vec4 output3;\n out vec4 output4;\n out vec4 output5;\n out vec4 output6;\n\n // Constants\n\n ${Object.entries(m).map((([e,t])=>`#define ${e} ${t}`)).join("\n")}\n\n const int ARRAY_SIZE = 32;\n const float M_PI = 3.14159265359;\n\n uniform float NaN;\n\n // Texture\n\n vec4\n texelFetch (const in sampler2D sampler, const in int index, const in int lod)\n {\n int x = textureSize (sampler, lod) .x;\n ivec2 p = ivec2 (index % x, index / x);\n vec4 t = texelFetch (sampler, p, lod);\n\n return t;\n }\n\n // Math\n\n // Save normalize, that will not divide by zero.\n vec3\n save_normalize (const in vec3 vector)\n {\n float l = length (vector);\n\n if (l == 0.0)\n return vec3 (0.0);\n\n return vector / l;\n }\n\n // Quaternion\n\n vec4\n Quaternion (const in vec3 fromVector, const in vec3 toVector)\n {\n vec3 from = save_normalize (fromVector);\n vec3 to = save_normalize (toVector);\n\n float cos_angle = dot (from, to);\n vec3 cross_vec = cross (from, to);\n float cross_len = length (cross_vec);\n\n if (cross_len == 0.0)\n {\n if (cos_angle > 0.0)\n {\n return vec4 (0.0, 0.0, 0.0, 1.0);\n }\n else\n {\n vec3 t = cross (from, vec3 (1.0, 0.0, 0.0));\n\n if (dot (t, t) == 0.0)\n t = cross (from, vec3 (0.0, 1.0, 0.0));\n\n t = save_normalize (t);\n\n return vec4 (t, 0.0);\n }\n }\n else\n {\n float s = sqrt (abs (1.0 - cos_angle) * 0.5);\n\n cross_vec = save_normalize (cross_vec);\n\n return vec4 (cross_vec * s, sqrt (abs (1.0 + cos_angle) * 0.5));\n }\n }\n\n vec3\n multVecQuat (const in vec3 v, const in vec4 q)\n {\n float a = q .w * q .w - q .x * q .x - q .y * q .y - q .z * q .z;\n float b = 2.0 * (v .x * q .x + v .y * q .y + v .z * q .z);\n float c = 2.0 * q .w;\n vec3 r = a * v .xyz + b * q .xyz + c * (q .yzx * v .zxy - q .zxy * v .yzx);\n\n return r;\n }\n\n mat3\n Matrix3 (const in vec4 quaternion)\n {\n float x = quaternion .x;\n float y = quaternion .y;\n float z = quaternion .z;\n float w = quaternion .w;\n float A = y * y;\n float B = z * z;\n float C = x * y;\n float D = z * w;\n float E = z * x;\n float F = y * w;\n float G = x * x;\n float H = y * z;\n float I = x * w;\n\n return mat3 (1.0 - 2.0 * (A + B),\n 2.0 * (C + D),\n 2.0 * (E - F),\n 2.0 * (C - D),\n 1.0 - 2.0 * (B + G),\n 2.0 * (H + I),\n 2.0 * (E + F),\n 2.0 * (H - I),\n 1.0 - 2.0 * (A + G));\n }\n\n /* Random number generation */\n\n uint seed = 1u;\n\n void\n srand (const in int value)\n {\n seed = uint (value);\n }\n\n // Return a uniform distributed random floating point number in the interval [0, 1].\n float\n random ()\n {\n seed = seed * 1103515245u + 12345u;\n\n return float (seed) / 4294967295.0;\n }\n\n float\n getRandomValue (const in float min, const in float max)\n {\n return min + random () * (max - min);\n }\n\n float\n getRandomLifetime ()\n {\n float v = particleLifetime * lifetimeVariation;\n float min_ = max (0.0, particleLifetime - v);\n float max_ = particleLifetime + v;\n\n return getRandomValue (min_, max_);\n }\n\n float\n getRandomSpeed ()\n {\n float v = speed * variation;\n float min_ = max (0.0, speed - v);\n float max_ = speed + v;\n\n return getRandomValue (min_, max_);\n }\n\n vec3\n getRandomNormal ()\n {\n float theta = getRandomValue (-M_PI, M_PI);\n float cphi = getRandomValue (-1.0, 1.0);\n float r = sqrt (1.0 - cphi * cphi); // sin (acos (cphi));\n\n return vec3 (sin (theta) * r, cos (theta) * r, cphi);\n }\n\n vec3\n getRandomNormalWithAngle (const in float angle)\n {\n float theta = getRandomValue (-M_PI, M_PI);\n float cphi = getRandomValue (cos (angle), 1.0);\n float r = sqrt (1.0 - cphi * cphi); // sin (acos (cphi));\n\n return vec3 (sin (theta) * r, cos (theta) * r, cphi);\n }\n\n vec3\n getRandomNormalWithDirectionAndAngle (const in vec3 direction, const in float angle)\n {\n vec4 rotation = Quaternion (vec3 (0.0, 0.0, 1.0), direction);\n vec3 normal = getRandomNormalWithAngle (angle);\n\n return multVecQuat (normal, rotation);\n }\n\n vec3\n getRandomSurfaceNormal (const in vec3 direction)\n {\n float theta = getRandomValue (-M_PI, M_PI);\n float cphi = pow (random (), 1.0 / 3.0);\n float r = sqrt (1.0 - cphi * cphi); // sin (acos (cphi));\n vec3 normal = vec3 (sin (theta) * r, cos (theta) * r, cphi);\n vec4 rotation = Quaternion (vec3 (0.0, 0.0, 1.0), direction);\n\n return multVecQuat (normal, rotation);\n }\n\n vec3\n getRandomSphericalVelocity ()\n {\n vec3 normal = getRandomNormal ();\n float speed = getRandomSpeed ();\n\n return normal * speed;\n }\n\n // Algorithms\n\n int\n upperBound (const in sampler2D sampler, in int count, const in float value)\n {\n int first = 0;\n int step = 0;\n\n while (count > 0)\n {\n int index = first;\n\n step = count >> 1;\n\n index += step;\n\n if (value < texelFetch (sampler, index, 0) .x)\n {\n count = step;\n }\n else\n {\n first = ++ index;\n count -= step + 1;\n }\n }\n\n return first;\n }\n\n void\n interpolate (const in sampler2D sampler, const in int count, const in float fraction, out int index0, out int index1, out float weight)\n {\n // Determine index0, index1 and weight.\n\n if (count == 1 || fraction <= texelFetch (sampler, 0, 0) .x)\n {\n index0 = 0;\n index1 = 0;\n weight = 0.0;\n }\n else if (fraction >= texelFetch (sampler, count - 1, 0) .x)\n {\n index0 = count - 2;\n index1 = count - 1;\n weight = 1.0;\n }\n else\n {\n int index = upperBound (sampler, count, fraction);\n\n if (index < count)\n {\n index1 = index;\n index0 = index - 1;\n\n float key0 = texelFetch (sampler, index0, 0) .x;\n float key1 = texelFetch (sampler, index1, 0) .x;\n\n weight = clamp ((fraction - key0) / (key1 - key0), 0.0, 1.0);\n }\n else\n {\n index0 = 0;\n index1 = 0;\n weight = 0.0;\n }\n }\n }\n\n void\n interpolate (const in sampler2D sampler, const in int count, const in float fraction, out int index0)\n {\n // Determine index0.\n\n if (count == 1 || fraction <= texelFetch (sampler, 0, 0) .x)\n {\n index0 = 0;\n }\n else if (fraction >= texelFetch (sampler, count - 1, 0) .x)\n {\n index0 = count - 2;\n }\n else\n {\n int index = upperBound (sampler, count, fraction);\n\n if (index < count)\n index0 = index - 1;\n else\n index0 = 0;\n }\n }\n\n vec3\n getRandomBarycentricCoord ()\n {\n // Random barycentric coordinates.\n\n float u = random ();\n float v = random ();\n\n if (u + v > 1.0)\n {\n u = 1.0 - u;\n v = 1.0 - v;\n }\n\n float t = 1.0 - u - v;\n\n return vec3 (t, u, v);\n }\n\n void\n getRandomPointOnSurface (const in sampler2D surface, const in int verticesIndex, const in int normalsIndex, out vec4 position, out vec3 normal)\n {\n // Determine index0, index1 and weight.\n\n float lastAreaSoFar = texelFetch (surface, verticesIndex - 1, 0) .x;\n float fraction = random () * lastAreaSoFar;\n\n int index0;\n int index1;\n int index2;\n float weight;\n\n interpolate (surface, verticesIndex, fraction, index0, index1, weight);\n\n // Interpolate and return position.\n\n index0 *= 3;\n index1 = index0 + 1;\n index2 = index0 + 2;\n\n vec4 vertex0 = texelFetch (surface, verticesIndex + index0, 0);\n vec4 vertex1 = texelFetch (surface, verticesIndex + index1, 0);\n vec4 vertex2 = texelFetch (surface, verticesIndex + index2, 0);\n\n vec3 normal0 = texelFetch (surface, normalsIndex + index0, 0) .xyz;\n vec3 normal1 = texelFetch (surface, normalsIndex + index1, 0) .xyz;\n vec3 normal2 = texelFetch (surface, normalsIndex + index2, 0) .xyz;\n\n // Random barycentric coordinates.\n\n vec3 r = getRandomBarycentricCoord ();\n\n // Calculate position and direction.\n\n position = r .z * vertex0 + r .x * vertex1 + r .y * vertex2;\n normal = save_normalize (r .z * normal0 + r .x * normal1 + r .y * normal2);\n }\n\n // Functions\n\n ${this.functions.join("\n")}\n\n // Current values\n\n vec4\n getColor (const in float lifetime, const in float elapsedTime)\n {\n if (numColors > 0)\n {\n // Determine index0, index1 and weight.\n\n float fraction = elapsedTime / lifetime;\n\n int index0;\n int index1;\n float weight;\n\n interpolate (colorRamp, numColors, fraction, index0, index1, weight);\n\n // Interpolate and return color.\n\n vec4 color0 = texelFetch (colorRamp, numColors + index0, 0);\n vec4 color1 = texelFetch (colorRamp, numColors + index1, 0);\n\n return mix (color0, color1, weight);\n }\n else\n {\n return vec4 (1.0);\n }\n }\n\n void\n bounce (const in vec4 fromPosition, inout vec4 toPosition, inout vec3 velocity)\n {\n if (boundedHierarchyRoot < 0)\n return;\n\n Line3 line = Line3 (fromPosition .xyz, save_normalize (velocity));\n\n vec4 points [ARRAY_SIZE];\n vec3 normals [ARRAY_SIZE];\n\n int numIntersections = getIntersections (boundedVolume, boundedVerticesIndex, boundedNormalsIndex, boundedHierarchyIndex, boundedHierarchyRoot, line, points, normals);\n\n if (numIntersections == 0)\n return;\n\n Plane3 plane1 = plane3 (line .point, line .direction);\n\n int index = min_index (points, numIntersections, 0.0, plane1);\n\n if (index == -1)\n return;\n\n Plane3 plane2 = plane3 (points [index] .xyz, normals [index]);\n\n if (sign (plane_distance (plane2, fromPosition .xyz)) == sign (plane_distance (plane2, toPosition .xyz)))\n return;\n\n velocity = reflect (velocity, normals [index]);\n toPosition = vec4 (points [index] .xyz + reflect (points [index] .xyz - fromPosition .xyz, normals [index]), 1.0);\n }\n\n int\n getTexCoordIndex0 (const in float lifetime, const in float elapsedTime)\n {\n if (numTexCoords == 0)\n {\n return -1;\n }\n else\n {\n float fraction = elapsedTime / lifetime;\n int index0 = 0;\n\n interpolate (texCoordRamp, numTexCoords, fraction, index0);\n\n return numTexCoords + index0 * texCoordCount;\n }\n }\n\n void\n main ()\n {\n int life = int (input0 [0]);\n float lifetime = input0 [1];\n float elapsedTime = input0 [2] + deltaTime;\n\n srand ((gl_VertexID + randomSeed) * randomSeed);\n\n if (elapsedTime > lifetime)\n {\n // Create new particle or hide particle.\n\n lifetime = getRandomLifetime ();\n elapsedTime = 0.0;\n\n output0 = vec4 (max (life + 1, 1), lifetime, elapsedTime, getTexCoordIndex0 (lifetime, elapsedTime));\n\n if (createParticles)\n {\n output1 = getColor (lifetime, elapsedTime);\n output2 = vec4 (getRandomVelocity (), 0.0);\n output6 = getRandomPosition ();\n }\n else\n {\n output1 = vec4 (0.0);\n output2 = vec4 (0.0);\n output6 = vec4 (NaN);\n }\n }\n else\n {\n // Animate particle.\n\n vec3 velocity = input2 .xyz;\n vec4 position = input6;\n\n for (int i = 0; i < numForces; ++ i)\n {\n vec4 force = texelFetch (forces, i, 0);\n float turbulence = force .w;\n vec3 normal = getRandomNormalWithDirectionAndAngle (force .xyz, turbulence);\n float speed = length (force .xyz);\n\n velocity += normal * speed;\n }\n\n position .xyz += velocity * deltaTime;\n\n bounce (input6, position, velocity);\n\n output0 = vec4 (life, lifetime, elapsedTime, getTexCoordIndex0 (lifetime, elapsedTime));\n output1 = getColor (lifetime, elapsedTime);\n output2 = vec4 (velocity, 0.0);\n output6 = position;\n }\n\n switch (geometryType)\n {\n case POINT:\n case SPRITE:\n case GEOMETRY:\n {\n output3 = vec4 (1.0, 0.0, 0.0, 0.0);\n output4 = vec4 (0.0, 1.0, 0.0, 0.0);\n output5 = vec4 (0.0, 0.0, 1.0, 0.0);\n break;\n }\n case LINE:\n {\n mat3 r = Matrix3 (Quaternion (vec3 (0.0, 0.0, 1.0), output2 .xyz));\n mat3 s = mat3 (1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, particleSize .y);\n mat3 m = r * s;\n\n output3 = vec4 (m [0], 0.0);\n output4 = vec4 (m [1], 0.0);\n output5 = vec4 (m [2], 0.0);\n break;\n }\n default: // QUAD, TRIANGLE\n {\n output3 = vec4 (particleSize .x, 0.0, 0.0, 0.0);\n output4 = vec4 (0.0, particleSize .y, 0.0, 0.0);\n output5 = vec4 (0.0, 0.0, 1.0, 0.0);\n break;\n }\n }\n }\n `,i=t.createShader(t.VERTEX_SHADER);t.shaderSource(i,n),t.compileShader(i);const o=t.createShader(t.FRAGMENT_SHADER);t.shaderSource(o,"#version 300 es\n\n precision highp float;\n\n void\n main () { }\n "),t.compileShader(o);const r=t.createProgram();t.attachShader(r,i),t.attachShader(r,o),t.transformFeedbackVaryings(r,Array.from({length:7},((e,t)=>"output"+t)),t.INTERLEAVED_ATTRIBS),t.linkProgram(r),t.getProgramParameter(r,t.LINK_STATUS)||console.error("Couldn't initialize particle shader: "+t.getProgramInfoLog(r)),r.inputs=[[0,t.getAttribLocation(r,"input0")],[2,t.getAttribLocation(r,"input2")],[6,t.getAttribLocation(r,"input6")]],r.randomSeed=t.getUniformLocation(r,"randomSeed"),r.geometryType=t.getUniformLocation(r,"geometryType"),r.createParticles=t.getUniformLocation(r,"createParticles"),r.particleLifetime=t.getUniformLocation(r,"particleLifetime"),r.lifetimeVariation=t.getUniformLocation(r,"lifetimeVariation"),r.deltaTime=t.getUniformLocation(r,"deltaTime"),r.particleSize=t.getUniformLocation(r,"particleSize"),r.numForces=t.getUniformLocation(r,"numForces"),r.forces=t.getUniformLocation(r,"forces"),r.boundedVerticesIndex=t.getUniformLocation(r,"boundedVerticesIndex"),r.boundedNormalsIndex=t.getUniformLocation(r,"boundedNormalsIndex"),r.boundedHierarchyIndex=t.getUniformLocation(r,"boundedHierarchyIndex"),r.boundedHierarchyRoot=t.getUniformLocation(r,"boundedHierarchyRoot"),r.boundedVolume=t.getUniformLocation(r,"boundedVolume"),r.numColors=t.getUniformLocation(r,"numColors"),r.colorRamp=t.getUniformLocation(r,"colorRamp"),r.texCoordCount=t.getUniformLocation(r,"texCoordCount"),r.numTexCoords=t.getUniformLocation(r,"numTexCoords"),r.texCoordRamp=t.getUniformLocation(r,"texCoordRamp");for(const e of Object.keys(this.uniforms))r[e]=t.getUniformLocation(r,e);r.NaN=t.getUniformLocation(r,"NaN"),t.useProgram(r);for(const n of this.samplers){const i=t.getUniformLocation(r,n);t.uniform1i(i,r[n+"TextureUnit"]=e.getTexture2DUnit())}return t.uniform1f(r.NaN,NaN),e.resetTextureUnits(),r},activateTextures:function(){},createTexture:function(){const e=this.getBrowser().getContext(),t=e.createTexture();return e.bindTexture(e.TEXTURE_2D,t),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texImage2D(e.TEXTURE_2D,0,e.RGBA32F,1,1,0,e.RGBA,e.FLOAT,new Float32Array(4)),t},getTexture2DUnit:function(e,t,n){const i=t[n];return void 0===i?t[n]=e.getTexture2DUnit():i}});const x=f,_=window[Symbol.for("X_ITE.X3D-8.0.0")].require("standard/Math/Numbers/Vector3");var g=e.n(_);function y(e){x.call(this,e),this.addType(p().PointEmitter),this._position.setUnit("length"),this.addUniform("position","uniform vec3 position;"),this.addUniform("direction","uniform vec3 direction;"),this.addFunction("vec3 getRandomVelocity ()\n {\n if (direction == vec3 (0.0))\n return getRandomSphericalVelocity ();\n\n else\n return direction * getRandomSpeed ();\n }"),this.addFunction("vec4 getRandomPosition ()\n {\n return vec4 (position, 1.0);\n }")}y.prototype=Object.assign(Object.create(x.prototype),{constructor:y,[Symbol.for("X_ITE.X3DBaseNode.fieldDefinitions")]:new(c())([new(s())(p().inputOutput,"metadata",new(o().SFNode)),new(s())(p().inputOutput,"on",new(o().SFBool)(!0)),new(s())(p().inputOutput,"position",new(o().SFVec3f)),new(s())(p().inputOutput,"direction",new(o().SFVec3f)(0,1,0)),new(s())(p().inputOutput,"speed",new(o().SFFloat)),new(s())(p().inputOutput,"variation",new(o().SFFloat)(.25)),new(s())(p().inputOutput,"mass",new(o().SFFloat)),new(s())(p().inputOutput,"surfaceArea",new(o().SFFloat))]),getTypeName:function(){return"PointEmitter"},getComponentName:function(){return"ParticleSystems"},getContainerField:function(){return"emitter"},initialize:function(){x.prototype.initialize.call(this),this.getBrowser().getContext().getVersion()<2||(this._position.addInterest("set_position__",this),this._direction.addInterest("set_direction__",this),this.set_position__(),this.set_direction__())},set_position__:function(){const e=this._position.getValue();this.setUniform("uniform3f","position",e.x,e.y,e.z)},set_direction__:function(){const e=new(g())(0,0,0);return function(){e.assign(this._direction.getValue()).normalize(),this.setUniform("uniform3f","direction",e.x,e.y,e.z)}}()});const v=y,T=Symbol();Symbol();function w(){}w.prototype={getDefaultEmitter:function(){return this[T]=new v(this.getPrivateScene()),this[T].setPrivate(!0),this[T].setup(),this.getDefaultEmitter=function(){return this[T]},Object.defineProperty(this,"getDefaultEmitter",{enumerable:!1}),this[T]}};const R=w;function b(e){u().call(this,e),this.addType(p().X3DParticlePhysicsModelNode)}b.prototype=Object.assign(Object.create(u().prototype),{constructor:b,addForce:function(){}});const F=b,I=window[Symbol.for("X_ITE.X3D-8.0.0")].require("x_ite/Base/X3DCast");var E=e.n(I);function A(e){F.call(this,e),this.addType(p().BoundedPhysicsModel)}A.prototype=Object.assign(Object.create(F.prototype),{constructor:A,[Symbol.for("X_ITE.X3DBaseNode.fieldDefinitions")]:new(c())([new(s())(p().inputOutput,"metadata",new(o().SFNode)),new(s())(p().inputOutput,"enabled",new(o().SFBool)(!0)),new(s())(p().inputOutput,"geometry",new(o().SFNode))]),getTypeName:function(){return"BoundedPhysicsModel"},getComponentName:function(){return"ParticleSystems"},getContainerField:function(){return"physics"},initialize:function(){F.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=E()(p().X3DGeometryNode,this._geometry),this.geometryNode&&this.geometryNode._rebuild.addInterest("addNodeEvent",this)},addGeometry:function(e,t){if(this.geometryNode&&this._enabled.getValue()){const n=this.geometryNode.getNormals().getValue(),i=this.geometryNode.getVertices().getValue();for(const t of n)e.push(t);for(const e of i)t.push(e)}}});const S=A;function N(e){x.call(this,e),this.addType(p().ConeEmitter),this._position.setUnit("length"),this._angle.setUnit("angle"),this.addUniform("position","uniform vec3 position;"),this.addUniform("direction","uniform vec3 direction;"),this.addUniform("angle","uniform float angle;"),this.addFunction("vec3 getRandomVelocity ()\n {\n if (direction == vec3 (0.0))\n {\n return getRandomSphericalVelocity ();\n }\n else\n {\n vec3 normal = getRandomNormalWithDirectionAndAngle (direction, angle);\n float speed = getRandomSpeed ();\n\n return normal * speed;\n }\n }"),this.addFunction("vec4 getRandomPosition ()\n {\n return vec4 (position, 1.0);\n }")}N.prototype=Object.assign(Object.create(x.prototype),{constructor:N,[Symbol.for("X_ITE.X3DBaseNode.fieldDefinitions")]:new(c())([new(s())(p().inputOutput,"metadata",new(o().SFNode)),new(s())(p().inputOutput,"on",new(o().SFBool)(!0)),new(s())(p().inputOutput,"position",new(o().SFVec3f)),new(s())(p().inputOutput,"direction",new(o().SFVec3f)(0,1,0)),new(s())(p().inputOutput,"angle",new(o().SFFloat)(.7854)),new(s())(p().inputOutput,"speed",new(o().SFFloat)),new(s())(p().inputOutput,"variation",new(o().SFFloat)(.25)),new(s())(p().inputOutput,"mass",new(o().SFFloat)),new(s())(p().inputOutput,"surfaceArea",new(o().SFFloat))]),getTypeName:function(){return"ConeEmitter"},getComponentName:function(){return"ParticleSystems"},getContainerField:function(){return"emitter"},initialize:function(){x.prototype.initialize.call(this),this.getBrowser().getContext().getVersion()<2||(this._position.addInterest("set_position__",this),this._direction.addInterest("set_direction__",this),this._angle.addInterest("set_angle__",this),this.set_position__(),this.set_direction__(),this.set_angle__())},set_position__:function(){const e=this._position.getValue();this.setUniform("uniform3f","position",e.x,e.y,e.z)},set_direction__:function(){const e=this._direction.getValue();this.setUniform("uniform3f","direction",e.x,e.y,e.z)},set_angle__:function(){this.setUniform("uniform1f","angle",this._angle.getValue())}});const P=N;function C(e){x.call(this,e),this.addType(p().ExplosionEmitter),this._position.setUnit("length"),this.addUniform("position","uniform vec3 position;"),this.addFunction("vec3 getRandomVelocity ()\n {\n return getRandomSphericalVelocity ();\n }"),this.addFunction("vec4 getRandomPosition ()\n {\n return vec4 (position, 1.0);\n }")}C.prototype=Object.assign(Object.create(x.prototype),{constructor:C,[Symbol.for("X_ITE.X3DBaseNode.fieldDefinitions")]:new(c())([new(s())(p().inputOutput,"metadata",new(o().SFNode)),new(s())(p().inputOutput,"on",new(o().SFBool)(!0)),new(s())(p().inputOutput,"position",new(o().SFVec3f)),new(s())(p().inputOutput,"speed",new(o().SFFloat)),new(s())(p().inputOutput,"variation",new(o().SFFloat)(.25)),new(s())(p().inputOutput,"mass",new(o().SFFloat)),new(s())(p().inputOutput,"surfaceArea",new(o().SFFloat))]),getTypeName:function(){return"ExplosionEmitter"},getComponentName:function(){return"ParticleSystems"},getContainerField:function(){return"emitter"},initialize:function(){x.prototype.initialize.call(this),this.getBrowser().getContext().getVersion()<2||(this._position.addInterest("set_position__",this),this.set_position__())},isExplosive:function(){return!0},set_position__:function(){const e=this._position.getValue();this.setUniform("uniform3f","position",e.x,e.y,e.z)}});const D=C;function O(e){F.call(this,e),this.addType(p().ForcePhysicsModel),this._force.setUnit("force")}O.prototype=Object.assign(Object.create(F.prototype),{constructor:O,[Symbol.for("X_ITE.X3DBaseNode.fieldDefinitions")]:new(c())([new(s())(p().inputOutput,"metadata",new(o().SFNode)),new(s())(p().inputOutput,"enabled",new(o().SFBool)(!0)),new(s())(p().inputOutput,"force",new(o().SFVec3f)(0,-9.8,0))]),getTypeName:function(){return"ForcePhysicsModel"},getComponentName:function(){return"ParticleSystems"},getContainerField:function(){return"physics"},addForce:function(){const e=new(g())(0,0,0);return function(t,n,i,o){return!!this._enabled.getValue()&&(o.set(e.assign(this._force.getValue()).multiply(i),4*t),o[4*t+3]=0,!0)}}()});const B=O,V=window[Symbol.for("X_ITE.X3D-8.0.0")].require("x_ite/Components/Shape/X3DShapeNode");var U=e.n(V);const z=window[Symbol.for("X_ITE.X3D-8.0.0")].require("x_ite/Browser/Rendering/GeometryContext");var M=e.n(z);const X=window[Symbol.for("X_ITE.X3D-8.0.0")].require("x_ite/Rendering/VertexArray");var L=e.n(X);const q=window[Symbol.for("X_ITE.X3D-8.0.0")].require("x_ite/Rendering/TraverseType");var j=e.n(q);const H=window[Symbol.for("X_ITE.X3D-8.0.0")].require("x_ite/Browser/Shape/AlphaMode");var k=e.n(H);const G=window[Symbol.for("X_ITE.X3D-8.0.0")].require("standard/Math/Numbers/Matrix4");var Y=e.n(G);const W=window[Symbol.for("X_ITE.X3D-8.0.0")].require("standard/Math/Numbers/Matrix3");var K=e.n(W);const Z=window[Symbol.for("X_ITE.X3D-8.0.0")].require("standard/Math/Geometry/Plane3");var Q=e.n(Z);const $=window[Symbol.for("X_ITE.X3D-8.0.0")].require("standard/Math/Algorithms/QuickSort");var J=e.n($);const ee=new(g())(0,0,0),te=new(g())(0,0,0),ne=new(g())(0,0,0),ie={u:0,v:0,t:0},oe=[new(g())(0,0,1),new(g())(0,0,-1),new(g())(0,1,0),new(g())(0,-1,0),new(g())(1,0,0)];function re(e,t){this.vertices=e.vertices,this.normals=e.normals,this.triangle=t,this.i4=12*t,this.i3=9*t}function se(e,t,n,i){this.min=new(g())(0,0,0),this.max=new(g())(0,0,0),this.planes=[],this.intersection=new(g())(0,0,0);const o=e.vertices,r=this.min,s=this.max,a=n+i;let c=12*t[n];r.set(o[c],o[c+1],o[c+2]),s.assign(r);for(let e=n;e<a;++e)c=12*t[e],ee.set(o[c],o[c+1],o[c+2]),te.set(o[c+4],o[c+5],o[c+6]),ne.set(o[c+8],o[c+9],o[c+10]),r.min(ee,te,ne),s.max(ee,te,ne);for(let e=0;e<5;++e)this.planes[e]=new(Q())(e%2?r:s,oe[e]);if(i>2){e.sorter.compare.axis=this.getLongestAxis(r,s),e.sorter.sort(n,a);var l=i>>>1}else l=1;const u=i-l;this.left=l>1?new se(e,t,n,l):new re(e,t[n]),this.right=u>1?new se(e,t,n+l,u):new re(e,t[n+l])}function ae(e,t){const n=e.length/12;switch(this.vertices=e,this.normals=t,n){case 0:this.root=null;break;case 1:this.root=new re(this,0);break;default:{const t=[];for(let e=0;e<n;++e)t.push(e);this.sorter=new(J())(t,function(e,t){return function(n,i){return Math.min(e[n+t],e[n+4+t],e[n+8+t])<Math.min(e[i+t],e[i+4+t],e[i+8+t])}}(e,0)),this.root=new se(this,t,0,n);break}}}re.prototype={intersectsLine:function(e,t,n){const i=this.vertices,o=this.normals,r=this.i4,s=this.i3;if(ee.x=i[r],ee.y=i[r+1],ee.z=i[r+2],te.x=i[r+4],te.y=i[r+5],te.z=i[r+6],ne.x=i[r+8],ne.y=i[r+9],ne.z=i[r+10],e.intersectsTriangle(ee,te,ne,ie)){const e=ie.u,a=ie.v,c=1-e-a,l=t.size++;l>=t.length&&t.push(new(g())(0,0,0)),t[l].set(c*i[r]+e*i[r+4]+a*i[r+8],c*i[r+1]+e*i[r+5]+a*i[r+9],c*i[r+2]+e*i[r+6]+a*i[r+10]),n&&(l>=n.length&&n.push(new(g())(0,0,0)),n[l].set(c*o[s]+e*o[s+3]+a*o[s+6],c*o[s+1]+e*o[s+4]+a*o[s+7],c*o[s+2]+e*o[s+5]+a*o[s+8]))}},toArray:function(e){const t=e.length/4;return e.push(1,3*this.triangle,0,0),t}},se.prototype={intersectsLine:function(e,t,n){this.intersectsBBox(e)&&(this.left.intersectsLine(e,t,n),this.right.intersectsLine(e,t,n))},intersectsBBox:function(e){const t=this.planes,n=this.min,i=this.max,o=n.x,r=i.x,s=n.y,a=i.y,c=n.z,l=i.z,u=this.intersection;return!!(t[0].intersectsLine(e,u)&&u.x>=o&&u.x<=r&&u.y>=s&&u.y<=a)||(!!(t[1].intersectsLine(e,u)&&u.x>=o&&u.x<=r&&u.y>=s&&u.y<=a)||(!!(t[2].intersectsLine(e,u)&&u.x>=o&&u.x<=r&&u.z>=c&&u.z<=l)||(!!(t[3].intersectsLine(e,u)&&u.x>=o&&u.x<=r&&u.z>=c&&u.z<=l)||!!(t[4].intersectsLine(e,u)&&u.y>=s&&u.y<=a&&u.z>=c&&u.z<=l))))},getLongestAxis:function(e,t){const n=t.x-e.x,i=t.y-e.y,o=t.z-e.z;return n<i?i<o?2:1:n<o?2:0},toArray:function(e){const t=this.left.toArray(e),n=this.right.toArray(e),i=this.min,o=this.max,r=e.length/4;return e.push(0,t,n,0,i.x,i.y,i.z,0,o.x,o.y,o.z,0),r}},ae.prototype={constructor:ae,intersectsLine:function(e,t,n){return t.size=0,this.root?(this.root.intersectsLine(e,t,n),t.size):0},toArray:function(e){if(this.root){const t=this.root.toArray(e);e.push(t,0,0,0)}return e}};const ce=ae,le=new Float32Array([0,0,0,1]),ue=new Float32Array([0,0,0,1,1,0,0,1,0,0,-.5,1,0,0,.5,1]),de=new Float32Array([0,0,0,1,1,0,0,1,1,1,0,1,0,0,0,1,1,1,0,1,0,1,0,1,0,0,1,-.5,-.5,0,1,.5,-.5,0,1,.5,.5,0,1,-.5,-.5,0,1,.5,.5,0,1,-.5,.5,0,1]);function me(e){U().call(this,e),this.addType(p().ParticleSystem),this._particleSize.setUnit("length");const t=this.getBrowser();this.maxParticles=0,this.numParticles=0,this.forcePhysicsModelNodes=[],this.forces=new Float32Array(4),this.boundedPhysicsModelNodes=[],this.boundedNormals=[],this.boundedVertices=[],this.colorRamp=new Float32Array,this.texCoordRamp=new Float32Array,this.geometryContext=new(M())({textureCoordinateNode:t.getDefaultTextureCoordinate()}),this.creationTime=0,this.pauseTime=0,this.deltaTime=0,this.particleStride=7*Float32Array.BYTES_PER_ELEMENT*4,this.particleOffsets=Array.from({length:7},((e,t)=>4*Float32Array.BYTES_PER_ELEMENT*t)),this.particleOffset=this.particleOffsets[0],this.colorOffset=this.particleOffsets[1],this.matrixOffset=this.particleOffsets[3],this.texCoordOffset=0}me.prototype=Object.assign(Object.create(U().prototype),{constructor:me,[Symbol.for("X_ITE.X3DBaseNode.fieldDefinitions")]:new(c())([new(s())(p().inputOutput,"metadata",new(o().SFNode)),new(s())(p().inputOutput,"enabled",new(o().SFBool)(!0)),new(s())(p().inputOutput,"createParticles",new(o().SFBool)(!0)),new(s())(p().initializeOnly,"geometryType",new(o().SFString)("QUAD")),new(s())(p().inputOutput,"maxParticles",new(o().SFInt32)(200)),new(s())(p().inputOutput,"particleLifetime",new(o().SFFloat)(5)),new(s())(p().inputOutput,"lifetimeVariation",new(o().SFFloat)(.25)),new(s())(p().inputOutput,"particleSize",new(o().SFVec2f)(.02,.02)),new(s())(p().initializeOnly,"emitter",new(o().SFNode)),new(s())(p().initializeOnly,"physics",new(o().MFNode)),new(s())(p().initializeOnly,"colorKey",new(o().MFFloat)),new(s())(p().initializeOnly,"colorRamp",new(o().SFNode)),new(s())(p().initializeOnly,"texCoordKey",new(o().MFFloat)),new(s())(p().initializeOnly,"texCoordRamp",new(o().SFNode)),new(s())(p().outputOnly,"isActive",new(o().SFBool)),new(s())(p().inputOutput,"visible",new(o().SFBool)(!0)),new(s())(p().inputOutput,"castShadow",new(o().SFBool)(!0)),new(s())(p().inputOutput,"bboxDisplay",new(o().SFBool)),new(s())(p().initializeOnly,"bboxSize",new(o().SFVec3f)(-1,-1,-1)),new(s())(p().initializeOnly,"bboxCenter",new(o().SFVec3f)),new(s())(p().inputOutput,"appearance",new(o().SFNode)),new(s())(p().inputOutput,"geometry",new(o().SFNode))]),getTypeName:function(){return"ParticleSystem"},getComponentName:function(){return"ParticleSystems"},getContainerField:function(){return"children"},initialize:function(){U().prototype.initialize.call(this);const e=this.getBrowser();e.getContext().getVersion()<2||(this.isLive().addInterest("set_live__",this),this._enabled.addInterest("set_enabled__",this),this._createParticles.addInterest("set_createParticles__",this),this._geometryType.addInterest("set_geometryType__",this),this._geometryType.addInterest("set_texCoord__",this),this._maxParticles.addInterest("set_enabled__",this),this._particleLifetime.addInterest("set_particleLifetime__",this),this._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.inputParticles=this.createBuffer(),this.outputParticles=this.createBuffer(),this.inputParticles.emitterArrayObject=new(L()),this.inputParticles.vertexArrayObject=new(L()),this.inputParticles.shadowArrayObject=new(L()),this.outputParticles.emitterArrayObject=new(L()),this.outputParticles.vertexArrayObject=new(L()),this.outputParticles.shadowArrayObject=new(L()),this.forcesTexture=this.createTexture(),this.boundedTexture=this.createTexture(),this.colorRampTexture=this.createTexture(),this.texCoordRampTexture=this.createTexture(),this.geometryBuffer=this.createBuffer(),this.texCoordBuffers=new Array(e.getMaxTextures()).fill(this.geometryBuffer),this.set_emitter__(),this.set_enabled__(),this.set_geometryType__(),this.set_createParticles__(),this.set_particleLifetime__(),this.set_lifetimeVariation__(),this.set_physics__(),this.set_colorRamp__(),this.set_texCoordRamp__())},getShapeKey:function(){return this.numTexCoords?"2":"1"},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()===k().AUTO)if(this.geometryType===m.POINT)this.setTransparent(!0);else this.setTransparent(this.getAppearance().getTransparent()||this.colorRampNode&&this.colorRampNode.getTransparent()||this.geometryType===m.GEOMETRY&&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+=Date.now()/1e3-this.pauseTime,this.pauseTime=0)):this._isActive.getValue()&&this._maxParticles.getValue()&&(this.getBrowser().sensorEvents().removeInterest("animateParticles",this),0===this.pauseTime&&(this.pauseTime=Date.now()/1e3))},set_enabled__:function(){this._enabled.getValue()&&this._maxParticles.getValue()?this._isActive.getValue()||(this.isLive().getValue()?(this.getBrowser().sensorEvents().addInterest("animateParticles",this),this.pauseTime=0):this.pauseTime=Date.now()/1e3,this._isActive=!0,delete this.traverse):this._isActive.getValue()&&(this.isLive().getValue()&&this.getBrowser().sensorEvents().removeInterest("animateParticles",this),this._isActive=!1,this.numParticles=0,this.traverse=Function.prototype),this.set_maxParticles__()},set_createParticles__:function(){this.createParticles=this._createParticles.getValue()},set_geometryType__:function(){const e=this.getBrowser().getContext();switch(this.geometryType=this.getEnum(m,this._geometryType.getValue(),m.QUAD),this.geometryType){case m.POINT:this.geometryContext.geometryType=0,this.geometryContext.hasNormals=!1,this.texCoordCount=0,this.vertexCount=1,this.hasNormals=!1,this.verticesOffset=0,this.primitiveMode=e.POINTS,e.bindBuffer(e.ARRAY_BUFFER,this.geometryBuffer),e.bufferData(e.ARRAY_BUFFER,le,e.DYNAMIC_DRAW);break;case m.LINE:this.geometryContext.geometryType=1,this.geometryContext.hasNormals=!1,this.texCoordCount=2,this.vertexCount=2,this.hasNormals=!1,this.texCoordsOffset=0,this.verticesOffset=8*Float32Array.BYTES_PER_ELEMENT,this.primitiveMode=e.LINES,e.bindBuffer(e.ARRAY_BUFFER,this.geometryBuffer),e.bufferData(e.ARRAY_BUFFER,ue,e.DYNAMIC_DRAW);break;case m.TRIANGLE:case m.QUAD:case m.SPRITE:this.geometryContext.geometryType=2,this.geometryContext.hasNormals=!0,this.texCoordCount=4,this.vertexCount=6,this.hasNormals=!0,this.texCoordsOffset=0,this.normalOffset=24*Float32Array.BYTES_PER_ELEMENT,this.verticesOffset=27*Float32Array.BYTES_PER_ELEMENT,this.primitiveMode=e.TRIANGLES,e.bindBuffer(e.ARRAY_BUFFER,this.geometryBuffer),e.bufferData(e.ARRAY_BUFFER,de,e.DYNAMIC_DRAW);break;case m.GEOMETRY:this.texCoordCount=0}this.geometryContext.updateGeometryKey(),this.updateVertexArrays(),this.set_transparent__()},set_maxParticles__:function(){const e=this.numParticles,t=Math.max(0,this._maxParticles.getValue());this.maxParticles=t,this.numParticles=Math.min(e,t),this.emitterNode.isExplosive()||(this.creationTime=Date.now()/1e3),this.resizeBuffers(e),this.updateVertexArrays()},set_particleLifetime__:function(){this.particleLifetime=this._particleLifetime.getValue()},set_lifetimeVariation__:function(){this.lifetimeVariation=this._lifetimeVariation.getValue()},set_emitter__:function(){this.emitterNode=E()(p().X3DParticleEmitterNode,this._emitter),this.emitterNode||(this.emitterNode=this.getBrowser().getDefaultEmitter()),this.createParticles=this._createParticles.getValue()},set_physics__:function(){const e=this._physics.getValue(),t=this.forcePhysicsModelNodes,n=this.boundedPhysicsModelNodes;for(let e=0,t=n.length;e<t;++e)n[e].removeInterest("set_boundedPhysics__",this);t.length=0,n.length=0;for(let i=0,o=e.length;i<o;++i)try{const o=e[i].getValue().getInnerNode(),r=o.getType();for(let e=r.length-1;e>=0;--e){switch(r[e]){case p().ForcePhysicsModel:case p().WindPhysicsModel:t.push(o);break;case p().BoundedPhysicsModel:o.addInterest("set_boundedPhysics__",this),n.push(o);break;default:continue}break}}catch(e){}this.set_boundedPhysics__()},set_boundedPhysics__:function(){const e=this.getBrowser().getContext(),t=this.boundedPhysicsModelNodes,n=this.boundedNormals,i=this.boundedVertices;n.length=0,i.length=0;for(let e=0,o=t.length;e<o;++e)t[e].addGeometry(n,i);const o=new ce(i,n).toArray([]),r=i.length/4,s=n.length/3,a=o.length/4,c=Math.ceil(Math.sqrt(r+s+a)),l=new Float32Array(c*c*4);this.boundedVerticesIndex=0,this.boundedNormalsIndex=r,this.boundedHierarchyIndex=this.boundedNormalsIndex+s,this.boundedHierarchyRoot=this.boundedHierarchyIndex+a-1,l.set(i);for(let e=4*this.boundedNormalsIndex,t=0,i=n.length;t<i;e+=4,t+=3)l[e+0]=n[t+0],l[e+1]=n[t+1],l[e+2]=n[t+2];l.set(o,4*this.boundedHierarchyIndex),c&&(e.bindTexture(e.TEXTURE_2D,this.boundedTexture),e.texImage2D(e.TEXTURE_2D,0,e.RGBA32F,c,c,0,e.RGBA,e.FLOAT,l))},set_colorRamp__:function(){this.colorRampNode&&this.colorRampNode.removeInterest("set_color__",this),this.colorRampNode=E()(p().X3DColorNode,this._colorRamp),this.colorRampNode&&this.colorRampNode.addInterest("set_color__",this),this.set_color__(),this.set_transparent__()},set_color__:function(){const e=this.getBrowser().getContext(),t=this._colorKey,n=t.length,i=Math.ceil(Math.sqrt(2*n));let o=this.colorRamp;i*i*4>o.length&&(o=this.colorRamp=new Float32Array(i*i*4));for(let e=0;e<n;++e)o[4*e]=t[e];this.colorRampNode?o.set(this.colorRampNode.addColors([],n).slice(0,4*n),4*n):o.fill(1,4*n),i&&(e.bindTexture(e.TEXTURE_2D,this.colorRampTexture),e.texImage2D(e.TEXTURE_2D,0,e.RGBA32F,i,i,0,e.RGBA,e.FLOAT,o)),this.numColors=n,this.geometryContext.colorMaterial=!(!n||!this.colorRampNode),this.geometryContext.updateGeometryKey(),this.updateVertexArrays()},set_texCoordRamp__:function(){this.texCoordRampNode&&this.texCoordRampNode.removeInterest("set_texCoord__",this),this.texCoordRampNode=E()(p().X3DTextureCoordinateNode,this._texCoordRamp),this.texCoordRampNode&&this.texCoordRampNode.addInterest("set_texCoord__",this),this.set_texCoord__()},set_texCoord__:function(){const e=this.getBrowser().getContext(),t=this._texCoordKey,n=t.length,i=Math.ceil(Math.sqrt(n+n*this.texCoordCount));let o=this.texCoordRamp;i*i*4>o.length?o=this.texCoordRamp=new Float32Array(i*i*4):o.fill(0);for(let e=0;e<n;++e)o[4*e]=t[e];this.texCoordRampNode&&o.set(this.texCoordRampNode.getTexCoord([]).slice(0,n*this.texCoordCount*4),4*n),i&&(e.bindTexture(e.TEXTURE_2D,this.texCoordRampTexture),e.texImage2D(e.TEXTURE_2D,0,e.RGBA32F,i,i,0,e.RGBA,e.FLOAT,o)),this.numTexCoords=this.texCoordRampNode?n:0,this.updateVertexArrays()},updateVertexArrays:function(){this.inputParticles.vertexArrayObject.update(),this.inputParticles.shadowArrayObject.update(),this.inputParticles.emitterArrayObject.update(),this.outputParticles.vertexArrayObject.update(),this.outputParticles.shadowArrayObject.update(),this.outputParticles.emitterArrayObject.update()},createTexture:function(){const e=this.getBrowser().getContext(),t=e.createTexture();return e.bindTexture(e.TEXTURE_2D,t),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texImage2D(e.TEXTURE_2D,0,e.RGBA32F,1,1,0,e.RGBA,e.FLOAT,new Float32Array(4)),t},createBuffer:function(){const e=this.getBrowser().getContext(),t=e.createBuffer();return e.bindBuffer(e.ARRAY_BUFFER,t),e.bufferData(e.ARRAY_BUFFER,new Uint32Array,e.DYNAMIC_DRAW),t},resizeBuffers:function(e){const t=this.getBrowser().getContext(),n=this.maxParticles,i=this.particleStride,o=Object.assign(t.createBuffer(),this.outputParticles),r=new Uint8Array(n*i);t.bindBuffer(t.ARRAY_BUFFER,this.inputParticles),t.bufferData(t.ARRAY_BUFFER,r,t.DYNAMIC_DRAW),t.bindBuffer(t.COPY_READ_BUFFER,this.outputParticles),t.bindBuffer(t.ARRAY_BUFFER,o),t.bufferData(t.ARRAY_BUFFER,r,t.DYNAMIC_DRAW),t.copyBufferSubData(t.COPY_READ_BUFFER,t.ARRAY_BUFFER,0,0,Math.min(n*i,e*i)),t.deleteBuffer(this.outputParticles),this.outputParticles=o},animateParticles:function(){const e=this.getBrowser(),t=e.getContext(),n=this.emitterNode,i=1/Math.max(10,this.getBrowser().getCurrentFrameRate());let o=this.deltaTime=(14*this.deltaTime+i)/15;if(n.isExplosive()){const e=Date.now()/1e3,t=this.particleLifetime+this.particleLifetime*this.lifetimeVariation;e-this.creationTime>t?(this.creationTime=e,this.numParticles=this.maxParticles,this.createParticles=this._createParticles.getValue(),o=Number.POSITIVE_INFINITY):this.createParticles=!1}else if(this.numParticles<this.maxParticles){const e=Date.now()/1e3,t=Math.max(0,Math.floor((e-this.creationTime)*this.maxParticles/this.particleLifetime));t&&(this.creationTime=e),this.numParticles=Math.min(this.maxParticles,this.numParticles+t)}if(n.getMass()){const e=this.forcePhysicsModelNodes;let i=e.length,r=this.forces,s=o/n.getMass();4*i>r.length&&(r=this.forces=new Float32Array(4*i));let a=0;for(let t=0;t<i;++t)a+=!e[t].addForce(t-a,n,s,r);this.numForces=i-=a,i&&(t.bindTexture(t.TEXTURE_2D,this.forcesTexture),t.texImage2D(t.TEXTURE_2D,0,t.RGBA32F,i,1,0,t.RGBA,t.FLOAT,r))}else this.numForces=0;const r=this.outputParticles;this.outputParticles=this.inputParticles,this.inputParticles=r,n.animate(this,o),e.addBrowserEvent()},updateSprite:function(){const e=new Float32Array(de),t=[new(g())(-.5,-.5,0),new(g())(.5,-.5,0),new(g())(.5,.5,0),new(g())(-.5,-.5,0),new(g())(.5,.5,0),new(g())(-.5,.5,0)],n=new(g())(0,0,0),i=new(g())(0,0,0);return function(o,r){for(let t=0;t<3;++t)e[24+t]=r[6+t];i.set(this._particleSize.x,this._particleSize.y,1);for(let o=0;o<6;++o){const s=27+4*o;r.multVecMatrix(n.assign(t[o]).multVec(i)),e[s+0]=n.x,e[s+1]=n.y,e[s+2]=n.z}o.bindBuffer(o.ARRAY_BUFFER,this.geometryBuffer),o.bufferData(o.ARRAY_BUFFER,e,o.DYNAMIC_DRAW)}}(),intersectsBox:function(e,t){},traverse:function(e,t){switch(e){case j().POINTER:case j().PICKING:case j().COLLISION:break;case j().SHADOW:this._castShadow.getValue()&&t.addShadowShape(this);break;case j().DISPLAY:t.addDisplayShape(this)&&this.getAppearance().traverse(e,t)}this.geometryType===m.GEOMETRY&&this.getGeometry()&&this.getGeometry().traverse(e,t)},depth:function(e,t,n){if(this.numParticles){const i=t.clipPlanes,o=this.getBrowser().getDepthShader(i.length,!0);switch(o.enable(e),o.setClipPlanes(e,i),e.uniformMatrix4fv(o.x3d_ProjectionMatrix,!1,n),e.uniformMatrix4fv(o.x3d_ModelViewMatrix,!1,t.modelViewMatrix),this.geometryType){case m.GEOMETRY:{const n=this.getGeometry();n&&n.displayParticlesDepth(e,t,o,this);break}case m.SPRITE:this.updateSprite(e,this.getScreenAlignedRotation(t.modelViewMatrix));default:{const t=this.outputParticles;if(t.shadowArrayObject.enable(e,o)){const n=this.particleStride;o.enableParticleAttribute(e,t,n,this.particleOffset,1),o.enableParticleMatrixAttribute(e,t,n,this.matrixOffset,1),o.enableVertexAttribute(e,this.geometryBuffer,0,this.verticesOffset)}e.drawArraysInstanced(this.primitiveMode,0,this.vertexCount,this.numParticles);break}}}},display:function(e,t){switch(this.geometryType){case m.GEOMETRY:if(this.numParticles){const n=this.getGeometry();n&&n.displayParticles(e,t,this)}break;case m.SPRITE:this.updateSprite(e,this.getScreenAlignedRotation(t.modelViewMatrix));case m.QUAD:case m.TRIANGLE:{const n=Y().prototype.determinant3.call(t.modelViewMatrix)>0;e.frontFace(n?e.CCW:e.CW),e.enable(e.CULL_FACE),e.cullFace(e.BACK)}default:{const n=this.getBrowser(),i=this.getAppearance(),o=i.getShader(this.geometryContext,t),r=n.getPrimitiveMode(this.primitiveMode);if(this.numParticles){const s=i.getBlendMode();if(s&&s.enable(e),o.enable(e),o.setUniforms(e,this.geometryContext,t),this.numTexCoords){const t=n.getTexture2DUnit();e.activeTexture(e.TEXTURE0+t),e.bindTexture(e.TEXTURE_2D,this.texCoordRampTexture),e.uniform1i(o.x3d_TexCoordRamp,t)}const a=this.outputParticles;if(a.vertexArrayObject.enable(e,o)){const t=this.particleStride;o.enableParticleAttribute(e,a,t,this.particleOffset,1),o.enableParticleMatrixAttribute(e,a,t,this.matrixOffset,1),this.geometryContext.colorMaterial&&(o.enableColorAttribute(e,a,t,this.colorOffset),o.colorAttributeDivisor(e,1)),this.texCoordCount&&o.enableTexCoordAttribute(e,this.texCoordBuffers,0,this.texCoordOffset),this.hasNormals&&(o.enableNormalAttribute(e,this.geometryBuffer,0,this.normalOffset),o.normalAttributeDivisor(e,this.maxParticles)),o.enableVertexAttribute(e,this.geometryBuffer,0,this.verticesOffset)}e.drawArraysInstanced(r,0,this.vertexCount,this.numParticles),s&&s.disable(e)}break}}},getScreenAlignedRotation:function(){const e=new(Y()),t=new(g())(0,0,0),n=new(g())(0,0,0),i=new(g())(0,0,0),o=new(K())(9);return function(r){e.assign(r).inverse(),e.multDirMatrix(t.assign(g().zAxis)),e.multDirMatrix(n.assign(g().yAxis));const s=n.cross(t);i.assign(t).cross(s);const a=t;return s.normalize(),i.normalize(),a.normalize(),o.set(s.x,s.y,s.z,i.x,i.y,i.z,a.x,a.y,a.z),o}}()});const he=me,pe=window[Symbol.for("X_ITE.X3D-8.0.0")].require("x_ite/Components/Rendering/IndexedLineSet");var fe=e.n(pe);function xe(e){x.call(this,e),this.addType(p().PolylineEmitter),this.polylinesNode=new(fe())(e),this.polylinesArray=new Float32Array,this.addSampler("polylines"),this.addUniform("direction","uniform vec3 direction;"),this.addUniform("verticesIndex","uniform int verticesIndex;"),this.addUniform("polylines","uniform sampler2D polylines;"),this.addFunction("vec3 getRandomVelocity ()\n {\n if (direction == vec3 (0.0))\n return getRandomSphericalVelocity ();\n\n else\n return direction * getRandomSpeed ();\n }"),this.addFunction("vec4 getRandomPosition ()\n {\n if (verticesIndex < 0)\n {\n return vec4 (NaN);\n }\n else\n {\n // Determine index0, index1 and weight.\n\n float lastLengthSoFar = texelFetch (polylines, verticesIndex - 1, 0) .x;\n float fraction = random () * lastLengthSoFar;\n\n int index0 = 0;\n int index1 = 0;\n float weight = 0.0;\n\n interpolate (polylines, verticesIndex, fraction, index0, index1, weight);\n\n // Interpolate and return position.\n\n index0 *= 2;\n index1 = index0 + 1;\n\n vec4 vertex0 = texelFetch (polylines, verticesIndex + index0, 0);\n vec4 vertex1 = texelFetch (polylines, verticesIndex + index1, 0);\n\n return mix (vertex0, vertex1, weight);\n }\n }")}xe.prototype=Object.assign(Object.create(x.prototype),{constructor:xe,[Symbol.for("X_ITE.X3DBaseNode.fieldDefinitions")]:new(c())([new(s())(p().inputOutput,"metadata",new(o().SFNode)),new(s())(p().inputOutput,"on",new(o().SFBool)(!0)),new(s())(p().inputOutput,"direction",new(o().SFVec3f)(0,1,0)),new(s())(p().inputOutput,"speed",new(o().SFFloat)),new(s())(p().inputOutput,"variation",new(o().SFFloat)(.25)),new(s())(p().inputOutput,"mass",new(o().SFFloat)),new(s())(p().inputOutput,"surfaceArea",new(o().SFFloat)),new(s())(p().inputOutput,"coordIndex",new(o().MFInt32)(-1)),new(s())(p().inputOutput,"coord",new(o().SFNode))]),getTypeName:function(){return"PolylineEmitter"},getComponentName:function(){return"ParticleSystems"},getContainerField:function(){return"emitter"},initialize:function(){x.prototype.initialize.call(this);this.getBrowser().getContext().getVersion()<2||(this.polylinesTexture=this.createTexture(),this._direction.addInterest("set_direction__",this),this._coordIndex.addFieldInterest(this.polylinesNode._coordIndex),this._coord.addFieldInterest(this.polylinesNode._coord),this.polylinesNode._coordIndex=this._coordIndex,this.polylinesNode._coord=this._coord,this.polylinesNode._rebuild.addInterest("set_polyline",this),this.polylinesNode.setPrivate(!0),this.polylinesNode.setup(),this.set_direction__(),this.set_polyline())},set_direction__:function(){const e=new(g())(0,0,0);return function(){e.assign(this._direction.getValue()).normalize(),this.setUniform("uniform3f","direction",e.x,e.y,e.z)}}(),set_polyline:function(){const e=new(g())(0,0,0),t=new(g())(0,0,0);return function(){const n=this.getBrowser().getContext(),i=this.polylinesNode.getVertices().getValue(),o=i.length/4,r=o/2+1,s=Math.ceil(Math.sqrt(r+o)),a=r;let c=this.polylinesArray;c.length<s*s*4&&(c=this.polylinesArray=new Float32Array(s*s*4));let l=0;for(let n=0,o=i.length;n<o;n+=8)e.set(i[n],i[n+1],i[n+2]),t.set(i[n+4],i[n+5],i[n+6]),c[n/2+4]=l+=t.subtract(e).magnitude();c.set(i,4*a),this.setUniform("uniform1i","verticesIndex",o?a:-1),s&&(n.bindTexture(n.TEXTURE_2D,this.polylinesTexture),n.texImage2D(n.TEXTURE_2D,0,n.RGBA32F,s,s,0,n.RGBA,n.FLOAT,c))}}(),activateTextures:function(e,t){e.activeTexture(e.TEXTURE0+t.polylinesTextureUnit),e.bindTexture(e.TEXTURE_2D,this.polylinesTexture)}});const _e=xe,ge=window[Symbol.for("X_ITE.X3D-8.0.0")].require("standard/Math/Geometry/Triangle3");var ye=e.n(ge);function ve(e){x.call(this,e),this.addType(p().SurfaceEmitter),this.surfaceNode=null,this.surfaceArray=new Float32Array,this.addSampler("surface"),this.addUniform("solid","uniform bool solid;"),this.addUniform("verticesIndex","uniform int verticesIndex;"),this.addUniform("normalsIndex","uniform int normalsIndex;"),this.addUniform("surface","uniform sampler2D surface;"),this.addFunction("vec4 position; vec3 getRandomVelocity ()\n {\n if (verticesIndex < 0)\n {\n return vec3 (0.0);\n }\n else\n {\n vec3 normal;\n\n getRandomPointOnSurface (surface, verticesIndex, normalsIndex, position, normal);\n\n if (solid == false && random () > 0.5)\n normal = -normal;\n\n return normal * getRandomSpeed ();\n }\n }"),this.addFunction("vec4 getRandomPosition ()\n {\n return verticesIndex < 0 ? vec4 (NaN) : position;\n }")}ve.prototype=Object.assign(Object.create(x.prototype),{constructor:ve,[Symbol.for("X_ITE.X3DBaseNode.fieldDefinitions")]:new(c())([new(s())(p().inputOutput,"metadata",new(o().SFNode)),new(s())(p().inputOutput,"on",new(o().SFBool)(!0)),new(s())(p().inputOutput,"speed",new(o().SFFloat)),new(s())(p().inputOutput,"variation",new(o().SFFloat)(.25)),new(s())(p().inputOutput,"mass",new(o().SFFloat)),new(s())(p().inputOutput,"surfaceArea",new(o().SFFloat)),new(s())(p().inputOutput,"surface",new(o().SFNode))]),getTypeName:function(){return"SurfaceEmitter"},getComponentName:function(){return"ParticleSystems"},getContainerField:function(){return"emitter"},initialize:function(){x.prototype.initialize.call(this);this.getBrowser().getContext().getVersion()<2||(this.surfaceTexture=this.createTexture(),this._surface.addInterest("set_surface__",this),this.set_surface__())},set_surface__:function(){this.surfaceNode&&(this.surfaceNode._solid.removeInterest("set_solid__",this),this.surfaceNode._rebuild.removeInterest("set_geometry__",this)),this.surfaceNode=E()(p().X3DGeometryNode,this._surface),this.surfaceNode&&(this.surfaceNode._solid.addInterest("set_solid__",this),this.surfaceNode._rebuild.addInterest("set_geometry__",this)),this.set_solid__(),this.set_geometry__()},set_solid__:function(){this.surfaceNode&&this.setUniform("uniform1i","solid",this.surfaceNode._solid.getValue())},set_geometry__:function(){const e=new(g())(0,0,0),t=new(g())(0,0,0),n=new(g())(0,0,0);return function(){const i=this.getBrowser().getContext();if(this.surfaceNode){const o=this.surfaceNode.getVertices().getValue(),r=this.surfaceNode.getNormals().getValue(),s=o.length/4,a=s/3+1,c=Math.ceil(Math.sqrt(a+s+s)),l=a,u=l+s;let d=this.surfaceArray;d.length<c*c*4&&(d=this.surfaceArray=new Float32Array(c*c*4));let m=0;for(let i=0,r=o.length;i<r;i+=12)e.set(o[i],o[i+1],o[i+2]),t.set(o[i+4],o[i+5],o[i+6]),n.set(o[i+8],o[i+9],o[i+10]),d[i/3+4]=m+=ye().area(e,t,n);d.set(o,4*l);for(let e=4*u,t=0,n=r.length;t<n;e+=4,t+=3)d[e+0]=r[t+0],d[e+1]=r[t+1],d[e+2]=r[t+2];this.setUniform("uniform1i","verticesIndex",s?l:-1),this.setUniform("uniform1i","normalsIndex",s?u:-1),c&&(i.bindTexture(i.TEXTURE_2D,this.surfaceTexture),i.texImage2D(i.TEXTURE_2D,0,i.RGBA32F,c,c,0,i.RGBA,i.FLOAT,d))}else this.setUniform("uniform1i","verticesIndex",-1),this.setUniform("uniform1i","normalsIndex",-1)}}(),activateTextures:function(e,t){e.activeTexture(e.TEXTURE0+t.surfaceTextureUnit),e.bindTexture(e.TEXTURE_2D,this.surfaceTexture)}});const Te=ve,we=window[Symbol.for("X_ITE.X3D-8.0.0")].require("x_ite/Components/Geometry3D/IndexedFaceSet");var Re=e.n(we);function be(e){x.call(this,e),this.addType(p().VolumeEmitter),this.volumeNode=new(Re())(e),this.volumeArray=new Float32Array,this.addSampler("volume"),this.addUniform("direction","uniform vec3 direction;"),this.addUniform("verticesIndex","uniform int verticesIndex;"),this.addUniform("normalsIndex","uniform int normalsIndex;"),this.addUniform("hierarchyIndex","uniform int hierarchyIndex;"),this.addUniform("hierarchyRoot","uniform int hierarchyRoot;"),this.addUniform("volume","uniform sampler2D volume;"),this.addFunction("vec3 getRandomVelocity ()\n {\n if (hierarchyRoot < 0)\n {\n return vec3 (0.0);\n }\n else\n {\n if (direction == vec3 (0.0))\n return getRandomSphericalVelocity ();\n\n else\n return direction * getRandomSpeed ();\n }\n }"),this.addFunction("vec4 getRandomPosition ()\n {\n if (hierarchyRoot < 0)\n {\n return vec4 (NaN);\n }\n else\n {\n vec4 point;\n vec3 normal;\n\n getRandomPointOnSurface (volume, verticesIndex, normalsIndex, point, normal);\n\n Line3 line = Line3 (point .xyz, getRandomSurfaceNormal (normal));\n\n vec4 points [ARRAY_SIZE];\n\n int numIntersections = getIntersections (volume, verticesIndex, hierarchyIndex, hierarchyRoot, line, points);\n\n numIntersections -= numIntersections % 2; // We need an even count of intersections.\n\n switch (numIntersections)\n {\n case 0:\n return vec4 (0.0);\n case 2:\n break;\n default:\n sort (points, numIntersections, plane3 (line .point, line .direction));\n break;\n }\n\n int index = int (fract (random ()) * float (numIntersections / 2)) * 2; // Select random intersection.\n\n return mix (points [index], points [index + 1], random ());\n }\n }")}be.prototype=Object.assign(Object.create(x.prototype),{constructor:be,[Symbol.for("X_ITE.X3DBaseNode.fieldDefinitions")]:new(c())([new(s())(p().inputOutput,"metadata",new(o().SFNode)),new(s())(p().inputOutput,"on",new(o().SFBool)(!0)),new(s())(p().inputOutput,"internal",new(o().SFBool)(!0)),new(s())(p().inputOutput,"direction",new(o().SFVec3f)(0,1,0)),new(s())(p().inputOutput,"speed",new(o().SFFloat)),new(s())(p().inputOutput,"variation",new(o().SFFloat)(.25)),new(s())(p().inputOutput,"mass",new(o().SFFloat)),new(s())(p().inputOutput,"surfaceArea",new(o().SFFloat)),new(s())(p().inputOutput,"coordIndex",new(o().MFInt32)(-1)),new(s())(p().inputOutput,"coord",new(o().SFNode))]),getTypeName:function(){return"VolumeEmitter"},getComponentName:function(){return"ParticleSystems"},getContainerField:function(){return"emitter"},initialize:function(){x.prototype.initialize.call(this);this.getBrowser().getContext().getVersion()<2||(this.volumeTexture=this.createTexture(),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(){const e=new(g())(0,0,0);return function(){e.assign(this._direction.getValue()).normalize(),this.setUniform("uniform3f","direction",e.x,e.y,e.z)}}(),set_geometry__:function(){const e=new(g())(0,0,0),t=new(g())(0,0,0),n=new(g())(0,0,0);return function(){const i=this.getBrowser().getContext(),o=this.volumeNode.getVertices().getValue(),r=this.volumeNode.getNormals().getValue(),s=new ce(o,r).toArray([]),a=o.length/4,c=r.length/3,l=a/3+1,u=s.length/4,d=Math.ceil(Math.sqrt(l+a+a+u)),m=l,h=m+a,p=h+c;let f=this.volumeArray;f.length<d*d*4&&(f=this.volumeArray=new Float32Array(d*d*4));let x=0;for(let i=0,r=o.length;i<r;i+=12)e.set(o[i],o[i+1],o[i+2]),t.set(o[i+4],o[i+5],o[i+6]),n.set(o[i+8],o[i+9],o[i+10]),f[i/3+4]=x+=ye().area(e,t,n);f.set(o,4*m);for(let e=4*h,t=0,n=r.length;t<n;e+=4,t+=3)f[e+0]=r[t+0],f[e+1]=r[t+1],f[e+2]=r[t+2];f.set(s,4*p),this.setUniform("uniform1i","verticesIndex",m),this.setUniform("uniform1i","normalsIndex",h),this.setUniform("uniform1i","hierarchyIndex",p),this.setUniform("uniform1i","hierarchyRoot",p+u-1),d&&(i.bindTexture(i.TEXTURE_2D,this.volumeTexture),i.texImage2D(i.TEXTURE_2D,0,i.RGBA32F,d,d,0,i.RGBA,i.FLOAT,f))}}(),activateTextures:function(e,t){e.activeTexture(e.TEXTURE0+t.volumeTextureUnit),e.bindTexture(e.TEXTURE_2D,this.volumeTexture)}});const Fe=be,Ie=window[Symbol.for("X_ITE.X3D-8.0.0")].require("standard/Math/Algorithm");var Ee=e.n(Ie);function Ae(e){F.call(this,e),this.addType(p().WindPhysicsModel),this._speed.setUnit("speed")}Ae.prototype=Object.assign(Object.create(F.prototype),{constructor:Ae,[Symbol.for("X_ITE.X3DBaseNode.fieldDefinitions")]:new(c())([new(s())(p().inputOutput,"metadata",new(o().SFNode)),new(s())(p().inputOutput,"enabled",new(o().SFBool)(!0)),new(s())(p().inputOutput,"direction",new(o().SFVec3f)),new(s())(p().inputOutput,"speed",new(o().SFFloat)(.1)),new(s())(p().inputOutput,"gustiness",new(o().SFFloat)(.1)),new(s())(p().inputOutput,"turbulence",new(o().SFFloat))]),getTypeName:function(){return"WindPhysicsModel"},getComponentName:function(){return"ParticleSystems"},getContainerField:function(){return"physics"},getRandomSpeed:function(e){const t=Math.max(0,this._speed.getValue()),n=t*Math.max(0,this._gustiness.getValue());return e.getRandomValue(Math.max(0,t-n),t+n)},addForce:function(){const e=new(g())(0,0,0);return function(t,n,i,o){if(this._enabled.getValue()){const r=n._surfaceArea.getValue(),s=this.getRandomSpeed(n),a=.64615*Math.pow(10,2*Math.log(s));return this._direction.getValue().equals(g().Zero)?n.getRandomNormal(e):e.assign(this._direction.getValue()).normalize(),o.set(e.multiply(r*a*i),4*t),o[4*t+3]=Math.PI*Ee().clamp(this._turbulence.getValue(),0,1),!0}return!1}}()});const Se=Ae;n().addComponent({name:"ParticleSystems",types:{BoundedPhysicsModel:S,ConeEmitter:P,ExplosionEmitter:D,ForcePhysicsModel:B,ParticleSystem:he,PointEmitter:v,PolylineEmitter:_e,SurfaceEmitter:Te,VolumeEmitter:Fe,WindPhysicsModel:Se},abstractTypes:{X3DParticleEmitterNode:x,X3DParticlePhysicsModelNode:F},browserContext:R})})();
|
|
1
|
+
/* X_ITE v8.3.0 */(()=>{"use strict";var e={n:t=>{var n=t&&t.__esModule?()=>t.default:()=>t;return e.d(n,{a:n}),n},d:(t,n)=>{for(var i in n)e.o(n,i)&&!e.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:n[i]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)};const t=window[Symbol.for("X_ITE.X3D-8.3.0")].require("x_ite/Components");var n=e.n(t);const i=window[Symbol.for("X_ITE.X3D-8.3.0")].require("x_ite/Fields");var o=e.n(i);const r=window[Symbol.for("X_ITE.X3D-8.3.0")].require("x_ite/Base/X3DFieldDefinition");var s=e.n(r);const a=window[Symbol.for("X_ITE.X3D-8.3.0")].require("x_ite/Base/FieldDefinitionArray");var c=e.n(a);const l=window[Symbol.for("X_ITE.X3D-8.3.0")].require("x_ite/Components/Core/X3DNode");var u=e.n(l);const d=window[Symbol.for("X_ITE.X3D-8.3.0")].require("x_ite/Namespace");var m=e.n(d);let h=0;const p={POINT:h++,LINE:h++,TRIANGLE:h++,QUAD:h++,SPRITE:h++,GEOMETRY:h++};m().set("x_ite/Browser/ParticleSystems/GeometryTypes",p);const f=p,x=window[Symbol.for("X_ITE.X3D-8.3.0")].require("x_ite/Base/X3DConstants");var _=e.n(x);const g="\nstruct Line3 {\n vec3 point;\n vec3 direction;\n};\n\n// Line3\n// line3 (const in vec3 point1, const in vec3 point2)\n// {\n// return Line3 (point1, normalize (point2 - point1));\n// }\n\n/* Line intersect triangle */\n\nbool\nintersects (const in Line3 line, const in vec3 a, const in vec3 b, const in vec3 c, out vec3 r)\n{\n // find vectors for two edges sharing vert0\n vec3 edge1 = b - a;\n vec3 edge2 = c - a;\n\n // begin calculating determinant - also used to calculate U parameter\n vec3 pvec = cross (line .direction, edge2);\n\n // if determinant is near zero, ray lies in plane of triangle\n float det = dot (edge1, pvec);\n\n // Non culling intersection\n\n if (det == 0.0)\n return false;\n\n float inv_det = 1.0 / det;\n\n // calculate distance from vert0 to ray point\n vec3 tvec = line .point - a;\n\n // calculate U parameter and test bounds\n float u = dot (tvec, pvec) * inv_det;\n\n if (u < 0.0 || u > 1.0)\n return false;\n\n // prepare to test V parameter\n vec3 qvec = cross (tvec, edge1);\n\n // calculate V parameter and test bounds\n float v = dot (line .direction, qvec) * inv_det;\n\n if (v < 0.0 || u + v > 1.0)\n return false;\n\n r = vec3 (u, v, 1.0 - u - v);\n\n return true;\n}\n";m().set("x_ite/Browser/ParticleSystems/Line3.glsl",g);const y=g,v="\nstruct Plane3\n{\n vec3 normal;\n float distanceFromOrigin;\n};\n\nPlane3\nplane3 (const in vec3 point, const in vec3 normal)\n{\n return Plane3 (normal, dot (normal, point));\n}\n\nfloat\nplane_distance (const in Plane3 plane, const in vec3 point)\n{\n return dot (point, plane .normal) - plane .distanceFromOrigin;\n}\n\n/* Plane intersect line */\nbool\nintersects (const in Plane3 plane, const in Line3 line, out vec3 point)\n{\n // Check if the line is parallel to the plane.\n float theta = dot (line .direction, plane .normal);\n\n // Plane and line are parallel.\n if (theta == 0.0)\n return false;\n\n // Plane and line are not parallel. The intersection point can be calculated now.\n float t = (plane .distanceFromOrigin - dot (plane .normal, line .point)) / theta;\n\n point = line .point + line .direction * t;\n\n return true;\n}\n\n/* Find find the first point that is farther to the plane than value. */\n// int\n// upper_bound (const in vec4 points [ARRAY_SIZE], in int count, const in float value, const in Plane3 plane)\n// {\n// int first = 0;\n// int step = 0;\n\n// while (count > 0)\n// {\n// int index = first;\n\n// step = count >> 1;\n\n// index += step;\n\n// if (value < plane_distance (plane, points [index] .xyz))\n// {\n// count = step;\n// }\n// else\n// {\n// first = ++ index;\n// count -= step + 1;\n// }\n// }\n\n// return first;\n// }\n\n/* CombSort: sort points in distance to a plane. */\nvoid\nsort (inout vec4 points [ARRAY_SIZE], const in int count, const in Plane3 plane)\n{\n const float shrink = 1.0 / 1.3;\n\n int gap = count;\n bool exchanged = true;\n\n while (exchanged)\n {\n gap = int (float (gap) * shrink);\n\n if (gap <= 1)\n {\n exchanged = false;\n gap = 1;\n }\n\n for (int i = 0, l = count - gap; i < l; ++ i)\n {\n int j = gap + i;\n\n if (plane_distance (plane, points [i] .xyz) > plane_distance (plane, points [j] .xyz))\n {\n vec4 tmp1 = points [i];\n points [i] = points [j];\n points [j] = tmp1;\n\n exchanged = true;\n }\n }\n }\n}\n\n\n// /* CombSort: sort points and normals in distance to a plane. */\n// void\n// sort (inout vec4 points [ARRAY_SIZE], inout vec3 normals [ARRAY_SIZE], const in int count, const in Plane3 plane)\n// {\n// const float shrink = 1.0 / 1.3;\n\n// int gap = count;\n// bool exchanged = true;\n\n// while (exchanged)\n// {\n// gap = int (float (gap) * shrink);\n\n// if (gap <= 1)\n// {\n// exchanged = false;\n// gap = 1;\n// }\n\n// for (int i = 0, l = count - gap; i < l; ++ i)\n// {\n// int j = gap + i;\n\n// if (plane_distance (plane, points [i] .xyz) > plane_distance (plane, points [j] .xyz))\n// {\n// vec4 tmp1 = points [i];\n// points [i] = points [j];\n// points [j] = tmp1;\n\n// vec3 tmp2 = normals [i];\n// normals [i] = normals [j];\n// normals [j] = tmp2;\n\n// exchanged = true;\n// }\n// }\n// }\n// }\n\nint\nmin_index (const in vec4 points [ARRAY_SIZE], const in int count, const in float value, const in Plane3 plane)\n{\n int index = -1;\n float dist = 1000000.0;\n\n for (int i = 0; i < count; ++ i)\n {\n float d = plane_distance (plane, points [i] .xyz);\n\n if (d >= value && d < dist)\n {\n dist = d;\n index = i;\n }\n }\n\n return index;\n}\n";m().set("x_ite/Browser/ParticleSystems/Plane3.glsl",v);const T=v,w="\nbool\nintersects (const in vec3 min, const in vec3 max, const in Line3 line)\n{\n vec3 intersection;\n\n // front\n\n if (intersects (plane3 (max, vec3 (0.0, 0.0, 1.0)), line, intersection))\n {\n if (all (greaterThanEqual (vec4 (intersection .xy, max .xy), vec4 (min .xy, intersection .xy))))\n return true;\n }\n\n // back\n\n if (intersects (plane3 (min, vec3 (0.0, 0.0, -1.0)), line, intersection))\n {\n if (all (greaterThanEqual (vec4 (intersection .xy, max .xy), vec4 (min .xy, intersection .xy))))\n return true;\n }\n\n // top\n\n if (intersects (plane3 (max, vec3 (0.0, 1.0, 0.0)), line, intersection))\n {\n if (all (greaterThanEqual (vec4 (intersection .xz, max .xz), vec4 (min .xz, intersection .xz))))\n return true;\n }\n\n // bottom\n\n if (intersects (plane3 (min, vec3 (0.0, -1.0, 0.0)), line, intersection))\n {\n if (all (greaterThanEqual (vec4 (intersection .xz, max .xz), vec4 (min .xz, intersection .xz))))\n return true;\n }\n\n // right\n\n if (intersects (plane3 (max, vec3 (1.0, 0.0, 0.0)), line, intersection))\n {\n if (all (greaterThanEqual (vec4 (intersection .yz, max .yz), vec4 (min .yz, intersection .yz))))\n return true;\n }\n\n return false;\n}\n";m().set("x_ite/Browser/ParticleSystems/Box3.glsl",w);const R=w,b="\n#define BVH_NODE 0\n#define BVH_TRIANGLE 1\n#define BVH_STACK_SIZE 32\n\nint bvhNodeIndex = 0;\n\nvoid\nsetBVHIndex (const in int index)\n{\n bvhNodeIndex = index;\n}\n\nint\ngetBVHRoot (const in sampler2D volume, const in int hierarchyIndex, const in int rootIndex)\n{\n return int (texelFetch (volume, rootIndex, 0) .x) + hierarchyIndex;\n}\n\nint\ngetBVHType (const in sampler2D volume)\n{\n return int (texelFetch (volume, bvhNodeIndex, 0) .x);\n}\n\nvec3\ngetBVHMin (const in sampler2D volume)\n{\n return texelFetch (volume, bvhNodeIndex + 1, 0) .xyz;\n}\n\nvec3\ngetBVHMax (const in sampler2D volume)\n{\n return texelFetch (volume, bvhNodeIndex + 2, 0) .xyz;\n}\n\nint\ngetBVHLeft (const in sampler2D volume, const in int hierarchyIndex)\n{\n return int (texelFetch (volume, bvhNodeIndex, 0) .y) + hierarchyIndex;\n}\n\nint\ngetBVHRight (const in sampler2D volume, const in int hierarchyIndex)\n{\n return int (texelFetch (volume, bvhNodeIndex, 0) .z) + hierarchyIndex;\n}\n\nint\ngetBVHTriangle (const in sampler2D volume)\n{\n return int (texelFetch (volume, bvhNodeIndex, 0) .y);\n}\n\n/* Ray triangle intersection test */\n\nint\ngetIntersections (const in sampler2D volume, const in int verticesIndex, const in int hierarchyIndex, const in int rootIndex, const in Line3 line, out vec4 points [ARRAY_SIZE])\n{\n int current = getBVHRoot (volume, hierarchyIndex, rootIndex);\n int count = 0;\n int stackIndex = -1;\n int stack [BVH_STACK_SIZE];\n\n while (stackIndex >= 0 || current >= 0)\n {\n if (current >= 0)\n {\n setBVHIndex (current);\n\n if (getBVHType (volume) == BVH_NODE)\n {\n // Node\n\n if (intersects (getBVHMin (volume), getBVHMax (volume), line))\n {\n stack [++ stackIndex] = current;\n\n current = getBVHLeft (volume, hierarchyIndex);\n }\n else\n {\n current = -1;\n }\n }\n else\n {\n // Triangle\n\n int t = getBVHTriangle (volume);\n int v = verticesIndex + t;\n vec3 r = vec3 (0.0);\n\n vec3 a = texelFetch (volume, v, 0) .xyz;\n vec3 b = texelFetch (volume, v + 1, 0) .xyz;\n vec3 c = texelFetch (volume, v + 2, 0) .xyz;\n\n if (intersects (line, a, b, c, r))\n points [count ++] = vec4 (r .z * a + r .x * b + r .y * c, 1.0);\n\n current = -1;\n }\n }\n else\n {\n setBVHIndex (stack [stackIndex --]);\n\n current = getBVHRight (volume, hierarchyIndex);\n }\n }\n\n return count;\n}\n\nint\ngetIntersections (const in sampler2D volume, const in int verticesIndex, const in int normalsIndex, const in int hierarchyIndex, const in int rootIndex, const in Line3 line, out vec4 points [ARRAY_SIZE], out vec3 normals [ARRAY_SIZE])\n{\n int current = getBVHRoot (volume, hierarchyIndex, rootIndex);\n int count = 0;\n int stackIndex = -1;\n int stack [BVH_STACK_SIZE];\n\n while (stackIndex >= 0 || current >= 0)\n {\n if (current >= 0)\n {\n setBVHIndex (current);\n\n if (getBVHType (volume) == BVH_NODE)\n {\n // Node\n\n if (intersects (getBVHMin (volume), getBVHMax (volume), line))\n {\n stack [++ stackIndex] = current;\n\n current = getBVHLeft (volume, hierarchyIndex);\n }\n else\n {\n current = -1;\n }\n }\n else\n {\n // Triangle\n\n int t = getBVHTriangle (volume);\n int v = verticesIndex + t;\n vec3 r = vec3 (0.0);\n\n vec3 a = texelFetch (volume, v, 0) .xyz;\n vec3 b = texelFetch (volume, v + 1, 0) .xyz;\n vec3 c = texelFetch (volume, v + 2, 0) .xyz;\n\n if (intersects (line, a, b, c, r))\n {\n points [count] = vec4 (r .z * a + r .x * b + r .y * c, 1.0);\n\n int n = normalsIndex + t;\n\n vec3 n0 = texelFetch (volume, n, 0) .xyz;\n vec3 n1 = texelFetch (volume, n + 1, 0) .xyz;\n vec3 n2 = texelFetch (volume, n + 2, 0) .xyz;\n\n normals [count] = save_normalize (r .z * n0 + r .x * n1 + r .y * n2);\n\n ++ count;\n }\n\n current = -1;\n }\n }\n else\n {\n setBVHIndex (stack [stackIndex --]);\n\n current = getBVHRight (volume, hierarchyIndex);\n }\n }\n\n return count;\n}\n";m().set("x_ite/Browser/ParticleSystems/BVH.glsl",b);const F=b;function I(e){u().call(this,e),this.addType(_().X3DParticleEmitterNode),this._speed.setUnit("speed"),this._mass.setUnit("mass"),this._surfaceArea.setUnit("area"),this.samplers=[],this.uniforms={},this.functions=[],this.program=null,this.addSampler("forces"),this.addSampler("boundedVolume"),this.addSampler("colorRamp"),this.addSampler("texCoordRamp"),this.addUniform("speed","uniform float speed;"),this.addUniform("variation","uniform float variation;"),this.addFunction(y),this.addFunction(T),this.addFunction(R),this.addFunction(F)}I.prototype=Object.assign(Object.create(u().prototype),{constructor:I,initialize:function(){u().prototype.initialize.call(this);const e=this.getBrowser().getContext();e.getVersion()<2||(this.program=this.createProgram(),this.transformFeedback=e.createTransformFeedback(),this._on.addInterest("set_on__",this),this._speed.addInterest("set_speed__",this),this._variation.addInterest("set_variation__",this),this._mass.addInterest("set_mass__",this),this.set_on__(),this.set_speed__(),this.set_variation__(),this.set_mass__())},isExplosive:function(){return!1},getMass:function(){return this.mass},set_on__:function(){this.on=this._on.getValue()},set_speed__:function(){this.setUniform("uniform1f","speed",this._speed.getValue())},set_variation__:function(){this.setUniform("uniform1f","variation",this._variation.getValue())},set_mass__:function(){this.mass=this._mass.getValue()},getRandomValue:function(e,t){return Math.random()*(t-e)+e},getRandomNormal:function(e){const t=this.getRandomValue(-1,1)*Math.PI,n=this.getRandomValue(-1,1),i=Math.acos(n),o=Math.sin(i);return e.set(Math.sin(t)*o,Math.cos(t)*o,n)},animate:function(e,t){const n=this.getBrowser().getContext(),i=e.inputParticles,o=e.particleStride,r=e.particleOffsets,s=this.program;if(n.useProgram(s),n.uniform1i(s.randomSeed,4294967295*Math.random()),n.uniform1i(s.geometryType,e.geometryType),n.uniform1i(s.createParticles,e.createParticles&&this.on),n.uniform1f(s.particleLifetime,e.particleLifetime),n.uniform1f(s.lifetimeVariation,e.lifetimeVariation),n.uniform1f(s.deltaTime,t),n.uniform2f(s.particleSize,e._particleSize.x,e._particleSize.y),n.uniform1i(s.numForces,e.numForces),e.numForces&&(n.activeTexture(n.TEXTURE0+s.forcesTextureUnit),n.bindTexture(n.TEXTURE_2D,e.forcesTexture)),e.boundedHierarchyRoot<0?n.uniform1i(s.boundedHierarchyRoot,-1):(n.uniform1i(s.boundedVerticesIndex,e.boundedVerticesIndex),n.uniform1i(s.boundedNormalsIndex,e.boundedNormalsIndex),n.uniform1i(s.boundedHierarchyIndex,e.boundedHierarchyIndex),n.uniform1i(s.boundedHierarchyRoot,e.boundedHierarchyRoot),n.activeTexture(n.TEXTURE0+s.boundedVolumeTextureUnit),n.bindTexture(n.TEXTURE_2D,e.boundedTexture)),n.uniform1i(s.numColors,e.numColors),e.numColors&&(n.activeTexture(n.TEXTURE0+s.colorRampTextureUnit),n.bindTexture(n.TEXTURE_2D,e.colorRampTexture)),n.uniform1i(s.numTexCoords,e.numTexCoords),e.numTexCoords&&(n.uniform1i(s.texCoordCount,e.texCoordCount),n.activeTexture(n.TEXTURE0+s.texCoordRampTextureUnit),n.bindTexture(n.TEXTURE_2D,e.texCoordRampTexture)),this.activateTextures(n,s),i.emitterArrayObject.enable(n,s)){for(const[e,t]of s.inputs)n.bindBuffer(n.ARRAY_BUFFER,i),n.enableVertexAttribArray(t),n.vertexAttribPointer(t,4,n.FLOAT,!1,o,r[e]);n.bindBuffer(n.ARRAY_BUFFER,null)}n.bindTransformFeedback(n.TRANSFORM_FEEDBACK,this.transformFeedback),n.bindBufferBase(n.TRANSFORM_FEEDBACK_BUFFER,0,e.outputParticles),n.enable(n.RASTERIZER_DISCARD),n.beginTransformFeedback(n.POINTS),n.drawArrays(n.POINTS,0,e.numParticles),n.endTransformFeedback(),n.disable(n.RASTERIZER_DISCARD),n.bindTransformFeedback(n.TRANSFORM_FEEDBACK,null)},addSampler:function(e){this.samplers.push(e)},addUniform:function(e,t){this.uniforms[e]=t},setUniform:function(e,t,n,i,o){const r=this.getBrowser().getContext(),s=this.program;r.useProgram(s),r[e](s[t],n,i,o)},addFunction:function(e){this.functions.push(e)},createProgram:function(){const e=this.getBrowser(),t=e.getContext(),n=`#version 300 es\n\n precision highp float;\n precision highp int;\n precision highp sampler2D;\n\n uniform int randomSeed;\n uniform int geometryType;\n uniform bool createParticles;\n uniform float particleLifetime;\n uniform float lifetimeVariation;\n uniform float deltaTime;\n uniform vec2 particleSize;\n\n uniform int numForces;\n uniform sampler2D forces;\n\n uniform int boundedVerticesIndex;\n uniform int boundedNormalsIndex;\n uniform int boundedHierarchyIndex;\n uniform int boundedHierarchyRoot;\n uniform sampler2D boundedVolume;\n\n uniform int numColors;\n uniform sampler2D colorRamp;\n\n uniform int texCoordCount;\n uniform int numTexCoords;\n uniform sampler2D texCoordRamp;\n\n ${Object.values(this.uniforms).join("\n")}\n\n in vec4 input0;\n in vec4 input2;\n in vec4 input6;\n\n out vec4 output0;\n out vec4 output1;\n out vec4 output2;\n\n out vec4 output3;\n out vec4 output4;\n out vec4 output5;\n out vec4 output6;\n\n // Constants\n\n ${Object.entries(f).map((([e,t])=>`#define ${e} ${t}`)).join("\n")}\n\n const int ARRAY_SIZE = 32;\n const float M_PI = 3.14159265359;\n\n uniform float NaN;\n\n // Texture\n\n vec4\n texelFetch (const in sampler2D sampler, const in int index, const in int lod)\n {\n int x = textureSize (sampler, lod) .x;\n ivec2 p = ivec2 (index % x, index / x);\n vec4 t = texelFetch (sampler, p, lod);\n\n return t;\n }\n\n // Math\n\n // Save normalize, that will not divide by zero.\n vec3\n save_normalize (const in vec3 vector)\n {\n float l = length (vector);\n\n if (l == 0.0)\n return vec3 (0.0);\n\n return vector / l;\n }\n\n // Quaternion\n\n vec4\n Quaternion (const in vec3 fromVector, const in vec3 toVector)\n {\n vec3 from = save_normalize (fromVector);\n vec3 to = save_normalize (toVector);\n\n float cos_angle = dot (from, to);\n vec3 cross_vec = cross (from, to);\n float cross_len = length (cross_vec);\n\n if (cross_len == 0.0)\n {\n if (cos_angle > 0.0)\n {\n return vec4 (0.0, 0.0, 0.0, 1.0);\n }\n else\n {\n vec3 t = cross (from, vec3 (1.0, 0.0, 0.0));\n\n if (dot (t, t) == 0.0)\n t = cross (from, vec3 (0.0, 1.0, 0.0));\n\n t = save_normalize (t);\n\n return vec4 (t, 0.0);\n }\n }\n else\n {\n float s = sqrt (abs (1.0 - cos_angle) * 0.5);\n\n cross_vec = save_normalize (cross_vec);\n\n return vec4 (cross_vec * s, sqrt (abs (1.0 + cos_angle) * 0.5));\n }\n }\n\n vec3\n multVecQuat (const in vec3 v, const in vec4 q)\n {\n float a = q .w * q .w - q .x * q .x - q .y * q .y - q .z * q .z;\n float b = 2.0 * (v .x * q .x + v .y * q .y + v .z * q .z);\n float c = 2.0 * q .w;\n vec3 r = a * v .xyz + b * q .xyz + c * (q .yzx * v .zxy - q .zxy * v .yzx);\n\n return r;\n }\n\n mat3\n Matrix3 (const in vec4 quaternion)\n {\n float x = quaternion .x;\n float y = quaternion .y;\n float z = quaternion .z;\n float w = quaternion .w;\n float A = y * y;\n float B = z * z;\n float C = x * y;\n float D = z * w;\n float E = z * x;\n float F = y * w;\n float G = x * x;\n float H = y * z;\n float I = x * w;\n\n return mat3 (1.0 - 2.0 * (A + B),\n 2.0 * (C + D),\n 2.0 * (E - F),\n 2.0 * (C - D),\n 1.0 - 2.0 * (B + G),\n 2.0 * (H + I),\n 2.0 * (E + F),\n 2.0 * (H - I),\n 1.0 - 2.0 * (A + G));\n }\n\n /* Random number generation */\n\n uint seed = 1u;\n\n void\n srand (const in int value)\n {\n seed = uint (value);\n }\n\n // Return a uniform distributed random floating point number in the interval [0, 1].\n float\n random ()\n {\n seed = seed * 1103515245u + 12345u;\n\n return float (seed) / 4294967295.0;\n }\n\n float\n getRandomValue (const in float min, const in float max)\n {\n return min + random () * (max - min);\n }\n\n float\n getRandomLifetime ()\n {\n float v = particleLifetime * lifetimeVariation;\n float min_ = max (0.0, particleLifetime - v);\n float max_ = particleLifetime + v;\n\n return getRandomValue (min_, max_);\n }\n\n float\n getRandomSpeed ()\n {\n float v = speed * variation;\n float min_ = max (0.0, speed - v);\n float max_ = speed + v;\n\n return getRandomValue (min_, max_);\n }\n\n vec3\n getRandomNormal ()\n {\n float theta = getRandomValue (-M_PI, M_PI);\n float cphi = getRandomValue (-1.0, 1.0);\n float r = sqrt (1.0 - cphi * cphi); // sin (acos (cphi));\n\n return vec3 (sin (theta) * r, cos (theta) * r, cphi);\n }\n\n vec3\n getRandomNormalWithAngle (const in float angle)\n {\n float theta = getRandomValue (-M_PI, M_PI);\n float cphi = getRandomValue (cos (angle), 1.0);\n float r = sqrt (1.0 - cphi * cphi); // sin (acos (cphi));\n\n return vec3 (sin (theta) * r, cos (theta) * r, cphi);\n }\n\n vec3\n getRandomNormalWithDirectionAndAngle (const in vec3 direction, const in float angle)\n {\n vec4 rotation = Quaternion (vec3 (0.0, 0.0, 1.0), direction);\n vec3 normal = getRandomNormalWithAngle (angle);\n\n return multVecQuat (normal, rotation);\n }\n\n vec3\n getRandomSurfaceNormal (const in vec3 direction)\n {\n float theta = getRandomValue (-M_PI, M_PI);\n float cphi = pow (random (), 1.0 / 3.0);\n float r = sqrt (1.0 - cphi * cphi); // sin (acos (cphi));\n vec3 normal = vec3 (sin (theta) * r, cos (theta) * r, cphi);\n vec4 rotation = Quaternion (vec3 (0.0, 0.0, 1.0), direction);\n\n return multVecQuat (normal, rotation);\n }\n\n vec3\n getRandomSphericalVelocity ()\n {\n vec3 normal = getRandomNormal ();\n float speed = getRandomSpeed ();\n\n return normal * speed;\n }\n\n // Algorithms\n\n int\n upperBound (const in sampler2D sampler, in int count, const in float value)\n {\n int first = 0;\n int step = 0;\n\n while (count > 0)\n {\n int index = first;\n\n step = count >> 1;\n\n index += step;\n\n if (value < texelFetch (sampler, index, 0) .x)\n {\n count = step;\n }\n else\n {\n first = ++ index;\n count -= step + 1;\n }\n }\n\n return first;\n }\n\n void\n interpolate (const in sampler2D sampler, const in int count, const in float fraction, out int index0, out int index1, out float weight)\n {\n // Determine index0, index1 and weight.\n\n if (count == 1 || fraction <= texelFetch (sampler, 0, 0) .x)\n {\n index0 = 0;\n index1 = 0;\n weight = 0.0;\n }\n else if (fraction >= texelFetch (sampler, count - 1, 0) .x)\n {\n index0 = count - 2;\n index1 = count - 1;\n weight = 1.0;\n }\n else\n {\n int index = upperBound (sampler, count, fraction);\n\n if (index < count)\n {\n index1 = index;\n index0 = index - 1;\n\n float key0 = texelFetch (sampler, index0, 0) .x;\n float key1 = texelFetch (sampler, index1, 0) .x;\n\n weight = clamp ((fraction - key0) / (key1 - key0), 0.0, 1.0);\n }\n else\n {\n index0 = 0;\n index1 = 0;\n weight = 0.0;\n }\n }\n }\n\n void\n interpolate (const in sampler2D sampler, const in int count, const in float fraction, out int index0)\n {\n // Determine index0.\n\n if (count == 1 || fraction <= texelFetch (sampler, 0, 0) .x)\n {\n index0 = 0;\n }\n else if (fraction >= texelFetch (sampler, count - 1, 0) .x)\n {\n index0 = count - 2;\n }\n else\n {\n int index = upperBound (sampler, count, fraction);\n\n if (index < count)\n index0 = index - 1;\n else\n index0 = 0;\n }\n }\n\n vec3\n getRandomBarycentricCoord ()\n {\n // Random barycentric coordinates.\n\n float u = random ();\n float v = random ();\n\n if (u + v > 1.0)\n {\n u = 1.0 - u;\n v = 1.0 - v;\n }\n\n float t = 1.0 - u - v;\n\n return vec3 (t, u, v);\n }\n\n void\n getRandomPointOnSurface (const in sampler2D surface, const in int verticesIndex, const in int normalsIndex, out vec4 position, out vec3 normal)\n {\n // Determine index0, index1 and weight.\n\n float lastAreaSoFar = texelFetch (surface, verticesIndex - 1, 0) .x;\n float fraction = random () * lastAreaSoFar;\n\n int index0;\n int index1;\n int index2;\n float weight;\n\n interpolate (surface, verticesIndex, fraction, index0, index1, weight);\n\n // Interpolate and return position.\n\n index0 *= 3;\n index1 = index0 + 1;\n index2 = index0 + 2;\n\n vec4 vertex0 = texelFetch (surface, verticesIndex + index0, 0);\n vec4 vertex1 = texelFetch (surface, verticesIndex + index1, 0);\n vec4 vertex2 = texelFetch (surface, verticesIndex + index2, 0);\n\n vec3 normal0 = texelFetch (surface, normalsIndex + index0, 0) .xyz;\n vec3 normal1 = texelFetch (surface, normalsIndex + index1, 0) .xyz;\n vec3 normal2 = texelFetch (surface, normalsIndex + index2, 0) .xyz;\n\n // Random barycentric coordinates.\n\n vec3 r = getRandomBarycentricCoord ();\n\n // Calculate position and direction.\n\n position = r .z * vertex0 + r .x * vertex1 + r .y * vertex2;\n normal = save_normalize (r .z * normal0 + r .x * normal1 + r .y * normal2);\n }\n\n // Functions\n\n ${this.functions.join("\n")}\n\n // Current values\n\n vec4\n getColor (const in float lifetime, const in float elapsedTime)\n {\n if (numColors > 0)\n {\n // Determine index0, index1 and weight.\n\n float fraction = elapsedTime / lifetime;\n\n int index0;\n int index1;\n float weight;\n\n interpolate (colorRamp, numColors, fraction, index0, index1, weight);\n\n // Interpolate and return color.\n\n vec4 color0 = texelFetch (colorRamp, numColors + index0, 0);\n vec4 color1 = texelFetch (colorRamp, numColors + index1, 0);\n\n return mix (color0, color1, weight);\n }\n else\n {\n return vec4 (1.0);\n }\n }\n\n void\n bounce (const in vec4 fromPosition, inout vec4 toPosition, inout vec3 velocity)\n {\n if (boundedHierarchyRoot < 0)\n return;\n\n Line3 line = Line3 (fromPosition .xyz, save_normalize (velocity));\n\n vec4 points [ARRAY_SIZE];\n vec3 normals [ARRAY_SIZE];\n\n int numIntersections = getIntersections (boundedVolume, boundedVerticesIndex, boundedNormalsIndex, boundedHierarchyIndex, boundedHierarchyRoot, line, points, normals);\n\n if (numIntersections == 0)\n return;\n\n Plane3 plane1 = plane3 (line .point, line .direction);\n\n int index = min_index (points, numIntersections, 0.0, plane1);\n\n if (index == -1)\n return;\n\n Plane3 plane2 = plane3 (points [index] .xyz, normals [index]);\n\n if (sign (plane_distance (plane2, fromPosition .xyz)) == sign (plane_distance (plane2, toPosition .xyz)))\n return;\n\n velocity = reflect (velocity, normals [index]);\n toPosition = vec4 (points [index] .xyz + reflect (points [index] .xyz - fromPosition .xyz, normals [index]), 1.0);\n }\n\n int\n getTexCoordIndex0 (const in float lifetime, const in float elapsedTime)\n {\n if (numTexCoords == 0)\n {\n return -1;\n }\n else\n {\n float fraction = elapsedTime / lifetime;\n int index0 = 0;\n\n interpolate (texCoordRamp, numTexCoords, fraction, index0);\n\n return numTexCoords + index0 * texCoordCount;\n }\n }\n\n void\n main ()\n {\n int life = int (input0 [0]);\n float lifetime = input0 [1];\n float elapsedTime = input0 [2] + deltaTime;\n\n srand ((gl_VertexID + randomSeed) * randomSeed);\n\n if (elapsedTime > lifetime)\n {\n // Create new particle or hide particle.\n\n lifetime = getRandomLifetime ();\n elapsedTime = 0.0;\n\n output0 = vec4 (max (life + 1, 1), lifetime, elapsedTime, getTexCoordIndex0 (lifetime, elapsedTime));\n\n if (createParticles)\n {\n output1 = getColor (lifetime, elapsedTime);\n output2 = vec4 (getRandomVelocity (), 0.0);\n output6 = getRandomPosition ();\n }\n else\n {\n output1 = vec4 (0.0);\n output2 = vec4 (0.0);\n output6 = vec4 (NaN);\n }\n }\n else\n {\n // Animate particle.\n\n vec3 velocity = input2 .xyz;\n vec4 position = input6;\n\n for (int i = 0; i < numForces; ++ i)\n {\n vec4 force = texelFetch (forces, i, 0);\n float turbulence = force .w;\n vec3 normal = getRandomNormalWithDirectionAndAngle (force .xyz, turbulence);\n float speed = length (force .xyz);\n\n velocity += normal * speed;\n }\n\n position .xyz += velocity * deltaTime;\n\n bounce (input6, position, velocity);\n\n output0 = vec4 (life, lifetime, elapsedTime, getTexCoordIndex0 (lifetime, elapsedTime));\n output1 = getColor (lifetime, elapsedTime);\n output2 = vec4 (velocity, 0.0);\n output6 = position;\n }\n\n switch (geometryType)\n {\n case POINT:\n case SPRITE:\n case GEOMETRY:\n {\n output3 = vec4 (1.0, 0.0, 0.0, 0.0);\n output4 = vec4 (0.0, 1.0, 0.0, 0.0);\n output5 = vec4 (0.0, 0.0, 1.0, 0.0);\n break;\n }\n case LINE:\n {\n mat3 r = Matrix3 (Quaternion (vec3 (0.0, 0.0, 1.0), output2 .xyz));\n mat3 s = mat3 (1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, particleSize .y);\n mat3 m = r * s;\n\n output3 = vec4 (m [0], 0.0);\n output4 = vec4 (m [1], 0.0);\n output5 = vec4 (m [2], 0.0);\n break;\n }\n default: // QUAD, TRIANGLE\n {\n output3 = vec4 (particleSize .x, 0.0, 0.0, 0.0);\n output4 = vec4 (0.0, particleSize .y, 0.0, 0.0);\n output5 = vec4 (0.0, 0.0, 1.0, 0.0);\n break;\n }\n }\n }\n `,i=t.createShader(t.VERTEX_SHADER);t.shaderSource(i,n),t.compileShader(i);const o=t.createShader(t.FRAGMENT_SHADER);t.shaderSource(o,"#version 300 es\n\n precision highp float;\n\n void\n main () { }\n "),t.compileShader(o);const r=t.createProgram();t.attachShader(r,i),t.attachShader(r,o),t.transformFeedbackVaryings(r,Array.from({length:7},((e,t)=>"output"+t)),t.INTERLEAVED_ATTRIBS),t.linkProgram(r),t.getProgramParameter(r,t.LINK_STATUS)||console.error("Couldn't initialize particle shader: "+t.getProgramInfoLog(r)),r.inputs=[[0,t.getAttribLocation(r,"input0")],[2,t.getAttribLocation(r,"input2")],[6,t.getAttribLocation(r,"input6")]],r.randomSeed=t.getUniformLocation(r,"randomSeed"),r.geometryType=t.getUniformLocation(r,"geometryType"),r.createParticles=t.getUniformLocation(r,"createParticles"),r.particleLifetime=t.getUniformLocation(r,"particleLifetime"),r.lifetimeVariation=t.getUniformLocation(r,"lifetimeVariation"),r.deltaTime=t.getUniformLocation(r,"deltaTime"),r.particleSize=t.getUniformLocation(r,"particleSize"),r.numForces=t.getUniformLocation(r,"numForces"),r.forces=t.getUniformLocation(r,"forces"),r.boundedVerticesIndex=t.getUniformLocation(r,"boundedVerticesIndex"),r.boundedNormalsIndex=t.getUniformLocation(r,"boundedNormalsIndex"),r.boundedHierarchyIndex=t.getUniformLocation(r,"boundedHierarchyIndex"),r.boundedHierarchyRoot=t.getUniformLocation(r,"boundedHierarchyRoot"),r.boundedVolume=t.getUniformLocation(r,"boundedVolume"),r.numColors=t.getUniformLocation(r,"numColors"),r.colorRamp=t.getUniformLocation(r,"colorRamp"),r.texCoordCount=t.getUniformLocation(r,"texCoordCount"),r.numTexCoords=t.getUniformLocation(r,"numTexCoords"),r.texCoordRamp=t.getUniformLocation(r,"texCoordRamp");for(const e of Object.keys(this.uniforms))r[e]=t.getUniformLocation(r,e);r.NaN=t.getUniformLocation(r,"NaN"),t.useProgram(r);for(const n of this.samplers){const i=t.getUniformLocation(r,n);t.uniform1i(i,r[n+"TextureUnit"]=e.getTexture2DUnit())}return t.uniform1f(r.NaN,NaN),e.resetTextureUnits(),r},activateTextures:function(){},createTexture:function(){const e=this.getBrowser().getContext(),t=e.createTexture();return e.bindTexture(e.TEXTURE_2D,t),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texImage2D(e.TEXTURE_2D,0,e.RGBA32F,1,1,0,e.RGBA,e.FLOAT,new Float32Array(4)),t},getTexture2DUnit:function(e,t,n){const i=t[n];return void 0===i?t[n]=e.getTexture2DUnit():i}});const E=I;m().set("x_ite/Components/ParticleSystems/X3DParticleEmitterNode",E);const S=E,A=window[Symbol.for("X_ITE.X3D-8.3.0")].require("standard/Math/Numbers/Vector3");var P=e.n(A);function N(e){S.call(this,e),this.addType(_().PointEmitter),this._position.setUnit("length"),this.addUniform("position","uniform vec3 position;"),this.addUniform("direction","uniform vec3 direction;"),this.addFunction("vec3 getRandomVelocity ()\n {\n if (direction == vec3 (0.0))\n return getRandomSphericalVelocity ();\n\n else\n return direction * getRandomSpeed ();\n }"),this.addFunction("vec4 getRandomPosition ()\n {\n return vec4 (position, 1.0);\n }")}N.prototype=Object.assign(Object.create(S.prototype),{constructor:N,[Symbol.for("X_ITE.X3DBaseNode.fieldDefinitions")]:new(c())([new(s())(_().inputOutput,"metadata",new(o().SFNode)),new(s())(_().inputOutput,"on",new(o().SFBool)(!0)),new(s())(_().inputOutput,"position",new(o().SFVec3f)),new(s())(_().inputOutput,"direction",new(o().SFVec3f)(0,1,0)),new(s())(_().inputOutput,"speed",new(o().SFFloat)),new(s())(_().inputOutput,"variation",new(o().SFFloat)(.25)),new(s())(_().inputOutput,"mass",new(o().SFFloat)),new(s())(_().inputOutput,"surfaceArea",new(o().SFFloat))]),getTypeName:function(){return"PointEmitter"},getComponentName:function(){return"ParticleSystems"},getContainerField:function(){return"emitter"},initialize:function(){S.prototype.initialize.call(this),this.getBrowser().getContext().getVersion()<2||(this._position.addInterest("set_position__",this),this._direction.addInterest("set_direction__",this),this.set_position__(),this.set_direction__())},set_position__:function(){const e=this._position.getValue();this.setUniform("uniform3f","position",e.x,e.y,e.z)},set_direction__:function(){const e=new(P())(0,0,0);return function(){e.assign(this._direction.getValue()).normalize(),this.setUniform("uniform3f","direction",e.x,e.y,e.z)}}()});const C=N;m().set("x_ite/Components/ParticleSystems/PointEmitter",C);const D=C,B=Symbol();Symbol();function O(){}O.prototype={getDefaultEmitter:function(){return this[B]=new D(this.getPrivateScene()),this[B].setPrivate(!0),this[B].setup(),this.getDefaultEmitter=function(){return this[B]},Object.defineProperty(this,"getDefaultEmitter",{enumerable:!1}),this[B]}};const V=O;m().set("x_ite/Browser/ParticleSystems/X3DParticleSystemsContext",V);const U=V;function z(e){u().call(this,e),this.addType(_().X3DParticlePhysicsModelNode)}z.prototype=Object.assign(Object.create(u().prototype),{constructor:z,addForce:function(){}});const M=z;m().set("x_ite/Components/ParticleSystems/X3DParticlePhysicsModelNode",M);const X=M,L=window[Symbol.for("X_ITE.X3D-8.3.0")].require("x_ite/Base/X3DCast");var q=e.n(L);function j(e){X.call(this,e),this.addType(_().BoundedPhysicsModel)}j.prototype=Object.assign(Object.create(X.prototype),{constructor:j,[Symbol.for("X_ITE.X3DBaseNode.fieldDefinitions")]:new(c())([new(s())(_().inputOutput,"metadata",new(o().SFNode)),new(s())(_().inputOutput,"enabled",new(o().SFBool)(!0)),new(s())(_().inputOutput,"geometry",new(o().SFNode))]),getTypeName:function(){return"BoundedPhysicsModel"},getComponentName:function(){return"ParticleSystems"},getContainerField:function(){return"physics"},initialize:function(){X.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=q()(_().X3DGeometryNode,this._geometry),this.geometryNode&&this.geometryNode._rebuild.addInterest("addNodeEvent",this)},addGeometry:function(e,t){if(this.geometryNode&&this._enabled.getValue()){const n=this.geometryNode.getNormals().getValue(),i=this.geometryNode.getVertices().getValue();for(const t of n)e.push(t);for(const e of i)t.push(e)}}});const H=j;m().set("x_ite/Components/ParticleSystems/BoundedPhysicsModel",H);const G=H;function k(e){S.call(this,e),this.addType(_().ConeEmitter),this._position.setUnit("length"),this._angle.setUnit("angle"),this.addUniform("position","uniform vec3 position;"),this.addUniform("direction","uniform vec3 direction;"),this.addUniform("angle","uniform float angle;"),this.addFunction("vec3 getRandomVelocity ()\n {\n if (direction == vec3 (0.0))\n {\n return getRandomSphericalVelocity ();\n }\n else\n {\n vec3 normal = getRandomNormalWithDirectionAndAngle (direction, angle);\n float speed = getRandomSpeed ();\n\n return normal * speed;\n }\n }"),this.addFunction("vec4 getRandomPosition ()\n {\n return vec4 (position, 1.0);\n }")}k.prototype=Object.assign(Object.create(S.prototype),{constructor:k,[Symbol.for("X_ITE.X3DBaseNode.fieldDefinitions")]:new(c())([new(s())(_().inputOutput,"metadata",new(o().SFNode)),new(s())(_().inputOutput,"on",new(o().SFBool)(!0)),new(s())(_().inputOutput,"position",new(o().SFVec3f)),new(s())(_().inputOutput,"direction",new(o().SFVec3f)(0,1,0)),new(s())(_().inputOutput,"angle",new(o().SFFloat)(.7854)),new(s())(_().inputOutput,"speed",new(o().SFFloat)),new(s())(_().inputOutput,"variation",new(o().SFFloat)(.25)),new(s())(_().inputOutput,"mass",new(o().SFFloat)),new(s())(_().inputOutput,"surfaceArea",new(o().SFFloat))]),getTypeName:function(){return"ConeEmitter"},getComponentName:function(){return"ParticleSystems"},getContainerField:function(){return"emitter"},initialize:function(){S.prototype.initialize.call(this),this.getBrowser().getContext().getVersion()<2||(this._position.addInterest("set_position__",this),this._direction.addInterest("set_direction__",this),this._angle.addInterest("set_angle__",this),this.set_position__(),this.set_direction__(),this.set_angle__())},set_position__:function(){const e=this._position.getValue();this.setUniform("uniform3f","position",e.x,e.y,e.z)},set_direction__:function(){const e=this._direction.getValue();this.setUniform("uniform3f","direction",e.x,e.y,e.z)},set_angle__:function(){this.setUniform("uniform1f","angle",this._angle.getValue())}});const Y=k;m().set("x_ite/Components/ParticleSystems/ConeEmitter",Y);const W=Y;function K(e){S.call(this,e),this.addType(_().ExplosionEmitter),this._position.setUnit("length"),this.addUniform("position","uniform vec3 position;"),this.addFunction("vec3 getRandomVelocity ()\n {\n return getRandomSphericalVelocity ();\n }"),this.addFunction("vec4 getRandomPosition ()\n {\n return vec4 (position, 1.0);\n }")}K.prototype=Object.assign(Object.create(S.prototype),{constructor:K,[Symbol.for("X_ITE.X3DBaseNode.fieldDefinitions")]:new(c())([new(s())(_().inputOutput,"metadata",new(o().SFNode)),new(s())(_().inputOutput,"on",new(o().SFBool)(!0)),new(s())(_().inputOutput,"position",new(o().SFVec3f)),new(s())(_().inputOutput,"speed",new(o().SFFloat)),new(s())(_().inputOutput,"variation",new(o().SFFloat)(.25)),new(s())(_().inputOutput,"mass",new(o().SFFloat)),new(s())(_().inputOutput,"surfaceArea",new(o().SFFloat))]),getTypeName:function(){return"ExplosionEmitter"},getComponentName:function(){return"ParticleSystems"},getContainerField:function(){return"emitter"},initialize:function(){S.prototype.initialize.call(this),this.getBrowser().getContext().getVersion()<2||(this._position.addInterest("set_position__",this),this.set_position__())},isExplosive:function(){return!0},set_position__:function(){const e=this._position.getValue();this.setUniform("uniform3f","position",e.x,e.y,e.z)}});const Z=K;m().set("x_ite/Components/ParticleSystems/ExplosionEmitter",Z);const Q=Z;function $(e){X.call(this,e),this.addType(_().ForcePhysicsModel),this._force.setUnit("force")}$.prototype=Object.assign(Object.create(X.prototype),{constructor:$,[Symbol.for("X_ITE.X3DBaseNode.fieldDefinitions")]:new(c())([new(s())(_().inputOutput,"metadata",new(o().SFNode)),new(s())(_().inputOutput,"enabled",new(o().SFBool)(!0)),new(s())(_().inputOutput,"force",new(o().SFVec3f)(0,-9.8,0))]),getTypeName:function(){return"ForcePhysicsModel"},getComponentName:function(){return"ParticleSystems"},getContainerField:function(){return"physics"},addForce:function(){const e=new(P())(0,0,0);return function(t,n,i,o){return!!this._enabled.getValue()&&(o.set(e.assign(this._force.getValue()).multiply(i),4*t),o[4*t+3]=0,!0)}}()});const J=$;m().set("x_ite/Components/ParticleSystems/ForcePhysicsModel",J);const ee=J,te=window[Symbol.for("X_ITE.X3D-8.3.0")].require("x_ite/Components/Shape/X3DShapeNode");var ne=e.n(te);const ie=window[Symbol.for("X_ITE.X3D-8.3.0")].require("x_ite/Browser/Rendering/GeometryContext");var oe=e.n(ie);const re=window[Symbol.for("X_ITE.X3D-8.3.0")].require("x_ite/Rendering/VertexArray");var se=e.n(re);const ae=window[Symbol.for("X_ITE.X3D-8.3.0")].require("x_ite/Rendering/TraverseType");var ce=e.n(ae);const le=window[Symbol.for("X_ITE.X3D-8.3.0")].require("x_ite/Browser/Shape/AlphaMode");var ue=e.n(le);const de=window[Symbol.for("X_ITE.X3D-8.3.0")].require("standard/Math/Numbers/Matrix4");var me=e.n(de);const he=window[Symbol.for("X_ITE.X3D-8.3.0")].require("standard/Math/Numbers/Matrix3");var pe=e.n(he);const fe=window[Symbol.for("X_ITE.X3D-8.3.0")].require("standard/Math/Geometry/Plane3");var xe=e.n(fe);const _e=window[Symbol.for("X_ITE.X3D-8.3.0")].require("standard/Math/Algorithms/QuickSort");var ge=e.n(_e);const ye=new(P())(0,0,0),ve=new(P())(0,0,0),Te=new(P())(0,0,0),we={u:0,v:0,t:0},Re=[new(P())(0,0,1),new(P())(0,0,-1),new(P())(0,1,0),new(P())(0,-1,0),new(P())(1,0,0)];function be(e,t){this.vertices=e.vertices,this.normals=e.normals,this.triangle=t,this.i4=12*t,this.i3=9*t}function Fe(e,t,n,i){this.min=new(P())(0,0,0),this.max=new(P())(0,0,0),this.planes=[],this.intersection=new(P())(0,0,0);const o=e.vertices,r=this.min,s=this.max,a=n+i;let c=12*t[n];r.set(o[c],o[c+1],o[c+2]),s.assign(r);for(let e=n;e<a;++e)c=12*t[e],ye.set(o[c],o[c+1],o[c+2]),ve.set(o[c+4],o[c+5],o[c+6]),Te.set(o[c+8],o[c+9],o[c+10]),r.min(ye,ve,Te),s.max(ye,ve,Te);for(let e=0;e<5;++e)this.planes[e]=new(xe())(e%2?r:s,Re[e]);if(i>2){e.sorter.compare.axis=this.getLongestAxis(r,s),e.sorter.sort(n,a);var l=i>>>1}else l=1;const u=i-l;this.left=l>1?new Fe(e,t,n,l):new be(e,t[n]),this.right=u>1?new Fe(e,t,n+l,u):new be(e,t[n+l])}function Ie(e,t){const n=e.length/12;switch(this.vertices=e,this.normals=t,n){case 0:this.root=null;break;case 1:this.root=new be(this,0);break;default:{const t=[];for(let e=0;e<n;++e)t.push(e);this.sorter=new(ge())(t,function(e,t){return function(n,i){return Math.min(e[n+t],e[n+4+t],e[n+8+t])<Math.min(e[i+t],e[i+4+t],e[i+8+t])}}(e,0)),this.root=new Fe(this,t,0,n);break}}}be.prototype={intersectsLine:function(e,t,n){const i=this.vertices,o=this.normals,r=this.i4,s=this.i3;if(ye.x=i[r],ye.y=i[r+1],ye.z=i[r+2],ve.x=i[r+4],ve.y=i[r+5],ve.z=i[r+6],Te.x=i[r+8],Te.y=i[r+9],Te.z=i[r+10],e.intersectsTriangle(ye,ve,Te,we)){const e=we.u,a=we.v,c=1-e-a,l=t.size++;l>=t.length&&t.push(new(P())(0,0,0)),t[l].set(c*i[r]+e*i[r+4]+a*i[r+8],c*i[r+1]+e*i[r+5]+a*i[r+9],c*i[r+2]+e*i[r+6]+a*i[r+10]),n&&(l>=n.length&&n.push(new(P())(0,0,0)),n[l].set(c*o[s]+e*o[s+3]+a*o[s+6],c*o[s+1]+e*o[s+4]+a*o[s+7],c*o[s+2]+e*o[s+5]+a*o[s+8]))}},toArray:function(e){const t=e.length/4;return e.push(1,3*this.triangle,0,0),t}},Fe.prototype={intersectsLine:function(e,t,n){this.intersectsBBox(e)&&(this.left.intersectsLine(e,t,n),this.right.intersectsLine(e,t,n))},intersectsBBox:function(e){const t=this.planes,n=this.min,i=this.max,o=n.x,r=i.x,s=n.y,a=i.y,c=n.z,l=i.z,u=this.intersection;return!!(t[0].intersectsLine(e,u)&&u.x>=o&&u.x<=r&&u.y>=s&&u.y<=a)||(!!(t[1].intersectsLine(e,u)&&u.x>=o&&u.x<=r&&u.y>=s&&u.y<=a)||(!!(t[2].intersectsLine(e,u)&&u.x>=o&&u.x<=r&&u.z>=c&&u.z<=l)||(!!(t[3].intersectsLine(e,u)&&u.x>=o&&u.x<=r&&u.z>=c&&u.z<=l)||!!(t[4].intersectsLine(e,u)&&u.y>=s&&u.y<=a&&u.z>=c&&u.z<=l))))},getLongestAxis:function(e,t){const n=t.x-e.x,i=t.y-e.y,o=t.z-e.z;return n<i?i<o?2:1:n<o?2:0},toArray:function(e){const t=this.left.toArray(e),n=this.right.toArray(e),i=this.min,o=this.max,r=e.length/4;return e.push(0,t,n,0,i.x,i.y,i.z,0,o.x,o.y,o.z,0),r}},Ie.prototype={constructor:Ie,intersectsLine:function(e,t,n){return t.size=0,this.root?(this.root.intersectsLine(e,t,n),t.size):0},toArray:function(e){if(this.root){const t=this.root.toArray(e);e.push(t,0,0,0)}return e}};const Ee=Ie;m().set("standard/Math/Utility/BVH",Ee);const Se=Ee,Ae=new Float32Array([0,0,0,1]),Pe=new Float32Array([0,0,0,1,1,0,0,1,0,0,-.5,1,0,0,.5,1]),Ne=new Float32Array([0,0,0,1,1,0,0,1,1,1,0,1,0,0,0,1,1,1,0,1,0,1,0,1,0,0,1,-.5,-.5,0,1,.5,-.5,0,1,.5,.5,0,1,-.5,-.5,0,1,.5,.5,0,1,-.5,.5,0,1]);function Ce(e){ne().call(this,e),this.addType(_().ParticleSystem),this._particleSize.setUnit("length");const t=this.getBrowser();this.maxParticles=0,this.numParticles=0,this.forcePhysicsModelNodes=[],this.forces=new Float32Array(4),this.boundedPhysicsModelNodes=[],this.boundedNormals=[],this.boundedVertices=[],this.colorRamp=new Float32Array,this.texCoordRamp=new Float32Array,this.geometryContext=new(oe())({textureCoordinateNode:t.getDefaultTextureCoordinate()}),this.creationTime=0,this.pauseTime=0,this.deltaTime=0,this.particleStride=7*Float32Array.BYTES_PER_ELEMENT*4,this.particleOffsets=Array.from({length:7},((e,t)=>4*Float32Array.BYTES_PER_ELEMENT*t)),this.particleOffset=this.particleOffsets[0],this.colorOffset=this.particleOffsets[1],this.matrixOffset=this.particleOffsets[3],this.texCoordOffset=0}Ce.prototype=Object.assign(Object.create(ne().prototype),{constructor:Ce,[Symbol.for("X_ITE.X3DBaseNode.fieldDefinitions")]:new(c())([new(s())(_().inputOutput,"metadata",new(o().SFNode)),new(s())(_().inputOutput,"enabled",new(o().SFBool)(!0)),new(s())(_().inputOutput,"createParticles",new(o().SFBool)(!0)),new(s())(_().initializeOnly,"geometryType",new(o().SFString)("QUAD")),new(s())(_().inputOutput,"maxParticles",new(o().SFInt32)(200)),new(s())(_().inputOutput,"particleLifetime",new(o().SFFloat)(5)),new(s())(_().inputOutput,"lifetimeVariation",new(o().SFFloat)(.25)),new(s())(_().inputOutput,"particleSize",new(o().SFVec2f)(.02,.02)),new(s())(_().initializeOnly,"emitter",new(o().SFNode)),new(s())(_().initializeOnly,"physics",new(o().MFNode)),new(s())(_().initializeOnly,"colorKey",new(o().MFFloat)),new(s())(_().initializeOnly,"colorRamp",new(o().SFNode)),new(s())(_().initializeOnly,"texCoordKey",new(o().MFFloat)),new(s())(_().initializeOnly,"texCoordRamp",new(o().SFNode)),new(s())(_().outputOnly,"isActive",new(o().SFBool)),new(s())(_().inputOutput,"visible",new(o().SFBool)(!0)),new(s())(_().inputOutput,"castShadow",new(o().SFBool)(!0)),new(s())(_().inputOutput,"bboxDisplay",new(o().SFBool)),new(s())(_().initializeOnly,"bboxSize",new(o().SFVec3f)(-1,-1,-1)),new(s())(_().initializeOnly,"bboxCenter",new(o().SFVec3f)),new(s())(_().inputOutput,"appearance",new(o().SFNode)),new(s())(_().inputOutput,"geometry",new(o().SFNode))]),getTypeName:function(){return"ParticleSystem"},getComponentName:function(){return"ParticleSystems"},getContainerField:function(){return"children"},initialize:function(){ne().prototype.initialize.call(this);const e=this.getBrowser();e.getContext().getVersion()<2||(this.isLive().addInterest("set_live__",this),this._enabled.addInterest("set_enabled__",this),this._createParticles.addInterest("set_createParticles__",this),this._geometryType.addInterest("set_geometryType__",this),this._geometryType.addInterest("set_texCoord__",this),this._maxParticles.addInterest("set_enabled__",this),this._particleLifetime.addInterest("set_particleLifetime__",this),this._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.inputParticles=this.createBuffer(),this.outputParticles=this.createBuffer(),this.inputParticles.emitterArrayObject=new(se()),this.inputParticles.vertexArrayObject=new(se()),this.inputParticles.shadowArrayObject=new(se()),this.outputParticles.emitterArrayObject=new(se()),this.outputParticles.vertexArrayObject=new(se()),this.outputParticles.shadowArrayObject=new(se()),this.forcesTexture=this.createTexture(),this.boundedTexture=this.createTexture(),this.colorRampTexture=this.createTexture(),this.texCoordRampTexture=this.createTexture(),this.geometryBuffer=this.createBuffer(),this.texCoordBuffers=new Array(e.getMaxTextures()).fill(this.geometryBuffer),this.set_emitter__(),this.set_enabled__(),this.set_geometryType__(),this.set_createParticles__(),this.set_particleLifetime__(),this.set_lifetimeVariation__(),this.set_physics__(),this.set_colorRamp__(),this.set_texCoordRamp__())},getShapeKey:function(){return this.numTexCoords?"2":"1"},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()===ue().AUTO)if(this.geometryType===f.POINT)this.setTransparent(!0);else this.setTransparent(this.getAppearance().getTransparent()||this.colorRampNode&&this.colorRampNode.getTransparent()||this.geometryType===f.GEOMETRY&&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+=Date.now()/1e3-this.pauseTime,this.pauseTime=0)):this._isActive.getValue()&&this._maxParticles.getValue()&&(this.getBrowser().sensorEvents().removeInterest("animateParticles",this),0===this.pauseTime&&(this.pauseTime=Date.now()/1e3))},set_enabled__:function(){this._enabled.getValue()&&this._maxParticles.getValue()?this._isActive.getValue()||(this.isLive().getValue()?(this.getBrowser().sensorEvents().addInterest("animateParticles",this),this.pauseTime=0):this.pauseTime=Date.now()/1e3,this._isActive=!0,delete this.traverse):this._isActive.getValue()&&(this.isLive().getValue()&&this.getBrowser().sensorEvents().removeInterest("animateParticles",this),this._isActive=!1,this.numParticles=0,this.traverse=Function.prototype),this.set_maxParticles__()},set_createParticles__:function(){this.createParticles=this._createParticles.getValue()},set_geometryType__:function(){const e=this.getBrowser().getContext();switch(this.geometryType=this.getEnum(f,this._geometryType.getValue(),f.QUAD),this.geometryType){case f.POINT:this.geometryContext.geometryType=0,this.geometryContext.hasNormals=!1,this.texCoordCount=0,this.vertexCount=1,this.hasNormals=!1,this.verticesOffset=0,this.primitiveMode=e.POINTS,e.bindBuffer(e.ARRAY_BUFFER,this.geometryBuffer),e.bufferData(e.ARRAY_BUFFER,Ae,e.DYNAMIC_DRAW);break;case f.LINE:this.geometryContext.geometryType=1,this.geometryContext.hasNormals=!1,this.texCoordCount=2,this.vertexCount=2,this.hasNormals=!1,this.texCoordsOffset=0,this.verticesOffset=8*Float32Array.BYTES_PER_ELEMENT,this.primitiveMode=e.LINES,e.bindBuffer(e.ARRAY_BUFFER,this.geometryBuffer),e.bufferData(e.ARRAY_BUFFER,Pe,e.DYNAMIC_DRAW);break;case f.TRIANGLE:case f.QUAD:case f.SPRITE:this.geometryContext.geometryType=2,this.geometryContext.hasNormals=!0,this.texCoordCount=4,this.vertexCount=6,this.hasNormals=!0,this.texCoordsOffset=0,this.normalOffset=24*Float32Array.BYTES_PER_ELEMENT,this.verticesOffset=27*Float32Array.BYTES_PER_ELEMENT,this.primitiveMode=e.TRIANGLES,e.bindBuffer(e.ARRAY_BUFFER,this.geometryBuffer),e.bufferData(e.ARRAY_BUFFER,Ne,e.DYNAMIC_DRAW);break;case f.GEOMETRY:this.texCoordCount=0}this.geometryContext.updateGeometryKey(),this.updateVertexArrays(),this.set_transparent__()},set_maxParticles__:function(){const e=this.numParticles,t=Math.max(0,this._maxParticles.getValue());this.maxParticles=t,this.numParticles=Math.min(e,t),this.emitterNode.isExplosive()||(this.creationTime=Date.now()/1e3),this.resizeBuffers(e),this.updateVertexArrays()},set_particleLifetime__:function(){this.particleLifetime=this._particleLifetime.getValue()},set_lifetimeVariation__:function(){this.lifetimeVariation=this._lifetimeVariation.getValue()},set_emitter__:function(){this.emitterNode=q()(_().X3DParticleEmitterNode,this._emitter),this.emitterNode||(this.emitterNode=this.getBrowser().getDefaultEmitter()),this.createParticles=this._createParticles.getValue()},set_physics__:function(){const e=this._physics.getValue(),t=this.forcePhysicsModelNodes,n=this.boundedPhysicsModelNodes;for(let e=0,t=n.length;e<t;++e)n[e].removeInterest("set_boundedPhysics__",this);t.length=0,n.length=0;for(let i=0,o=e.length;i<o;++i)try{const o=e[i].getValue().getInnerNode(),r=o.getType();for(let e=r.length-1;e>=0;--e){switch(r[e]){case _().ForcePhysicsModel:case _().WindPhysicsModel:t.push(o);break;case _().BoundedPhysicsModel:o.addInterest("set_boundedPhysics__",this),n.push(o);break;default:continue}break}}catch(e){}this.set_boundedPhysics__()},set_boundedPhysics__:function(){const e=this.getBrowser().getContext(),t=this.boundedPhysicsModelNodes,n=this.boundedNormals,i=this.boundedVertices;n.length=0,i.length=0;for(let e=0,o=t.length;e<o;++e)t[e].addGeometry(n,i);const o=new Se(i,n).toArray([]),r=i.length/4,s=n.length/3,a=o.length/4,c=Math.ceil(Math.sqrt(r+s+a)),l=new Float32Array(c*c*4);this.boundedVerticesIndex=0,this.boundedNormalsIndex=r,this.boundedHierarchyIndex=this.boundedNormalsIndex+s,this.boundedHierarchyRoot=this.boundedHierarchyIndex+a-1,l.set(i);for(let e=4*this.boundedNormalsIndex,t=0,i=n.length;t<i;e+=4,t+=3)l[e+0]=n[t+0],l[e+1]=n[t+1],l[e+2]=n[t+2];l.set(o,4*this.boundedHierarchyIndex),c&&(e.bindTexture(e.TEXTURE_2D,this.boundedTexture),e.texImage2D(e.TEXTURE_2D,0,e.RGBA32F,c,c,0,e.RGBA,e.FLOAT,l))},set_colorRamp__:function(){this.colorRampNode&&this.colorRampNode.removeInterest("set_color__",this),this.colorRampNode=q()(_().X3DColorNode,this._colorRamp),this.colorRampNode&&this.colorRampNode.addInterest("set_color__",this),this.set_color__(),this.set_transparent__()},set_color__:function(){const e=this.getBrowser().getContext(),t=this._colorKey,n=t.length,i=Math.ceil(Math.sqrt(2*n));let o=this.colorRamp;i*i*4>o.length&&(o=this.colorRamp=new Float32Array(i*i*4));for(let e=0;e<n;++e)o[4*e]=t[e];this.colorRampNode?o.set(this.colorRampNode.addColors([],n).slice(0,4*n),4*n):o.fill(1,4*n),i&&(e.bindTexture(e.TEXTURE_2D,this.colorRampTexture),e.texImage2D(e.TEXTURE_2D,0,e.RGBA32F,i,i,0,e.RGBA,e.FLOAT,o)),this.numColors=n,this.geometryContext.colorMaterial=!(!n||!this.colorRampNode),this.geometryContext.updateGeometryKey(),this.updateVertexArrays()},set_texCoordRamp__:function(){this.texCoordRampNode&&this.texCoordRampNode.removeInterest("set_texCoord__",this),this.texCoordRampNode=q()(_().X3DTextureCoordinateNode,this._texCoordRamp),this.texCoordRampNode&&this.texCoordRampNode.addInterest("set_texCoord__",this),this.set_texCoord__()},set_texCoord__:function(){const e=this.getBrowser().getContext(),t=this._texCoordKey,n=t.length,i=Math.ceil(Math.sqrt(n+n*this.texCoordCount));let o=this.texCoordRamp;i*i*4>o.length?o=this.texCoordRamp=new Float32Array(i*i*4):o.fill(0);for(let e=0;e<n;++e)o[4*e]=t[e];this.texCoordRampNode&&o.set(this.texCoordRampNode.getTexCoord([]).slice(0,n*this.texCoordCount*4),4*n),i&&(e.bindTexture(e.TEXTURE_2D,this.texCoordRampTexture),e.texImage2D(e.TEXTURE_2D,0,e.RGBA32F,i,i,0,e.RGBA,e.FLOAT,o)),this.numTexCoords=this.texCoordRampNode?n:0,this.updateVertexArrays()},updateVertexArrays:function(){this.inputParticles.vertexArrayObject.update(),this.inputParticles.shadowArrayObject.update(),this.inputParticles.emitterArrayObject.update(),this.outputParticles.vertexArrayObject.update(),this.outputParticles.shadowArrayObject.update(),this.outputParticles.emitterArrayObject.update()},createTexture:function(){const e=this.getBrowser().getContext(),t=e.createTexture();return e.bindTexture(e.TEXTURE_2D,t),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texImage2D(e.TEXTURE_2D,0,e.RGBA32F,1,1,0,e.RGBA,e.FLOAT,new Float32Array(4)),t},createBuffer:function(){const e=this.getBrowser().getContext(),t=e.createBuffer();return e.bindBuffer(e.ARRAY_BUFFER,t),e.bufferData(e.ARRAY_BUFFER,new Uint32Array,e.DYNAMIC_DRAW),t},resizeBuffers:function(e){const t=this.getBrowser().getContext(),n=this.maxParticles,i=this.particleStride,o=Object.assign(t.createBuffer(),this.outputParticles),r=new Uint8Array(n*i);t.bindBuffer(t.ARRAY_BUFFER,this.inputParticles),t.bufferData(t.ARRAY_BUFFER,r,t.DYNAMIC_DRAW),t.bindBuffer(t.COPY_READ_BUFFER,this.outputParticles),t.bindBuffer(t.ARRAY_BUFFER,o),t.bufferData(t.ARRAY_BUFFER,r,t.DYNAMIC_DRAW),t.copyBufferSubData(t.COPY_READ_BUFFER,t.ARRAY_BUFFER,0,0,Math.min(n*i,e*i)),t.deleteBuffer(this.outputParticles),this.outputParticles=o},animateParticles:function(){const e=this.getBrowser(),t=e.getContext(),n=this.emitterNode,i=1/Math.max(10,this.getBrowser().getCurrentFrameRate());let o=this.deltaTime=(14*this.deltaTime+i)/15;if(n.isExplosive()){const e=Date.now()/1e3,t=this.particleLifetime+this.particleLifetime*this.lifetimeVariation;e-this.creationTime>t?(this.creationTime=e,this.numParticles=this.maxParticles,this.createParticles=this._createParticles.getValue(),o=Number.POSITIVE_INFINITY):this.createParticles=!1}else if(this.numParticles<this.maxParticles){const e=Date.now()/1e3,t=Math.max(0,Math.floor((e-this.creationTime)*this.maxParticles/this.particleLifetime));t&&(this.creationTime=e),this.numParticles=Math.min(this.maxParticles,this.numParticles+t)}if(n.getMass()){const e=this.forcePhysicsModelNodes;let i=e.length,r=this.forces,s=o/n.getMass();4*i>r.length&&(r=this.forces=new Float32Array(4*i));let a=0;for(let t=0;t<i;++t)a+=!e[t].addForce(t-a,n,s,r);this.numForces=i-=a,i&&(t.bindTexture(t.TEXTURE_2D,this.forcesTexture),t.texImage2D(t.TEXTURE_2D,0,t.RGBA32F,i,1,0,t.RGBA,t.FLOAT,r))}else this.numForces=0;const r=this.outputParticles;this.outputParticles=this.inputParticles,this.inputParticles=r,n.animate(this,o),e.addBrowserEvent()},updateSprite:function(){const e=new Float32Array(Ne),t=[new(P())(-.5,-.5,0),new(P())(.5,-.5,0),new(P())(.5,.5,0),new(P())(-.5,-.5,0),new(P())(.5,.5,0),new(P())(-.5,.5,0)],n=new(P())(0,0,0),i=new(P())(0,0,0);return function(o,r){for(let t=0;t<3;++t)e[24+t]=r[6+t];i.set(this._particleSize.x,this._particleSize.y,1);for(let o=0;o<6;++o){const s=27+4*o;r.multVecMatrix(n.assign(t[o]).multVec(i)),e[s+0]=n.x,e[s+1]=n.y,e[s+2]=n.z}o.bindBuffer(o.ARRAY_BUFFER,this.geometryBuffer),o.bufferData(o.ARRAY_BUFFER,e,o.DYNAMIC_DRAW)}}(),intersectsBox:function(e,t){},traverse:function(e,t){switch(e){case ce().POINTER:case ce().PICKING:case ce().COLLISION:break;case ce().SHADOW:this._castShadow.getValue()&&t.addShadowShape(this);break;case ce().DISPLAY:t.addDisplayShape(this)&&this.getAppearance().traverse(e,t)}this.geometryType===f.GEOMETRY&&this.getGeometry()&&this.getGeometry().traverse(e,t)},depth:function(e,t,n){if(this.numParticles){const i=t.clipPlanes,o=this.getBrowser().getDepthShader(i.length,!0);switch(o.enable(e),o.setClipPlanes(e,i),e.uniformMatrix4fv(o.x3d_ProjectionMatrix,!1,n),e.uniformMatrix4fv(o.x3d_ModelViewMatrix,!1,t.modelViewMatrix),this.geometryType){case f.GEOMETRY:{const n=this.getGeometry();n&&n.displayParticlesDepth(e,t,o,this);break}case f.SPRITE:this.updateSprite(e,this.getScreenAlignedRotation(t.modelViewMatrix));default:{const t=this.outputParticles;if(t.shadowArrayObject.enable(e,o)){const n=this.particleStride;o.enableParticleAttribute(e,t,n,this.particleOffset,1),o.enableParticleMatrixAttribute(e,t,n,this.matrixOffset,1),o.enableVertexAttribute(e,this.geometryBuffer,0,this.verticesOffset)}e.drawArraysInstanced(this.primitiveMode,0,this.vertexCount,this.numParticles);break}}}},display:function(e,t){switch(this.geometryType){case f.GEOMETRY:if(this.numParticles){const n=this.getGeometry();n&&n.displayParticles(e,t,this)}break;case f.SPRITE:this.updateSprite(e,this.getScreenAlignedRotation(t.modelViewMatrix));case f.QUAD:case f.TRIANGLE:{const n=me().prototype.determinant3.call(t.modelViewMatrix)>0;e.frontFace(n?e.CCW:e.CW),e.enable(e.CULL_FACE),e.cullFace(e.BACK)}default:{const n=this.getBrowser(),i=this.getAppearance(),o=i.getShader(this.geometryContext,t),r=n.getPrimitiveMode(this.primitiveMode);if(this.numParticles){const s=i.getBlendMode();if(s&&s.enable(e),o.enable(e),o.setUniforms(e,this.geometryContext,t),this.numTexCoords){const t=n.getTexture2DUnit();e.activeTexture(e.TEXTURE0+t),e.bindTexture(e.TEXTURE_2D,this.texCoordRampTexture),e.uniform1i(o.x3d_TexCoordRamp,t)}const a=this.outputParticles;if(a.vertexArrayObject.enable(e,o)){const t=this.particleStride;o.enableParticleAttribute(e,a,t,this.particleOffset,1),o.enableParticleMatrixAttribute(e,a,t,this.matrixOffset,1),this.geometryContext.colorMaterial&&(o.enableColorAttribute(e,a,t,this.colorOffset),o.colorAttributeDivisor(e,1)),this.texCoordCount&&o.enableTexCoordAttribute(e,this.texCoordBuffers,0,this.texCoordOffset),this.hasNormals&&(o.enableNormalAttribute(e,this.geometryBuffer,0,this.normalOffset),o.normalAttributeDivisor(e,this.maxParticles)),o.enableVertexAttribute(e,this.geometryBuffer,0,this.verticesOffset)}e.drawArraysInstanced(r,0,this.vertexCount,this.numParticles),s&&s.disable(e)}break}}},getScreenAlignedRotation:function(){const e=new(me()),t=new(P())(0,0,0),n=new(P())(0,0,0),i=new(P())(0,0,0),o=new(pe())(9);return function(r){e.assign(r).inverse(),e.multDirMatrix(t.assign(P().zAxis)),e.multDirMatrix(n.assign(P().yAxis));const s=n.cross(t);i.assign(t).cross(s);const a=t;return s.normalize(),i.normalize(),a.normalize(),o.set(s.x,s.y,s.z,i.x,i.y,i.z,a.x,a.y,a.z),o}}()});const De=Ce;m().set("x_ite/Components/ParticleSystems/ParticleSystem",De);const Be=De,Oe=window[Symbol.for("X_ITE.X3D-8.3.0")].require("x_ite/Components/Rendering/IndexedLineSet");var Ve=e.n(Oe);function Ue(e){S.call(this,e),this.addType(_().PolylineEmitter),this.polylinesNode=new(Ve())(e),this.polylinesArray=new Float32Array,this.addSampler("polylines"),this.addUniform("direction","uniform vec3 direction;"),this.addUniform("verticesIndex","uniform int verticesIndex;"),this.addUniform("polylines","uniform sampler2D polylines;"),this.addFunction("vec3 getRandomVelocity ()\n {\n if (direction == vec3 (0.0))\n return getRandomSphericalVelocity ();\n\n else\n return direction * getRandomSpeed ();\n }"),this.addFunction("vec4 getRandomPosition ()\n {\n if (verticesIndex < 0)\n {\n return vec4 (NaN);\n }\n else\n {\n // Determine index0, index1 and weight.\n\n float lastLengthSoFar = texelFetch (polylines, verticesIndex - 1, 0) .x;\n float fraction = random () * lastLengthSoFar;\n\n int index0 = 0;\n int index1 = 0;\n float weight = 0.0;\n\n interpolate (polylines, verticesIndex, fraction, index0, index1, weight);\n\n // Interpolate and return position.\n\n index0 *= 2;\n index1 = index0 + 1;\n\n vec4 vertex0 = texelFetch (polylines, verticesIndex + index0, 0);\n vec4 vertex1 = texelFetch (polylines, verticesIndex + index1, 0);\n\n return mix (vertex0, vertex1, weight);\n }\n }")}Ue.prototype=Object.assign(Object.create(S.prototype),{constructor:Ue,[Symbol.for("X_ITE.X3DBaseNode.fieldDefinitions")]:new(c())([new(s())(_().inputOutput,"metadata",new(o().SFNode)),new(s())(_().inputOutput,"on",new(o().SFBool)(!0)),new(s())(_().inputOutput,"direction",new(o().SFVec3f)(0,1,0)),new(s())(_().inputOutput,"speed",new(o().SFFloat)),new(s())(_().inputOutput,"variation",new(o().SFFloat)(.25)),new(s())(_().inputOutput,"mass",new(o().SFFloat)),new(s())(_().inputOutput,"surfaceArea",new(o().SFFloat)),new(s())(_().inputOutput,"coordIndex",new(o().MFInt32)(-1)),new(s())(_().inputOutput,"coord",new(o().SFNode))]),getTypeName:function(){return"PolylineEmitter"},getComponentName:function(){return"ParticleSystems"},getContainerField:function(){return"emitter"},initialize:function(){S.prototype.initialize.call(this);this.getBrowser().getContext().getVersion()<2||(this.polylinesTexture=this.createTexture(),this._direction.addInterest("set_direction__",this),this._coordIndex.addFieldInterest(this.polylinesNode._coordIndex),this._coord.addFieldInterest(this.polylinesNode._coord),this.polylinesNode._coordIndex=this._coordIndex,this.polylinesNode._coord=this._coord,this.polylinesNode._rebuild.addInterest("set_polyline",this),this.polylinesNode.setPrivate(!0),this.polylinesNode.setup(),this.set_direction__(),this.set_polyline())},set_direction__:function(){const e=new(P())(0,0,0);return function(){e.assign(this._direction.getValue()).normalize(),this.setUniform("uniform3f","direction",e.x,e.y,e.z)}}(),set_polyline:function(){const e=new(P())(0,0,0),t=new(P())(0,0,0);return function(){const n=this.getBrowser().getContext(),i=this.polylinesNode.getVertices().getValue(),o=i.length/4,r=o/2+1,s=Math.ceil(Math.sqrt(r+o)),a=r;let c=this.polylinesArray;c.length<s*s*4&&(c=this.polylinesArray=new Float32Array(s*s*4));let l=0;for(let n=0,o=i.length;n<o;n+=8)e.set(i[n],i[n+1],i[n+2]),t.set(i[n+4],i[n+5],i[n+6]),c[n/2+4]=l+=t.subtract(e).magnitude();c.set(i,4*a),this.setUniform("uniform1i","verticesIndex",o?a:-1),s&&(n.bindTexture(n.TEXTURE_2D,this.polylinesTexture),n.texImage2D(n.TEXTURE_2D,0,n.RGBA32F,s,s,0,n.RGBA,n.FLOAT,c))}}(),activateTextures:function(e,t){e.activeTexture(e.TEXTURE0+t.polylinesTextureUnit),e.bindTexture(e.TEXTURE_2D,this.polylinesTexture)}});const ze=Ue;m().set("x_ite/Components/ParticleSystems/PolylineEmitter",ze);const Me=ze,Xe=window[Symbol.for("X_ITE.X3D-8.3.0")].require("standard/Math/Geometry/Triangle3");var Le=e.n(Xe);function qe(e){S.call(this,e),this.addType(_().SurfaceEmitter),this.surfaceNode=null,this.surfaceArray=new Float32Array,this.addSampler("surface"),this.addUniform("solid","uniform bool solid;"),this.addUniform("verticesIndex","uniform int verticesIndex;"),this.addUniform("normalsIndex","uniform int normalsIndex;"),this.addUniform("surface","uniform sampler2D surface;"),this.addFunction("vec4 position; vec3 getRandomVelocity ()\n {\n if (verticesIndex < 0)\n {\n return vec3 (0.0);\n }\n else\n {\n vec3 normal;\n\n getRandomPointOnSurface (surface, verticesIndex, normalsIndex, position, normal);\n\n if (solid == false && random () > 0.5)\n normal = -normal;\n\n return normal * getRandomSpeed ();\n }\n }"),this.addFunction("vec4 getRandomPosition ()\n {\n return verticesIndex < 0 ? vec4 (NaN) : position;\n }")}qe.prototype=Object.assign(Object.create(S.prototype),{constructor:qe,[Symbol.for("X_ITE.X3DBaseNode.fieldDefinitions")]:new(c())([new(s())(_().inputOutput,"metadata",new(o().SFNode)),new(s())(_().inputOutput,"on",new(o().SFBool)(!0)),new(s())(_().inputOutput,"speed",new(o().SFFloat)),new(s())(_().inputOutput,"variation",new(o().SFFloat)(.25)),new(s())(_().inputOutput,"mass",new(o().SFFloat)),new(s())(_().inputOutput,"surfaceArea",new(o().SFFloat)),new(s())(_().inputOutput,"surface",new(o().SFNode))]),getTypeName:function(){return"SurfaceEmitter"},getComponentName:function(){return"ParticleSystems"},getContainerField:function(){return"emitter"},initialize:function(){S.prototype.initialize.call(this);this.getBrowser().getContext().getVersion()<2||(this.surfaceTexture=this.createTexture(),this._surface.addInterest("set_surface__",this),this.set_surface__())},set_surface__:function(){this.surfaceNode&&(this.surfaceNode._solid.removeInterest("set_solid__",this),this.surfaceNode._rebuild.removeInterest("set_geometry__",this)),this.surfaceNode=q()(_().X3DGeometryNode,this._surface),this.surfaceNode&&(this.surfaceNode._solid.addInterest("set_solid__",this),this.surfaceNode._rebuild.addInterest("set_geometry__",this)),this.set_solid__(),this.set_geometry__()},set_solid__:function(){this.surfaceNode&&this.setUniform("uniform1i","solid",this.surfaceNode._solid.getValue())},set_geometry__:function(){const e=new(P())(0,0,0),t=new(P())(0,0,0),n=new(P())(0,0,0);return function(){const i=this.getBrowser().getContext();if(this.surfaceNode){const o=this.surfaceNode.getVertices().getValue(),r=this.surfaceNode.getNormals().getValue(),s=o.length/4,a=s/3+1,c=Math.ceil(Math.sqrt(a+s+s)),l=a,u=l+s;let d=this.surfaceArray;d.length<c*c*4&&(d=this.surfaceArray=new Float32Array(c*c*4));let m=0;for(let i=0,r=o.length;i<r;i+=12)e.set(o[i],o[i+1],o[i+2]),t.set(o[i+4],o[i+5],o[i+6]),n.set(o[i+8],o[i+9],o[i+10]),d[i/3+4]=m+=Le().area(e,t,n);d.set(o,4*l);for(let e=4*u,t=0,n=r.length;t<n;e+=4,t+=3)d[e+0]=r[t+0],d[e+1]=r[t+1],d[e+2]=r[t+2];this.setUniform("uniform1i","verticesIndex",s?l:-1),this.setUniform("uniform1i","normalsIndex",s?u:-1),c&&(i.bindTexture(i.TEXTURE_2D,this.surfaceTexture),i.texImage2D(i.TEXTURE_2D,0,i.RGBA32F,c,c,0,i.RGBA,i.FLOAT,d))}else this.setUniform("uniform1i","verticesIndex",-1),this.setUniform("uniform1i","normalsIndex",-1)}}(),activateTextures:function(e,t){e.activeTexture(e.TEXTURE0+t.surfaceTextureUnit),e.bindTexture(e.TEXTURE_2D,this.surfaceTexture)}});const je=qe;m().set("x_ite/Components/ParticleSystems/SurfaceEmitter",je);const He=je,Ge=window[Symbol.for("X_ITE.X3D-8.3.0")].require("x_ite/Components/Geometry3D/IndexedFaceSet");var ke=e.n(Ge);function Ye(e){S.call(this,e),this.addType(_().VolumeEmitter),this.volumeNode=new(ke())(e),this.volumeArray=new Float32Array,this.addSampler("volume"),this.addUniform("direction","uniform vec3 direction;"),this.addUniform("verticesIndex","uniform int verticesIndex;"),this.addUniform("normalsIndex","uniform int normalsIndex;"),this.addUniform("hierarchyIndex","uniform int hierarchyIndex;"),this.addUniform("hierarchyRoot","uniform int hierarchyRoot;"),this.addUniform("volume","uniform sampler2D volume;"),this.addFunction("vec3 getRandomVelocity ()\n {\n if (hierarchyRoot < 0)\n {\n return vec3 (0.0);\n }\n else\n {\n if (direction == vec3 (0.0))\n return getRandomSphericalVelocity ();\n\n else\n return direction * getRandomSpeed ();\n }\n }"),this.addFunction("vec4 getRandomPosition ()\n {\n if (hierarchyRoot < 0)\n {\n return vec4 (NaN);\n }\n else\n {\n vec4 point;\n vec3 normal;\n\n getRandomPointOnSurface (volume, verticesIndex, normalsIndex, point, normal);\n\n Line3 line = Line3 (point .xyz, getRandomSurfaceNormal (normal));\n\n vec4 points [ARRAY_SIZE];\n\n int numIntersections = getIntersections (volume, verticesIndex, hierarchyIndex, hierarchyRoot, line, points);\n\n numIntersections -= numIntersections % 2; // We need an even count of intersections.\n\n switch (numIntersections)\n {\n case 0:\n return vec4 (0.0);\n case 2:\n break;\n default:\n sort (points, numIntersections, plane3 (line .point, line .direction));\n break;\n }\n\n int index = int (fract (random ()) * float (numIntersections / 2)) * 2; // Select random intersection.\n\n return mix (points [index], points [index + 1], random ());\n }\n }")}Ye.prototype=Object.assign(Object.create(S.prototype),{constructor:Ye,[Symbol.for("X_ITE.X3DBaseNode.fieldDefinitions")]:new(c())([new(s())(_().inputOutput,"metadata",new(o().SFNode)),new(s())(_().inputOutput,"on",new(o().SFBool)(!0)),new(s())(_().inputOutput,"internal",new(o().SFBool)(!0)),new(s())(_().inputOutput,"direction",new(o().SFVec3f)(0,1,0)),new(s())(_().inputOutput,"speed",new(o().SFFloat)),new(s())(_().inputOutput,"variation",new(o().SFFloat)(.25)),new(s())(_().inputOutput,"mass",new(o().SFFloat)),new(s())(_().inputOutput,"surfaceArea",new(o().SFFloat)),new(s())(_().inputOutput,"coordIndex",new(o().MFInt32)(-1)),new(s())(_().inputOutput,"coord",new(o().SFNode))]),getTypeName:function(){return"VolumeEmitter"},getComponentName:function(){return"ParticleSystems"},getContainerField:function(){return"emitter"},initialize:function(){S.prototype.initialize.call(this);this.getBrowser().getContext().getVersion()<2||(this.volumeTexture=this.createTexture(),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(){const e=new(P())(0,0,0);return function(){e.assign(this._direction.getValue()).normalize(),this.setUniform("uniform3f","direction",e.x,e.y,e.z)}}(),set_geometry__:function(){const e=new(P())(0,0,0),t=new(P())(0,0,0),n=new(P())(0,0,0);return function(){const i=this.getBrowser().getContext(),o=this.volumeNode.getVertices().getValue(),r=this.volumeNode.getNormals().getValue(),s=new Se(o,r).toArray([]),a=o.length/4,c=r.length/3,l=a/3+1,u=s.length/4,d=Math.ceil(Math.sqrt(l+a+a+u)),m=l,h=m+a,p=h+c;let f=this.volumeArray;f.length<d*d*4&&(f=this.volumeArray=new Float32Array(d*d*4));let x=0;for(let i=0,r=o.length;i<r;i+=12)e.set(o[i],o[i+1],o[i+2]),t.set(o[i+4],o[i+5],o[i+6]),n.set(o[i+8],o[i+9],o[i+10]),f[i/3+4]=x+=Le().area(e,t,n);f.set(o,4*m);for(let e=4*h,t=0,n=r.length;t<n;e+=4,t+=3)f[e+0]=r[t+0],f[e+1]=r[t+1],f[e+2]=r[t+2];f.set(s,4*p),this.setUniform("uniform1i","verticesIndex",m),this.setUniform("uniform1i","normalsIndex",h),this.setUniform("uniform1i","hierarchyIndex",p),this.setUniform("uniform1i","hierarchyRoot",p+u-1),d&&(i.bindTexture(i.TEXTURE_2D,this.volumeTexture),i.texImage2D(i.TEXTURE_2D,0,i.RGBA32F,d,d,0,i.RGBA,i.FLOAT,f))}}(),activateTextures:function(e,t){e.activeTexture(e.TEXTURE0+t.volumeTextureUnit),e.bindTexture(e.TEXTURE_2D,this.volumeTexture)}});const We=Ye;m().set("x_ite/Components/ParticleSystems/VolumeEmitter",We);const Ke=We,Ze=window[Symbol.for("X_ITE.X3D-8.3.0")].require("standard/Math/Algorithm");var Qe=e.n(Ze);function $e(e){X.call(this,e),this.addType(_().WindPhysicsModel),this._speed.setUnit("speed")}$e.prototype=Object.assign(Object.create(X.prototype),{constructor:$e,[Symbol.for("X_ITE.X3DBaseNode.fieldDefinitions")]:new(c())([new(s())(_().inputOutput,"metadata",new(o().SFNode)),new(s())(_().inputOutput,"enabled",new(o().SFBool)(!0)),new(s())(_().inputOutput,"direction",new(o().SFVec3f)),new(s())(_().inputOutput,"speed",new(o().SFFloat)(.1)),new(s())(_().inputOutput,"gustiness",new(o().SFFloat)(.1)),new(s())(_().inputOutput,"turbulence",new(o().SFFloat))]),getTypeName:function(){return"WindPhysicsModel"},getComponentName:function(){return"ParticleSystems"},getContainerField:function(){return"physics"},getRandomSpeed:function(e){const t=Math.max(0,this._speed.getValue()),n=t*Math.max(0,this._gustiness.getValue());return e.getRandomValue(Math.max(0,t-n),t+n)},addForce:function(){const e=new(P())(0,0,0);return function(t,n,i,o){if(this._enabled.getValue()){const r=n._surfaceArea.getValue(),s=this.getRandomSpeed(n),a=.64615*Math.pow(10,2*Math.log(s));return this._direction.getValue().equals(P().Zero)?n.getRandomNormal(e):e.assign(this._direction.getValue()).normalize(),o.set(e.multiply(r*a*i),4*t),o[4*t+3]=Math.PI*Qe().clamp(this._turbulence.getValue(),0,1),!0}return!1}}()});const Je=$e;m().set("x_ite/Components/ParticleSystems/WindPhysicsModel",Je);const et=Je;n().addComponent({name:"ParticleSystems",types:{BoundedPhysicsModel:G,ConeEmitter:W,ExplosionEmitter:Q,ForcePhysicsModel:ee,ParticleSystem:Be,PointEmitter:D,PolylineEmitter:Me,SurfaceEmitter:He,VolumeEmitter:Ke,WindPhysicsModel:et},abstractTypes:{X3DParticleEmitterNode:S,X3DParticlePhysicsModelNode:X},browserContext:U});const tt=void 0;m().set("assets/components/ParticleSystems",tt)})();
|