babylonjs-editor-tools 5.0.1 → 5.1.3

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.
@@ -1 +1 @@
1
- var H=Object.defineProperty;var dt=Object.getOwnPropertyDescriptor;var yt=Object.getOwnPropertyNames;var ht=Object.prototype.hasOwnProperty;var i=(e,o)=>H(e,"name",{value:o,configurable:!0});var St=(e,o)=>{for(var t in o)H(e,t,{get:o[t],enumerable:!0})},Pt=(e,o,t,r)=>{if(o&&typeof o=="object"||typeof o=="function")for(let n of yt(o))!ht.call(e,n)&&n!==t&&H(e,n,{get:()=>o[n],enumerable:!(r=dt(o,n))||r.enumerable});return e};var bt=e=>Pt(H({},"__esModule",{value:!0}),e);var ur={};St(ur,{_applyScriptsForObject:()=>R,animationGroupFromScene:()=>Wt,configureEngineToUseCompressedTextures:()=>jt,configureShadowMapRefreshRate:()=>Ae,configureShadowMapRenderListPredicate:()=>xe,createDefaultRenderingPipeline:()=>Je,createMotionBlurPostProcess:()=>$e,createSSAO2RenderingPipeline:()=>We,createSSRRenderingPipeline:()=>He,createVLSPostProcess:()=>ze,defaultPipelineCameraConfigurations:()=>B,disposeDefaultRenderingPipeline:()=>be,disposeMotionBlurPostProcess:()=>ye,disposeSSAO2RenderingPipeline:()=>ue,disposeSSRRenderingPipeline:()=>ce,disposeVLSPostProcess:()=>se,generateCinematicAnimationGroup:()=>sr,getAllScriptsByClassForObject:()=>Le,getAnimationTypeForObject:()=>k,getDefaultRenderingPipeline:()=>K,getMotionBlurPostProcess:()=>de,getPowerOfTwoUntil:()=>D,getSSAO2RenderingPipeline:()=>Lt,getSSRRenderingPipeline:()=>Nt,getScriptByClassForObject:()=>Ft,getVLSPostProcess:()=>Mt,guiFromAsset:()=>Ut,isAbstractMesh:()=>Re,isAnyParticleSystem:()=>ie,isArcRotateCamera:()=>At,isBone:()=>Ct,isCamera:()=>Y,isCinematicGroup:()=>mr,isCinematicKey:()=>ar,isCinematicKeyCut:()=>lr,isCinematicKeyEvent:()=>cr,isCinematicSound:()=>pr,isDirectionalLight:()=>Et,isFreeCamera:()=>xt,isGPUParticleSystem:()=>Ot,isGroundMesh:()=>It,isHemisphericLight:()=>vt,isInstancedMesh:()=>te,isLight:()=>Fe,isMesh:()=>E,isNode:()=>ne,isParticleSystem:()=>Rt,isPointLight:()=>Tt,isScene:()=>oe,isSpotLight:()=>Dt,isTexture:()=>re,isTransformNode:()=>Oe,loadMaterialFromFile:()=>zt,loadScene:()=>kt,motionBlurPostProcessCameraConfigurations:()=>L,nodeFromDescendants:()=>Yt,nodeFromScene:()=>Ht,parseCinematic:()=>ir,parseCinematicKeyValue:()=>C,parseDefaultRenderingPipeline:()=>Ie,parseMotionBlurPostProcess:()=>Se,parseSSAO2RenderingPipeline:()=>fe,parseSSRRenderingPipeline:()=>pe,parseVLSPostProcess:()=>le,particleSystemFromScene:()=>Qt,registerScriptInstance:()=>Ve,serializeDefaultRenderingPipeline:()=>Ce,serializeMotionBlurPostProcess:()=>he,serializeSSAO2RenderingPipeline:()=>ge,serializeSSRRenderingPipeline:()=>me,serializeVLSPostProcess:()=>ae,setDefaultRenderingPipelineRef:()=>Gt,setMotionBlurPostProcessRef:()=>_t,setSSAO2RenderingPipelineRef:()=>Bt,setSSRRenderingPipelineRef:()=>Vt,setVLSPostProcessRef:()=>wt,soundFromScene:()=>$t,ssaoRenderingPipelineCameraConfigurations:()=>V,ssrRenderingPipelineCameraConfigurations:()=>N,visibleAsBoolean:()=>Zt,visibleAsColor3:()=>er,visibleAsColor4:()=>tr,visibleAsEntity:()=>rr,visibleAsKeyMap:()=>or,visibleAsNumber:()=>qt,visibleAsTexture:()=>nr,visibleAsVector2:()=>Xt,visibleAsVector3:()=>Jt,vlsPostProcessCameraConfigurations:()=>w});module.exports=bt(ur);function Re(e){switch(e.getClassName?.()){case"Mesh":case"LineMesh":case"GroundMesh":case"InstancedMesh":return!0}return!1}i(Re,"isAbstractMesh");function E(e){switch(e.getClassName?.()){case"Mesh":case"GroundMesh":return!0}return!1}i(E,"isMesh");function te(e){return e.getClassName?.()==="InstancedMesh"}i(te,"isInstancedMesh");function Ct(e){return e.getClassName?.()==="Bone"}i(Ct,"isBone");function It(e){return e.getClassName?.()==="GroundMesh"}i(It,"isGroundMesh");function Oe(e){return e.getClassName?.()==="TransformNode"}i(Oe,"isTransformNode");function re(e){return e?.getClassName?.()==="Texture"}i(re,"isTexture");function Y(e){switch(e.getClassName?.()){case"Camera":case"FreeCamera":case"TargetCamera":case"EditorCamera":case"ArcRotateCamera":case"UniversalCamera":return!0}return!1}i(Y,"isCamera");function xt(e){switch(e.getClassName?.()){case"FreeCamera":case"UniversalCamera":return!0}return!1}i(xt,"isFreeCamera");function At(e){return e.getClassName?.()==="ArcRotateCamera"}i(At,"isArcRotateCamera");function Tt(e){return e.getClassName?.()==="PointLight"}i(Tt,"isPointLight");function Et(e){return e.getClassName?.()==="DirectionalLight"}i(Et,"isDirectionalLight");function Dt(e){return e.getClassName?.()==="SpotLight"}i(Dt,"isSpotLight");function vt(e){return e.getClassName?.()==="HemisphericLight"}i(vt,"isHemisphericLight");function Fe(e){switch(e.getClassName?.()){case"Light":case"PointLight":case"SpotLight":case"DirectionalLight":case"HemisphericLight":return!0}return!1}i(Fe,"isLight");function ne(e){return Re(e)||Oe(e)||Fe(e)||Y(e)}i(ne,"isNode");function oe(e){return e.getClassName?.()==="Scene"}i(oe,"isScene");function Rt(e){return e.getClassName?.()==="ParticleSystem"}i(Rt,"isParticleSystem");function Ot(e){return e.getClassName?.()==="GPUParticleSystem"}i(Ot,"isGPUParticleSystem");function ie(e){switch(e.getClassName?.()){case"ParticleSystem":case"GPUParticleSystem":return!0}return!1}i(ie,"isAnyParticleSystem");function W(e,o){let t=o.soundTracks??[];t.length||t.push(o.mainSoundTrack);for(let r=0,n=t.length;r<n;r++){let l=t[r].soundCollection.find(s=>s.id===e);if(l)return l}return null}i(W,"getSoundById");var U=require("babylonjs"),Me=require("babylonjs"),$=require("babylonjs"),we=require("babylonjs-gui");function Ne(e,o,t,r,n){let l=r.constructor;l&&(l._NodesFromScene?.forEach(s=>{r[s.propertyKey.toString()]=e.getNodeByName(s.nodeName)}),l._NodesFromDescendants?.forEach(s=>{let c=o.getDescendants?.(s.directDescendantsOnly,p=>p.name===s.nodeName)[0];r[s.propertyKey.toString()]=c??null}),l._AnimationGroups?.forEach(s=>{r[s.propertyKey.toString()]=e.getAnimationGroupByName(s.animationGroupName)}),l._SoundsFromScene?.forEach(s=>{let c=e.getSoundByName?.(s.soundName);r[s.propertyKey.toString()]=c??null}),l._GuiFromAsset?.forEach(async s=>{let c=`${n}assets/${s.pathInAssets}`;try{let y=await(await fetch(c)).json(),b=we.AdvancedDynamicTexture.CreateFullscreenUI(y.name,!0,e);b.parseSerializedObject(y.content,!1),r[s.propertyKey.toString()]=b,s.onGuiCreated?.(r,b)}catch(p){throw console.error(`Failed to load GUI from asset: ${c}`),p}}),l._ParticleSystemsFromScene?.forEach(s=>{let c=e.particleSystems?.find(p=>p.name===s.particleSystemName);r[s.propertyKey.toString()]=c}),l._VisibleInInspector?.forEach(s=>{let c=s.propertyKey.toString(),p=t.values;if(p.hasOwnProperty(c)&&p[c].hasOwnProperty("value")){let y=p[c].value;switch(s.configuration.type){case"number":case"boolean":case"keymap":r[c]=y;break;case"vector2":r[c]=$.Vector2.FromArray(y);break;case"vector3":r[c]=$.Vector3.FromArray(y);break;case"color3":r[c]=U.Color3.FromArray(y);break;case"color4":r[c]=U.Color4.FromArray(y);break;case"entity":switch(s.configuration.entityType){case"node":r[c]=e.getNodeById(y)??null;break;case"animationGroup":r[c]=e.getAnimationGroupByName(y)??null;break;case"sound":r[c]=W(y,e);break;case"particleSystem":r[c]=e.particleSystems?.find(O=>O.id===y)??null;break}break;case"texture":y&&(r[c]=Me.Texture.Parse(y,e,n));break}}}))}i(Ne,"applyDecorators");function R(e,o,t,r){o.metadata&&(o.metadata.scripts?.forEach(n=>{if(!n.enabled)return;let l=t[n.key];if(l)if(l.default){let s=new l.default(o);Ve(o,s,n.key),Ne(e,o,n,s,r),s.onStart&&e.onBeforeRenderObservable.addOnce(()=>s.onStart()),s.onUpdate&&e.onBeforeRenderObservable.add(()=>s.onUpdate())}else l.onStart&&e.onBeforeRenderObservable.addOnce(()=>l.onStart(o)),l.onUpdate&&e.onBeforeRenderObservable.add(()=>l.onUpdate(o))}),o.metadata.scripts=void 0)}i(R,"_applyScriptsForObject");var _=new Map;function Ve(e,o,t){let r={key:t,instance:o};_.has(e)?_.get(e).push(r):_.set(e,[r]),(ne(e)||ie(e)||oe(e))&&e.onDisposeObservable.addOnce(()=>{_.delete(e)})}i(Ve,"registerScriptInstance");function Le(e,o){return _.get(e)?.filter(n=>n.instance.constructor===o)?.map(n=>n.instance)??null}i(Le,"getAllScriptsByClassForObject");function Ft(e,o){return Le(e,o)?.[0]??null}i(Ft,"getScriptByClassForObject");var G=require("babylonjs"),Be=require("babylonjs");function _e(e){let o=e.metadata?.physicsAggregate;if(!o)return;let t;E(e)?t=e:te(e)&&(t=e.sourceMesh);let r=new Be.PhysicsAggregate(e,o.shape.type,{mesh:t,mass:o.massProperties.mass});r.body.setMassProperties({mass:o.massProperties.mass,inertia:o.massProperties.inertia?G.Vector3.FromArray(o.massProperties.inertia):void 0,centerOfMass:o.massProperties.centerOfMass?G.Vector3.FromArray(o.massProperties.centerOfMass):void 0,inertiaOrientation:o.massProperties.inertiaOrientation?G.Quaternion.FromArray(o.massProperties.inertiaOrientation):void 0}),r.shape.density=o.shape.density,r.body.setMotionType(o.body.motionType),r.shape.material=o.material,e.physicsAggregate=r,e.metadata.physicsAggregate=void 0}i(_e,"configurePhysicsAggregate");var Ge=require("babylonjs"),Ke=require("babylonjs"),ke=require("babylonjs"),S=null,w=new Map;function Mt(){return S}i(Mt,"getVLSPostProcess");function wt(e){S=e}i(wt,"setVLSPostProcessRef");function se(e){S&&e.activeCamera&&(S.dispose(e.activeCamera),S=null)}i(se,"disposeVLSPostProcess");function ze(e,o){return o??=e.meshes.find(t=>E(t)),S=new ke.VolumetricLightScatteringPostProcess("VolumetricLightScatteringPostProcess",1,e.activeCamera,o,100,Ke.Texture.BILINEAR_SAMPLINGMODE,e.getEngine(),!1),S}i(ze,"createVLSPostProcess");function ae(){return S?{meshId:S.mesh?.id,exposure:S.exposure,decay:S.decay,weight:S.weight,density:S.density,invert:S.invert,useCustomMeshPosition:S.useCustomMeshPosition,customMeshPosition:S.customMeshPosition.asArray()}:null}i(ae,"serializeVLSPostProcess");function le(e,o){let t=null;if(o.meshId){let n=e.getMeshById(o.meshId);n&&E(n)&&(t=n)}let r=ze(e,t);return r.exposure=o.exposure,r.decay=o.decay,r.weight=o.weight,r.density=o.density,r.invert=o.invert,r.useCustomMeshPosition=o.useCustomMeshPosition,r.customMeshPosition.copyFrom(Ge.Vector3.FromArray(o.customMeshPosition)),r}i(le,"parseVLSPostProcess");var je=require("babylonjs"),m=null,N=new Map;function Nt(){return m}i(Nt,"getSSRRenderingPipeline");function Vt(e){m=e}i(Vt,"setSSRRenderingPipelineRef");function ce(){m&&(m.dispose(),m=null)}i(ce,"disposeSSRRenderingPipeline");function He(e,o){return m=new je.SSRRenderingPipeline("SSRRenderingPipeline",e,[o]),m.samples=4,m}i(He,"createSSRRenderingPipeline");function me(){return m?{samples:m.samples,step:m.step,thickness:m.thickness,strength:m.strength,reflectionSpecularFalloffExponent:m.reflectionSpecularFalloffExponent,maxSteps:m.maxSteps,maxDistance:m.maxDistance,roughnessFactor:m.roughnessFactor,reflectivityThreshold:m.reflectivityThreshold,blurDispersionStrehgth:m.blurDispersionStrength,clipToFrustum:m.clipToFrustum,enableSmoothReflections:m.enableSmoothReflections,enableAutomaticThicknessComputation:m.enableAutomaticThicknessComputation,attenuateFacingCamera:m.attenuateFacingCamera,attenuateScreenBorders:m.attenuateScreenBorders,attenuateIntersectionDistance:m.attenuateIntersectionDistance,attenuateBackfaceReflection:m.attenuateBackfaceReflection,blurDownsample:m.blurDownsample,selfCollisionNumSkip:m.selfCollisionNumSkip,ssrDownsample:m.ssrDownsample,backfaceDepthTextureDownsample:m.backfaceDepthTextureDownsample}:null}i(me,"serializeSSRRenderingPipeline");function pe(e,o,t){if(m)return m;let r=He(e,o);return r.samples=t.samples,r.step=t.step,r.thickness=t.thickness,r.strength=t.strength,r.reflectionSpecularFalloffExponent=t.reflectionSpecularFalloffExponent,r.maxSteps=t.maxSteps,r.maxDistance=t.maxDistance,r.roughnessFactor=t.roughnessFactor,r.reflectivityThreshold=t.reflectivityThreshold,r.blurDispersionStrength=t.blurDispersionStrehgth,r.clipToFrustum=t.clipToFrustum,r.enableSmoothReflections=t.enableSmoothReflections,r.enableAutomaticThicknessComputation=t.enableAutomaticThicknessComputation,r.attenuateFacingCamera=t.attenuateFacingCamera,r.attenuateScreenBorders=t.attenuateScreenBorders,r.attenuateIntersectionDistance=t.attenuateIntersectionDistance,r.attenuateBackfaceReflection=t.attenuateBackfaceReflection,r.blurDownsample=t.blurDownsample,r.selfCollisionNumSkip=t.selfCollisionNumSkip,r.ssrDownsample=t.ssrDownsample,r.backfaceDepthTextureDownsample=t.backfaceDepthTextureDownsample,r}i(pe,"parseSSRRenderingPipeline");var Ye=require("babylonjs"),d=null,V=new Map;function Lt(){return d}i(Lt,"getSSAO2RenderingPipeline");function Bt(e){d=e}i(Bt,"setSSAO2RenderingPipelineRef");function ue(){d&&(d.dispose(),d=null)}i(ue,"disposeSSAO2RenderingPipeline");function We(e,o){return d=new Ye.SSAO2RenderingPipeline("SSAO2RenderingPipeline",e,1,[o]),d.samples=4,d}i(We,"createSSAO2RenderingPipeline");function ge(){return d?{radius:d.radius,totalStrength:d.totalStrength,samples:d.samples,maxZ:d.maxZ,minZAspect:d.minZAspect,epsilon:d.epsilon,textureSamples:d.textureSamples,bypassBlur:d.bypassBlur,bilateralSamples:d.bilateralSamples,bilateralSoften:d.bilateralSoften,bilateralTolerance:d.bilateralTolerance,expensiveBlur:d.expensiveBlur}:null}i(ge,"serializeSSAO2RenderingPipeline");function fe(e,o,t){if(d)return d;let r=We(e,o);return r.radius=t.radius,r.totalStrength=t.totalStrength,r.samples=t.samples,r.maxZ=t.maxZ,r.minZAspect=t.minZAspect,r.epsilon=t.epsilon,r.textureSamples=t.textureSamples,r.bypassBlur=t.bypassBlur,r.bilateralSamples=t.bilateralSamples,r.bilateralSoften=t.bilateralSoften,r.bilateralTolerance=t.bilateralTolerance,r.expensiveBlur=t.expensiveBlur,r}i(fe,"parseSSAO2RenderingPipeline");var Ue=require("babylonjs"),P=null,L=new Map;function de(){return P}i(de,"getMotionBlurPostProcess");function _t(e){P=e}i(_t,"setMotionBlurPostProcessRef");function ye(){P&&(P.dispose(),P=null)}i(ye,"disposeMotionBlurPostProcess");function $e(e,o){return P=new Ue.MotionBlurPostProcess("MotionBlurPostProcess",e,1,o),P.motionStrength=1,P.isObjectBased=!0,P}i($e,"createMotionBlurPostProcess");function he(){return P?{isObjectBased:P.isObjectBased,motionStrength:P.motionStrength,motionBlurSamples:P.motionBlurSamples}:null}i(he,"serializeMotionBlurPostProcess");function Se(e,o,t){if(P)return P;let r=$e(e,o);return r.isObjectBased=t.isObjectBased,r.motionStrength=t.motionStrength,r.motionBlurSamples=t.motionBlurSamples,r}i(Se,"parseMotionBlurPostProcess");var Qe=require("babylonjs"),Pe=require("babylonjs"),Ze=require("babylonjs"),qe=require("babylonjs"),Xe=require("babylonjs"),a=null,B=new Map;function K(){return a}i(K,"getDefaultRenderingPipeline");function Gt(e){a=e}i(Gt,"setDefaultRenderingPipelineRef");function be(){a&&(a.dispose(),a=null)}i(be,"disposeDefaultRenderingPipeline");function Je(e,o){return a=new Xe.DefaultRenderingPipeline("DefaultRenderingPipeline",!0,e,[o]),a.samples=4,a.depthOfField.lensSize=512,a.depthOfField.fStop=.25,a.depthOfField.focusDistance=55e3,a}i(Je,"createDefaultRenderingPipeline");function Ce(){return a?{samples:a.samples,fxaaEnabled:a.fxaaEnabled,imageProcessingEnabled:a.imageProcessingEnabled,exposure:a.imageProcessing?.exposure,contrast:a.imageProcessing?.contrast,fromLinearSpace:a.imageProcessing?.fromLinearSpace,toneMappingEnabled:a.imageProcessing?.toneMappingEnabled,toneMappingType:a.imageProcessing?.toneMappingType,ditheringEnabled:a.imageProcessing?.ditheringEnabled,ditheringIntensity:a.imageProcessing?.ditheringIntensity,bloomEnabled:a.bloomEnabled,bloomThreshold:a.bloomThreshold,bloomWeight:a.bloomWeight,bloomScale:a.bloomScale,bloomKernel:a.bloomKernel,sharpenEnabled:a.sharpenEnabled,sharpenEdgeAmount:a.sharpen.edgeAmount,sharpenColorAmount:a.sharpen.colorAmount,grainEnabled:a.grainEnabled,grainIntensity:a.grain.intensity,grainAnimated:a.grain.animated,depthOfFieldEnabled:a.depthOfFieldEnabled,depthOfFieldBlurLevel:a.depthOfFieldBlurLevel,lensSize:a.depthOfField.lensSize,fStop:a.depthOfField.fStop,focusDistance:a.depthOfField.focusDistance,focalLength:a.depthOfField.focalLength,vignetteEnabled:a.imageProcessing?.vignetteEnabled,vignetteColor:a.imageProcessing?.vignetteColor.asArray(),vignetteWeight:a.imageProcessing?.vignetteWeight,chromaticAberrationEnabled:a.chromaticAberrationEnabled,aberrationAmount:a.chromaticAberration.aberrationAmount,radialIntensity:a.chromaticAberration.radialIntensity,direction:a.chromaticAberration.direction.asArray(),centerPosition:a.chromaticAberration.centerPosition.asArray(),glowLayerEnabled:a.glowLayerEnabled,glowLayerIntensity:a.glowLayer?.intensity,glowLayerBlurKernelSize:a.glowLayer?.blurKernelSize,colorGradingEnabled:a.imageProcessing.colorGradingEnabled,colorGradingTexture:a.imageProcessing.colorGradingTexture?.serialize(),colorGradingWithGreenDepth:a.imageProcessing.imageProcessingConfiguration.colorGradingWithGreenDepth,colorCurvesEnabled:a.imageProcessing.colorCurvesEnabled,globalHue:a.imageProcessing.colorCurves?.globalHue,globalDensity:a.imageProcessing.colorCurves?.globalDensity,globalExposure:a.imageProcessing.colorCurves?.globalExposure,globalSaturation:a.imageProcessing.colorCurves?.globalSaturation,highlightsHue:a.imageProcessing.colorCurves?.highlightsHue,highlightsDensity:a.imageProcessing.colorCurves?.highlightsDensity,highlightsExposure:a.imageProcessing.colorCurves?.highlightsExposure,highlightsSaturation:a.imageProcessing.colorCurves?.highlightsSaturation,midtonesHue:a.imageProcessing.colorCurves?.midtonesHue,midtonesDensity:a.imageProcessing.colorCurves?.midtonesDensity,midtonesExposure:a.imageProcessing.colorCurves?.midtonesExposure,midtonesSaturation:a.imageProcessing.colorCurves?.midtonesSaturation,shadowsHue:a.imageProcessing.colorCurves?.shadowsHue,shadowsDensity:a.imageProcessing.colorCurves?.shadowsDensity,shadowsExposure:a.imageProcessing.colorCurves?.shadowsExposure,shadowsSaturation:a.imageProcessing.colorCurves?.shadowsSaturation}:null}i(Ce,"serializeDefaultRenderingPipeline");function Ie(e,o,t,r){if(a)return a;let n=Je(e,o);if(n.samples=t.samples,n.fxaaEnabled=t.fxaaEnabled,n.imageProcessingEnabled=t.imageProcessingEnabled,n.imageProcessing){if(n.imageProcessing.exposure=t.exposure,n.imageProcessing.contrast=t.contrast,n.imageProcessing.fromLinearSpace=t.fromLinearSpace,n.imageProcessing.toneMappingEnabled=t.toneMappingEnabled,n.imageProcessing.toneMappingType=t.toneMappingType,n.imageProcessing.ditheringEnabled=t.ditheringEnabled,n.imageProcessing.ditheringIntensity=t.ditheringIntensity,n.imageProcessing.vignetteEnabled=t.vignetteEnabled??!1,n.imageProcessing.vignetteColor=Qe.Color4.FromArray(t.vignetteColor??[0,0,0]),n.imageProcessing.vignetteWeight=t.vignetteWeight??.3,n.imageProcessing.colorGradingEnabled=t.colorGradingEnabled??!1,n.imageProcessing.imageProcessingConfiguration.colorGradingWithGreenDepth=t.colorGradingWithGreenDepth??!0,t.colorGradingTexture){let l=null;if(t.colorGradingTexture.customType==="BABYLON.ColorGradingTexture"){let s=r+t.colorGradingTexture.name;l=new qe.ColorGradingTexture(s,e),l.level=t.colorGradingTexture.level}else{let s=Ze.Texture.Parse(t.colorGradingTexture,e,r);re(s)&&(l=s)}n.imageProcessing.colorGradingTexture=l}n.imageProcessing.colorCurvesEnabled=t.colorCurvesEnabled??!1,n.imageProcessing.colorCurves&&(n.imageProcessing.colorCurves.globalHue=t.globalHue??30,n.imageProcessing.colorCurves.globalDensity=t.globalDensity??0,n.imageProcessing.colorCurves.globalExposure=t.globalExposure??0,n.imageProcessing.colorCurves.globalSaturation=t.globalSaturation??0,n.imageProcessing.colorCurves.highlightsHue=t.highlightsHue??30,n.imageProcessing.colorCurves.highlightsDensity=t.highlightsDensity??0,n.imageProcessing.colorCurves.highlightsExposure=t.highlightsExposure??0,n.imageProcessing.colorCurves.highlightsSaturation=t.highlightsSaturation??0,n.imageProcessing.colorCurves.midtonesHue=t.midtonesHue??30,n.imageProcessing.colorCurves.midtonesDensity=t.midtonesDensity??0,n.imageProcessing.colorCurves.midtonesExposure=t.midtonesExposure??0,n.imageProcessing.colorCurves.midtonesSaturation=t.midtonesSaturation??0,n.imageProcessing.colorCurves.shadowsHue=t.shadowsHue??30,n.imageProcessing.colorCurves.shadowsDensity=t.shadowsDensity??0,n.imageProcessing.colorCurves.shadowsExposure=t.shadowsExposure??0,n.imageProcessing.colorCurves.shadowsSaturation=t.shadowsSaturation??0)}return n.bloomEnabled=t.bloomEnabled,n.bloomThreshold=t.bloomThreshold,n.bloomWeight=t.bloomWeight,n.bloomScale=t.bloomScale,n.bloomKernel=t.bloomKernel,n.sharpenEnabled=t.sharpenEnabled,n.sharpen.edgeAmount=t.sharpenEdgeAmount,n.sharpen.colorAmount=t.sharpenColorAmount,n.grainEnabled=t.grainEnabled,n.grain.intensity=t.grainIntensity,n.grain.animated=t.grainAnimated,n.depthOfFieldEnabled=t.depthOfFieldEnabled,n.depthOfFieldBlurLevel=t.depthOfFieldBlurLevel,n.depthOfField.lensSize=t.lensSize,n.depthOfField.fStop=t.fStop,n.depthOfField.focusDistance=t.focusDistance,n.depthOfField.focalLength=t.focalLength,n.chromaticAberrationEnabled=t.chromaticAberrationEnabled??!1,n.chromaticAberration.aberrationAmount=t.aberrationAmount??10,n.chromaticAberration.radialIntensity=t.radialIntensity??1,n.chromaticAberration.direction=Pe.Vector2.FromArray(t.direction??[0,0]),n.chromaticAberration.centerPosition=Pe.Vector2.FromArray(t.centerPosition??[0,0]),n.glowLayerEnabled=t.glowLayerEnabled??!1,n.glowLayer&&(n.glowLayer.intensity=t.glowLayerIntensity??1,n.glowLayer.blurKernelSize=t.glowLayerBlurKernelSize??32),n}i(Ie,"parseDefaultRenderingPipeline");function et(e,o){(Array.isArray(o)?o:[]).forEach(r=>{let n=e.getCameraById(r.cameraId);n&&(r.ssao2RenderingPipeline&&V.set(n,r.ssao2RenderingPipeline),r.vlsPostProcess&&w.set(n,r.vlsPostProcess),r.ssrRenderingPipeline&&N.set(n,r.ssrRenderingPipeline),r.motionBlurPostProcess&&L.set(n,r.motionBlurPostProcess),r.defaultRenderingPipeline&&B.set(n,r.defaultRenderingPipeline))})}i(et,"applyRenderingConfigurations");function wo(e){V.set(e,ge()),w.set(e,ae()),N.set(e,me()),L.set(e,he()),B.set(e,Ce())}i(wo,"saveRenderingConfigurationForCamera");function tt(e,o){ue(),se(e.getScene()),ce(),ye(),be();let t=V.get(e);t&&fe(e.getScene(),e,t);let r=w.get(e);r&&le(e.getScene(),r);let n=N.get(e);n&&pe(e.getScene(),e,n);let l=L.get(e);l&&Se(e.getScene(),e,l);let s=B.get(e);s&&Ie(e.getScene(),e,s,o)}i(tt,"applyRenderingConfigurationForCamera");var rt=require("babylonjs"),nt=require("babylonjs");function xe(e){e.lights.forEach(o=>{let t=o.getShadowGenerator()?.getShadowMap();t&&(t.renderListPredicate=r=>rt.Vector3.Distance(r.getAbsolutePosition(),o.getAbsolutePosition())<=o.range)})}i(xe,"configureShadowMapRenderListPredicate");async function Ae(e){e.executeWhenReady(()=>{e.lights.forEach(o=>{let t=o.getShadowGenerator()?.getShadowMap();t&&(t.refreshRate=o.metadata?.refreshRate??nt.RenderTargetTexture.REFRESHRATE_RENDER_ONEVERYFRAME)})})}i(Ae,"configureShadowMapRefreshRate");var Te=require("babylonjs"),Q=require("babylonjs"),Kt=(0,Q.GetParser)(Te.SceneComponentConstants.NAME_AUDIO);(0,Q.AddParser)(Te.SceneComponentConstants.NAME_AUDIO,(e,o,t,r)=>{Kt?.(e,o,t,r),e.sounds?.forEach(n=>{let l=t.sounds?.find(s=>s.name===n.name);l&&(l.id=n.id,l.uniqueId=n.uniqueId)})});function D(e){let o=1;for(;o<=e;)o<<=1;return o>>1}i(D,"getPowerOfTwoUntil");var Ee=require("babylonjs"),Z=Ee.SerializationHelper._TextureParser;Ee.SerializationHelper._TextureParser=(e,o,t)=>{if(o.loadingQuality==="high"||!e.metadata?.baseSize)return Z(e,o,t);let r=e.metadata.baseSize.width,n=e.metadata.baseSize.height,l=r===D(r)||n===D(n),s="";switch(o.loadingQuality){case"medium":let h=r*.66>>0,f=n*.66>>0;l&&(h=D(h),f=D(f)),s=`_${h}_${f}`;break;case"low":let u=r*.33>>0,g=n*.33>>0;l&&(u=D(u),g=D(g)),s=`_${u}_${g}`;break}let c=e.name;if(!c||!s)return Z(e,o,t);let p=c.split("/"),y=p.pop();if(!y)return Z(e,o,t);let b=y.split(".").pop(),F=`${y.replace(`.${b}`,"")}${s}.${b}`;return p.push(F),e.name=p.join("/"),Z(e,o,t)};var ot=require("babylonjs"),it=require("babylonjs"),st=require("babylonjs");async function kt(e,o,t,r,n){t.loadingQuality=n?.quality??"high",await(0,it.AppendSceneAsync)(`${e}${o}`,t,{pluginExtension:".babylon",onProgress:i(s=>{let c=Math.min(s.loaded/s.total*.5);n?.onProgress?.(c)},"onProgress")}),st.SceneLoaderFlags.ForceFullSceneLoadingForIncremental&&t.meshes.forEach(s=>E(s)&&s._checkDelayState());let l=t.getWaitingItemsCount();for(;!t.isReady()||t.getWaitingItemsCount()>0;){await new Promise(c=>setTimeout(c,150));let s=l-t.getWaitingItemsCount();n?.onProgress?.(.5+s/l*.5)}n?.onProgress?.(1),xe(t),Ae(t),t.metadata?.rendering&&(et(t,t.metadata.rendering),t.activeCamera&&tt(t.activeCamera,e)),t.metadata?.physicsGravity&&t.getPhysicsEngine()?.setGravity(ot.Vector3.FromArray(t.metadata?.physicsGravity)),R(t,t,r,e),t.transformNodes.forEach(s=>{R(t,s,r,e)}),t.meshes.forEach(s=>{_e(s),R(t,s,r,e)}),t.lights.forEach(s=>{R(t,s,r,e)}),t.cameras.forEach(s=>{R(t,s,r,e)})}i(kt,"loadScene");var at=require("babylonjs");async function zt(e,o,t){let n=await(await fetch(e+o)).json(),s=at.Tools.Instantiate(n.customType).Parse(n,t,e);return s.id=n.id,s.uniqueId=n.uniqueId,s}i(zt,"loadMaterialFromFile");function jt(e){e.setTextureFormatToUse(["-dxt.ktx","-astc.ktx","-pvrtc.ktx","-etc1.ktx","-etc2.ktx"])}i(jt,"configureEngineToUseCompressedTextures");var A=require("babylonjs");function k(e){if(!isNaN(parseFloat(e))&&isFinite(e))return A.Animation.ANIMATIONTYPE_FLOAT;switch(e?.getClassName?.()){case"Vector2":return A.Animation.ANIMATIONTYPE_VECTOR2;case"Vector3":return A.Animation.ANIMATIONTYPE_VECTOR3;case"Quaternion":return A.Animation.ANIMATIONTYPE_QUATERNION;case"Color3":return A.Animation.ANIMATIONTYPE_COLOR3;case"Color4":return A.Animation.ANIMATIONTYPE_COLOR4;case"Size":return A.Animation.ANIMATIONTYPE_SIZE;case"Matrix":return A.Animation.ANIMATIONTYPE_MATRIX}return null}i(k,"getAnimationTypeForObject");function Ht(e){return function(o,t){let r=o.constructor;r._NodesFromScene??=[],r._NodesFromScene.push({propertyKey:t,nodeName:e})}}i(Ht,"nodeFromScene");function Yt(e,o=!1){return function(t,r){let n=t.constructor;n._NodesFromDescendants??=[],n._NodesFromDescendants.push({propertyKey:r,nodeName:e,directDescendantsOnly:o})}}i(Yt,"nodeFromDescendants");function Wt(e){return function(o,t){let r=o.constructor;r._AnimationGroups??=[],r._AnimationGroups.push({animationGroupName:e,propertyKey:t})}}i(Wt,"animationGroupFromScene");function Ut(e,o){return function(t,r){let n=t.constructor;n._GuiFromAsset??=[],n._GuiFromAsset.push({propertyKey:r,pathInAssets:e,onGuiCreated:o})}}i(Ut,"guiFromAsset");function $t(e){return function(o,t){let r=o.constructor;r._SoundsFromScene??=[],r._SoundsFromScene.push({propertyKey:t,soundName:e})}}i($t,"soundFromScene");function Qt(e){return function(o,t){let r=o.constructor;r._ParticleSystemsFromScene??=[],r._ParticleSystemsFromScene.push({propertyKey:t,particleSystemName:e})}}i(Qt,"particleSystemFromScene");function Zt(e,o){return function(t,r){let n=t.constructor;n._VisibleInInspector??=[],n._VisibleInInspector.push({label:e,propertyKey:r,configuration:{...o,type:"boolean"}})}}i(Zt,"visibleAsBoolean");function qt(e,o){return function(t,r){let n=t.constructor;n._VisibleInInspector??=[],n._VisibleInInspector.push({label:e,propertyKey:r,configuration:{...o,type:"number"}})}}i(qt,"visibleAsNumber");function Xt(e,o){return function(t,r){let n=t.constructor;n._VisibleInInspector??=[],n._VisibleInInspector.push({label:e,propertyKey:r,configuration:{...o,type:"vector2"}})}}i(Xt,"visibleAsVector2");function Jt(e,o){return function(t,r){let n=t.constructor;n._VisibleInInspector??=[],n._VisibleInInspector.push({label:e,propertyKey:r,configuration:{...o,type:"vector3"}})}}i(Jt,"visibleAsVector3");function er(e,o){return function(t,r){let n=t.constructor;n._VisibleInInspector??=[],n._VisibleInInspector.push({label:e,propertyKey:r,configuration:{...o,type:"color3"}})}}i(er,"visibleAsColor3");function tr(e,o){return function(t,r){let n=t.constructor;n._VisibleInInspector??=[],n._VisibleInInspector.push({label:e,propertyKey:r,configuration:{...o,type:"color4"}})}}i(tr,"visibleAsColor4");function rr(e,o,t){return function(r,n){let l=r.constructor;l._VisibleInInspector??=[],l._VisibleInInspector.push({label:o,propertyKey:n,configuration:{...t,entityType:e,type:"entity"}})}}i(rr,"visibleAsEntity");function nr(e,o){return function(t,r){let n=t.constructor;n._VisibleInInspector??=[],n._VisibleInInspector.push({label:e,propertyKey:r,configuration:{...o,type:"texture"}})}}i(nr,"visibleAsTexture");function or(e,o){return function(t,r){let n=t.constructor;n._VisibleInInspector??=[],n._VisibleInInspector.push({label:e,propertyKey:r,configuration:{...o,type:"keymap"}})}}i(or,"visibleAsKeyMap");var q=require("babylonjs");function lt(e,o){let t;switch(e){case q.Animation.ANIMATIONTYPE_FLOAT:t=o.value;break;default:t=o.value.clone();break}return{value:t,frame:o.frame,interpolation:o.interpolation,inTangent:e===q.Animation.ANIMATIONTYPE_FLOAT?o.inTangent:o.inTangent?.clone(),outTangent:e===q.Animation.ANIMATIONTYPE_FLOAT?o.outTangent:o.outTangent?.clone()}}i(lt,"cloneKey");function X(e,o){let t=o.split("."),r=e;for(let n=0;n<t.length;++n)r=r[t[n]];return r}i(X,"getPropertyValue");var v=require("babylonjs"),J=require("babylonjs"),I=require("babylonjs");function ir(e,o){return{name:e.name,framesPerSecond:e.framesPerSecond,outputFramesPerSecond:e.outputFramesPerSecond,tracks:e.tracks.map(t=>{let r=null,n=null;if(t.node?(r=o.getNodeById(t.node),r||(r=o.particleSystems?.find(s=>s.id===t.node)??null)):t.defaultRenderingPipeline&&(r=K()),t.propertyPath){let s=X(r,t.propertyPath);n=k(s)}let l=null;return t.sound&&(l=W(t.sound,o)),{node:r,sound:l,propertyPath:t.propertyPath,defaultRenderingPipeline:t.defaultRenderingPipeline,animationGroup:t.animationGroup?o.getAnimationGroupByName(t.animationGroup):null,animationGroups:t.animationGroups,sounds:t.sounds,keyFrameEvents:t.keyFrameEvents?.map(s=>{let c={...s};switch(s.data?.type){case"set-enabled":c.data={type:"set-enabled",value:s.data.value,node:o.getNodeById(s.data.node)};break;case"apply-impulse":c.data={type:"apply-impulse",radius:s.data.radius,mesh:o.getMeshById(s.data.mesh),force:I.Vector3.FromArray(s.data.force),contactPoint:I.Vector3.FromArray(s.data.contactPoint)};break}return c}),keyFrameAnimations:r&&n!==null&&t.keyFrameAnimations?.map(s=>{let c=s.type==="key"?s:null;if(c)return{...c,value:C(c.value,n),inTangent:C(c.inTangent,n),outTangent:C(c.outTangent,n)};let p=s.type==="cut"?s:null;if(p)return{...p,key1:{...p.key1,value:C(p.key1.value,n),inTangent:C(p.key1.inTangent,n),outTangent:C(p.key1.outTangent,n)},key2:{...p.key2,value:C(p.key2.value,n),inTangent:C(p.key2.inTangent,n),outTangent:C(p.key2.outTangent,n)}};throw new Error(`Unknown key frame type: ${s.type}`)})}})}}i(ir,"parseCinematic");function C(e,o){if(e===null)return null;if(e!==void 0)switch(o){case v.Animation.ANIMATIONTYPE_FLOAT:return e;case v.Animation.ANIMATIONTYPE_VECTOR2:return I.Vector2.FromArray(e);case v.Animation.ANIMATIONTYPE_VECTOR3:return I.Vector3.FromArray(e);case v.Animation.ANIMATIONTYPE_QUATERNION:return I.Quaternion.FromArray(e);case v.Animation.ANIMATIONTYPE_COLOR3:return J.Color3.FromArray(e);case v.Animation.ANIMATIONTYPE_COLOR4:return J.Color4.FromArray(e);case v.Animation.ANIMATIONTYPE_MATRIX:return I.Matrix.FromArray(e)}}i(C,"parseCinematicKeyValue");function ct(e){e.node?.setEnabled(e.value)}i(ct,"handleSetEnabledEvent");var De=require("babylonjs"),mt=De.Vector3.Zero();function pt(e,o){let t=o.mesh?[o.mesh]:e.meshes.filter(r=>r.physicsAggregate);o.radius&&(t=t.filter(r=>{let n=r.getBoundingInfo().boundingBox.centerWorld;return De.Vector3.Distance(n,o.contactPoint)<=o.radius})),t.forEach(r=>{if(r.physicsAggregate?.body){let n=o.contactPoint.subtract(r.getBoundingInfo().boundingBox.centerWorld);n.multiplyInPlace(o.force),r.physicsAggregate.body.setLinearVelocity(mt),r.physicsAggregate.body.setAngularVelocity(mt),r.physicsAggregate.body.applyImpulse(n.negateInPlace(),o.contactPoint)}})}i(pt,"handleApplyImpulseEvent");var ut=require("babylonjs"),T=require("babylonjs"),z=require("babylonjs"),gt=require("babylonjs");function sr(e,o,t){let r=new gt.AnimationGroup(e.name,o);return e.tracks.forEach(n=>{let l=n.animationGroup;l&&n.animationGroups?.forEach(h=>{l.targetedAnimations.forEach(f=>{let u=null;e:{let x=r.targetedAnimations.filter(j=>j.target===f.target);if(x.length){let j=x.find(ft=>ft.animation.targetProperty===f.animation.targetProperty);if(j){u=j.animation;break e}}u=f.animation.clone(),u.setKeys([]),u.name=ut.Tools.RandomId(),u.framePerSecond=e.framesPerSecond}let g=u.getKeys(),M=f.animation.getKeys(),ee=h.speed,ve=e.framesPerSecond/f.animation.framePerSecond/ee;M.forEach(x=>{x.frame>=h.startFrame&&x.frame<=h.endFrame&&g.push({...lt(f.animation.dataType,x),frame:h.frame+x.frame*ve})}),u.setKeys(g),r.addTargetedAnimation(u,f.target)})});let s=n.sound,c=s?.getAudioBuffer();if(!t?.ignoreSounds&&s&&c&&n.sounds?.length){let h={dummy:0},f=new T.Animation(s.name,"dummy",60,T.Animation.ANIMATIONTYPE_FLOAT,T.Animation.ANIMATIONLOOPMODE_CYCLE,!1),u=0;n.sounds?.forEach(g=>{let M=g.endFrame-g.startFrame;u=Math.max(u,g.frame+M),f.addEvent(new z.AnimationEvent(g.frame,ee=>{let x=(ee-g.frame+g.startFrame)/e.framesPerSecond;s.play(0,x)},!1)),f.addEvent(new z.AnimationEvent(g.frame+M,()=>{s.stop()}))}),f.setKeys([{frame:0,value:0},{frame:u,value:u}]),r.addTargetedAnimation(f,h)}if(n.keyFrameEvents){let h={dummy:0},f=new T.Animation("events","dummy",60,T.Animation.ANIMATIONTYPE_FLOAT,T.Animation.ANIMATIONLOOPMODE_CYCLE,!1),u=0;n.keyFrameEvents?.forEach(g=>{u=Math.max(u,g.frame),f.addEvent(new z.AnimationEvent(g.frame,()=>{switch(g.data?.type){case"set-enabled":ct(g.data);break;case"apply-impulse":pt(o,g.data);break}}))}),f.setKeys([{frame:0,value:0},{frame:u,value:u}]),r.addTargetedAnimation(f,h)}let p=n.defaultRenderingPipeline?K():n.node;if(!p||!n.propertyPath||!n.keyFrameAnimations)return;let y=X(p,n.propertyPath),b=k(y);if(b===null)return;let O=new T.Animation(n.propertyPath,n.propertyPath,60,b,T.Animation.ANIMATIONLOOPMODE_CYCLE,!1),F=[];n.keyFrameAnimations?.forEach(h=>{let f=h.type==="key"?h:null;if(f)return F.push(f);let u=h.type==="cut"?h:null;u&&(F.push(u.key1),F.push(u.key2),Y(p)&&n.propertyPath==="position"&&O.addEvent(new z.AnimationEvent(u.key1.frame,()=>{let g=de();if(!g)return;let M=g.motionStrength;g.motionStrength=0,requestAnimationFrame(()=>{g.motionStrength=M})})))}),O.setKeys(F),r.addTargetedAnimation(O,p)}),r.normalize(),r}i(sr,"generateCinematicAnimationGroup");function ar(e){return e.type==="key"}i(ar,"isCinematicKey");function lr(e){return e.type==="cut"}i(lr,"isCinematicKeyCut");function cr(e){return e.type==="event"}i(cr,"isCinematicKeyEvent");function mr(e){return e.type==="group"}i(mr,"isCinematicGroup");function pr(e){return e.type==="sound"}i(pr,"isCinematicSound");0&&(module.exports={_applyScriptsForObject,animationGroupFromScene,configureEngineToUseCompressedTextures,configureShadowMapRefreshRate,configureShadowMapRenderListPredicate,createDefaultRenderingPipeline,createMotionBlurPostProcess,createSSAO2RenderingPipeline,createSSRRenderingPipeline,createVLSPostProcess,defaultPipelineCameraConfigurations,disposeDefaultRenderingPipeline,disposeMotionBlurPostProcess,disposeSSAO2RenderingPipeline,disposeSSRRenderingPipeline,disposeVLSPostProcess,generateCinematicAnimationGroup,getAllScriptsByClassForObject,getAnimationTypeForObject,getDefaultRenderingPipeline,getMotionBlurPostProcess,getPowerOfTwoUntil,getSSAO2RenderingPipeline,getSSRRenderingPipeline,getScriptByClassForObject,getVLSPostProcess,guiFromAsset,isAbstractMesh,isAnyParticleSystem,isArcRotateCamera,isBone,isCamera,isCinematicGroup,isCinematicKey,isCinematicKeyCut,isCinematicKeyEvent,isCinematicSound,isDirectionalLight,isFreeCamera,isGPUParticleSystem,isGroundMesh,isHemisphericLight,isInstancedMesh,isLight,isMesh,isNode,isParticleSystem,isPointLight,isScene,isSpotLight,isTexture,isTransformNode,loadMaterialFromFile,loadScene,motionBlurPostProcessCameraConfigurations,nodeFromDescendants,nodeFromScene,parseCinematic,parseCinematicKeyValue,parseDefaultRenderingPipeline,parseMotionBlurPostProcess,parseSSAO2RenderingPipeline,parseSSRRenderingPipeline,parseVLSPostProcess,particleSystemFromScene,registerScriptInstance,serializeDefaultRenderingPipeline,serializeMotionBlurPostProcess,serializeSSAO2RenderingPipeline,serializeSSRRenderingPipeline,serializeVLSPostProcess,setDefaultRenderingPipelineRef,setMotionBlurPostProcessRef,setSSAO2RenderingPipelineRef,setSSRRenderingPipelineRef,setVLSPostProcessRef,soundFromScene,ssaoRenderingPipelineCameraConfigurations,ssrRenderingPipelineCameraConfigurations,visibleAsBoolean,visibleAsColor3,visibleAsColor4,visibleAsEntity,visibleAsKeyMap,visibleAsNumber,visibleAsTexture,visibleAsVector2,visibleAsVector3,vlsPostProcessCameraConfigurations});
1
+ var H=Object.defineProperty;var yt=Object.getOwnPropertyDescriptor;var ht=Object.getOwnPropertyNames;var St=Object.prototype.hasOwnProperty;var i=(e,o)=>H(e,"name",{value:o,configurable:!0});var Pt=(e,o)=>{for(var t in o)H(e,t,{get:o[t],enumerable:!0})},bt=(e,o,t,r)=>{if(o&&typeof o=="object"||typeof o=="function")for(let n of ht(o))!St.call(e,n)&&n!==t&&H(e,n,{get:()=>o[n],enumerable:!(r=yt(o,n))||r.enumerable});return e};var Ct=e=>bt(H({},"__esModule",{value:!0}),e);var yn={};Pt(yn,{_applyScriptsForObject:()=>R,animationGroupFromScene:()=>$t,configureEngineToUseCompressedTextures:()=>Ht,configureShadowMapRefreshRate:()=>Ae,configureShadowMapRenderListPredicate:()=>xe,createDefaultRenderingPipeline:()=>et,createMotionBlurPostProcess:()=>Qe,createSSAO2RenderingPipeline:()=>Ue,createSSRRenderingPipeline:()=>He,createVLSPostProcess:()=>Ye,defaultPipelineCameraConfigurations:()=>B,disposeDefaultRenderingPipeline:()=>be,disposeMotionBlurPostProcess:()=>ye,disposeSSAO2RenderingPipeline:()=>ue,disposeSSRRenderingPipeline:()=>ce,disposeVLSPostProcess:()=>se,forceCompileAllSceneMaterials:()=>jt,generateCinematicAnimationGroup:()=>mn,getAllScriptsByClassForObject:()=>Be,getAnimationTypeForObject:()=>z,getDefaultRenderingPipeline:()=>k,getMotionBlurPostProcess:()=>de,getPowerOfTwoUntil:()=>D,getSSAO2RenderingPipeline:()=>Bt,getSSRRenderingPipeline:()=>Vt,getScriptByClassForObject:()=>Ft,getVLSPostProcess:()=>wt,guiFromAsset:()=>Qt,isAbstractMesh:()=>Oe,isAnyParticleSystem:()=>ie,isArcRotateCamera:()=>Tt,isBone:()=>It,isCamera:()=>W,isCinematicGroup:()=>fn,isCinematicKey:()=>pn,isCinematicKeyCut:()=>un,isCinematicKeyEvent:()=>gn,isCinematicSound:()=>dn,isDirectionalLight:()=>Dt,isFreeCamera:()=>At,isGPUParticleSystem:()=>Mt,isGroundMesh:()=>xt,isHemisphericLight:()=>Rt,isInstancedMesh:()=>_,isLight:()=>Fe,isMesh:()=>E,isNode:()=>re,isParticleSystem:()=>Ot,isPointLight:()=>Et,isScene:()=>oe,isSpotLight:()=>vt,isTexture:()=>ne,isTransformNode:()=>Me,loadMaterialFromFile:()=>Yt,loadScene:()=>zt,motionBlurPostProcessCameraConfigurations:()=>L,nodeFromDescendants:()=>Ut,nodeFromScene:()=>Wt,parseCinematic:()=>cn,parseCinematicKeyValue:()=>C,parseDefaultRenderingPipeline:()=>Ie,parseMotionBlurPostProcess:()=>Se,parseSSAO2RenderingPipeline:()=>fe,parseSSRRenderingPipeline:()=>pe,parseVLSPostProcess:()=>le,particleSystemFromScene:()=>qt,registerScriptInstance:()=>Le,serializeDefaultRenderingPipeline:()=>Ce,serializeMotionBlurPostProcess:()=>he,serializeSSAO2RenderingPipeline:()=>ge,serializeSSRRenderingPipeline:()=>me,serializeVLSPostProcess:()=>ae,setDefaultRenderingPipelineRef:()=>Kt,setMotionBlurPostProcessRef:()=>Gt,setSSAO2RenderingPipelineRef:()=>_t,setSSRRenderingPipelineRef:()=>Lt,setVLSPostProcessRef:()=>Nt,soundFromScene:()=>Zt,ssaoRenderingPipelineCameraConfigurations:()=>V,ssrRenderingPipelineCameraConfigurations:()=>N,visibleAsBoolean:()=>Xt,visibleAsColor3:()=>rn,visibleAsColor4:()=>on,visibleAsEntity:()=>sn,visibleAsKeyMap:()=>ln,visibleAsNumber:()=>en,visibleAsString:()=>Jt,visibleAsTexture:()=>an,visibleAsVector2:()=>tn,visibleAsVector3:()=>nn,vlsPostProcessCameraConfigurations:()=>w});module.exports=Ct(yn);function Oe(e){switch(e.getClassName?.()){case"Mesh":case"LineMesh":case"GroundMesh":case"InstancedMesh":return!0}return!1}i(Oe,"isAbstractMesh");function E(e){switch(e.getClassName?.()){case"Mesh":case"GroundMesh":return!0}return!1}i(E,"isMesh");function _(e){return e.getClassName?.()==="InstancedMesh"}i(_,"isInstancedMesh");function It(e){return e.getClassName?.()==="Bone"}i(It,"isBone");function xt(e){return e.getClassName?.()==="GroundMesh"}i(xt,"isGroundMesh");function Me(e){return e.getClassName?.()==="TransformNode"}i(Me,"isTransformNode");function ne(e){return e?.getClassName?.()==="Texture"}i(ne,"isTexture");function W(e){switch(e.getClassName?.()){case"Camera":case"FreeCamera":case"TargetCamera":case"EditorCamera":case"ArcRotateCamera":case"UniversalCamera":return!0}return!1}i(W,"isCamera");function At(e){switch(e.getClassName?.()){case"FreeCamera":case"UniversalCamera":return!0}return!1}i(At,"isFreeCamera");function Tt(e){return e.getClassName?.()==="ArcRotateCamera"}i(Tt,"isArcRotateCamera");function Et(e){return e.getClassName?.()==="PointLight"}i(Et,"isPointLight");function Dt(e){return e.getClassName?.()==="DirectionalLight"}i(Dt,"isDirectionalLight");function vt(e){return e.getClassName?.()==="SpotLight"}i(vt,"isSpotLight");function Rt(e){return e.getClassName?.()==="HemisphericLight"}i(Rt,"isHemisphericLight");function Fe(e){switch(e.getClassName?.()){case"Light":case"PointLight":case"SpotLight":case"DirectionalLight":case"HemisphericLight":return!0}return!1}i(Fe,"isLight");function re(e){return Oe(e)||Me(e)||Fe(e)||W(e)}i(re,"isNode");function oe(e){return e.getClassName?.()==="Scene"}i(oe,"isScene");function Ot(e){return e.getClassName?.()==="ParticleSystem"}i(Ot,"isParticleSystem");function Mt(e){return e.getClassName?.()==="GPUParticleSystem"}i(Mt,"isGPUParticleSystem");function ie(e){switch(e.getClassName?.()){case"ParticleSystem":case"GPUParticleSystem":return!0}return!1}i(ie,"isAnyParticleSystem");function U(e,o){let t=o.soundTracks??[];t.length||t.push(o.mainSoundTrack);for(let r=0,n=t.length;r<n;r++){let l=t[r].soundCollection.find(s=>s.id===e);if(l)return l}return null}i(U,"getSoundById");var $=require("babylonjs"),we=require("babylonjs"),Q=require("babylonjs"),Ne=require("babylonjs-gui");function Ve(e,o,t,r,n){let l=r.constructor;l&&(l._NodesFromScene?.forEach(s=>{r[s.propertyKey.toString()]=e.getNodeByName(s.nodeName)}),l._NodesFromDescendants?.forEach(s=>{let c=o.getDescendants?.(s.directDescendantsOnly,m=>m.name===s.nodeName)[0];r[s.propertyKey.toString()]=c??null}),l._AnimationGroups?.forEach(s=>{r[s.propertyKey.toString()]=e.getAnimationGroupByName(s.animationGroupName)}),l._SoundsFromScene?.forEach(s=>{let c=e.getSoundByName?.(s.soundName);r[s.propertyKey.toString()]=c??null}),l._GuiFromAsset?.forEach(async s=>{let c=`${n}assets/${s.pathInAssets}`;try{let y=await(await fetch(c)).json(),b=Ne.AdvancedDynamicTexture.CreateFullscreenUI(y.name,!0,e);b.parseSerializedObject(y.content,!1),r[s.propertyKey.toString()]=b,s.onGuiCreated?.(r,b)}catch(m){throw console.error(`Failed to load GUI from asset: ${c}`),m}}),l._ParticleSystemsFromScene?.forEach(s=>{let c=e.particleSystems?.find(m=>m.name!==s.particleSystemName?!1:s.directDescendantsOnly?m.emitter===o:m);r[s.propertyKey.toString()]=c}),l._VisibleInInspector?.forEach(s=>{let c=s.propertyKey.toString(),m=t.values;if(m.hasOwnProperty(c)&&m[c].hasOwnProperty("value")){let y=m[c].value;switch(s.configuration.type){case"number":case"boolean":case"keymap":case"string":r[c]=y;break;case"vector2":r[c]=Q.Vector2.FromArray(y);break;case"vector3":r[c]=Q.Vector3.FromArray(y);break;case"color3":r[c]=$.Color3.FromArray(y);break;case"color4":r[c]=$.Color4.FromArray(y);break;case"entity":switch(s.configuration.entityType){case"node":r[c]=e.getNodeById(y)??null;break;case"animationGroup":r[c]=e.getAnimationGroupByName(y)??null;break;case"sound":r[c]=U(y,e);break;case"particleSystem":r[c]=e.particleSystems?.find(O=>O.id===y)??null;break}break;case"texture":y&&(r[c]=we.Texture.Parse(y,e,n));break}}}))}i(Ve,"applyDecorators");function R(e,o,t,r){o.metadata&&(o.metadata.scripts?.forEach(n=>{if(!n.enabled)return;let l=t[n.key];if(l)if(l.default){let s=new l.default(o);Le(o,s,n.key),Ve(e,o,n,s,r),s.onStart&&e.onBeforeRenderObservable.addOnce(()=>s.onStart()),s.onUpdate&&e.onBeforeRenderObservable.add(()=>s.onUpdate())}else l.onStart&&e.onBeforeRenderObservable.addOnce(()=>l.onStart(o)),l.onUpdate&&e.onBeforeRenderObservable.add(()=>l.onUpdate(o))}),o.metadata.scripts=void 0)}i(R,"_applyScriptsForObject");var G=new Map;function Le(e,o,t){let r={key:t,instance:o};G.has(e)?G.get(e).push(r):G.set(e,[r]),(re(e)||ie(e)||oe(e))&&e.onDisposeObservable.addOnce(()=>{G.delete(e)})}i(Le,"registerScriptInstance");function Be(e,o){return G.get(e)?.filter(n=>n.instance.constructor===o)?.map(n=>n.instance)??null}i(Be,"getAllScriptsByClassForObject");function Ft(e,o){return Be(e,o)?.[0]??null}i(Ft,"getScriptByClassForObject");var K=require("babylonjs"),_e=require("babylonjs");function Ge(e){let o=e.metadata?.physicsAggregate;if(!o)return;let t;E(e)?t=e:_(e)&&(t=e.sourceMesh);let r=new _e.PhysicsAggregate(e,o.shape.type,{mesh:t,mass:o.massProperties.mass});r.body.setMassProperties({mass:o.massProperties.mass,inertia:o.massProperties.inertia?K.Vector3.FromArray(o.massProperties.inertia):void 0,centerOfMass:o.massProperties.centerOfMass?K.Vector3.FromArray(o.massProperties.centerOfMass):void 0,inertiaOrientation:o.massProperties.inertiaOrientation?K.Quaternion.FromArray(o.massProperties.inertiaOrientation):void 0}),r.shape.density=o.shape.density,r.body.setMotionType(o.body.motionType),r.shape.material=o.material,e.physicsAggregate=r,e.metadata.physicsAggregate=void 0}i(Ge,"configurePhysicsAggregate");var Ke=require("babylonjs"),ke=require("babylonjs"),ze=require("babylonjs"),S=null,w=new Map;function wt(){return S}i(wt,"getVLSPostProcess");function Nt(e){S=e}i(Nt,"setVLSPostProcessRef");function se(e){S&&e.activeCamera&&(S.dispose(e.activeCamera),S=null)}i(se,"disposeVLSPostProcess");function Ye(e,o){return o??=e.meshes.find(t=>E(t)),S=new ze.VolumetricLightScatteringPostProcess("VolumetricLightScatteringPostProcess",1,e.activeCamera,o,100,ke.Texture.BILINEAR_SAMPLINGMODE,e.getEngine(),!1),S}i(Ye,"createVLSPostProcess");function ae(){return S?{meshId:S.mesh?.id,exposure:S.exposure,decay:S.decay,weight:S.weight,density:S.density,invert:S.invert,useCustomMeshPosition:S.useCustomMeshPosition,customMeshPosition:S.customMeshPosition.asArray()}:null}i(ae,"serializeVLSPostProcess");function le(e,o){let t=null;if(o.meshId){let n=e.getMeshById(o.meshId);n&&E(n)&&(t=n)}let r=Ye(e,t);return r.exposure=o.exposure,r.decay=o.decay,r.weight=o.weight,r.density=o.density,r.invert=o.invert,r.useCustomMeshPosition=o.useCustomMeshPosition,r.customMeshPosition.copyFrom(Ke.Vector3.FromArray(o.customMeshPosition)),r}i(le,"parseVLSPostProcess");var je=require("babylonjs"),p=null,N=new Map;function Vt(){return p}i(Vt,"getSSRRenderingPipeline");function Lt(e){p=e}i(Lt,"setSSRRenderingPipelineRef");function ce(){p&&(p.dispose(),p=null)}i(ce,"disposeSSRRenderingPipeline");function He(e,o){return p=new je.SSRRenderingPipeline("SSRRenderingPipeline",e,[o]),p.samples=4,p}i(He,"createSSRRenderingPipeline");function me(){return p?{samples:p.samples,step:p.step,thickness:p.thickness,strength:p.strength,reflectionSpecularFalloffExponent:p.reflectionSpecularFalloffExponent,maxSteps:p.maxSteps,maxDistance:p.maxDistance,roughnessFactor:p.roughnessFactor,reflectivityThreshold:p.reflectivityThreshold,blurDispersionStrehgth:p.blurDispersionStrength,clipToFrustum:p.clipToFrustum,enableSmoothReflections:p.enableSmoothReflections,enableAutomaticThicknessComputation:p.enableAutomaticThicknessComputation,attenuateFacingCamera:p.attenuateFacingCamera,attenuateScreenBorders:p.attenuateScreenBorders,attenuateIntersectionDistance:p.attenuateIntersectionDistance,attenuateBackfaceReflection:p.attenuateBackfaceReflection,blurDownsample:p.blurDownsample,selfCollisionNumSkip:p.selfCollisionNumSkip,ssrDownsample:p.ssrDownsample,backfaceDepthTextureDownsample:p.backfaceDepthTextureDownsample}:null}i(me,"serializeSSRRenderingPipeline");function pe(e,o,t){if(p)return p;let r=He(e,o);return r.samples=t.samples,r.step=t.step,r.thickness=t.thickness,r.strength=t.strength,r.reflectionSpecularFalloffExponent=t.reflectionSpecularFalloffExponent,r.maxSteps=t.maxSteps,r.maxDistance=t.maxDistance,r.roughnessFactor=t.roughnessFactor,r.reflectivityThreshold=t.reflectivityThreshold,r.blurDispersionStrength=t.blurDispersionStrehgth,r.clipToFrustum=t.clipToFrustum,r.enableSmoothReflections=t.enableSmoothReflections,r.enableAutomaticThicknessComputation=t.enableAutomaticThicknessComputation,r.attenuateFacingCamera=t.attenuateFacingCamera,r.attenuateScreenBorders=t.attenuateScreenBorders,r.attenuateIntersectionDistance=t.attenuateIntersectionDistance,r.attenuateBackfaceReflection=t.attenuateBackfaceReflection,r.blurDownsample=t.blurDownsample,r.selfCollisionNumSkip=t.selfCollisionNumSkip,r.ssrDownsample=t.ssrDownsample,r.backfaceDepthTextureDownsample=t.backfaceDepthTextureDownsample,r}i(pe,"parseSSRRenderingPipeline");var We=require("babylonjs"),d=null,V=new Map;function Bt(){return d}i(Bt,"getSSAO2RenderingPipeline");function _t(e){d=e}i(_t,"setSSAO2RenderingPipelineRef");function ue(){d&&(d.dispose(),d=null)}i(ue,"disposeSSAO2RenderingPipeline");function Ue(e,o){return d=new We.SSAO2RenderingPipeline("SSAO2RenderingPipeline",e,1,[o]),d.samples=4,d}i(Ue,"createSSAO2RenderingPipeline");function ge(){return d?{radius:d.radius,totalStrength:d.totalStrength,samples:d.samples,maxZ:d.maxZ,minZAspect:d.minZAspect,epsilon:d.epsilon,textureSamples:d.textureSamples,bypassBlur:d.bypassBlur,bilateralSamples:d.bilateralSamples,bilateralSoften:d.bilateralSoften,bilateralTolerance:d.bilateralTolerance,expensiveBlur:d.expensiveBlur}:null}i(ge,"serializeSSAO2RenderingPipeline");function fe(e,o,t){if(d)return d;let r=Ue(e,o);return r.radius=t.radius,r.totalStrength=t.totalStrength,r.samples=t.samples,r.maxZ=t.maxZ,r.minZAspect=t.minZAspect,r.epsilon=t.epsilon,r.textureSamples=t.textureSamples,r.bypassBlur=t.bypassBlur,r.bilateralSamples=t.bilateralSamples,r.bilateralSoften=t.bilateralSoften,r.bilateralTolerance=t.bilateralTolerance,r.expensiveBlur=t.expensiveBlur,r}i(fe,"parseSSAO2RenderingPipeline");var $e=require("babylonjs"),P=null,L=new Map;function de(){return P}i(de,"getMotionBlurPostProcess");function Gt(e){P=e}i(Gt,"setMotionBlurPostProcessRef");function ye(){P&&(P.dispose(),P=null)}i(ye,"disposeMotionBlurPostProcess");function Qe(e,o){return P=new $e.MotionBlurPostProcess("MotionBlurPostProcess",e,1,o),P.motionStrength=1,P.isObjectBased=!0,P}i(Qe,"createMotionBlurPostProcess");function he(){return P?{isObjectBased:P.isObjectBased,motionStrength:P.motionStrength,motionBlurSamples:P.motionBlurSamples}:null}i(he,"serializeMotionBlurPostProcess");function Se(e,o,t){if(P)return P;let r=Qe(e,o);return r.isObjectBased=t.isObjectBased,r.motionStrength=t.motionStrength,r.motionBlurSamples=t.motionBlurSamples,r}i(Se,"parseMotionBlurPostProcess");var Ze=require("babylonjs"),Pe=require("babylonjs"),qe=require("babylonjs"),Xe=require("babylonjs"),Je=require("babylonjs"),a=null,B=new Map;function k(){return a}i(k,"getDefaultRenderingPipeline");function Kt(e){a=e}i(Kt,"setDefaultRenderingPipelineRef");function be(){a&&(a.dispose(),a=null)}i(be,"disposeDefaultRenderingPipeline");function et(e,o){return a=new Je.DefaultRenderingPipeline("DefaultRenderingPipeline",!0,e,[o]),a.samples=4,a.depthOfField.lensSize=512,a.depthOfField.fStop=.25,a.depthOfField.focusDistance=55e3,a}i(et,"createDefaultRenderingPipeline");function Ce(){return a?{samples:a.samples,fxaaEnabled:a.fxaaEnabled,imageProcessingEnabled:a.imageProcessingEnabled,exposure:a.imageProcessing?.exposure,contrast:a.imageProcessing?.contrast,fromLinearSpace:a.imageProcessing?.fromLinearSpace,toneMappingEnabled:a.imageProcessing?.toneMappingEnabled,toneMappingType:a.imageProcessing?.toneMappingType,ditheringEnabled:a.imageProcessing?.ditheringEnabled,ditheringIntensity:a.imageProcessing?.ditheringIntensity,bloomEnabled:a.bloomEnabled,bloomThreshold:a.bloomThreshold,bloomWeight:a.bloomWeight,bloomScale:a.bloomScale,bloomKernel:a.bloomKernel,sharpenEnabled:a.sharpenEnabled,sharpenEdgeAmount:a.sharpen.edgeAmount,sharpenColorAmount:a.sharpen.colorAmount,grainEnabled:a.grainEnabled,grainIntensity:a.grain.intensity,grainAnimated:a.grain.animated,depthOfFieldEnabled:a.depthOfFieldEnabled,depthOfFieldBlurLevel:a.depthOfFieldBlurLevel,lensSize:a.depthOfField.lensSize,fStop:a.depthOfField.fStop,focusDistance:a.depthOfField.focusDistance,focalLength:a.depthOfField.focalLength,vignetteEnabled:a.imageProcessing?.vignetteEnabled,vignetteColor:a.imageProcessing?.vignetteColor.asArray(),vignetteWeight:a.imageProcessing?.vignetteWeight,chromaticAberrationEnabled:a.chromaticAberrationEnabled,aberrationAmount:a.chromaticAberration.aberrationAmount,radialIntensity:a.chromaticAberration.radialIntensity,direction:a.chromaticAberration.direction.asArray(),centerPosition:a.chromaticAberration.centerPosition.asArray(),glowLayerEnabled:a.glowLayerEnabled,glowLayerIntensity:a.glowLayer?.intensity,glowLayerBlurKernelSize:a.glowLayer?.blurKernelSize,colorGradingEnabled:a.imageProcessing.colorGradingEnabled,colorGradingTexture:a.imageProcessing.colorGradingTexture?.serialize(),colorGradingWithGreenDepth:a.imageProcessing.imageProcessingConfiguration.colorGradingWithGreenDepth,colorCurvesEnabled:a.imageProcessing.colorCurvesEnabled,globalHue:a.imageProcessing.colorCurves?.globalHue,globalDensity:a.imageProcessing.colorCurves?.globalDensity,globalExposure:a.imageProcessing.colorCurves?.globalExposure,globalSaturation:a.imageProcessing.colorCurves?.globalSaturation,highlightsHue:a.imageProcessing.colorCurves?.highlightsHue,highlightsDensity:a.imageProcessing.colorCurves?.highlightsDensity,highlightsExposure:a.imageProcessing.colorCurves?.highlightsExposure,highlightsSaturation:a.imageProcessing.colorCurves?.highlightsSaturation,midtonesHue:a.imageProcessing.colorCurves?.midtonesHue,midtonesDensity:a.imageProcessing.colorCurves?.midtonesDensity,midtonesExposure:a.imageProcessing.colorCurves?.midtonesExposure,midtonesSaturation:a.imageProcessing.colorCurves?.midtonesSaturation,shadowsHue:a.imageProcessing.colorCurves?.shadowsHue,shadowsDensity:a.imageProcessing.colorCurves?.shadowsDensity,shadowsExposure:a.imageProcessing.colorCurves?.shadowsExposure,shadowsSaturation:a.imageProcessing.colorCurves?.shadowsSaturation}:null}i(Ce,"serializeDefaultRenderingPipeline");function Ie(e,o,t,r){if(a)return a;let n=et(e,o);if(n.samples=t.samples,n.fxaaEnabled=t.fxaaEnabled,n.imageProcessingEnabled=t.imageProcessingEnabled,n.imageProcessing){if(n.imageProcessing.exposure=t.exposure,n.imageProcessing.contrast=t.contrast,n.imageProcessing.fromLinearSpace=t.fromLinearSpace,n.imageProcessing.toneMappingEnabled=t.toneMappingEnabled,n.imageProcessing.toneMappingType=t.toneMappingType,n.imageProcessing.ditheringEnabled=t.ditheringEnabled,n.imageProcessing.ditheringIntensity=t.ditheringIntensity,n.imageProcessing.vignetteEnabled=t.vignetteEnabled??!1,n.imageProcessing.vignetteColor=Ze.Color4.FromArray(t.vignetteColor??[0,0,0]),n.imageProcessing.vignetteWeight=t.vignetteWeight??.3,n.imageProcessing.colorGradingEnabled=t.colorGradingEnabled??!1,n.imageProcessing.imageProcessingConfiguration.colorGradingWithGreenDepth=t.colorGradingWithGreenDepth??!0,t.colorGradingTexture){let l=null;if(t.colorGradingTexture.customType==="BABYLON.ColorGradingTexture"){let s=r+t.colorGradingTexture.name;l=new Xe.ColorGradingTexture(s,e),l.level=t.colorGradingTexture.level}else{let s=qe.Texture.Parse(t.colorGradingTexture,e,r);ne(s)&&(l=s)}n.imageProcessing.colorGradingTexture=l}n.imageProcessing.colorCurvesEnabled=t.colorCurvesEnabled??!1,n.imageProcessing.colorCurves&&(n.imageProcessing.colorCurves.globalHue=t.globalHue??30,n.imageProcessing.colorCurves.globalDensity=t.globalDensity??0,n.imageProcessing.colorCurves.globalExposure=t.globalExposure??0,n.imageProcessing.colorCurves.globalSaturation=t.globalSaturation??0,n.imageProcessing.colorCurves.highlightsHue=t.highlightsHue??30,n.imageProcessing.colorCurves.highlightsDensity=t.highlightsDensity??0,n.imageProcessing.colorCurves.highlightsExposure=t.highlightsExposure??0,n.imageProcessing.colorCurves.highlightsSaturation=t.highlightsSaturation??0,n.imageProcessing.colorCurves.midtonesHue=t.midtonesHue??30,n.imageProcessing.colorCurves.midtonesDensity=t.midtonesDensity??0,n.imageProcessing.colorCurves.midtonesExposure=t.midtonesExposure??0,n.imageProcessing.colorCurves.midtonesSaturation=t.midtonesSaturation??0,n.imageProcessing.colorCurves.shadowsHue=t.shadowsHue??30,n.imageProcessing.colorCurves.shadowsDensity=t.shadowsDensity??0,n.imageProcessing.colorCurves.shadowsExposure=t.shadowsExposure??0,n.imageProcessing.colorCurves.shadowsSaturation=t.shadowsSaturation??0)}return n.bloomEnabled=t.bloomEnabled,n.bloomThreshold=t.bloomThreshold,n.bloomWeight=t.bloomWeight,n.bloomScale=t.bloomScale,n.bloomKernel=t.bloomKernel,n.sharpenEnabled=t.sharpenEnabled,n.sharpen.edgeAmount=t.sharpenEdgeAmount,n.sharpen.colorAmount=t.sharpenColorAmount,n.grainEnabled=t.grainEnabled,n.grain.intensity=t.grainIntensity,n.grain.animated=t.grainAnimated,n.depthOfFieldEnabled=t.depthOfFieldEnabled,n.depthOfFieldBlurLevel=t.depthOfFieldBlurLevel,n.depthOfField.lensSize=t.lensSize,n.depthOfField.fStop=t.fStop,n.depthOfField.focusDistance=t.focusDistance,n.depthOfField.focalLength=t.focalLength,n.chromaticAberrationEnabled=t.chromaticAberrationEnabled??!1,n.chromaticAberration.aberrationAmount=t.aberrationAmount??10,n.chromaticAberration.radialIntensity=t.radialIntensity??1,n.chromaticAberration.direction=Pe.Vector2.FromArray(t.direction??[0,0]),n.chromaticAberration.centerPosition=Pe.Vector2.FromArray(t.centerPosition??[0,0]),n.glowLayerEnabled=t.glowLayerEnabled??!1,n.glowLayer&&(n.glowLayer.intensity=t.glowLayerIntensity??1,n.glowLayer.blurKernelSize=t.glowLayerBlurKernelSize??32),n}i(Ie,"parseDefaultRenderingPipeline");function tt(e,o){(Array.isArray(o)?o:[]).forEach(r=>{let n=e.getCameraById(r.cameraId);n&&(r.ssao2RenderingPipeline&&V.set(n,r.ssao2RenderingPipeline),r.vlsPostProcess&&w.set(n,r.vlsPostProcess),r.ssrRenderingPipeline&&N.set(n,r.ssrRenderingPipeline),r.motionBlurPostProcess&&L.set(n,r.motionBlurPostProcess),r.defaultRenderingPipeline&&B.set(n,r.defaultRenderingPipeline))})}i(tt,"applyRenderingConfigurations");function Ko(e){V.set(e,ge()),w.set(e,ae()),N.set(e,me()),L.set(e,he()),B.set(e,Ce())}i(Ko,"saveRenderingConfigurationForCamera");function nt(e,o){ue(),se(e.getScene()),ce(),ye(),be();let t=V.get(e);t&&fe(e.getScene(),e,t);let r=w.get(e);r&&le(e.getScene(),r);let n=N.get(e);n&&pe(e.getScene(),e,n);let l=L.get(e);l&&Se(e.getScene(),e,l);let s=B.get(e);s&&Ie(e.getScene(),e,s,o)}i(nt,"applyRenderingConfigurationForCamera");var rt=require("babylonjs"),ot=require("babylonjs");function xe(e){e.lights.forEach(o=>{let t=o.getShadowGenerator()?.getShadowMap();t&&(t.renderListPredicate=r=>rt.Vector3.Distance(r.getAbsolutePosition(),o.getAbsolutePosition())<=o.range)})}i(xe,"configureShadowMapRenderListPredicate");async function Ae(e){e.executeWhenReady(()=>{e.lights.forEach(o=>{let t=o.getShadowGenerator()?.getShadowMap();t&&(t.refreshRate=o.metadata?.refreshRate??ot.RenderTargetTexture.REFRESHRATE_RENDER_ONEVERYFRAME)})})}i(Ae,"configureShadowMapRefreshRate");var Te=require("babylonjs"),Z=require("babylonjs"),kt=(0,Z.GetParser)(Te.SceneComponentConstants.NAME_AUDIO);(0,Z.AddParser)(Te.SceneComponentConstants.NAME_AUDIO,(e,o,t,r)=>{kt?.(e,o,t,r),e.sounds?.forEach(n=>{let l=t.sounds?.find(s=>s.name===n.name);l&&(l.id=n.id,l.uniqueId=n.uniqueId)})});function D(e){let o=1;for(;o<=e;)o<<=1;return o>>1}i(D,"getPowerOfTwoUntil");var Ee=require("babylonjs"),q=Ee.SerializationHelper._TextureParser;Ee.SerializationHelper._TextureParser=(e,o,t)=>{if(o.loadingQuality==="high"||!e.metadata?.baseSize)return q(e,o,t);let r=e.metadata.baseSize.width,n=e.metadata.baseSize.height,l=r===D(r)||n===D(n),s="";switch(o.loadingQuality){case"medium":let h=r*.66>>0,f=n*.66>>0;l&&(h=D(h),f=D(f)),s=`_${h}_${f}`;break;case"low":let u=r*.33>>0,g=n*.33>>0;l&&(u=D(u),g=D(g)),s=`_${u}_${g}`;break}let c=e.name;if(!c||!s)return q(e,o,t);let m=c.split("/"),y=m.pop();if(!y)return q(e,o,t);let b=y.split(".").pop(),M=`${y.replace(`.${b}`,"")}${s}.${b}`;return m.push(M),e.name=m.join("/"),q(e,o,t)};var it=require("babylonjs"),De=require("babylonjs"),st=require("babylonjs"),at=require("babylonjs");async function zt(e,o,t,r,n){t.loadingQuality=n?.quality??"high",await(0,st.AppendSceneAsync)(`${e}${o}`,t,{pluginExtension:".babylon",onProgress:i(s=>{let c=Math.min(s.loaded/s.total*.5);n?.onProgress?.(c)},"onProgress")}),at.SceneLoaderFlags.ForceFullSceneLoadingForIncremental&&t.meshes.forEach(s=>E(s)&&s._checkDelayState());let l=t.getWaitingItemsCount();for(;!t.isDisposed&&(!t.isReady()||t.getWaitingItemsCount()>0);){await new Promise(c=>setTimeout(c,150));let s=l-t.getWaitingItemsCount();s===l&&t.textures.forEach(c=>{c.delayLoadState===De.Constants.DELAYLOADSTATE_NONE&&(c.delayLoadState=De.Constants.DELAYLOADSTATE_LOADED)}),n?.onProgress?.(.5+s/l*.5)}n?.onProgress?.(1),xe(t),Ae(t),t.metadata?.rendering&&(tt(t,t.metadata.rendering),t.activeCamera&&nt(t.activeCamera,e)),t.metadata?.physicsGravity&&t.getPhysicsEngine()?.setGravity(it.Vector3.FromArray(t.metadata?.physicsGravity)),R(t,t,r,e),t.transformNodes.forEach(s=>{R(t,s,r,e)}),t.meshes.forEach(s=>{Ge(s),R(t,s,r,e)}),t.lights.forEach(s=>{R(t,s,r,e)}),t.cameras.forEach(s=>{R(t,s,r,e)})}i(zt,"loadScene");var lt=require("babylonjs");async function Yt(e,o,t){let n=await(await fetch(e+o)).json(),s=lt.Tools.Instantiate(n.customType).Parse(n,t,e);return s.id=n.id,s.uniqueId=n.uniqueId,s}i(Yt,"loadMaterialFromFile");function jt(e){return Promise.all(e.materials.map(async o=>{let t=o.getBindedMeshes();await Promise.all(t.map(async r=>{_(r)||await o.forceCompilationAsync(r,{clipPlane:!!e.clipPlane,useInstances:r.hasInstances})}))}))}i(jt,"forceCompileAllSceneMaterials");function Ht(e){e.setTextureFormatToUse(["-dxt.ktx","-astc.ktx","-pvrtc.ktx","-etc1.ktx","-etc2.ktx"])}i(Ht,"configureEngineToUseCompressedTextures");var A=require("babylonjs");function z(e){if(!isNaN(parseFloat(e))&&isFinite(e))return A.Animation.ANIMATIONTYPE_FLOAT;switch(e?.getClassName?.()){case"Vector2":return A.Animation.ANIMATIONTYPE_VECTOR2;case"Vector3":return A.Animation.ANIMATIONTYPE_VECTOR3;case"Quaternion":return A.Animation.ANIMATIONTYPE_QUATERNION;case"Color3":return A.Animation.ANIMATIONTYPE_COLOR3;case"Color4":return A.Animation.ANIMATIONTYPE_COLOR4;case"Size":return A.Animation.ANIMATIONTYPE_SIZE;case"Matrix":return A.Animation.ANIMATIONTYPE_MATRIX}return null}i(z,"getAnimationTypeForObject");function Wt(e){return function(o,t){let r=o.constructor;r._NodesFromScene??=[],r._NodesFromScene.push({propertyKey:t,nodeName:e})}}i(Wt,"nodeFromScene");function Ut(e,o=!1){return function(t,r){let n=t.constructor;n._NodesFromDescendants??=[],n._NodesFromDescendants.push({propertyKey:r,nodeName:e,directDescendantsOnly:o})}}i(Ut,"nodeFromDescendants");function $t(e){return function(o,t){let r=o.constructor;r._AnimationGroups??=[],r._AnimationGroups.push({animationGroupName:e,propertyKey:t})}}i($t,"animationGroupFromScene");function Qt(e,o){return function(t,r){let n=t.constructor;n._GuiFromAsset??=[],n._GuiFromAsset.push({propertyKey:r,pathInAssets:e,onGuiCreated:o})}}i(Qt,"guiFromAsset");function Zt(e){return function(o,t){let r=o.constructor;r._SoundsFromScene??=[],r._SoundsFromScene.push({propertyKey:t,soundName:e})}}i(Zt,"soundFromScene");function qt(e,o=!1){return function(t,r){let n=t.constructor;n._ParticleSystemsFromScene??=[],n._ParticleSystemsFromScene.push({propertyKey:r,particleSystemName:e,directDescendantsOnly:o})}}i(qt,"particleSystemFromScene");function Xt(e,o){return function(t,r){let n=t.constructor;n._VisibleInInspector??=[],n._VisibleInInspector.push({label:e,propertyKey:r,configuration:{...o,type:"boolean"}})}}i(Xt,"visibleAsBoolean");function Jt(e,o){return function(t,r){let n=t.constructor;n._VisibleInInspector??=[],n._VisibleInInspector.push({label:e,propertyKey:r,configuration:{...o,type:"string"}})}}i(Jt,"visibleAsString");function en(e,o){return function(t,r){let n=t.constructor;n._VisibleInInspector??=[],n._VisibleInInspector.push({label:e,propertyKey:r,configuration:{...o,type:"number"}})}}i(en,"visibleAsNumber");function tn(e,o){return function(t,r){let n=t.constructor;n._VisibleInInspector??=[],n._VisibleInInspector.push({label:e,propertyKey:r,configuration:{...o,type:"vector2"}})}}i(tn,"visibleAsVector2");function nn(e,o){return function(t,r){let n=t.constructor;n._VisibleInInspector??=[],n._VisibleInInspector.push({label:e,propertyKey:r,configuration:{...o,type:"vector3"}})}}i(nn,"visibleAsVector3");function rn(e,o){return function(t,r){let n=t.constructor;n._VisibleInInspector??=[],n._VisibleInInspector.push({label:e,propertyKey:r,configuration:{...o,type:"color3"}})}}i(rn,"visibleAsColor3");function on(e,o){return function(t,r){let n=t.constructor;n._VisibleInInspector??=[],n._VisibleInInspector.push({label:e,propertyKey:r,configuration:{...o,type:"color4"}})}}i(on,"visibleAsColor4");function sn(e,o,t){return function(r,n){let l=r.constructor;l._VisibleInInspector??=[],l._VisibleInInspector.push({label:o,propertyKey:n,configuration:{...t,entityType:e,type:"entity"}})}}i(sn,"visibleAsEntity");function an(e,o){return function(t,r){let n=t.constructor;n._VisibleInInspector??=[],n._VisibleInInspector.push({label:e,propertyKey:r,configuration:{...o,type:"texture"}})}}i(an,"visibleAsTexture");function ln(e,o){return function(t,r){let n=t.constructor;n._VisibleInInspector??=[],n._VisibleInInspector.push({label:e,propertyKey:r,configuration:{...o,type:"keymap"}})}}i(ln,"visibleAsKeyMap");var X=require("babylonjs");function ct(e,o){let t;switch(e){case X.Animation.ANIMATIONTYPE_FLOAT:t=o.value;break;default:t=o.value.clone();break}return{value:t,frame:o.frame,interpolation:o.interpolation,inTangent:e===X.Animation.ANIMATIONTYPE_FLOAT?o.inTangent:o.inTangent?.clone(),outTangent:e===X.Animation.ANIMATIONTYPE_FLOAT?o.outTangent:o.outTangent?.clone()}}i(ct,"cloneKey");function J(e,o){let t=o.split("."),r=e;for(let n=0;n<t.length;++n)r=r[t[n]];return r}i(J,"getPropertyValue");var v=require("babylonjs"),ee=require("babylonjs"),I=require("babylonjs");function cn(e,o){return{name:e.name,framesPerSecond:e.framesPerSecond,outputFramesPerSecond:e.outputFramesPerSecond,tracks:e.tracks.map(t=>{let r=null,n=null;if(t.node?(r=o.getNodeById(t.node),r||(r=o.particleSystems?.find(s=>s.id===t.node)??null)):t.defaultRenderingPipeline&&(r=k()),t.propertyPath){let s=J(r,t.propertyPath);n=z(s)}let l=null;return t.sound&&(l=U(t.sound,o)),{node:r,sound:l,propertyPath:t.propertyPath,defaultRenderingPipeline:t.defaultRenderingPipeline,animationGroup:t.animationGroup?o.getAnimationGroupByName(t.animationGroup):null,animationGroups:t.animationGroups,sounds:t.sounds,keyFrameEvents:t.keyFrameEvents?.map(s=>{let c={...s};switch(s.data?.type){case"set-enabled":c.data={type:"set-enabled",value:s.data.value,node:o.getNodeById(s.data.node)};break;case"apply-impulse":c.data={type:"apply-impulse",radius:s.data.radius,mesh:o.getMeshById(s.data.mesh),force:I.Vector3.FromArray(s.data.force),contactPoint:I.Vector3.FromArray(s.data.contactPoint)};break}return c}),keyFrameAnimations:r&&n!==null&&t.keyFrameAnimations?.map(s=>{let c=s.type==="key"?s:null;if(c)return{...c,value:C(c.value,n),inTangent:C(c.inTangent,n),outTangent:C(c.outTangent,n)};let m=s.type==="cut"?s:null;if(m)return{...m,key1:{...m.key1,value:C(m.key1.value,n),inTangent:C(m.key1.inTangent,n),outTangent:C(m.key1.outTangent,n)},key2:{...m.key2,value:C(m.key2.value,n),inTangent:C(m.key2.inTangent,n),outTangent:C(m.key2.outTangent,n)}};throw new Error(`Unknown key frame type: ${s.type}`)})}})}}i(cn,"parseCinematic");function C(e,o){if(e===null)return null;if(e!==void 0)switch(o){case v.Animation.ANIMATIONTYPE_FLOAT:return e;case v.Animation.ANIMATIONTYPE_VECTOR2:return I.Vector2.FromArray(e);case v.Animation.ANIMATIONTYPE_VECTOR3:return I.Vector3.FromArray(e);case v.Animation.ANIMATIONTYPE_QUATERNION:return I.Quaternion.FromArray(e);case v.Animation.ANIMATIONTYPE_COLOR3:return ee.Color3.FromArray(e);case v.Animation.ANIMATIONTYPE_COLOR4:return ee.Color4.FromArray(e);case v.Animation.ANIMATIONTYPE_MATRIX:return I.Matrix.FromArray(e)}}i(C,"parseCinematicKeyValue");function mt(e){e.node?.setEnabled(e.value)}i(mt,"handleSetEnabledEvent");var ve=require("babylonjs"),pt=ve.Vector3.Zero();function ut(e,o){let t=o.mesh?[o.mesh]:e.meshes.filter(r=>r.physicsAggregate);o.radius&&(t=t.filter(r=>{let n=r.getBoundingInfo().boundingBox.centerWorld;return ve.Vector3.Distance(n,o.contactPoint)<=o.radius})),t.forEach(r=>{if(r.physicsAggregate?.body){let n=o.contactPoint.subtract(r.getBoundingInfo().boundingBox.centerWorld);n.multiplyInPlace(o.force),r.physicsAggregate.body.setLinearVelocity(pt),r.physicsAggregate.body.setAngularVelocity(pt),r.physicsAggregate.body.applyImpulse(n.negateInPlace(),o.contactPoint)}})}i(ut,"handleApplyImpulseEvent");var gt=require("babylonjs"),T=require("babylonjs"),Y=require("babylonjs"),ft=require("babylonjs");function mn(e,o,t){let r=new ft.AnimationGroup(e.name,o);return e.tracks.forEach(n=>{let l=n.animationGroup;l&&n.animationGroups?.forEach(h=>{l.targetedAnimations.forEach(f=>{let u=null;e:{let x=r.targetedAnimations.filter(j=>j.target===f.target);if(x.length){let j=x.find(dt=>dt.animation.targetProperty===f.animation.targetProperty);if(j){u=j.animation;break e}}u=f.animation.clone(),u.setKeys([]),u.name=gt.Tools.RandomId(),u.framePerSecond=e.framesPerSecond}let g=u.getKeys(),F=f.animation.getKeys(),te=h.speed,Re=e.framesPerSecond/f.animation.framePerSecond/te;F.forEach(x=>{x.frame>=h.startFrame&&x.frame<=h.endFrame&&g.push({...ct(f.animation.dataType,x),frame:h.frame+x.frame*Re})}),u.setKeys(g),r.addTargetedAnimation(u,f.target)})});let s=n.sound,c=s?.getAudioBuffer();if(!t?.ignoreSounds&&s&&c&&n.sounds?.length){let h={dummy:0},f=new T.Animation(s.name,"dummy",60,T.Animation.ANIMATIONTYPE_FLOAT,T.Animation.ANIMATIONLOOPMODE_CYCLE,!1),u=0;n.sounds?.forEach(g=>{let F=g.endFrame-g.startFrame;u=Math.max(u,g.frame+F),f.addEvent(new Y.AnimationEvent(g.frame,te=>{let x=(te-g.frame+g.startFrame)/e.framesPerSecond;s.play(0,x)},!1)),f.addEvent(new Y.AnimationEvent(g.frame+F,()=>{s.stop()}))}),f.setKeys([{frame:0,value:0},{frame:u,value:u}]),r.addTargetedAnimation(f,h)}if(n.keyFrameEvents){let h={dummy:0},f=new T.Animation("events","dummy",60,T.Animation.ANIMATIONTYPE_FLOAT,T.Animation.ANIMATIONLOOPMODE_CYCLE,!1),u=0;n.keyFrameEvents?.forEach(g=>{u=Math.max(u,g.frame),f.addEvent(new Y.AnimationEvent(g.frame,()=>{switch(g.data?.type){case"set-enabled":mt(g.data);break;case"apply-impulse":ut(o,g.data);break}}))}),f.setKeys([{frame:0,value:0},{frame:u,value:u}]),r.addTargetedAnimation(f,h)}let m=n.defaultRenderingPipeline?k():n.node;if(!m||!n.propertyPath||!n.keyFrameAnimations)return;let y=J(m,n.propertyPath),b=z(y);if(b===null)return;let O=new T.Animation(n.propertyPath,n.propertyPath,60,b,T.Animation.ANIMATIONLOOPMODE_CYCLE,!1),M=[];n.keyFrameAnimations?.forEach(h=>{let f=h.type==="key"?h:null;if(f)return M.push(f);let u=h.type==="cut"?h:null;u&&(M.push(u.key1),M.push(u.key2),W(m)&&n.propertyPath==="position"&&O.addEvent(new Y.AnimationEvent(u.key1.frame,()=>{let g=de();if(!g)return;let F=g.motionStrength;g.motionStrength=0,requestAnimationFrame(()=>{g.motionStrength=F})})))}),O.setKeys(M),r.addTargetedAnimation(O,m)}),r.normalize(),r}i(mn,"generateCinematicAnimationGroup");function pn(e){return e.type==="key"}i(pn,"isCinematicKey");function un(e){return e.type==="cut"}i(un,"isCinematicKeyCut");function gn(e){return e.type==="event"}i(gn,"isCinematicKeyEvent");function fn(e){return e.type==="group"}i(fn,"isCinematicGroup");function dn(e){return e.type==="sound"}i(dn,"isCinematicSound");0&&(module.exports={_applyScriptsForObject,animationGroupFromScene,configureEngineToUseCompressedTextures,configureShadowMapRefreshRate,configureShadowMapRenderListPredicate,createDefaultRenderingPipeline,createMotionBlurPostProcess,createSSAO2RenderingPipeline,createSSRRenderingPipeline,createVLSPostProcess,defaultPipelineCameraConfigurations,disposeDefaultRenderingPipeline,disposeMotionBlurPostProcess,disposeSSAO2RenderingPipeline,disposeSSRRenderingPipeline,disposeVLSPostProcess,forceCompileAllSceneMaterials,generateCinematicAnimationGroup,getAllScriptsByClassForObject,getAnimationTypeForObject,getDefaultRenderingPipeline,getMotionBlurPostProcess,getPowerOfTwoUntil,getSSAO2RenderingPipeline,getSSRRenderingPipeline,getScriptByClassForObject,getVLSPostProcess,guiFromAsset,isAbstractMesh,isAnyParticleSystem,isArcRotateCamera,isBone,isCamera,isCinematicGroup,isCinematicKey,isCinematicKeyCut,isCinematicKeyEvent,isCinematicSound,isDirectionalLight,isFreeCamera,isGPUParticleSystem,isGroundMesh,isHemisphericLight,isInstancedMesh,isLight,isMesh,isNode,isParticleSystem,isPointLight,isScene,isSpotLight,isTexture,isTransformNode,loadMaterialFromFile,loadScene,motionBlurPostProcessCameraConfigurations,nodeFromDescendants,nodeFromScene,parseCinematic,parseCinematicKeyValue,parseDefaultRenderingPipeline,parseMotionBlurPostProcess,parseSSAO2RenderingPipeline,parseSSRRenderingPipeline,parseVLSPostProcess,particleSystemFromScene,registerScriptInstance,serializeDefaultRenderingPipeline,serializeMotionBlurPostProcess,serializeSSAO2RenderingPipeline,serializeSSRRenderingPipeline,serializeVLSPostProcess,setDefaultRenderingPipelineRef,setMotionBlurPostProcessRef,setSSAO2RenderingPipelineRef,setSSRRenderingPipelineRef,setVLSPostProcessRef,soundFromScene,ssaoRenderingPipelineCameraConfigurations,ssrRenderingPipelineCameraConfigurations,visibleAsBoolean,visibleAsColor3,visibleAsColor4,visibleAsEntity,visibleAsKeyMap,visibleAsNumber,visibleAsString,visibleAsTexture,visibleAsVector2,visibleAsVector3,vlsPostProcessCameraConfigurations});
@@ -1,9 +1,7 @@
1
1
  import { Vector3 } from "@babylonjs/core/Maths/math.vector";
2
2
  const zeroVector = Vector3.Zero();
3
3
  export function handleApplyImpulseEvent(scene, config) {
4
- let meshes = config.mesh
5
- ? [config.mesh]
6
- : scene.meshes.filter((m) => m.physicsAggregate);
4
+ let meshes = config.mesh ? [config.mesh] : scene.meshes.filter((m) => m.physicsAggregate);
7
5
  if (config.radius) {
8
6
  meshes = meshes.filter((mesh) => {
9
7
  const centerWorld = mesh.getBoundingInfo().boundingBox.centerWorld;
@@ -41,7 +41,7 @@ export function generateCinematicAnimationGroup(cinematic, scene, options) {
41
41
  const keys = animation.getKeys();
42
42
  const sourceKeys = targetedAnimation.animation.getKeys();
43
43
  const speed = configuration.speed;
44
- const normalizedFps = (cinematic.framesPerSecond / targetedAnimation.animation.framePerSecond) / speed;
44
+ const normalizedFps = cinematic.framesPerSecond / targetedAnimation.animation.framePerSecond / speed;
45
45
  sourceKeys.forEach((k) => {
46
46
  if (k.frame >= configuration.startFrame && k.frame <= configuration.endFrame) {
47
47
  keys.push({
@@ -67,36 +67,38 @@ export function parseCinematic(data, scene) {
67
67
  }
68
68
  return result;
69
69
  }),
70
- keyFrameAnimations: node && animationType !== null && track.keyFrameAnimations?.map((keyFrame) => {
71
- const animationKey = keyFrame.type === "key" ? keyFrame : null;
72
- if (animationKey) {
73
- return {
74
- ...animationKey,
75
- value: parseCinematicKeyValue(animationKey.value, animationType),
76
- inTangent: parseCinematicKeyValue(animationKey.inTangent, animationType),
77
- outTangent: parseCinematicKeyValue(animationKey.outTangent, animationType),
78
- };
79
- }
80
- const animationKeyCut = keyFrame.type === "cut" ? keyFrame : null;
81
- if (animationKeyCut) {
82
- return {
83
- ...animationKeyCut,
84
- key1: {
85
- ...animationKeyCut.key1,
86
- value: parseCinematicKeyValue(animationKeyCut.key1.value, animationType),
87
- inTangent: parseCinematicKeyValue(animationKeyCut.key1.inTangent, animationType),
88
- outTangent: parseCinematicKeyValue(animationKeyCut.key1.outTangent, animationType),
89
- },
90
- key2: {
91
- ...animationKeyCut.key2,
92
- value: parseCinematicKeyValue(animationKeyCut.key2.value, animationType),
93
- inTangent: parseCinematicKeyValue(animationKeyCut.key2.inTangent, animationType),
94
- outTangent: parseCinematicKeyValue(animationKeyCut.key2.outTangent, animationType),
95
- },
96
- };
97
- }
98
- throw new Error(`Unknown key frame type: ${keyFrame.type}`);
99
- }),
70
+ keyFrameAnimations: node &&
71
+ animationType !== null &&
72
+ track.keyFrameAnimations?.map((keyFrame) => {
73
+ const animationKey = keyFrame.type === "key" ? keyFrame : null;
74
+ if (animationKey) {
75
+ return {
76
+ ...animationKey,
77
+ value: parseCinematicKeyValue(animationKey.value, animationType),
78
+ inTangent: parseCinematicKeyValue(animationKey.inTangent, animationType),
79
+ outTangent: parseCinematicKeyValue(animationKey.outTangent, animationType),
80
+ };
81
+ }
82
+ const animationKeyCut = keyFrame.type === "cut" ? keyFrame : null;
83
+ if (animationKeyCut) {
84
+ return {
85
+ ...animationKeyCut,
86
+ key1: {
87
+ ...animationKeyCut.key1,
88
+ value: parseCinematicKeyValue(animationKeyCut.key1.value, animationType),
89
+ inTangent: parseCinematicKeyValue(animationKeyCut.key1.inTangent, animationType),
90
+ outTangent: parseCinematicKeyValue(animationKeyCut.key1.outTangent, animationType),
91
+ },
92
+ key2: {
93
+ ...animationKeyCut.key2,
94
+ value: parseCinematicKeyValue(animationKeyCut.key2.value, animationType),
95
+ inTangent: parseCinematicKeyValue(animationKeyCut.key2.inTangent, animationType),
96
+ outTangent: parseCinematicKeyValue(animationKeyCut.key2.outTangent, animationType),
97
+ },
98
+ };
99
+ }
100
+ throw new Error(`Unknown key frame type: ${keyFrame.type}`);
101
+ }),
100
102
  };
101
103
  }),
102
104
  };
@@ -115,13 +117,20 @@ export function parseCinematicKeyValue(value, type) {
115
117
  return undefined;
116
118
  }
117
119
  switch (type) {
118
- case Animation.ANIMATIONTYPE_FLOAT: return value;
119
- case Animation.ANIMATIONTYPE_VECTOR2: return Vector2.FromArray(value);
120
- case Animation.ANIMATIONTYPE_VECTOR3: return Vector3.FromArray(value);
121
- case Animation.ANIMATIONTYPE_QUATERNION: return Quaternion.FromArray(value);
122
- case Animation.ANIMATIONTYPE_COLOR3: return Color3.FromArray(value);
123
- case Animation.ANIMATIONTYPE_COLOR4: return Color4.FromArray(value);
124
- case Animation.ANIMATIONTYPE_MATRIX: return Matrix.FromArray(value);
120
+ case Animation.ANIMATIONTYPE_FLOAT:
121
+ return value;
122
+ case Animation.ANIMATIONTYPE_VECTOR2:
123
+ return Vector2.FromArray(value);
124
+ case Animation.ANIMATIONTYPE_VECTOR3:
125
+ return Vector3.FromArray(value);
126
+ case Animation.ANIMATIONTYPE_QUATERNION:
127
+ return Quaternion.FromArray(value);
128
+ case Animation.ANIMATIONTYPE_COLOR3:
129
+ return Color3.FromArray(value);
130
+ case Animation.ANIMATIONTYPE_COLOR4:
131
+ return Color4.FromArray(value);
132
+ case Animation.ANIMATIONTYPE_MATRIX:
133
+ return Matrix.FromArray(value);
125
134
  }
126
135
  }
127
136
  //# sourceMappingURL=parse.js.map
@@ -25,7 +25,7 @@ export function cloneKey(dataType, key) {
25
25
  * @example getPropertyValue(scene, "ambientColor.r");
26
26
  */
27
27
  export function getPropertyValue(object, property) {
28
- const parts = property.split('.');
28
+ const parts = property.split(".");
29
29
  let value = object;
30
30
  for (let i = 0; i < parts.length; ++i) {
31
31
  value = value[parts[i]];
@@ -45,7 +45,10 @@ export function applyDecorators(scene, object, script, instance, rootUrl) {
45
45
  // @fromParticleSystems
46
46
  ctor._ParticleSystemsFromScene?.forEach((params) => {
47
47
  const particleSystem = scene.particleSystems?.find((particleSystem) => {
48
- return particleSystem.name === params.particleSystemName;
48
+ if (particleSystem.name !== params.particleSystemName) {
49
+ return false;
50
+ }
51
+ return params.directDescendantsOnly ? particleSystem.emitter === object : particleSystem;
49
52
  });
50
53
  instance[params.propertyKey.toString()] = particleSystem;
51
54
  });
@@ -53,13 +56,13 @@ export function applyDecorators(scene, object, script, instance, rootUrl) {
53
56
  ctor._VisibleInInspector?.forEach((params) => {
54
57
  const propertyKey = params.propertyKey.toString();
55
58
  const attachedScripts = script.values;
56
- if (attachedScripts.hasOwnProperty(propertyKey) &&
57
- attachedScripts[propertyKey].hasOwnProperty("value")) {
59
+ if (attachedScripts.hasOwnProperty(propertyKey) && attachedScripts[propertyKey].hasOwnProperty("value")) {
58
60
  const value = attachedScripts[propertyKey].value;
59
61
  switch (params.configuration.type) {
60
62
  case "number":
61
63
  case "boolean":
62
64
  case "keymap":
65
+ case "string":
63
66
  instance[propertyKey] = value;
64
67
  break;
65
68
  case "vector2":
@@ -20,6 +20,28 @@ export function visibleAsBoolean(label, configuration) {
20
20
  });
21
21
  };
22
22
  }
23
+ /**
24
+ * Makes the decorated property visible in the editor inspector as a string.
25
+ * The property can be customized per object in the editor and the custom value is applied
26
+ * once the script is invoked at runtime in the game/application.
27
+ * This can be used only by scripts using Classes.
28
+ * @param label defines the optional label displayed in the inspector in the editor.
29
+ * @param configuration defines the optional configuration for the field in the inspector (description, etc.).
30
+ */
31
+ export function visibleAsString(label, configuration) {
32
+ return function (target, propertyKey) {
33
+ const ctor = target.constructor;
34
+ ctor._VisibleInInspector ??= [];
35
+ ctor._VisibleInInspector.push({
36
+ label,
37
+ propertyKey,
38
+ configuration: {
39
+ ...configuration,
40
+ type: "string",
41
+ },
42
+ });
43
+ };
44
+ }
23
45
  /**
24
46
  * Makes the decorated property visible in the editor inspector as a number.
25
47
  * The property can be customized per object in the editor and the custom value is applied
@@ -4,12 +4,13 @@
4
4
  * from the scene and assigned to the property. Node link cant' be used in constructor.
5
5
  * This can be used only by scripts using Classes.
6
6
  * @param particleSystemName defines the name of the sound to retrieve in scene.
7
+ * @param directDescendantsOnly defines if true only direct descendants of 'this' will be considered, if false direct and also global particle systems will be considered.
7
8
  */
8
- export function particleSystemFromScene(particleSystemName) {
9
+ export function particleSystemFromScene(particleSystemName, directDescendantsOnly = false) {
9
10
  return function (target, propertyKey) {
10
11
  const ctor = target.constructor;
11
12
  ctor._ParticleSystemsFromScene ??= [];
12
- ctor._ParticleSystemsFromScene.push({ propertyKey, particleSystemName });
13
+ ctor._ParticleSystemsFromScene.push({ propertyKey, particleSystemName, directDescendantsOnly });
13
14
  };
14
15
  }
15
16
  //# sourceMappingURL=particle-systems.js.map
@@ -1,4 +1,5 @@
1
1
  import { Vector3 } from "@babylonjs/core/Maths/math.vector";
2
+ import { Constants } from "@babylonjs/core/Engines/constants";
2
3
  import { AppendSceneAsync } from "@babylonjs/core/Loading/sceneLoader";
3
4
  import { SceneLoaderFlags } from "@babylonjs/core/Loading/sceneLoaderFlags";
4
5
  import { isMesh } from "../tools/guards";
@@ -24,9 +25,16 @@ export async function loadScene(rootUrl, sceneFilename, scene, scriptsMap, optio
24
25
  }
25
26
  const waitingItemsCount = scene.getWaitingItemsCount();
26
27
  // Wait until scene is ready.
27
- while (!scene.isReady() || scene.getWaitingItemsCount() > 0) {
28
+ while (!scene.isDisposed && (!scene.isReady() || scene.getWaitingItemsCount() > 0)) {
28
29
  await new Promise((resolve) => setTimeout(resolve, 150));
29
30
  const loadedItemsCount = waitingItemsCount - scene.getWaitingItemsCount();
31
+ if (loadedItemsCount === waitingItemsCount) {
32
+ scene.textures.forEach((texture) => {
33
+ if (texture.delayLoadState === Constants.DELAYLOADSTATE_NONE) {
34
+ texture.delayLoadState = Constants.DELAYLOADSTATE_LOADED;
35
+ }
36
+ });
37
+ }
30
38
  options?.onProgress?.(0.5 + (loadedItemsCount / waitingItemsCount) * 0.5);
31
39
  }
32
40
  options?.onProgress?.(1);
@@ -1,4 +1,5 @@
1
1
  import { Tools } from "@babylonjs/core/Misc/tools";
2
+ import { isInstancedMesh } from "../tools/guards";
2
3
  /**
3
4
  * Loads the file located at `rootUrl + relativePath` and creates a new material from it.
4
5
  * @param rootUrl defines the absolute root url for the assets. (generally "/scene/")
@@ -16,4 +17,23 @@ export async function loadMaterialFromFile(rootUrl, relativePath, scene) {
16
17
  material.uniqueId = data.uniqueId;
17
18
  return material;
18
19
  }
20
+ /**
21
+ * Force compile all materials of the given scene.
22
+ * This is useful to ensure that all materials are compiled and ready to use to avoid lag.
23
+ * @param scene The scene to force compile all materials
24
+ */
25
+ export function forceCompileAllSceneMaterials(scene) {
26
+ return Promise.all(scene.materials.map(async (material) => {
27
+ const meshes = material.getBindedMeshes();
28
+ await Promise.all(meshes.map(async (mesh) => {
29
+ if (isInstancedMesh(mesh)) {
30
+ return;
31
+ }
32
+ await material.forceCompilationAsync(mesh, {
33
+ clipPlane: !!scene.clipPlane,
34
+ useInstances: mesh.hasInstances,
35
+ });
36
+ }));
37
+ }));
38
+ }
19
39
  //# sourceMappingURL=material.js.map
@@ -8,13 +8,20 @@ export function getAnimationTypeForObject(effectiveProperty) {
8
8
  return Animation.ANIMATIONTYPE_FLOAT;
9
9
  }
10
10
  switch (effectiveProperty?.getClassName?.()) {
11
- case "Vector2": return Animation.ANIMATIONTYPE_VECTOR2;
12
- case "Vector3": return Animation.ANIMATIONTYPE_VECTOR3;
13
- case "Quaternion": return Animation.ANIMATIONTYPE_QUATERNION;
14
- case "Color3": return Animation.ANIMATIONTYPE_COLOR3;
15
- case "Color4": return Animation.ANIMATIONTYPE_COLOR4;
16
- case "Size": return Animation.ANIMATIONTYPE_SIZE;
17
- case "Matrix": return Animation.ANIMATIONTYPE_MATRIX;
11
+ case "Vector2":
12
+ return Animation.ANIMATIONTYPE_VECTOR2;
13
+ case "Vector3":
14
+ return Animation.ANIMATIONTYPE_VECTOR3;
15
+ case "Quaternion":
16
+ return Animation.ANIMATIONTYPE_QUATERNION;
17
+ case "Color3":
18
+ return Animation.ANIMATIONTYPE_COLOR3;
19
+ case "Color4":
20
+ return Animation.ANIMATIONTYPE_COLOR4;
21
+ case "Size":
22
+ return Animation.ANIMATIONTYPE_SIZE;
23
+ case "Matrix":
24
+ return Animation.ANIMATIONTYPE_MATRIX;
18
25
  }
19
26
  return null;
20
27
  }
@@ -5,12 +5,6 @@
5
5
  * @see `@babylonjs/core/Engines/Extensions/engine.textureSelector.d.ts` for more information.
6
6
  */
7
7
  export function configureEngineToUseCompressedTextures(engine) {
8
- engine.setTextureFormatToUse([
9
- "-dxt.ktx",
10
- "-astc.ktx",
11
- "-pvrtc.ktx",
12
- "-etc1.ktx",
13
- "-etc2.ktx",
14
- ]);
8
+ engine.setTextureFormatToUse(["-dxt.ktx", "-astc.ktx", "-pvrtc.ktx", "-etc1.ktx", "-etc2.ktx"]);
15
9
  }
16
10
  //# sourceMappingURL=texture.js.map
@@ -26,6 +26,7 @@ export interface ISceneDecoratorData {
26
26
  }[];
27
27
  _ParticleSystemsFromScene: {
28
28
  particleSystemName: string;
29
+ directDescendantsOnly: boolean;
29
30
  propertyKey: string | Symbol;
30
31
  }[];
31
32
  _VisibleInInspector: {
@@ -1,4 +1,4 @@
1
- export type VisibleInInspectorDecoratorType = "number" | "boolean" | "vector2" | "vector3" | "color3" | "color4" | "entity" | "texture" | "keymap";
1
+ export type VisibleInInspectorDecoratorType = "number" | "boolean" | "string" | "vector2" | "vector3" | "color3" | "color4" | "entity" | "texture" | "keymap";
2
2
  export type VisibleInInspectorDecoratorConfiguration = {
3
3
  type: VisibleInInspectorDecoratorType;
4
4
  description?: string;
@@ -12,6 +12,15 @@ export type VisibleInInspectorDecoratorConfiguration = {
12
12
  * @param configuration defines the optional configuration for the field in the inspector (description, etc.).
13
13
  */
14
14
  export declare function visibleAsBoolean(label?: string, configuration?: Omit<VisibleInInspectorDecoratorConfiguration, "type">): (target: any, propertyKey: string | Symbol) => void;
15
+ /**
16
+ * Makes the decorated property visible in the editor inspector as a string.
17
+ * The property can be customized per object in the editor and the custom value is applied
18
+ * once the script is invoked at runtime in the game/application.
19
+ * This can be used only by scripts using Classes.
20
+ * @param label defines the optional label displayed in the inspector in the editor.
21
+ * @param configuration defines the optional configuration for the field in the inspector (description, etc.).
22
+ */
23
+ export declare function visibleAsString(label?: string, configuration?: Omit<VisibleInInspectorDecoratorConfiguration, "type">): (target: any, propertyKey: string | Symbol) => void;
15
24
  /**
16
25
  * Makes the decorated property visible in the editor inspector as a number.
17
26
  * The property can be customized per object in the editor and the custom value is applied
@@ -4,5 +4,6 @@
4
4
  * from the scene and assigned to the property. Node link cant' be used in constructor.
5
5
  * This can be used only by scripts using Classes.
6
6
  * @param particleSystemName defines the name of the sound to retrieve in scene.
7
+ * @param directDescendantsOnly defines if true only direct descendants of 'this' will be considered, if false direct and also global particle systems will be considered.
7
8
  */
8
- export declare function particleSystemFromScene(particleSystemName: string): (target: any, propertyKey: string | Symbol) => void;
9
+ export declare function particleSystemFromScene(particleSystemName: string, directDescendantsOnly?: boolean): (target: any, propertyKey: string | Symbol) => void;
@@ -9,3 +9,9 @@ import { Material } from "@babylonjs/core/Materials/material";
9
9
  * @example await loadMaterialFromFile<PBRMaterial>("/scene/", "assets/floor.material", scene);
10
10
  */
11
11
  export declare function loadMaterialFromFile<T extends Material>(rootUrl: string, relativePath: string, scene: Scene): Promise<T>;
12
+ /**
13
+ * Force compile all materials of the given scene.
14
+ * This is useful to ensure that all materials are compiled and ready to use to avoid lag.
15
+ * @param scene The scene to force compile all materials
16
+ */
17
+ export declare function forceCompileAllSceneMaterials(scene: Scene): Promise<void[]>;
package/package.json CHANGED
@@ -1,37 +1,37 @@
1
1
  {
2
- "name": "babylonjs-editor-tools",
3
- "version": "5.0.1",
4
- "description": "Babylon.js Editor Tools is a set of tools to help you create, edit and manage your Babylon.js scenes made using the Babylon.js Editor",
5
- "productName": "Babylon.js Editor Tools",
6
- "scripts": {
7
- "build": "tsc -p . && node esbuild.mjs",
8
- "watch": "concurrently \"tsc -p . --watch\" \"node esbuild.mjs --watch\"",
9
- "test": "jest build/test/*",
10
- "coverage": "jest build/test/* --coverage"
11
- },
12
- "main": "build/index.js",
13
- "exports": {
14
- ".": {
15
- "types": "./declaration/src/index.d.ts",
16
- "import": "./build/src/index.js",
17
- "require": "./build/index.node.js"
18
- }
19
- },
20
- "typings": "declaration/src/index.d.ts",
21
- "license": "(Apache-2.0)",
22
- "devDependencies": {
23
- "@babel/core": "^7.26.10",
24
- "@babel/preset-env": "^7.26.9",
25
- "@babel/preset-typescript": "^7.27.0",
26
- "@babylonjs/core": "8.15.1",
27
- "@babylonjs/gui": "8.15.1",
28
- "@types/jest": "^29.5.14",
29
- "babel-jest": "^29.7.0",
30
- "babel-plugin-transform-class-properties": "^6.24.1",
31
- "babel-plugin-transform-decorators-legacy": "^1.3.5",
32
- "esbuild": "0.25.5",
33
- "jest": "^29.7.0",
34
- "typescript": "5.8.3"
35
- },
36
- "dependencies": {}
2
+ "name": "babylonjs-editor-tools",
3
+ "version": "5.1.3",
4
+ "description": "Babylon.js Editor Tools is a set of tools to help you create, edit and manage your Babylon.js scenes made using the Babylon.js Editor",
5
+ "productName": "Babylon.js Editor Tools",
6
+ "scripts": {
7
+ "build": "tsc -p . && node esbuild.mjs",
8
+ "watch": "concurrently \"tsc -p . --watch\" \"node esbuild.mjs --watch\"",
9
+ "test": "jest build/test/*",
10
+ "coverage": "jest build/test/* --coverage"
11
+ },
12
+ "main": "build/index.js",
13
+ "exports": {
14
+ ".": {
15
+ "types": "./declaration/src/index.d.ts",
16
+ "import": "./build/src/index.js",
17
+ "require": "./build/index.node.js"
18
+ }
19
+ },
20
+ "typings": "declaration/src/index.d.ts",
21
+ "license": "(Apache-2.0)",
22
+ "devDependencies": {
23
+ "@babel/core": "^7.26.10",
24
+ "@babel/preset-env": "^7.26.9",
25
+ "@babel/preset-typescript": "^7.27.0",
26
+ "@babylonjs/core": "8.26.1",
27
+ "@babylonjs/gui": "8.26.1",
28
+ "@types/jest": "^29.5.14",
29
+ "babel-jest": "^29.7.0",
30
+ "babel-plugin-transform-class-properties": "^6.24.1",
31
+ "babel-plugin-transform-decorators-legacy": "^1.3.5",
32
+ "esbuild": "0.25.5",
33
+ "jest": "^29.7.0",
34
+ "typescript": "5.8.3"
35
+ },
36
+ "dependencies": {}
37
37
  }