react-babylonjs
Version:
React for Babylon.js
1 lines • 547 kB
JavaScript
import{Camera as e}from"@babylonjs/core/Cameras/camera.js";import{Ray as n}from"@babylonjs/core/Culling/ray.js";import{Frustum as t}from"@babylonjs/core/Maths/math.frustum.js";import{Vector3 as o,Matrix as r,Vector2 as a}from"@babylonjs/core/Maths/math.vector.js";import i,{createContext as s,useContext as l,useEffect as p,forwardRef as c,useState as u,useRef as d,useMemo as m,useLayoutEffect as b,version as h}from"react";import{createRoot as y}from"react-dom/client";import{SceneLoader as f}from"@babylonjs/core/Loading/sceneLoader.js";import{Mesh as g}from"@babylonjs/core/Meshes/mesh.js";import{Sound as P}from"@babylonjs/core/Audio/sound.js";import{AutoRotationBehavior as C}from"@babylonjs/core/Behaviors/Cameras/autoRotationBehavior.js";import{BouncingBehavior as v}from"@babylonjs/core/Behaviors/Cameras/bouncingBehavior.js";import{FramingBehavior as M}from"@babylonjs/core/Behaviors/Cameras/framingBehavior.js";import{AttachToBoxBehavior as S}from"@babylonjs/core/Behaviors/Meshes/attachToBoxBehavior.js";import{BaseSixDofDragBehavior as T}from"@babylonjs/core/Behaviors/Meshes/baseSixDofDragBehavior.js";import{FadeInOutBehavior as x}from"@babylonjs/core/Behaviors/Meshes/fadeInOutBehavior.js";import{FollowBehavior as B}from"@babylonjs/core/Behaviors/Meshes/followBehavior.js";import{HandConstraintBehavior as H}from"@babylonjs/core/Behaviors/Meshes/handConstraintBehavior.js";import{MultiPointerScaleBehavior as w}from"@babylonjs/core/Behaviors/Meshes/multiPointerScaleBehavior.js";import{PointerDragBehavior as F}from"@babylonjs/core/Behaviors/Meshes/pointerDragBehavior.js";import{SixDofDragBehavior as R}from"@babylonjs/core/Behaviors/Meshes/sixDofDragBehavior.js";import{SurfaceMagnetismBehavior as D}from"@babylonjs/core/Behaviors/Meshes/surfaceMagnetismBehavior.js";import{ArcRotateCamera as I}from"@babylonjs/core/Cameras/arcRotateCamera.js";import{DeviceOrientationCamera as O}from"@babylonjs/core/Cameras/deviceOrientationCamera.js";import{FlyCamera as j}from"@babylonjs/core/Cameras/flyCamera.js";import{ArcFollowCamera as L,FollowCamera as A}from"@babylonjs/core/Cameras/followCamera.js";import{FreeCamera as E}from"@babylonjs/core/Cameras/freeCamera.js";import{GamepadCamera as G}from"@babylonjs/core/Cameras/gamepadCamera.js";import{AnaglyphArcRotateCamera as z}from"@babylonjs/core/Cameras/Stereoscopic/anaglyphArcRotateCamera.js";import{AnaglyphFreeCamera as k}from"@babylonjs/core/Cameras/Stereoscopic/anaglyphFreeCamera.js";import{AnaglyphGamepadCamera as N}from"@babylonjs/core/Cameras/Stereoscopic/anaglyphGamepadCamera.js";import{AnaglyphUniversalCamera as U}from"@babylonjs/core/Cameras/Stereoscopic/anaglyphUniversalCamera.js";import{StereoscopicArcRotateCamera as V}from"@babylonjs/core/Cameras/Stereoscopic/stereoscopicArcRotateCamera.js";import{StereoscopicFreeCamera as _}from"@babylonjs/core/Cameras/Stereoscopic/stereoscopicFreeCamera.js";import{StereoscopicGamepadCamera as W}from"@babylonjs/core/Cameras/Stereoscopic/stereoscopicGamepadCamera.js";import{StereoscopicScreenUniversalCamera as X}from"@babylonjs/core/Cameras/Stereoscopic/stereoscopicScreenUniversalCamera.js";import{StereoscopicUniversalCamera as Z}from"@babylonjs/core/Cameras/Stereoscopic/stereoscopicUniversalCamera.js";import{TargetCamera as Y}from"@babylonjs/core/Cameras/targetCamera.js";import{TouchCamera as K}from"@babylonjs/core/Cameras/touchCamera.js";import{UniversalCamera as q}from"@babylonjs/core/Cameras/universalCamera.js";import{VirtualJoysticksCamera as Q}from"@babylonjs/core/Cameras/virtualJoysticksCamera.js";import{VRDeviceOrientationArcRotateCamera as J}from"@babylonjs/core/Cameras/VR/vrDeviceOrientationArcRotateCamera.js";import{VRDeviceOrientationFreeCamera as $}from"@babylonjs/core/Cameras/VR/vrDeviceOrientationFreeCamera.js";import{VRDeviceOrientationGamepadCamera as ee}from"@babylonjs/core/Cameras/VR/vrDeviceOrientationGamepadCamera.js";import{VRExperienceHelper as ne}from"@babylonjs/core/Cameras/VR/vrExperienceHelper.js";import{EngineView as te}from"@babylonjs/core/Engines/AbstractEngine/abstractEngine.views.js";import{AxisDragGizmo as oe}from"@babylonjs/core/Gizmos/axisDragGizmo.js";import{AxisScaleGizmo as re}from"@babylonjs/core/Gizmos/axisScaleGizmo.js";import{BoundingBoxGizmo as ae}from"@babylonjs/core/Gizmos/boundingBoxGizmo.js";import{CameraGizmo as ie}from"@babylonjs/core/Gizmos/cameraGizmo.js";import{Gizmo as se}from"@babylonjs/core/Gizmos/gizmo.js";import{GizmoManager as le}from"@babylonjs/core/Gizmos/gizmoManager.js";import{LightGizmo as pe}from"@babylonjs/core/Gizmos/lightGizmo.js";import{PlaneDragGizmo as ce}from"@babylonjs/core/Gizmos/planeDragGizmo.js";import{PlaneRotationGizmo as ue}from"@babylonjs/core/Gizmos/planeRotationGizmo.js";import{PositionGizmo as de}from"@babylonjs/core/Gizmos/positionGizmo.js";import{RotationGizmo as me}from"@babylonjs/core/Gizmos/rotationGizmo.js";import{ScaleGizmo as be}from"@babylonjs/core/Gizmos/scaleGizmo.js";import{EnvironmentHelper as he}from"@babylonjs/core/Helpers/environmentHelper.js";import{EffectLayer as ye}from"@babylonjs/core/Layers/effectLayer.js";import{GlowLayer as fe}from"@babylonjs/core/Layers/glowLayer.js";import{HighlightLayer as ge}from"@babylonjs/core/Layers/highlightLayer.js";import{Layer as Pe}from"@babylonjs/core/Layers/layer.js";import{DirectionalLight as Ce}from"@babylonjs/core/Lights/directionalLight.js";import{HemisphericLight as ve}from"@babylonjs/core/Lights/hemisphericLight.js";import{Light as Me}from"@babylonjs/core/Lights/light.js";import{PointLight as Se}from"@babylonjs/core/Lights/pointLight.js";import{ShadowLight as Te}from"@babylonjs/core/Lights/shadowLight.js";import{CascadedShadowGenerator as xe}from"@babylonjs/core/Lights/Shadows/cascadedShadowGenerator.js";import{ShadowGenerator as Be}from"@babylonjs/core/Lights/Shadows/shadowGenerator.js";import{SpotLight as He}from"@babylonjs/core/Lights/spotLight.js";import{BackgroundMaterial as we}from"@babylonjs/core/Materials/Background/backgroundMaterial.js";import{GaussianSplattingMaterial as Fe}from"@babylonjs/core/Materials/GaussianSplatting/gaussianSplattingMaterial.js";import{GreasedLineSimpleMaterial as Re}from"@babylonjs/core/Materials/GreasedLine/greasedLineSimpleMaterial.js";import{ImageProcessingConfiguration as De}from"@babylonjs/core/Materials/imageProcessingConfiguration.js";import{DetailMapConfiguration as Ie}from"@babylonjs/core/Materials/material.detailMapConfiguration.js";import{Material as Oe}from"@babylonjs/core/Materials/material.js";import{MaterialPluginBase as je}from"@babylonjs/core/Materials/materialPluginBase.js";import{MultiMaterial as Le}from"@babylonjs/core/Materials/multiMaterial.js";import{NodeMaterial as Ae}from"@babylonjs/core/Materials/Node/nodeMaterial.js";import{OcclusionMaterial as Ee}from"@babylonjs/core/Materials/Occlusion/occlusionMaterial.js";import{PBRAnisotropicConfiguration as Ge}from"@babylonjs/core/Materials/PBR/pbrAnisotropicConfiguration.js";import{PBRBaseMaterial as ze}from"@babylonjs/core/Materials/PBR/pbrBaseMaterial.js";import{PBRBaseSimpleMaterial as ke}from"@babylonjs/core/Materials/PBR/pbrBaseSimpleMaterial.js";import{PBRBRDFConfiguration as Ne}from"@babylonjs/core/Materials/PBR/pbrBRDFConfiguration.js";import{PBRClearCoatConfiguration as Ue}from"@babylonjs/core/Materials/PBR/pbrClearCoatConfiguration.js";import{PBRIridescenceConfiguration as Ve}from"@babylonjs/core/Materials/PBR/pbrIridescenceConfiguration.js";import{PBRMaterial as _e}from"@babylonjs/core/Materials/PBR/pbrMaterial.js";import{PBRMetallicRoughnessMaterial as We}from"@babylonjs/core/Materials/PBR/pbrMetallicRoughnessMaterial.js";import{PBRSheenConfiguration as Xe}from"@babylonjs/core/Materials/PBR/pbrSheenConfiguration.js";import{PBRSpecularGlossinessMaterial as Ze}from"@babylonjs/core/Materials/PBR/pbrSpecularGlossinessMaterial.js";import{PBRSubSurfaceConfiguration as Ye}from"@babylonjs/core/Materials/PBR/pbrSubSurfaceConfiguration.js";import{PrePassConfiguration as Ke}from"@babylonjs/core/Materials/prePassConfiguration.js";import{PushMaterial as qe}from"@babylonjs/core/Materials/pushMaterial.js";import{ShaderMaterial as Qe}from"@babylonjs/core/Materials/shaderMaterial.js";import{StandardMaterial as Je}from"@babylonjs/core/Materials/standardMaterial.js";import{BaseTexture as $e}from"@babylonjs/core/Materials/Textures/baseTexture.js";import{ColorGradingTexture as en}from"@babylonjs/core/Materials/Textures/colorGradingTexture.js";import{CubeTexture as nn}from"@babylonjs/core/Materials/Textures/cubeTexture.js";import{DynamicTexture as tn}from"@babylonjs/core/Materials/Textures/dynamicTexture.js";import{EquiRectangularCubeTexture as on}from"@babylonjs/core/Materials/Textures/equiRectangularCubeTexture.js";import{HDRCubeTexture as rn}from"@babylonjs/core/Materials/Textures/hdrCubeTexture.js";import{HtmlElementTexture as an}from"@babylonjs/core/Materials/Textures/htmlElementTexture.js";import{MirrorTexture as sn}from"@babylonjs/core/Materials/Textures/mirrorTexture.js";import{MultiRenderTarget as ln}from"@babylonjs/core/Materials/Textures/multiRenderTarget.js";import{MultiviewRenderTarget as pn}from"@babylonjs/core/Materials/Textures/MultiviewRenderTarget.js";import{PrePassRenderTarget as cn}from"@babylonjs/core/Materials/Textures/prePassRenderTarget.js";import{CustomProceduralTexture as un}from"@babylonjs/core/Materials/Textures/Procedurals/customProceduralTexture.js";import{NoiseProceduralTexture as dn}from"@babylonjs/core/Materials/Textures/Procedurals/noiseProceduralTexture.js";import{ProceduralTexture as mn}from"@babylonjs/core/Materials/Textures/Procedurals/proceduralTexture.js";import{RawCubeTexture as bn}from"@babylonjs/core/Materials/Textures/rawCubeTexture.js";import{RawTexture as hn}from"@babylonjs/core/Materials/Textures/rawTexture.js";import{RawTexture2DArray as yn}from"@babylonjs/core/Materials/Textures/rawTexture2DArray.js";import{RawTexture3D as fn}from"@babylonjs/core/Materials/Textures/rawTexture3D.js";import{RefractionTexture as gn}from"@babylonjs/core/Materials/Textures/refractionTexture.js";import{RenderTargetTexture as Pn}from"@babylonjs/core/Materials/Textures/renderTargetTexture.js";import{Texture as Cn}from"@babylonjs/core/Materials/Textures/texture.js";import{ThinRenderTargetTexture as vn}from"@babylonjs/core/Materials/Textures/thinRenderTargetTexture.js";import{ThinTexture as Mn}from"@babylonjs/core/Materials/Textures/thinTexture.js";import{VideoTexture as Sn}from"@babylonjs/core/Materials/Textures/videoTexture.js";import{Viewport as Tn}from"@babylonjs/core/Maths/math.viewport.js";import{AbstractMesh as xn}from"@babylonjs/core/Meshes/abstractMesh.js";import{GaussianSplattingMesh as Bn}from"@babylonjs/core/Meshes/GaussianSplatting/gaussianSplattingMesh.js";import{GoldbergMesh as Hn}from"@babylonjs/core/Meshes/goldbergMesh.js";import{GreasedLineBaseMesh as wn}from"@babylonjs/core/Meshes/GreasedLine/greasedLineBaseMesh.js";import{GreasedLineMesh as Fn}from"@babylonjs/core/Meshes/GreasedLine/greasedLineMesh.js";import{GreasedLineRibbonMesh as Rn}from"@babylonjs/core/Meshes/GreasedLine/greasedLineRibbonMesh.js";import{GroundMesh as Dn}from"@babylonjs/core/Meshes/groundMesh.js";import{InstancedMesh as In}from"@babylonjs/core/Meshes/instancedMesh.js";import{LinesMesh as On,InstancedLinesMesh as jn}from"@babylonjs/core/Meshes/linesMesh.js";import{MeshBuilder as Ln}from"@babylonjs/core/Meshes/meshBuilder.js";import{TrailMesh as An}from"@babylonjs/core/Meshes/trailMesh.js";import{TransformNode as En}from"@babylonjs/core/Meshes/transformNode.js";import{Node as Gn}from"@babylonjs/core/node.js";import{PointsCloudSystem as zn}from"@babylonjs/core/Particles/pointsCloudSystem.js";import{PhysicsImpostor as kn}from"@babylonjs/core/Physics/v1/physicsImpostor.js";import{PhysicsAggregate as Nn}from"@babylonjs/core/Physics/v2/physicsAggregate.js";import{AnaglyphPostProcess as Un}from"@babylonjs/core/PostProcesses/anaglyphPostProcess.js";import{BlackAndWhitePostProcess as Vn}from"@babylonjs/core/PostProcesses/blackAndWhitePostProcess.js";import{BloomMergePostProcess as _n}from"@babylonjs/core/PostProcesses/bloomMergePostProcess.js";import{BlurPostProcess as Wn}from"@babylonjs/core/PostProcesses/blurPostProcess.js";import{ChromaticAberrationPostProcess as Xn}from"@babylonjs/core/PostProcesses/chromaticAberrationPostProcess.js";import{CircleOfConfusionPostProcess as Zn}from"@babylonjs/core/PostProcesses/circleOfConfusionPostProcess.js";import{ColorCorrectionPostProcess as Yn}from"@babylonjs/core/PostProcesses/colorCorrectionPostProcess.js";import{ConvolutionPostProcess as Kn}from"@babylonjs/core/PostProcesses/convolutionPostProcess.js";import{DepthOfFieldBlurPostProcess as qn}from"@babylonjs/core/PostProcesses/depthOfFieldBlurPostProcess.js";import{DepthOfFieldMergePostProcess as Qn}from"@babylonjs/core/PostProcesses/depthOfFieldMergePostProcess.js";import{DisplayPassPostProcess as Jn}from"@babylonjs/core/PostProcesses/displayPassPostProcess.js";import{ExtractHighlightsPostProcess as $n}from"@babylonjs/core/PostProcesses/extractHighlightsPostProcess.js";import{FilterPostProcess as et}from"@babylonjs/core/PostProcesses/filterPostProcess.js";import{FxaaPostProcess as nt}from"@babylonjs/core/PostProcesses/fxaaPostProcess.js";import{GrainPostProcess as tt}from"@babylonjs/core/PostProcesses/grainPostProcess.js";import{HighlightsPostProcess as ot}from"@babylonjs/core/PostProcesses/highlightsPostProcess.js";import{ImageProcessingPostProcess as rt}from"@babylonjs/core/PostProcesses/imageProcessingPostProcess.js";import{MotionBlurPostProcess as at}from"@babylonjs/core/PostProcesses/motionBlurPostProcess.js";import{PassCubePostProcess as it,PassPostProcess as st}from"@babylonjs/core/PostProcesses/passPostProcess.js";import{PostProcess as lt}from"@babylonjs/core/PostProcesses/postProcess.js";import{RefractionPostProcess as pt}from"@babylonjs/core/PostProcesses/refractionPostProcess.js";import{DefaultRenderingPipeline as ct}from"@babylonjs/core/PostProcesses/RenderPipeline/Pipelines/defaultRenderingPipeline.js";import{LensRenderingPipeline as ut}from"@babylonjs/core/PostProcesses/RenderPipeline/Pipelines/lensRenderingPipeline.js";import{SSAO2RenderingPipeline as dt}from"@babylonjs/core/PostProcesses/RenderPipeline/Pipelines/ssao2RenderingPipeline.js";import{SSAORenderingPipeline as mt}from"@babylonjs/core/PostProcesses/RenderPipeline/Pipelines/ssaoRenderingPipeline.js";import{SSRRenderingPipeline as bt}from"@babylonjs/core/PostProcesses/RenderPipeline/Pipelines/ssrRenderingPipeline.js";import{StandardRenderingPipeline as ht}from"@babylonjs/core/PostProcesses/RenderPipeline/Pipelines/standardRenderingPipeline.js";import{TAARenderingPipeline as yt}from"@babylonjs/core/PostProcesses/RenderPipeline/Pipelines/taaRenderingPipeline.js";import{PostProcessRenderPipeline as ft}from"@babylonjs/core/PostProcesses/RenderPipeline/postProcessRenderPipeline.js";import{ScreenSpaceCurvaturePostProcess as gt}from"@babylonjs/core/PostProcesses/screenSpaceCurvaturePostProcess.js";import{ScreenSpaceReflectionPostProcess as Pt}from"@babylonjs/core/PostProcesses/screenSpaceReflectionPostProcess.js";import{SharpenPostProcess as Ct}from"@babylonjs/core/PostProcesses/sharpenPostProcess.js";import{StereoscopicInterlacePostProcess as vt,StereoscopicInterlacePostProcessI as Mt}from"@babylonjs/core/PostProcesses/stereoscopicInterlacePostProcess.js";import{SubSurfaceScatteringPostProcess as St}from"@babylonjs/core/PostProcesses/subSurfaceScatteringPostProcess.js";import{TonemapPostProcess as Tt}from"@babylonjs/core/PostProcesses/tonemapPostProcess.js";import{VolumetricLightScatteringPostProcess as xt}from"@babylonjs/core/PostProcesses/volumetricLightScatteringPostProcess.js";import{VRDistortionCorrectionPostProcess as Bt}from"@babylonjs/core/PostProcesses/vrDistortionCorrectionPostProcess.js";import{VRMultiviewToSingleviewPostProcess as Ht}from"@babylonjs/core/PostProcesses/vrMultiviewToSingleviewPostProcess.js";import{IblShadowsRenderPipeline as wt}from"@babylonjs/core/Rendering/IBLShadows/iblShadowsRenderPipeline.js";import{UtilityLayerRenderer as Ft}from"@babylonjs/core/Rendering/utilityLayerRenderer.js";import{Scene as Rt}from"@babylonjs/core/scene.js";import{Sprite as Dt}from"@babylonjs/core/Sprites/sprite.js";import{SpriteManager as It}from"@babylonjs/core/Sprites/spriteManager.js";import{SpritePackedManager as Ot}from"@babylonjs/core/Sprites/spritePackedManager.js";import{ThinSprite as jt}from"@babylonjs/core/Sprites/thinSprite.js";import{XRSpaceWarpRenderTarget as Lt}from"@babylonjs/core/XR/features/WebXRSpaceWarp.js";import{WebXRCamera as At}from"@babylonjs/core/XR/webXRCamera.js";import{AdvancedDynamicTexture as Et}from"@babylonjs/gui/2D/advancedDynamicTexture.js";import{Button as Gt}from"@babylonjs/gui/2D/controls/button.js";import{Checkbox as zt}from"@babylonjs/gui/2D/controls/checkbox.js";import{ColorPicker as kt}from"@babylonjs/gui/2D/controls/colorpicker.js";import{Container as Nt}from"@babylonjs/gui/2D/controls/container.js";import{Control as Ut}from"@babylonjs/gui/2D/controls/control.js";import{DisplayGrid as Vt}from"@babylonjs/gui/2D/controls/displayGrid.js";import{Ellipse as _t}from"@babylonjs/gui/2D/controls/ellipse.js";import{FocusableButton as Wt}from"@babylonjs/gui/2D/controls/focusableButton.js";import{Grid as Xt}from"@babylonjs/gui/2D/controls/grid.js";import{Image as Zt}from"@babylonjs/gui/2D/controls/image.js";import{InputPassword as Yt}from"@babylonjs/gui/2D/controls/inputPassword.js";import{InputText as Kt}from"@babylonjs/gui/2D/controls/inputText.js";import{InputTextArea as qt}from"@babylonjs/gui/2D/controls/inputTextArea.js";import{Line as Qt}from"@babylonjs/gui/2D/controls/line.js";import{MultiLine as Jt}from"@babylonjs/gui/2D/controls/multiLine.js";import{RadioButton as $t}from"@babylonjs/gui/2D/controls/radioButton.js";import{Rectangle as eo}from"@babylonjs/gui/2D/controls/rectangle.js";import{ScrollViewer as no}from"@babylonjs/gui/2D/controls/scrollViewers/scrollViewer.js";import{_ScrollViewerWindow as to}from"@babylonjs/gui/2D/controls/scrollViewers/scrollViewerWindow.js";import{SelectionPanel as oo}from"@babylonjs/gui/2D/controls/selector.js";import{BaseSlider as ro}from"@babylonjs/gui/2D/controls/sliders/baseSlider.js";import{ImageBasedSlider as ao}from"@babylonjs/gui/2D/controls/sliders/imageBasedSlider.js";import{ImageScrollBar as io}from"@babylonjs/gui/2D/controls/sliders/imageScrollBar.js";import{ScrollBar as so}from"@babylonjs/gui/2D/controls/sliders/scrollBar.js";import{Slider as lo}from"@babylonjs/gui/2D/controls/sliders/slider.js";import{StackPanel as po}from"@babylonjs/gui/2D/controls/stackPanel.js";import{TextBlock as co}from"@babylonjs/gui/2D/controls/textBlock.js";import{ToggleButton as uo}from"@babylonjs/gui/2D/controls/toggleButton.js";import{VirtualKeyboard as mo}from"@babylonjs/gui/2D/controls/virtualKeyboard.js";import{DefaultBehavior as bo}from"@babylonjs/gui/3D/behaviors/defaultBehavior.js";import{AbstractButton3D as ho}from"@babylonjs/gui/3D/controls/abstractButton3D.js";import{Button3D as yo}from"@babylonjs/gui/3D/controls/button3D.js";import{Container3D as fo}from"@babylonjs/gui/3D/controls/container3D.js";import{ContentDisplay3D as go}from"@babylonjs/gui/3D/controls/contentDisplay3D.js";import{Control3D as Po}from"@babylonjs/gui/3D/controls/control3D.js";import{CylinderPanel as Co}from"@babylonjs/gui/3D/controls/cylinderPanel.js";import{HandMenu as vo}from"@babylonjs/gui/3D/controls/handMenu.js";import{HolographicBackplate as Mo}from"@babylonjs/gui/3D/controls/holographicBackplate.js";import{HolographicButton as So}from"@babylonjs/gui/3D/controls/holographicButton.js";import{HolographicSlate as To}from"@babylonjs/gui/3D/controls/holographicSlate.js";import{MeshButton3D as xo}from"@babylonjs/gui/3D/controls/meshButton3D.js";import{NearMenu as Bo}from"@babylonjs/gui/3D/controls/nearMenu.js";import{PlanePanel as Ho}from"@babylonjs/gui/3D/controls/planePanel.js";import{ScatterPanel as wo}from"@babylonjs/gui/3D/controls/scatterPanel.js";import{Slider3D as Fo}from"@babylonjs/gui/3D/controls/slider3D.js";import{SpherePanel as Ro}from"@babylonjs/gui/3D/controls/spherePanel.js";import{StackPanel3D as Do}from"@babylonjs/gui/3D/controls/stackPanel3D.js";import{TouchButton3D as Io}from"@babylonjs/gui/3D/controls/touchButton3D.js";import{TouchHolographicButton as Oo}from"@babylonjs/gui/3D/controls/touchHolographicButton.js";import{TouchHolographicMenu as jo}from"@babylonjs/gui/3D/controls/touchHolographicMenu.js";import{TouchMeshButton3D as Lo}from"@babylonjs/gui/3D/controls/touchMeshButton3D.js";import{VolumeBasedPanel as Ao}from"@babylonjs/gui/3D/controls/volumeBasedPanel.js";import{SlateGizmo as Eo}from"@babylonjs/gui/3D/gizmos/slateGizmo.js";import{GUI3DManager as Go}from"@babylonjs/gui/3D/gui3DManager.js";import{FluentMaterial as zo}from"@babylonjs/gui/3D/materials/fluent/fluentMaterial.js";import{FluentBackplateMaterial as ko}from"@babylonjs/gui/3D/materials/fluentBackplate/fluentBackplateMaterial.js";import{FluentButtonMaterial as No}from"@babylonjs/gui/3D/materials/fluentButton/fluentButtonMaterial.js";import{HandleMaterial as Uo}from"@babylonjs/gui/3D/materials/handle/handleMaterial.js";import{MRDLBackglowMaterial as Vo}from"@babylonjs/gui/3D/materials/mrdl/mrdlBackglowMaterial.js";import{MRDLBackplateMaterial as _o}from"@babylonjs/gui/3D/materials/mrdl/mrdlBackplateMaterial.js";import{MRDLFrontplateMaterial as Wo}from"@babylonjs/gui/3D/materials/mrdl/mrdlFrontplateMaterial.js";import{MRDLInnerquadMaterial as Xo}from"@babylonjs/gui/3D/materials/mrdl/mrdlInnerquadMaterial.js";import{MRDLSliderBarMaterial as Zo}from"@babylonjs/gui/3D/materials/mrdl/mrdlSliderBarMaterial.js";import{MRDLSliderThumbMaterial as Yo}from"@babylonjs/gui/3D/materials/mrdl/mrdlSliderThumbMaterial.js";import{Color3 as Ko,Color4 as qo}from"@babylonjs/core/Maths/math.color.js";import{VertexBuffer as Qo}from"@babylonjs/core/Meshes/buffer.js";import{VertexData as Jo}from"@babylonjs/core/Meshes/mesh.vertexData.js";import{Tools as $o}from"@babylonjs/core/Misc/tools.js";import{BoundingInfo as er}from"@babylonjs/core/Culling/boundingInfo.js";import{Engine as nr}from"@babylonjs/core/Engines/engine.js";import{WebGPUEngine as tr}from"@babylonjs/core/Engines/webgpuEngine.js";import{AssetsManager as or}from"@babylonjs/core/Misc/assetsManager.js";import{ActionManager as rr}from"@babylonjs/core/Actions/actionManager.js";import{ExecuteCodeAction as ar}from"@babylonjs/core/Actions/directActions.js";import ir from"react-reconciler";import{InspectableType as sr}from"@babylonjs/core/Misc/iInspectable.js";import{PhysicsImpostor as lr}from"@babylonjs/core/Physics/physicsImpostor.js";import{ValueAndUnit as pr}from"@babylonjs/gui/2D/valueAndUnit.js";import{PointerEventTypes as cr}from"@babylonjs/core/Events/pointerEvents.js";import"@babylonjs/core/Physics/physicsEngineComponent.js";var ur=function(e,n){return ur=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,n){e.__proto__=n}||function(e,n){for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&(e[t]=n[t])},ur(e,n)};function dr(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function t(){this.constructor=e}ur(e,n),e.prototype=null===n?Object.create(n):(t.prototype=n.prototype,new t)}var mr=function(){return mr=Object.assign||function(e){for(var n,t=1,o=arguments.length;t<o;t++)for(var r in n=arguments[t])Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r]);return e},mr.apply(this,arguments)};function br(e,n){var t={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&n.indexOf(o)<0&&(t[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(o=Object.getOwnPropertySymbols(e);r<o.length;r++)n.indexOf(o[r])<0&&Object.prototype.propertyIsEnumerable.call(e,o[r])&&(t[o[r]]=e[o[r]])}return t}function hr(e,n,t,o){return new(t||(t=Promise))(function(r,a){function i(e){try{l(o.next(e))}catch(e){a(e)}}function s(e){try{l(o.throw(e))}catch(e){a(e)}}function l(e){var n;e.done?r(e.value):(n=e.value,n instanceof t?n:new t(function(e){e(n)})).then(i,s)}l((o=o.apply(e,n||[])).next())})}function yr(e,n){var t,o,r,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return i.next=s(0),i.throw=s(1),i.return=s(2),"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(s){return function(l){return function(s){if(t)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(a=0)),a;)try{if(t=1,o&&(r=2&s[0]?o.return:s[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,s[1])).done)return r;switch(o=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,o=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!(r=a.trys,(r=r.length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]<r[3])){a.label=s[1];break}if(6===s[0]&&a.label<r[1]){a.label=r[1],r=s;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(s);break}r[2]&&a.ops.pop(),a.trys.pop();continue}s=n.call(e,a)}catch(e){s=[6,e],o=0}finally{t=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}}function fr(e,n,t){if(t||2===arguments.length)for(var o,r=0,a=n.length;r<a;r++)!o&&r in n||(o||(o=Array.prototype.slice.call(n,0,r)),o[r]=n[r]);return e.concat(o||Array.prototype.slice.call(n))}"function"==typeof SuppressedError&&SuppressedError;var gr=s({scene:null,sceneReady:!1}),Pr=function(){return l(gr).scene},Cr=function(e,n,t,o,r){void 0===r&&(r=[]);var a=l(gr).scene;p(function(){if(null!==a){var r=!0===o,i=a.onBeforeRenderObservable.add(e,n,t,void 0,r);return!0!==r?function(){a.onBeforeRenderObservable.remove(i)}:void 0}},fr([a],r,!0))},vr=function(e,n,t,o,r){void 0===r&&(r=[]);var a=l(gr).scene;p(function(){if(null!==a){var r=!0===o,i=a.onAfterRenderObservable.add(e,n,t,void 0,r);return!0!==r?function(){a.onAfterRenderObservable.remove(i)}:void 0}},fr([a],r,!0))},Mr=function(e,n,t,o,r){void 0===r&&(r=[]);var a=l(gr).scene;p(function(){if(null!==a){var r=!0===o,i=a.onBeforeCameraRenderObservable.add(e,n,t,void 0,r);return!0!==r?function(){a.onBeforeCameraRenderObservable.remove(i)}:void 0}},fr([a],r,!0))},Sr=function(e,n,t,o){var r=l(gr).scene;p(function(){if(null!==r){var a=!0===o,i=r.onAfterCameraRenderObservable.add(e,n,t,void 0,a);return!0!==a?function(){r.onAfterCameraRenderObservable.remove(i)}:void 0}})};function Tr(e,n){var t=e.getAbsolutePosition(),a=n.getEngine(),i=n.viewport.toGlobal(a.getRenderWidth(),a.getRenderHeight()),s=o.Project(t,r.Identity(),n.getTransformationMatrix(),i);return[s.x*a.getHardwareScalingLevel(),s.y*a.getHardwareScalingLevel()]}var xr=function(e){return Math.abs(e)<1e-10?0:e};function Br(e,n,t){void 0===t&&(t="");for(var o="matrix3d(",r=0;16!==r;r++)o+=xr(n[r]*e.m[r])+(15!==r?",":")");return t+o}var Hr,wr,Fr=(Hr=[1,-1,1,1,1,-1,1,1,1,-1,1,1,1,-1,1,1],function(e){return Br(e,Hr)}),Rr=function(e,n){return Br(e,[1/(t=n),1/t,1/t,1,-1/t,-1/t,-1/t,-1,1/t,1/t,1/t,1,1,1,1,1],"translate(-50%,-50%)");var t},Dr=c(function(r,a){var s,l,c,h=r.children,f=r.babylonChildren,g=r.eps,P=void 0===g?.001:g,C=r.style,v=r.className,M=r.prepend,S=r.center,T=r.fullscreen,x=r.portal,B=r.distanceFactor,H=r.sprite,w=void 0!==H&&H,F=r.transform,R=void 0!==F&&F,D=r.occlude,I=r.onOcclude,O=r.zIndexRange,j=void 0===O?[16777271,0]:O,L=r.calculatePosition,A=void 0===L?Tr:L,E=r.as,G=void 0===E?"div":E,z=r.pointerEvents,k=br(r,["children","babylonChildren","eps","style","className","prepend","center","fullscreen","portal","distanceFactor","sprite","transform","occlude","onOcclude","zIndexRange","calculatePosition","as","pointerEvents"]),N=Pr(),U=null==N?void 0:N.getEngine().getRenderingCanvas(),V=null==N?void 0:N.getEngine().getRenderingCanvasClientRect(),_={width:null!==(s=null==V?void 0:V.width)&&void 0!==s?s:1,height:null!==(l=null==V?void 0:V.height)&&void 0!==l?l:1},W=u(function(){return document.createElement(G)})[0],X=d(null),Z=d(0),Y=d([0,0]),K=d(null),q=d(null),Q=null!==(c=null==x?void 0:x.current)&&void 0!==c?c:null==U?void 0:U.parentNode;p(function(){if(N&&X.current){var e=X.current,n=null==N?void 0:N.activeCamera;if(n&&V){if(R)W.style.cssText="position:absolute;top:0;left:0;pointer-events:none;overflow:hidden;";else{var t=A(e,n);W.style.cssText="position:absolute;top:0;left:0;transform:translate3d(".concat(t[0],"px,").concat(t[1],"px,0);transform-origin:0 0;")}Q&&(M?Q.prepend(W):Q.appendChild(W))}return function(){Q&&Q.removeChild(W)}}},[Q,R,N,X]);var J=m(function(){return R?{position:"absolute",top:0,left:0,width:_.width,height:_.height,transformStyle:"preserve-3d",pointerEvents:"none"}:mr(mr({position:"absolute",transform:S?"translate3d(-50%,-50%,0)":"none"},T&&{top:-_.height/2,left:-_.width/2,width:_.width,height:_.height}),C)},[C,S,T,_,R]),$=m(function(){return{position:"absolute",pointerEvents:z}},[z]);b(function(){var e=y(W);return R?e.render(i.createElement("div",{id:"html_babylon",ref:K,style:J},i.createElement("div",{ref:q,style:$},i.createElement("div",{ref:a,className:v,style:C,children:h})))):e.render(i.createElement("div",{id:"html_babylon",ref:a,style:J,className:v,children:h})),function(){e.unmount()}});var ee=d(!0);return vr(function(){var r=null==N?void 0:N.activeCamera;if(r&&X.current){var a=X.current;a.computeWorldMatrix(!0);var i=R?Y.current:A(a,r);if(W.style.display=ee.current&&a.isEnabled(!0)?"block":"none",!1===isNaN(i[0])&&(R||Math.abs(Z.current-r.fov)>P||Math.abs(Y.current[0]-i[0])>P||Math.abs(Y.current[1]-i[1])>P)){var s=function(e,n){var o=t.GetPlanes(n.getTransformationMatrix()),r=e.absolutePosition;return-1!==o.findIndex(function(e){return e.dotCoordinate(r)<0})}(a,r),l=!1;"boolean"==typeof D?!0===D&&(l=null==N?void 0:N.meshes):Array.isArray(D)&&(l=D.map(function(e){return e.current}));var p=ee.current;if(l){var c=function(e,t,r){var a,i,s=e.getAbsolutePosition(),l=t.globalPosition,p=new n(l,s.subtract(l),void 0),c=t.getScene().pickWithRay(p,function(n){return(r.length>0?-1!==r.indexOf(n):n!==e.parent)&&"skybox"!==n.name});return!!c&&((null===(a=c.pickedMesh)||void 0===a?void 0:a.name)===(null===(i=e.parent)||void 0===i?void 0:i.name)||c.distance*c.distance>=o.DistanceSquared(s,l))}(a,r,l);ee.current=c&&!s}else ee.current=!s;if(p!==ee.current&&(I?I(!ee.current):(W.style.display=ee.current&&a.isEnabled(!0)?"block":"none",X.current.isVisible=ee.current)),W.style.zIndex="".concat(function(n,t,r){if(t.mode===e.PERSPECTIVE_CAMERA||t.mode===e.ORTHOGRAPHIC_CAMERA){var a=n.getAbsolutePosition(),i=t.globalPosition,s=o.Distance(a,i),l=(r[1]-r[0])/(t.maxZ-t.minZ),p=r[1]-l*t.maxZ;return Math.round(l*s+p)}}(a,r,j)),R){var u=[_.width/2,_.height/2],d=u[0],m=u[1],b=r.getProjectionMatrix().m[5]*m,h=r.mode,y=r.orthoTop,f=r.orthoLeft,g=r.orthoBottom,C=r.orthoRight,v=r.getWorldMatrix().invert(),M=Fr(v),S=h===e.ORTHOGRAPHIC_CAMERA?"scale(".concat(b,")translate(").concat(xr(-(C+f)/2),"px,").concat(xr((y+g)/2),"px)"):"translateZ(".concat(b,"px)"),T=a.getWorldMatrix();w&&(T=r.getViewMatrix().getRotationMatrix().invert().clone()),W.style.width=_.width+"px",W.style.height=_.height+"px",W.style.perspective=h===e.ORTHOGRAPHIC_CAMERA?"":"".concat(b,"px"),K.current&&q.current&&(K.current.style.transform="".concat(S).concat(M,"translate(").concat(d,"px,").concat(m,"px)"),q.current.style.transform=Rr(T,1/((B||10)/400)))}else{var x=void 0===B?1:function(n,t){if(t.mode===e.ORTHOGRAPHIC_CAMERA)return 1;if(t.mode===e.PERSPECTIVE_CAMERA){var r=n.getAbsolutePosition(),a=t.globalPosition,i=t.fov*Math.PI/180,s=o.Distance(r,a);return 1/(2*Math.tan(i/2)*s)}return 1}(a,r)*B;W.style.transform="translate3d(".concat(i[0],"px,").concat(i[1],"px,0) scale(").concat(x,")")}Y.current=i,Z.current=r.fov}}}),i.createElement("abstractMesh",mr({},k,{ref:X}),f)}),Ir=function(){function e(e,n,t){var r=this;this._particleDataStride=9,this._particleColorStride=4,this._particleUVStride=4,this._subToleranceX=1,this._subToleranceZ=1,this._LODLimits=[],this._initialLOD=1,this._LODValue=1,this._cameraLODCorrection=0,this._LODPositiveX=!0,this._LODNegativeX=!0,this._LODPositiveZ=!0,this._LODNegativeZ=!0,this._inverted=!1,this.shiftFromCamera={x:0,z:0},this._deltaSubX=0,this._deltaSubZ=0,this._refreshEveryFrame=!1,this._useCustomVertexFunction=!1,this._computeNormals=!1,this._datamap=!1,this._uvmap=!1,this._colormap=!1,this._mapSPData=!1,this._colorSPData=!1,this._uvSPData=!1,this._averageSubSizeX=0,this._averageSubSizeZ=0,this._terrainSizeX=0,this._terrainSizeZ=0,this._terrainHalfSizeX=0,this._terrainHalfSizeZ=0,this._centerWorld=o.Zero(),this._centerLocal=o.Zero(),this._mapSizeX=0,this._mapSizeZ=0,this._isAlwaysVisible=!1,this._precomputeNormalsFromMap=!1,this.name=e,t=t||{},this._terrainSub=t.terrainSub||60,this._mapData=t.mapData,this._terrainIdx=this._terrainSub+1,this._mapSubX=t.mapSubX||this._terrainIdx,this._mapSubZ=t.mapSubZ||this._terrainIdx,this._mapUVs=t.mapUVs,this._mapColors=t.mapColors,this._scene=n,this._terrainCamera=t.camera||n.activeCamera,this._inverted=t.invertSide,this._SPmapData=t.SPmapData,this._SPcolorData=t.SPcolorData,this._SPuvData=t.SPuvData,this._sps=t.sps,this._datamap=!!this._mapData,this._uvmap=!!this._mapUVs,this._colormap=!!this._mapColors,this._mapSPData=!!this._SPmapData,this._colorSPData=!(!this._mapSPData||!this._SPcolorData),this._uvSPData=!(!this._mapSPData||!this._SPuvData),this._mapData=this._datamap?this._mapData:new Float32Array(this._terrainIdx*this._terrainIdx*3),this._mapUVs=this._uvmap?this._mapUVs:new Float32Array(this._terrainIdx*this._terrainIdx*2),this._datamap?this._mapNormals=t.mapNormals||new Float32Array(this._mapSubX*this._mapSubZ*3):this._mapNormals=new Float32Array(this._terrainIdx*this._terrainIdx*3);for(var i,s,l,p=0,c=0,u=0,d=0,m=0,b=0,h=0,y=0,f=this._terrainIdx+1,P=[],C=[],v=[],M=this._mapData,S=this._mapColors,T=this._mapUVs,x=0;x<=this._terrainSub;x++){l=[];for(var B=0;B<=this._terrainSub;B++)c=3*(p=this._mod(3*x,this._mapSubZ)*this._mapSubX+this._mod(3*B,this._mapSubX)),u=3*p,d=2*p,m=x*this._terrainIdx+B,this._datamap?b=M[c+1]:(b=0,M[3*m]=B,M[3*m+1]=b,M[3*m+2]=x),l.push(new o(B,b,x)),i=this._colormap?new qo(S[u],S[u+1],S[u+2],1):new qo(1,1,1,1),C.push(i),this._uvmap?s=new a(T[d],T[d+1]):(h=1-Math.abs(1-2*B/f),y=1-Math.abs(1-2*x/f),T[2*m]=h,T[2*m+1]=y,s=new a(h,y)),v.push(s);P.push(l)}this._mapSizeX=Math.abs(M[3*(this._mapSubX-1)]-M[0]),this._mapSizeZ=Math.abs(M[(this._mapSubZ-1)*this._mapSubX*3+2]-M[2]),this._averageSubSizeX=this._mapSizeX/this._mapSubX,this._averageSubSizeZ=this._mapSizeZ/this._mapSubZ;var H={pathArray:P,sideOrientation:t.invertSide?g.FRONTSIDE:g.BACKSIDE,colors:C,uvs:v,updatable:!0};this._terrain=Ln.CreateRibbon("terrain",H,this._scene),this._indices=this._terrain.getIndices(),this._positions=this._terrain.getVerticesData(Qo.PositionKind),this._normals=this._terrain.getVerticesData(Qo.NormalKind),this._uvs=this._terrain.getVerticesData(Qo.UVKind),this._colors=this._terrain.getVerticesData(Qo.ColorKind),this.computeNormalsFromMap(),this.update(!0),this._terrain.position.x=this._terrainCamera.globalPosition.x-this._terrainHalfSizeX+this.shiftFromCamera.x,this._terrain.position.z=this._terrainCamera.globalPosition.z-this._terrainHalfSizeZ+this.shiftFromCamera.z;var w=(this._terrain.position.x-M[0])/this._averageSubSizeX,F=(this._terrain.position.z-M[2])/this._averageSubSizeZ;this._deltaSubX=w>0?Math.floor(w):Math.ceil(w),this._deltaSubZ=F>0?Math.floor(F):Math.ceil(F),this._scene.onBeforeRenderObservable.add(function(){var e=r._refreshEveryFrame;r.beforeUpdate(e),r.update(e),r.afterUpdate(e)});var R=this._SPmapData,D=this._particleDataStride;if(this._mapSPData){var I=this._mapSizeX,O=this._mapSizeZ,j=this._mapSubX,L=this._mapSubZ,A=[];this._mapQuads=A;for(var E=M[0],G=M[2],z=0;z<R.length;z++)for(var k=R[z],N=k.length/D|0,U=0;U<N;U++){var V=U*D,_=k[V],W=k[V+2];_-=Math.floor((_-E)/I)*I,W-=Math.floor((W-G)/O)*O;var X=Math.floor((_-E)*j/I),Z=Math.floor((W-G)*L/O)*j+X;void 0===A[Z]&&(A[Z]=[]),void 0===A[Z][z]&&(A[Z][z]=[]),A[Z][z].push(U)}var Y=this._sps;Y.computeBoundingBox=!0,Y.isAlwaysVisible=!0,this._colorSPData&&(Y.computeParticleColor=!0),this._uvSPData&&(Y.computeParticleTexture=!0);var K=[];this._spsTypeStartIndexes=K;var q=[];this._spsNbPerType=q;var Q=[];this._nbAvailablePerType=Q;var J=Y.nbParticles,$=Y.particles,ee=0;K.push(ee),Q.push(0);for(var ne=1,te=1;te<J;te++)$[te].isVisible=!1,ee!=$[te].shapeId&&(ee++,K.push(te),q.push(ne),Q.push(ne),ne=0),ne++;q.push(ne)}this.update(!0)}return e.prototype.update=function(e){var n,t=!1,o=!!e,r=this._terrain.position,a=this._terrainCamera.globalPosition,i=this.shiftFromCamera,s=this._terrainHalfSizeX,l=this._terrainHalfSizeZ,p=s+r.x-a.x-i.x,c=l+r.z-a.z-i.z,u=this._subToleranceX,d=this._subToleranceZ,m=this._mod,b=this._cameraLODCorrection;this._cameraLODCorrection=0|this.updateCameraLOD(this._terrainCamera),n=b!=this._cameraLODCorrection;var h=this._initialLOD+this._cameraLODCorrection;h=h>0?h:1,this._LODValue=h;var y=this._averageSubSizeX*u*h,f=this._averageSubSizeZ*d*h,g=0,P=this._deltaSubX,C=this._deltaSubZ;if(Math.abs(p)>y){var v=p>0?-1:1;g=0|Math.abs(p/y),r.x+=y*v*g,P+=u*v*h*g,t=!0}if(Math.abs(c)>f){var M=c>0?-1:1;g=0|Math.abs(c/f),r.z+=f*M*g,C+=d*M*h*g,t=!0}var S=n||o;return(t||S)&&(this._deltaSubX=m(P,this._mapSubX),this._deltaSubZ=m(C,this._mapSubZ),this._updateTerrain(S)),s=this._terrainHalfSizeX,l=this._terrainHalfSizeZ,this.centerLocal.copyFromFloats(s,0,l),this._centerWorld.copyFromFloats(r.x+s,r.y,r.z+l),this},e.prototype._updateTerrain=function(n){var t=0,r=0,a=0,i=0,s=this._LODValue,l=s,p=s,c=s,u=e._bbMin,d=e._bbMax,m=this._terrain,b=this._positions,h=this._normals,y=this._colors,f=this._uvs,g=this._mapColors,P=this._mapNormals,C=this._mapData,v=this._mapUVs,M=this._mapSPData,S=this._mapQuads,T=this._spsNbPerType,x=this._SPmapData,B=this._SPcolorData,H=this._SPuvData,w=this._particleDataStride,F=this._particleColorStride,R=this._particleUVStride,D=this._LODLimits,I=this._terrainSub,O=this._mod,j=this._terrainIdx,L=this._mapSubX,A=this._mapSubZ,E=this._deltaSubX,G=this._deltaSubZ,z=this._datamap,k=this._uvmap,N=this._colormap,U=this._useCustomVertexFunction,V=this.updateVertex,_=!this._computeNormals,W=this._LODPositiveX,X=this._LODNegativeX,Z=this._LODPositiveZ,Y=this._LODNegativeZ,K=this._mapSizeX,q=this._mapSizeZ,Q=this._averageSubSizeX,J=this._averageSubSizeZ,$=M&&S,ee=$&&this._colorSPData,ne=$&&this._uvSPData,te=0,oe=0,re=0,ae=0,ie=0,se=0,le=0,pe=0,ce=0,ue=0,de=0,me=0,be=0,he=0,ye=0,fe=0,ge=0,Pe=0,Ce=0;if(n&&this.updateTerrainSize(),o.FromFloatsToRef(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE,u),o.FromFloatsToRef(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE,d),$)for(var ve=this._sps,Me=ve.particles,Se=this._spsTypeStartIndexes,Te=this._nbAvailablePerType,xe=C[0],Be=C[2],He=m.position,we=ve.nbParticles,Fe=0;Fe<we;Fe++)Me[Fe].isVisible=!1;for(var Re=0;Re<=I;Re++){for(l=s,te=0;te<D.length;te++)i=I-(a=D[te])-1,(Y&&Re<a||Z&&Re>i)&&(l=te+1+s),c=l;for(var De=0;De<=I;De++){for(l=s,te=0;te<D.length;te++)i=I-(a=D[te])-1,(X&&De<a||W&&De>i)&&(l=te+1+s),p=l;if(oe=O(G+t,A)*L+O(E+r,L),pe=O(G+t,j)*j+O(E+r,j),le=k?2*oe:2*pe,se=N?3*oe:3*pe,ae=(re=z?3*oe:3*pe)+1,ie=re+2,de=2*ce,Pe=(ue=3*ce)+1,Ce=ue+2,be=me=4*ce,he=me+1,ye=me+2,fe=me+3,ce+=1,b[ge=ue]=Q*r,b[Pe]=C[ae],b[Ce]=J*t,_&&(h[ge]=P[re],h[Pe]=P[ae],h[Ce]=P[ie]),b[ge]<u.x&&(u.x=b[ge]),b[ge]>d.x&&(d.x=b[ge]),b[Pe]<u.y&&(u.y=b[Pe]),b[Pe]>d.y&&(d.y=b[Pe]),b[Ce]<u.z&&(u.z=b[Ce]),b[Ce]>d.z&&(d.z=b[Ce]),N&&(y[be]=g[se],y[he]=g[se+1],y[ye]=g[se+2]),f[de]=v[le],f[de+1]=v[le+1],U){var Ie=e._vertex,Oe=Ie.position,je=Ie.worldPosition,Le=Ie.color,Ae=Ie.uvs;Oe.copyFromFloats(b[ge],b[Pe],b[Ce]),je.copyFromFloats(C[re],Oe.y,C[ie]),Ie.lodX=p,Ie.lodZ=c,Le.copyFromFloats(y[be],y[he],y[ye],y[fe]),Ae.copyFromFloats(f[de],f[de+1]),Ie.mapIndex=oe,V(Ie,De,Re),y[be]=Le.r,y[he]=Le.g,y[ye]=Le.b,y[fe]=Le.a,f[de]=Ae.x,f[de+1]=Ae.y,b[ge]=Oe.x,b[Pe]=Oe.y,b[Ce]=Oe.z}if($){var Ee=S[oe];if(Ee)for(var Ge=0;Ge<Ee.length;Ge++){var ze=x[Ge],ke=Ee[Ge];if(ee)var Ne=B[Ge];if(ne)var Ue=H[Ge];if(ke){for(var Ve=Se[Ge],_e=ke.length,We=T[Ge],Xe=Te[Ge],Ze=We-Xe,Ye=Ze>0?Ze:0,Ke=Xe<_e?Xe:_e,qe=0;qe<Ke;qe++){var Qe=ke[qe],Je=Qe*w,$e=Me[Ve+qe+Ye],en=$e.position,nn=$e.rotation,tn=$e.scaling,on=ze[Je];en.x=on+Math.floor((He.x-on-xe)/K)*K,en.y=ze[Je+1];var rn=ze[Je+2];if(en.z=rn+Math.floor((He.z-rn-Be)/q)*q,nn.x=ze[Je+3],nn.y=ze[Je+4],nn.z=ze[Je+5],tn.x=ze[Je+6],tn.y=ze[Je+7],tn.z=ze[Je+8],ee){var an=Qe*F,sn=$e.color;sn.r=Ne[an],sn.g=Ne[an+1],sn.b=Ne[an+2],sn.a=Ne[an+3]}if(ne){var ln=Qe*R,pn=$e.uvs;pn.x=Ue[ln],pn.y=Ue[ln+1],pn.z=Ue[ln+2],pn.w=Ue[ln+3]}$e.isVisible=!0,Ye+=1,Ke=(Xe-=1)<_e?Xe:_e}Xe=Xe>0?Xe:0,Te[Ge]=Xe}}}r+=p}r=0,t+=c}if($){ve.setParticles();for(var cn=0;cn<Te.length;cn++)Te[cn]=T[cn]}m.updateVerticesData(Qo.PositionKind,b,!1,!1),this._computeNormals&&Jo.ComputeNormals(b,this._indices,h),m.updateVerticesData(Qo.NormalKind,h,!1,!1),m.updateVerticesData(Qo.UVKind,f,!1,!1),m.updateVerticesData(Qo.ColorKind,y,!1,!1),m._boundingInfo.reConstruct(u,d,m._worldMatrix)},e.prototype._mod=function(e,n){return(e%n+n)%n},e.prototype.updateTerrainSize=function(){for(var e=this._terrainSub,n=0,t=0,o=this._LODValue,r=o+1,a=0,i=0,s=this._LODLimits,l=this._averageSubSizeX,p=this._averageSubSizeZ,c=0;c<s.length;c++)r=o+c+1,t=c>=s.length-1?0:s[c+1],a+=l*r*(n=2*(s[c]-t)),i+=p*r*n,e-=n;return a+=e*l*o,i+=e*p*o,this._terrainSizeX=a,this._terrainSizeZ=i,this._terrainHalfSizeX=.5*a,this._terrainHalfSizeZ=.5*i,this},e.prototype.getHeightFromMap=function(n,t,o){return e._GetHeightFromMap(n,t,this._mapData,this._mapSubX,this._mapSubZ,this._mapSizeX,this._mapSizeZ,o,this._inverted)},e.GetHeightFromMap=function(n,t,o,r,a,i,s){var l=Math.abs(o[3*(r-1)]-o[0]),p=Math.abs(o[(a-1)*r*3+2]-o[2]);return e._GetHeightFromMap(n,t,o,r,a,l,p,i,s)},e._GetHeightFromMap=function(n,t,r,a,i,s,l,p,c){var u=r[0],d=r[2];n-=Math.floor((n-u)/s)*s,t-=Math.floor((t-d)/l)*l;var m=Math.floor((n-u)*a/s),b=Math.floor((t-d)*i/l),h=(m+1)%a,y=(b+1)%i,f=3*(b*a+m),g=3*(b*a+h),P=3*(y*a+m),C=3*(y*a+h),v=e._v1,M=e._v2,S=e._v3,T=e._v4;v.copyFromFloats(r[f],r[f+1],r[f+2]),M.copyFromFloats(r[g],r[g+1],r[g+2]),S.copyFromFloats(r[P],r[P+1],r[P+2]),T.copyFromFloats(r[C],r[C+1],r[C+2]);var x,B,H,w=e._vAvB,F=e._vAvC,R=e._norm,D=v,I=T.x-v.x,O=T.z-v.z;if(0==I||0==O)return v.y;var j=O/I;t<j*n+(v.z-j*v.x)?(x=T,B=M,H=D):(B=T,H=x=S),x.subtractToRef(D,w),B.subtractToRef(D,F),o.CrossToRef(w,F,R),R.normalize(),c&&R.scaleInPlace(-1),p&&p.normal&&p.normal.copyFrom(R);var L=-(R.x*H.x+R.y*H.y+R.z*H.z),A=H.y;return 0!=R.y&&(A=-(R.x*n+R.z*t+L)/R.y),A},e.ComputeNormalsFromMapToRef=function(n,t,r,a,i){var s=[],l={normal:o.Zero()},p={normal:o.Zero()},c=l.normal,u=p.normal,d=t*(r-1),m=0;for(m=0;m<d;m++)s.push(m+1,m+t,m),s.push(m+t,m+1,m+t+1);Jo.ComputeNormals(n,s,a);var b=3*(t-1),h=0,y=0,f=e.GetHeightFromMap;for(m=0;m<r;m++)y=(h=m*t*3)+b,f(n[h],n[h+2],n,t,r,l),f(n[y],n[y+2],n,t,r,p),c.addInPlace(u).scaleInPlace(.5),a[h]=c.x,a[h+1]=c.y,a[h+2]=c.z,a[y]=c.x,a[y+1]=c.y,a[y+2]=c.z;if(i)for(m=0;m<a.length;m++)a[m]=-a[m]},e.prototype.computeNormalsFromMap=function(){return e.ComputeNormalsFromMapToRef(this._mapData,this._mapSubX,this._mapSubZ,this._mapNormals,this._inverted),this},e.prototype.contains=function(e,n){var t=this._positions,o=this.mesh.position,r=this._terrainIdx;return!(e<t[0]+o.x||e>t[3*r]+o.x)&&!(n<t[2]+o.z||n>t[3*r*r+2]+o.z)},e.CreateMapFromHeightMap=function(n,t,o){var r=t.subX||100,a=t.subZ||100,i=new Float32Array(r*a*3);return e.CreateMapFromHeightMapToRef(n,t,i,o),i},e.CreateMapFromHeightMapToRef=function(e,n,t,o){var r=n.width||300,a=n.height||300,i=n.subX||100,s=n.subZ||100,l=n.minHeight||0,p=n.maxHeight||10,c=n.offsetX||0,u=n.offsetZ||0,d=n.colorFilter||new Ko(.3,.59,.11),m=n.onReady;$o.LoadImage(e,function(e){var n=document.createElement("canvas"),o=n.getContext("2d"),b=e.width,h=e.height;n.width=b,n.height=h,o.drawImage(e,0,0);for(var y=o.getImageData(0,0,b,h).data,f=0,g=0,P=0,C=0;C<s;C++)for(var v=0;v<i;v++){var M=4*((((f=v*r/i-.5*r)+.5*r)/r*(b-1)|0)+(h-1-((P=C*a/s-.5*a)+.5*a)/a*(h-1)|0)*b),S=(y[M]*d.r+y[M+1]*d.g+y[M+2]*d.b)/255;g=l+(p-l)*S;var T=3*(C*i+v);t[T]=f+c,t[T+1]=g,t[T+2]=P+u}m&&m(t,i,s)},function(){},o.offlineProvider)},e.CreateUVMapToRef=function(e,n,t){for(var o=0;o<n;o++)for(var r=0;r<e;r++)t[2*(o*e+r)]=r/e,t[2*(o*e+r)+1]=o/n},e.CreateUVMap=function(n,t){var o=new Float32Array(n*t*2);return e.CreateUVMapToRef(n,t,o),o},e.prototype.createUVMap=function(){return this.mapUVs=e.CreateUVMap(this._mapSubX,this._mapSubZ),this},Object.defineProperty(e.prototype,"refreshEveryFrame",{get:function(){return this._refreshEveryFrame},set:function(e){this._refreshEveryFrame=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"mesh",{get:function(){return this._terrain},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"camera",{get:function(){return this._terrainCamera},set:function(e){this._terrainCamera=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"subToleranceX",{get:function(){return this._subToleranceX},set:function(e){this._subToleranceX=e>0?e:1},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"subToleranceZ",{get:function(){return this._subToleranceZ},set:function(e){this._subToleranceZ=e>0?e:1},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"initialLOD",{get:function(){return this._initialLOD},set:function(e){this._initialLOD=e>0?e:1},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"LODValue",{get:function(){return this._LODValue},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"cameraLODCorrection",{get:function(){return this._cameraLODCorrection},set:function(e){this._cameraLODCorrection=e>=0?e:0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"LODPositiveX",{get:function(){return this._LODPositiveX},set:function(e){this._LODPositiveX=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"LODNegativeX",{get:function(){return this._LODNegativeX},set:function(e){this._LODNegativeX=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"LODPositiveZ",{get:function(){return this._LODPositiveZ},set:function(e){this._LODPositiveZ=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"LODNegativeZ",{get:function(){return this._LODNegativeZ},set:function(e){this._LODNegativeZ=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"averageSubSizeX",{get:function(){return this._averageSubSizeX},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"averageSubSizeZ",{get:function(){return this._averageSubSizeZ},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"terrainSizeX",{get:function(){return this._terrainSizeX},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"terrainHalfSizeX",{get:function(){return this._terrainHalfSizeX},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"terrainSizeZ",{get:function(){return this._terrainSizeZ},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"terrainHalfSizeZ",{get:function(){return this._terrainHalfSizeZ},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"centerLocal",{get:function(){return this._centerLocal},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"centerWorld",{get:function(){return this._centerWorld},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"LODLimits",{get:function(){return this._LODLimits},set:function(e){e.sort(function(e,n){return n-e}),this._LODLimits=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"mapData",{get:function(){return this._mapData},set:function(e){this._mapData=e,this._datamap=!0;var n=this._mapSubX,t=this._mapSubZ;this._mapSizeX=Math.abs(e[3*(n-1)]-e[0]),this._mapSizeZ=Math.abs(e[(t-1)*n*3+2]-e[2]),this._averageSubSizeX=this._mapSizeX/n,this._averageSubSizeZ=this._mapSizeZ/t,this._precomputeNormalsFromMap&&this.computeNormalsFromMap(),this.update(!0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"mapSubX",{get:function(){return this._mapSubX},set:function(e){this._mapSubX=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"mapSubZ",{get:function(){return this._mapSubZ},set:function(e){this._mapSubZ=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"mapColors",{get:function(){return this._mapColors},set:function(e){this._colormap=!0,this._mapColors=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"mapUVs",{get:function(){return this._mapUVs},set:function(e){this._uvmap=!0,this._mapUVs=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"mapNormals",{get:function(){return this._mapNormals},set:function(e){this._mapNormals=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"computeNormals",{get:function(){return this._computeNormals},set:function(e){this._computeNormals=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"useCustomVertexFunction",{get:function(){return this._useCustomVertexFunction},set:function(e){this._useCustomVertexFunction=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isAlwaysVisible",{get:function(){return this._isAlwaysVisible},set:function(e){this.mesh.alwaysSelectAsActiveMesh=e,this._isAlwaysVisible=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"precomputeNormalsFromMap",{get:function(){return this._precomputeNormalsFromMap},set:function(e){this._precomputeNormalsFromMap=e},enumerable:!1,configurable:!0}),e.prototype.updateVertex=function(e,n,t){},e.prototype.updateCameraLOD=function(e){return 0},e.prototype.beforeUpdate=function(e){},e.prototype.afterUpdate=function(e){},e._vertex={position:o.Zero(),uvs:a.Zero(),color:new qo(1,1,1,1),lodX:1,lodZ:1,worldPosition:o.Zero(),mapIndex:0},e._v1=o.Zero(),e._v2=o.Zero(),e._v3=o.Zero(),e._v4=o.Zero(),e._vAvB=o.Zero(),e._vAvC=o.Zero(),e._norm=